protected void LoadCompanies() { connectionstring concls = new connectionstring(); ylibWebClass ylib = new ylibWebClass(concls.connect()); FillWebControlClass FCC = new FillWebControlClass(); FCC.FillDropDownList(ref ddlCompany, ylib.GiveDataTable_BySQLStatement("select CompanyId,CompanyName from Company"), "CompanyName", "CompanyId", true, false, ""); }
protected void btnUpdate_Click(object sender, EventArgs e) { string sqlinsert = ""; ylib = new ylibWebClass(ConStr.connect()); sqlinsert = "insert into ProductPricing(ProductId,Price,Date) values (" + lblProductId.Text + ",'"+ txtPrice.Text +"','"+ DateTime.Now +"')"; ylib.ExecuateSQLStatement(sqlinsert); //Update the record here this.ModalPopupExtender1.Hide(); //imgbtn_Click }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable DT; ylibWebClass ylib = new ylibWebClass(constr.connect()); DT = ylib.GiveDataTable_BySQLStatement("select AuthorId,name,points from auther"); if (DT.Rows.Count > 0) { gdvauthors.DataSource = DT; gdvauthors.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; ylib = new ylibWebClass(constring.connect()); if (Request.QueryString["ID"] != null) { if (Request.QueryString["ID"] == "True") { lblMsg.Visible = true; lblMsg.Text = "Successfully Edited"; } } BindData(); }
protected void btnAdd_Click(object sender, EventArgs e) { string sqlinsert = ""; ylibWebClass ylib = new ylibWebClass(constring.connect()); if (Request.QueryString["WarCode"] == null) { sqlinsert = "insert into Bas_Warranties(WatName,inactive) values ('" + txtWatName.Text + "',0)"; ylib.ExecuateSQLStatement(sqlinsert); Response.Redirect("WarrantyAdd.aspx?ID=True"); } else { WarCode=Convert.ToInt16( Request.QueryString["WarCode"]); sqlinsert = "update Bas_Warranties set WatName='" + txtWatName.Text + "' where WarCode=" + WarCode; ylib.ExecuateSQLStatement(sqlinsert); Response.Redirect("Warranty.aspx"); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { string sqldelet = ""; if (e.CommandName == "Delete") { ylib = new ylibWebClass(constring.connect()); int WarCode = Convert.ToInt32(e.CommandArgument); sqldelet = "delete from Bas_Warranties where WarCode=" + WarCode; ylib.ExecuateSQLStatement(sqldelet); BindData(); } if (e.CommandName == "Edit") { int WarCode = Convert.ToInt32(e.CommandArgument); Response.Redirect("WarrantyAdd.aspx?WarCode=" + WarCode); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; WarCode = 0; if (Request.QueryString["WarCode"] != null) { lblWarranty.Text = "Edit Warranty"; WarCode = Convert.ToInt16(Request.QueryString["WarCode"]); ylibWebClass ylib = new ylibWebClass(constring.connect()); txtWatName.Text = ylib.GiveTableQueryValue("select WatName from Bas_Warranties where WarCode=" + WarCode); } if (Request.QueryString["ID"] != null) { if (Request.QueryString["ID"] == "True") { lblMsg.Visible = true; lblMsg.Text = "Successfully Added"; } } }
private void BindData() { DataTable DT; ylib = new ylibWebClass(constr.connect()); FillWebControlClass FCC = new FillWebControlClass(); int CompanyId; int SubCategoryId; int CategoryId; int ProductGroupCode; #region SetListVariables CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]); CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]); SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]); ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]); #endregion #region FillDropDownLists dtCompany = taCompany.GetData(); FCC.FillDropDownList(ref ddlCompany, dtCompany, "CompanyName", "CompanyId", true, true, CompanyId.ToString()); dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId); FCC.FillDropDownList(ref ddlCategory, dtCategory, "CategoryName", "CategoryId", true, true, CategoryId.ToString()); dtSubCategory = taSubCategory.GetDataByCategoryId(CategoryId); FCC.FillDropDownList(ref ddlSubCategory, dtSubCategory, "SubCategoryName", "SubCategoryId", true, true, SubCategoryId.ToString()); dtProductGroup = taProductGroup.GetDataBySubCategoryId(SubCategoryId); FCC.FillDropDownList(ref ddlProductGroupCode, dtProductGroup, "ProductGroupDescription", "ProductGroupCode", true, true, ProductGroupCode.ToString()); #endregion #region SetSelectionLabel if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode != 0) lblGroupLevel.Text = "Product Group"; else if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0) lblGroupLevel.Text = "Sub Category"; else if (CompanyId != 0 && CategoryId != 0) lblGroupLevel.Text = "Category"; else if (CompanyId != 0) lblGroupLevel.Text = "Company"; #endregion #region Set Main Repeater Page Parts DT = ylib.GiveDataTable_BySQLStatement("select PagePartName from PageParts "); if (DT.Rows.Count > 0) { if (CompanyId != 0) { Repeater1.DataSource = DT; Repeater1.DataBind(); } } else { lblMsg.Text = "No record found"; return; } #endregion }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Add") { string[] Str = new string[3]; Str=e.CommandArgument.ToString().Split('?'); Int16 DocumentId = Convert.ToInt16(Str[0].ToString()); Int16 LanguageId = Convert.ToInt16(Str[1].ToString()); Int16 OSId= Convert.ToInt16(Str[2].ToString()); Response.Redirect("uploadbrochures.aspx?DocumentId=" + DocumentId + "&ProductId=" + Convert.ToInt16(Request.QueryString["ProductId"].ToString()) + "&LanguageId=" + LanguageId + "&DocumenType=" + Request.QueryString["DocumenType"].ToString() + "&osDocumenType=" + Request.QueryString["osDocumenType"].ToString() + "&OSId=" + OSId); } else if (e.CommandName == "Delete") { string[] Str = new string[3]; Str = e.CommandArgument.ToString().Split('?'); Int16 DocumentId = Convert.ToInt16(Str[0].ToString()); Int16 LanguageId = Convert.ToInt16(Str[1].ToString()); Int16 OSId = Convert.ToInt16(Str[2].ToString()); taProductDocumentation.DeleteQuery(Convert.ToInt16(Request.QueryString["ProductId"]), DocumentId, LanguageId, OSId); Response.Redirect("DocumentsDetails.aspx?ProductId=" + Request.QueryString["ProductId"] + "&DocumenType=" + Request.QueryString["DocumenType"].ToString() + "&osDocumenType=" + Request.QueryString["osDocumenType"].ToString()); } else if (e.CommandName == "Download") { ylib = new ylibWebClass(constr.connect()); string FileExtension = ""; DataTable DT1; string pdfurl = ""; string[] Str = new string[3]; Str = e.CommandArgument.ToString().Split('?'); Int16 DocumentId = Convert.ToInt16(Str[0].ToString()); Int16 LanguageId = Convert.ToInt16(Str[1].ToString()); Int16 OSId = Convert.ToInt16(Str[2].ToString()); DT1 = ylib.GiveDataTable_BySQLStatement("SELECT top 1 [ProductId],[LanguageId],[DocumentId],[DocumentDescription],ThumbNailName_,UploadedFileName FROM [ProductDocumentation] where ProductId=" + Request.QueryString["ProductId"] + " and DocumentId=" + DocumentId + " and LanguageId = " + LanguageId + " and OSId=" + OSId); if (DT1.Rows.Count > 0) { FileExtension=System.IO.Path.GetExtension(DT1.Rows[0]["UploadedFileName"].ToString()); pdfurl = "../Documentation/" + DocumentId + "-" + LanguageId + "-" + OSId + "-" + Request.QueryString["ProductId"] + System.IO.Path.GetExtension(DT1.Rows[0]["UploadedFileName"].ToString()); } Response.Clear(); Response.ContentType = "application/x-pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=TechnicalFile" + FileExtension); Response.TransmitFile(pdfurl); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; ylib = new ylibWebClass(constr.connect()); BindData(); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { ylib = new ylibWebClass(ConStr.connect()); if (e.CommandName == "Delete") { int ProductId = Convert.ToInt32(e.CommandArgument); taProduct.DeleteProduct(ProductId); BindData(); } if (e.CommandName == "Edit") { DataTable DT = new DataTable(); int ProductId = Convert.ToInt32(e.CommandArgument); DT = ylib.GiveDataTable_BySQLStatement("select CompanyId,CategoryId,SubCategoryId,ProductGroupCode from v_products where productid=" + ProductId); if (DT.Rows.Count > 0) { DataRow row = DT.Rows[0]; Response.Redirect("ProductAdd.aspx?ProductId=" + ProductId + "&CompanyId=" + Convert.ToInt16(row["CompanyId"]) + "&CategoryId=" + Convert.ToInt16(row["CategoryId"]) + "&SubCategoryId=" + Convert.ToInt16(row["SubCategoryId"]) + "&ProductGroupCode=" + Convert.ToInt16(row["ProductGroupCode"]) ); } else Response.Redirect("ProductAdd.aspx?ProductId=" + ProductId); } if (e.CommandName == "Image") { int ProductId = Convert.ToInt32(e.CommandArgument); Response.Redirect("ProductImages.aspx?ProductId=" + ProductId); } if (e.CommandName == "Features") { int ProductId = Convert.ToInt32(e.CommandArgument); Response.Redirect("ProductKeyFeatures.aspx?ProductId=" + ProductId); } if (e.CommandName == "Color") { int ProductId = Convert.ToInt32(e.CommandArgument); Response.Redirect("ProductColors.aspx?ProductId=" + ProductId); } if (e.CommandName == "TechnicalSpecs") { int ProductId = Convert.ToInt32(e.CommandArgument); Response.Redirect("TechnicalSpecsEdit.aspx?ProductId=" + ProductId); } if (e.CommandName == "Documents") { int ProductId = Convert.ToInt32(e.CommandArgument); Response.Redirect("DocumentsDetails.aspx?ProductId=" + ProductId + "&DocumenType=0&osDocumenType=0"); } if (e.CommandName == "Drivers") { int ProductId = Convert.ToInt32(e.CommandArgument); Response.Redirect("DocumentsDetails.aspx?ProductId=" + ProductId + "&DocumenType=1&osDocumenType=1"); } if (e.CommandName == "FreeShipment") { string sqlupdate; Boolean IsFreeShipment = false; string[] Str= new string[2]; Str = e.CommandArgument.ToString().Split(';'); int ProductId = Convert.ToInt32(Str[0]); IsFreeShipment = Convert.ToBoolean(Str[1]); if (IsFreeShipment == false) IsFreeShipment = true; else IsFreeShipment = false; sqlupdate = ""; if (IsFreeShipment == true) sqlupdate = "update product set freeshipment=1 where productid=" + ProductId; else sqlupdate = "update product set freeshipment=0 where productid=" + ProductId; ylib.ExecuateSQLStatement(sqlupdate); BindData(); } if (e.CommandName == "InStock") { string sqlupdate; Boolean IsInStock = false; string[] Str = new string[2]; Str = e.CommandArgument.ToString().Split(';'); int ProductId = Convert.ToInt32(Str[0]); IsInStock = Convert.ToBoolean(Str[1]); sqlupdate = ""; if (IsInStock == false) IsInStock = true; else IsInStock = false; if (IsInStock == true) sqlupdate = "update product set InStock=1 where productid=" + ProductId; else sqlupdate = "update product set InStock=0 where productid=" + ProductId; ylib.ExecuateSQLStatement(sqlupdate); BindData(); } }
protected void imgbtn_Click(object sender, ImageClickEventArgs e) { DataTable DTPrice; ylib = new ylibWebClass(ConStr.connect()); ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; lblProductId.Text = gvrow.Cells[0].Text; lblItemName.Text = gvrow.Cells[1].Text; DTPrice = ylib.GiveDataTable_BySQLStatement("select productid,price,date from ProductPricing where productid="+Convert.ToInt16(gvrow.Cells[0].Text) ); if (DTPrice.Rows.Count > 0) { GrdPrices.DataSource = DTPrice; GrdPrices.DataBind(); lblPriceNotDefined.Visible = false; } else { lblPriceNotDefined.Visible = true; GrdPrices.DataSource = null; GrdPrices.DataBind(); } this.ModalPopupExtender1.Show(); }
private void FillBaseFiles(int CompanyId) { DataTable DT1; ylib = new ylibWebClass(constr.connect()); dtAdmin = taAdmin.GetAllUsers(); FCF.FillCheckBoxList(ref loclst, dtAdmin, "LoginId", "AdminId"); DT1 = ylib.GiveDataTable_BySQLStatement("select adminid from Admin_Company_Transaction where companyid=" + CompanyId); FCF.SelectItemInCheckBoxList2(ref loclst, DT1, "AdminId", "Int32"); }
private void LoadDropDownLists() { FillWebControlClass FCC = new FillWebControlClass(); //drop down filling through method 1 dtBas_Brands=dsBas_Brands.GetData(); FCC.FillDropDownList(ref ddlBas_Brands, dtBas_Brands, "Br_Name", "Br_Code"); //drop down filling through method 2 connectionstring concls = new connectionstring(); ylibWebClass ylib = new ylibWebClass(concls.connect()); FCC.FillDropDownList(ref ddlBas_Warranties,ylib.GiveDataTable_BySQLStatement("select WarCode,WatName from Bas_Warranties"), "WatName", "WarCode"); }