. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 87.98.249.37 / Your IP : 216.73.216.208 [ Web Server : Microsoft-IIS/10.0 System : Windows NT NS3076740 10.0 build 17763 (Windows Server 2019) AMD64 User : IWPD_292(growel19p) ( 0) PHP Version : 8.3.12 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Inetpub/vhosts/growel.com/httpdocs/GrowelAdmin/ |
Upload File : |
using GrowelBLL.Services;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GrowelWeb.GrowelAdmin
{
public partial class AddEditBrochure : System.Web.UI.Page
{
public string BrochureId = "";
public string url = "";
public string urlcover = "";
public string siteurl = "";
protected void Page_Load(object sender, EventArgs e)
{
siteurl = clsComman.value("SiteUrl");
BrochureId = Convert.ToString(Request.QueryString["BrochureId"]);
if (!IsPostBack)
{
BindBusinessTypes();
BindBrochure();
}
}
public void BindBusinessTypes()
{
AdminService adminService = new AdminService();
this.ddlbusinessType.DataSource = adminService.GetBusinessType().Tables[0].DefaultView;
this.ddlbusinessType.DataValueField = "Type";
this.ddlbusinessType.DataTextField = "Type";
this.ddlbusinessType.DataBind();
}
public void BindBrochure()
{
if (!string.IsNullOrEmpty(BrochureId))
{
AdminService adminService = new AdminService();
DataSet ds = adminService.GetBrochureDetailsById(BrochureId);
this.txtname.Text = ds.Tables[0].Rows[0]["Name"].ToString();
this.ddlbusinessType.SelectedValue = ds.Tables[0].Rows[0]["Type"].ToString();
string FileName = ds.Tables[0].Rows[0]["FileName"].ToString();
if (FileName != "")
{
urlcover = siteurl + "downloads/brochures/" + FileName;
Session["FileName"] = FileName;
}
else
{
urlcover = siteurl + "images/noimage.jpg";
Session["FileName"] = "";
}
string imgName = ds.Tables[0].Rows[0]["imgName"].ToString();
if (imgName != "")
{
urlcover = siteurl + "images/download/" + imgName;
Session["imgName"] = imgName;
}
else
{
urlcover = siteurl + "images/noimage.jpg";
Session["imgName"] = "";
}
btnsubmit.Text = "Edit";
}
}
protected void lnkremovecover_Click(object sender, EventArgs e)
{
AdminService adminService = new AdminService();
adminService.RemoveProductTypeCover(BrochureId);
this.status.Visible = true;
this.status.InnerHtml = "Brochure Image Removed successfully";
BindBrochure();
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
try
{
AdminService adminService = new AdminService();
clsCommon clscommon = new clsCommon();
this.txtname.Text = clscommon.ProperData(this.txtname.Text);
string imgName = "";
string FileName = "";
string FileName1 = "";
if (this.FileUpload2.HasFile)
{
FileInfo f = new FileInfo(this.FileUpload2.PostedFile.FileName.ToString());
imgName = this.txtname.Text.Replace(" ","-") + f.Extension;
this.FileUpload2.PostedFile.SaveAs(Server.MapPath("..") + @"\images\download\" + imgName);
}
else
{
imgName = Convert.ToString(Session["imgName"]);
}
string path = ddlbusinessType.SelectedValue.Split('-')[0].ToString() ;
if (this.fuPdf.HasFile)
{
FileInfo f = new FileInfo(this.fuPdf.PostedFile.FileName.ToString());
FileName = this.txtname.Text.Replace(" ", "-") + f.Extension;
this.fuPdf.PostedFile.SaveAs(Server.MapPath("..") + @"\downloads/brochures\" + path + "\\" + FileName);
FileName1 = path + "/" + FileName;
}
else
{
FileName1 = Convert.ToString(Session["FileName"]);
}
if (string.IsNullOrEmpty(BrochureId))
{
adminService.AddEditBrochures("",this.txtname.Text, this.ddlbusinessType.SelectedValue.ToString(), FileName1, imgName);
this.status.Visible = true;
this.status.InnerHtml = "Product Type Added Successfully ";
}
else
{
adminService.AddEditBrochures(BrochureId,txtname.Text, this.ddlbusinessType.SelectedValue.ToString(), FileName1, imgName);
this.status.Visible = true;
this.status.InnerHtml = "Brochure Updated successfully";
}
}
catch (Exception ex)
{
this.status.InnerHtml = "This Name Already Exists";
}
}
protected void lnkremoveproduct_Click(object sender, EventArgs e)
{
AdminService adminService = new AdminService();
adminService.RemoveProductTypeImage(BrochureId);
this.status.Visible = true;
this.status.InnerHtml = "Brochure Image Removed successfully";
BindBrochure();
}
}
}