. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| 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 AddSubProduct : System.Web.UI.Page
{
public string subproduct = "";
public string product = "";
public string type = "";
public string url = "";
public string urlcover = "";
public string siteurl = "";
protected void Page_Load(object sender, EventArgs e)
{
try
{
siteurl = clsComman.value("SiteUrl");
product = Convert.ToString( Request.QueryString["product"]);
type = Request.QueryString["type"].ToString();
// For Edit Mode
subproduct = Convert.ToString(Request.QueryString["subproduct"]);
if (!IsPostBack)
{
this.txtproduct.Text = product;
BindSubProduct();
}
}
catch (Exception ex)
{
}
}
public void BindSubProduct()
{
if (!string.IsNullOrEmpty(subproduct))
{
AdminService adminService = new AdminService();
DataSet ds = adminService.GetSubProductDetails(subproduct);
this.txttitle.Text = ds.Tables[0].Rows[0]["subproduct"].ToString();
this.txtproduct.Text = ds.Tables[0].Rows[0]["product"].ToString();
this.content.InnerText = ds.Tables[0].Rows[0]["subproduct_description"].ToString();
this.txtdisplayname.Text = ds.Tables[0].Rows[0]["subproduct_displayname"].ToString();
product = ds.Tables[0].Rows[0]["product"].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; }
}
}
}
if (ds.Tables[2].Rows.Count > 0)
{
this.gdvtypes.DataSource = ds.Tables[2];
this.gdvtypes.DataBind();
List<string> strImages = new List<string>();
foreach (DataRow dr in ds.Tables[2].Rows)
{
strImages.Add(Convert.ToString(dr["ImgName"]));
}
Session["strImages"] = strImages;
}
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 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 imgMulti = "";
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"]);
}
List<string> strImages = new List<string>();
if (this.FileUploadmultiple.HasFile)
{
if (Session["strImages"]!=null)
strImages = (List<string>)Session["strImages"];
HttpFileCollection uploadedFiles = Request.Files;
int index = strImages.Count+1;
foreach (var ff in this.FileUploadmultiple.PostedFiles)
{
FileInfo f = new FileInfo(ff.FileName.ToString());
imgMulti = this.txttitle.Text + "-" + index.ToString() + f.Extension;
//this.FileUploadmultiple.PostedFiles[.SaveAs(Server.MapPath("..") + @"\images\products\" + imgMulti);;
ff.SaveAs(Server.MapPath("..") + @"\images\products\" + imgMulti);;
strImages.Add(imgMulti);
index++;
}
}
else
{
strImages = (List<string>)Session["strImages"];
}
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(subproduct))
{
adminService.AddSubProduct(this.txttitle.Text, this.txtdisplayname.Text, this.txtproduct.Text, this.content.InnerText,
this.txtmetatitle.Text, this.txtmetakeywords.Text, this.txtmetadesc.Text, isFinalProduct.ToString(), img, imgcover,ds, IsShowEnquiry.ToString(),strImages);
this.status.Visible = true;
this.status.InnerHtml = "Subproduct Added";
}
else
{
adminService.UpdateSubProduct(subproduct, this.txtdisplayname.Text, this.txtproduct.Text, this.content.InnerText,
this.txtmetatitle.Text, this.txtmetakeywords.Text, this.txtmetadesc.Text, isFinalProduct.ToString(), img, imgcover,ds, IsShowEnquiry.ToString(),strImages);
this.status.Visible = true;
this.status.InnerHtml = "Subproduct Updated";
}
product = txtproduct.Text;
}
catch (Exception ex)
{
this.status.Visible = true;
this.status.InnerHtml = "Subproduct With this name is exists";
}
}
protected void lnkremovecover_Click(object sender, EventArgs e)
{
AdminService adminService = new AdminService();
adminService.RemoveSubproductsCover(subproduct);
this.status.Visible = true;
this.status.InnerHtml = "Subproduct Cover Removed successfully";
//ds = adminService.GetPageDetails(product);
BindSubProduct();
}
protected void lnkremoveproduct_Click(object sender, EventArgs e)
{
AdminService adminService = new AdminService();
adminService.RemoveSubproductsImage(subproduct);
this.status.Visible = true;
this.status.InnerHtml = "Subproduct Cover Removed successfully";
//ds = adminService.GetPageDetails(product);
BindSubProduct();
}
protected void lnkdelete_click(object sender, CommandEventArgs e)
{
AdminService adminService = new AdminService();
LinkButton l = (LinkButton)sender;
string s = l.CommandArgument.ToString();
adminService.DeleteProductMultipleImage(s);
this.status.Visible = true;
this.status.InnerHtml = "Deleted Successfully ";
//this.gdvtypes.DataSource = adminService.GetBrochures(this.ddlbusinessType.SelectedValue.ToString()).Tables[0].DefaultView;
//this.gdvtypes.DataBind();
DataSet ds = adminService.GetSubProductDetails(subproduct);
this.gdvtypes.DataSource = ds.Tables[2];
this.gdvtypes.DataBind();
}
}
}