. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| 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 AddProduct : System.Web.UI.Page
{
public string type = "";
public string product = "";
public string url = "";
public string urlcover = "";
public string ptype = "";
public string siteurl = "";
DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
try
{
siteurl = clsComman.value("SiteUrl");
product = Convert.ToString(Request.QueryString["product"]);
//AdminService adminService = new AdminService();
//type = Convert.ToString(Request.QueryString["type"]);
//ds = adminService.GetProductTypeDetails(type);
//this.txttype.Text = ds.Tables[0].Rows[0]["product_type"].ToString();
//ptype = ds.Tables[0].Rows[0]["product_type_displayname"].ToString();
if (!IsPostBack)
{
BindProduct();
}
}
catch (Exception ex)
{
throw ex;
}
}
public void BindProduct()
{
if (!string.IsNullOrEmpty(product))
{
AdminService adminService = new AdminService();
ds = adminService.GetProductDetails(product);
this.txttitle.Text = ds.Tables[0].Rows[0]["product"].ToString();
this.txtdisplayname.Text = ds.Tables[0].Rows[0]["product_displayname"].ToString();
this.content.InnerText = ds.Tables[0].Rows[0]["product_description"].ToString();
this.txttype.Text = ds.Tables[0].Rows[0]["product_type"].ToString();
//this.txtspecs.Text = ds.Tables[0].Rows[0]["product_technical_details"].ToString();
this.txtmetatitle.Text = ds.Tables[0].Rows[0]["meta_title"].ToString();
this.txtmetakeywords.Text = ds.Tables[0].Rows[0]["meta_keywords"].ToString();
this.txtmetadesc.Text = ds.Tables[0].Rows[0]["meta_description"].ToString();
this.chkisfinalproduct.Checked = Convert.ToString( ds.Tables[0].Rows[0]["IsFinalProduct"])== "1" ? true:false;
this.chkShowEnquiry.Checked = Convert.ToString( ds.Tables[0].Rows[0]["IsShowEnquiry"])== "1" ? true:false;
type = ds.Tables[0].Rows[0]["product_type"].ToString();
if (ds.Tables[1].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
{
DataRow dr = ds.Tables[1].Rows[i];
foreach (ListItem li in ddlIndustries.Items)
{
if (dr["Industry"].ToString() == li.Value)
{ li.Selected = true; }
}
}
}
string ProductImage = ds.Tables[0].Rows[0]["ProductImage"].ToString();
if (ProductImage != "")
{
url = siteurl + "images/products/" + ProductImage;
Session["ProductImage"] = ProductImage;
}
else
{
url = siteurl + "images/noimage.jpg";
Session["ProductImage"] = "";
}
string CoverImage = ds.Tables[0].Rows[0]["Cover"].ToString();
if (CoverImage != "")
{
urlcover = siteurl + "images/Covers/" + CoverImage;
Session["CoverImage"] = CoverImage;
}
else
{
urlcover = siteurl + "images/noimage.jpg";
Session["CoverImage"] = "";
}
}
}
protected void lnkremovecover_Click(object sender, EventArgs e)
{
AdminService adminService = new AdminService();
adminService.RemoveProductCover(product);
this.status.Visible = true;
this.status.InnerHtml = "Page Cover Removed successfully";
BindProduct();
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
try
{
AdminService adminService = new AdminService();
clsCommon clscommon = new clsCommon();
this.txttitle.Text = clscommon.ProperData(this.txttitle.Text);
int isFinalProduct = 0;
if (chkisfinalproduct.Checked)
isFinalProduct = 1;
int IsShowEnquiry = 0;
if (chkShowEnquiry.Checked)
IsShowEnquiry = 1;
string img = "";
string imgcover = "";
if (this.FileUpload1.HasFile)
{
FileInfo f = new FileInfo(this.FileUpload1.PostedFile.FileName.ToString());
img = this.txttitle.Text + f.Extension;
this.FileUpload1.PostedFile.SaveAs(Server.MapPath("..") + @"\images\products\" + img);
}
else
{
img = Convert.ToString(Session["ProductImage"]);
}
if (this.FileUpload2.HasFile)
{
FileInfo f = new FileInfo(this.FileUpload2.PostedFile.FileName.ToString());
imgcover = this.txttitle.Text + f.Extension;
this.FileUpload2.PostedFile.SaveAs(Server.MapPath("..") + @"\images\Covers\" + imgcover);
}
else
{
imgcover = Convert.ToString(Session["CoverImage"]);
}
DataSet ds = new DataSet();
DataTable dt = new DataTable("Details");
ds.Tables.Add(dt);
ds.Tables[0].Columns.Add("Industry", typeof(string));
ds.Tables[0].Columns.Add("Product", typeof(string));
foreach (ListItem li in ddlIndustries.Items)
{
if (li.Selected)
{
DataRow dr = ds.Tables[0].NewRow();
dr["Industry"] = li.Value;
dr["Product"] = this.txttitle.Text;
ds.Tables[0].Rows.Add(dr);
}
}
if (string.IsNullOrEmpty(product))
{
adminService.AddProduct(this.txttitle.Text, this.txtdisplayname.Text, this.txttype.Text, this.content.InnerText, "",
this.txtmetatitle.Text, this.txtmetakeywords.Text, this.txtmetadesc.Text, isFinalProduct.ToString(),img, imgcover,ds, IsShowEnquiry.ToString());
this.status.Visible = true;
this.status.InnerHtml = "Product Added Successfully";
}
else
{
adminService.UpdateProduct(product, this.txtdisplayname.Text, this.content.InnerText, "", true, this.txtmetatitle.Text,
this.txtmetakeywords.Text, this.txtmetadesc.Text, isFinalProduct.ToString(),img, imgcover,ds, IsShowEnquiry.ToString());
this.status.Visible = true;
this.status.InnerHtml = "Product Updated Successfully";
}
}
catch (Exception ex)
{
this.status.Visible = true;
this.status.InnerHtml = "Cannot Add Product With This Name";
}
}
protected void lnkremoveproduct_Click(object sender, EventArgs e)
{
AdminService adminService = new AdminService();
adminService.RemoveProductImage(product);
this.status.Visible = true;
this.status.InnerHtml = "Product Image Removed successfully";
BindProduct();
}
}
}