protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "PincodeChecker", "Pincode", txtpincode.Text, "")) { lblMsg.Text = "This Pincode already exists."; return; } else { cls.ExecuteDA("Insert_PincodeChecker", new SqlParameter("@City", txtCity.Text), new SqlParameter("@Zone", drpZone.SelectedValue.ToString()), new SqlParameter("@Pincode", txtpincode.Text), new SqlParameter("@District", txtDistrict.Text), new SqlParameter("@IsODA", drpoda.SelectedValue.ToString()), new SqlParameter("@StateCode", txtStateCode.Text), new SqlParameter("@IsActive", chkIsActive.Checked)); clearall(); lblMsg.Text = "Details inserted successfully."; BindPincodeChecker(); } } else { if (cls.CheckExistField("CheckExistField", "PincodeChecker", "Pincode", txtpincode.Text, "and Id <> " + lblId.Text + "")) { lblMsg.Text = "This Pincode already exists."; return; } else { cls.ExecuteDA("Update_PincodeChecker", new SqlParameter("@Id", lblId.Text), new SqlParameter("@City", txtCity.Text), new SqlParameter("@Zone", drpZone.SelectedValue.ToString()), new SqlParameter("@Pincode", txtpincode.Text), new SqlParameter("@District", txtDistrict.Text), new SqlParameter("@IsODA", drpoda.SelectedValue.ToString()), new SqlParameter("@StateCode", txtStateCode.Text), new SqlParameter("@IsActive", chkIsActive.Checked)); clearall(); lblMsg.Text = "Details Updated Successfully"; BindPincodeChecker(); } } }
protected void CheckUserExists(string name, string email, string password) { //if exists then login using system if (cls.CheckExistField("CheckExistField", "Members", "Email", email, "and IsActive = 1")) { //get details from db DataTable dt = new DataTable(); dt = cls.ReturnDataTable("Select_MemberDetailsFromEmail", new SqlParameter("@Email", email)); if (dt.Rows.Count > 0) { Binduser1("L", dt.Rows[0]["Email"].ToString(), dt.Rows[0]["Password"].ToString()); } } else { //does not exits then register to the system cls.ExecuteDA("Insert_Members", new SqlParameter("@Name", name), new SqlParameter("@Email", email), new SqlParameter("@Password", password), new SqlParameter("@Company", ""), new SqlParameter("@Contact", "")); //insert into DB //MailAdminRegistration1(name, email, password); //MailUserRegistration1(name, email, password); Binduser1("L", email, password); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "Supplier", "SupplierName", txtsuppliername.Text.Trim(), "and IsActive = 1")) { lblMsg.Text = "This Supplier already exists."; return; } else { cls.ExecuteDA("Insert_Supplier", new SqlParameter("@SupplierCode", txtSuppliercode.Text), new SqlParameter("@SupplierName", txtsuppliername.Text), new SqlParameter("@Address", txtsupplieradd.Text), new SqlParameter("@ContactNo", txtcontactno.Text), new SqlParameter("@Email", txtEmailId.Text), new SqlParameter("@IsActive", 1)); clearall(); lblMsg.Text = "Details inserted successfully."; BindSupplier(); } } else { if (cls.CheckExistField("CheckExistField", "Supplier", "SupplierName", txtsuppliername.Text.Trim(), "and Id<>" + lblId.Text + " and IsActive = 1")) { lblMsg.Text = "This Supplier already exists."; return; } else { cls.ExecuteDA("Update_Supplier", new SqlParameter("@Id", lblId.Text), new SqlParameter("@SupplierCode", txtSuppliercode.Text), new SqlParameter("@SupplierName", txtsuppliername.Text), new SqlParameter("@Address", txtsupplieradd.Text), new SqlParameter("@ContactNo", txtcontactno.Text), new SqlParameter("@Email", txtEmailId.Text), new SqlParameter("@IsActive", 1)); clearall(); lblMsg.Text = "Details updated successfully."; BindSupplier(); } } }
protected void btnSubmit_OnClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "CurrentOpenings", "Designation", txtDesignation.Text, "and IsActive = 1 ")) { lblMsg.Text = "This designation already exists."; return; } else { cls.ExecuteDA("Insert_CurrentOpenings", new SqlParameter("@Designation", txtDesignation.Text), new SqlParameter("@Position", txtPosition.Text), new SqlParameter("@NoOfPosition", txtNoOfPosition.Text), new SqlParameter("@Location", txtLocation.Text), new SqlParameter("@DatePosted", DateTime.Now), new SqlParameter("@Responsibilities", txtResponsiblities.Text), new SqlParameter("@Requirements", txtRequirements.Text)); lblMsg.Text = "Details inserted successfully."; } } else { if (cls.CheckExistField("CheckExistField", "CurrentOpenings", "Designation", txtDesignation.Text, "and IsActive = 1 and CurrentOpeningID != '" + lblId.Text + "'")) { lblMsg.Text = "This designation already exists."; return; } else { cls.ExecuteDA("Update_CurrentOpenings", new SqlParameter("@CurrentOpeningID", lblId.Text), new SqlParameter("@Designation", txtDesignation.Text), new SqlParameter("@Position", txtPosition.Text), new SqlParameter("@NoOfPosition", txtNoOfPosition.Text), new SqlParameter("@Location", txtLocation.Text), new SqlParameter("@DatePosted", DateTime.Now), new SqlParameter("@Responsibilities", txtResponsiblities.Text), new SqlParameter("@Requirements", txtRequirements.Text)); lblMsg.Text = "Details updated successfully."; } } BindCurrentOpenings(); clearall(); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "ColourSetup", "ColourName", txtcolourname.Text, "and IsActive = 1")) { lblMsg.Text = "This ColourName already exists."; return; } else { cls.ExecuteDA("Insert_ColourSetup", new SqlParameter("@ColourName", txtcolourname.Text), new SqlParameter("@ColourCode", txtcolourcode.Text), new SqlParameter("@IsActive", 1)); clearall(); lblMsg.Text = "Details inserted successfully."; BindColourSetup(); } } else { if (cls.CheckExistField("CheckExistField", "ColourSetup", "ColourName", txtcolourname.Text, "and ColourId <> " + lblId.Text + " and IsActive = 1")) { lblMsg.Text = "This ColourName already exists."; return; } else { cls.ExecuteDA("Update_ColourSetup", new SqlParameter("@ColourId", lblId.Text), new SqlParameter("@ColourName", txtcolourname.Text), new SqlParameter("@ColourCode", txtcolourcode.Text), new SqlParameter("@IsActive", 1)); clearall(); lblMsg.Text = "Details updated successfully."; BindColourSetup(); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "Unit", "Unit", txtUnit.Text.Trim(), "and IsActive = 1")) { lblMsg.Text = "This Unit already exists."; return; } else { cls.ExecuteDA("Insert_Unit", new SqlParameter("@Unit", txtUnit.Text), new SqlParameter("@IsActive", 1)); clearall(); lblMsg.Text = "Details inserted successfully."; BindUnit(); } } else { if (cls.CheckExistField("CheckExistField", "Unit", "Unit", txtUnit.Text.Trim(), " and Id <> " + lblId.Text + " and IsActive = 1")) { lblMsg.Text = "This Unit already exists."; return; } else { cls.ExecuteDA("Update_Unit", new SqlParameter("@Id", lblId.Text), new SqlParameter("@Unit", txtUnit.Text), new SqlParameter("@IsActive", 1)); clearall(); lblMsg.Text = "Details updated successfully."; BindUnit(); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { if (clscon.CheckExistField("CheckExistField", "CourierMaster", "CourierName", txtCourierName.Text, "and IsActive = 1")) { lblMsg.Text = "This Courier Name Already exists."; return; } else { clscon.ExecuteDA("Insert_CourierMaster", new SqlParameter("@CourierName", txtCourierName.Text), new SqlParameter("@Url", txtUrl.Text)); lblMsg.Text = "Details inserted successfully."; BindData(); clearall(); } } else { if (clscon.CheckExistField("CheckExistField", "CourierMaster", "CourierName", txtCourierName.Text, "and IsActive = 1 and ID <> '" + lblId.Text + "'")) { lblMsg.Text = "This Courier Name Already exists."; return; } else { clscon.ExecuteDA("Update_CourierMaster", new SqlParameter("@ID", lblId.Text), new SqlParameter("@CourierName", txtCourierName.Text), new SqlParameter("@Url", txtUrl.Text)); lblMsg.Text = "Details updated successfully."; BindData(); clearall(); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { lblMsg.Text = "You cannot insert new category, please update the category name."; } else { if (cls.CheckExistField("CheckExistField", "ProductCategory", "CategoryName", txtCategoryName.Text, "and Id <> " + lblId.Text + " and IsActive = 1")) { lblMsg.Text = "This Category already exists."; return; } else { cls.ExecuteDA("Update_ProductCategory", new SqlParameter("@Id", lblId.Text), new SqlParameter("@CategoryName", txtCategoryName.Text), new SqlParameter("@IsActive", 1)); clearall(); lblMsg.Text = "Details updated successfully."; BindCategory(); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { int flag = 0; string crA = "0"; string crB = "0"; string crC = "0"; if (chkCriteriaA.Checked) { if (rbtCriteriaA.SelectedValue != "") { crA = rbtCriteriaA.SelectedValue; flag = 1; } else { lblMsg.Text = "Choose Value in Criteria A"; return; } } if (chkCriteriaB.Checked) { if (rbtCriteriaB.SelectedValue != "") { crB = rbtCriteriaB.SelectedValue; flag = 1; } else { lblMsg.Text = "Choose Value in Criteria B"; return; } } if (chkCriteriaC.Checked) { if (rbtCriteriaC.SelectedValue != "") { crC = rbtCriteriaC.SelectedValue; flag = 1; } else { lblMsg.Text = "Choose Value in Criteria C"; return; } } if (flag <= 0) { lblMsg.Text = "Choose Criteria"; return; } else { if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "Coupon", "CouponName", txtCode.Text, "and IsActive = 1 ")) { lblMsg.Text = "This coupon code already exists."; return; } else { cls.ExecuteDA("Insert_Coupon", new SqlParameter("@CouponName", txtCode.Text), new SqlParameter("@CriteriaA", crA), new SqlParameter("@CriteriaB", crB), new SqlParameter("@CriteriaC", crC), new SqlParameter("@Discount", txtDiscount.Text), new SqlParameter("@InUse", chkIsActive.Checked)); lblMsg.Text = "Details inserted successfully."; } } else { if (cls.CheckExistField("CheckExistField", "Coupon", "CouponName", txtCode.Text, "and IsActive = 1 and Id != '" + lblId.Text + "'")) { lblMsg.Text = "This coupon code already exists."; return; } else { cls.ExecuteDA("Update_Coupon", new SqlParameter("@Id", lblId.Text), new SqlParameter("@CouponName", txtCode.Text), new SqlParameter("@CriteriaA", crA), new SqlParameter("@CriteriaB", crB), new SqlParameter("@CriteriaC", crC), new SqlParameter("@Discount", txtDiscount.Text), new SqlParameter("@InUse", chkIsActive.Checked)); lblMsg.Text = "Details updated successfully."; } } BindData(); clearall(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (!IsSizeSet()) { MsgBox("Please Select Size"); return; } if (!IsColorSet()) { MsgBox("Please Select Color"); return; } string concat = Guid.NewGuid().ToString(); string strDoc = ""; if (fupPhoto.HasFile != false) { string ext = null; ext = Path.GetExtension(fupPhoto.PostedFile.FileName).ToLower(); if ((ext != ".jpg") & (ext != ".jpeg") & (ext != ".gif") & (ext != ".png") & (ext != ".bmp")) { lblMsg.Text = "Please select jpg or gif or png or bmp files only"; fupPhoto.Focus(); return; } //''''''Create an image object from the uploaded file System.Drawing.Image FrontImage = null; FrontImage = System.Drawing.Image.FromStream(fupPhoto.PostedFile.InputStream); ///'''''''''''Determine width and height of uploaded image double UploadedImageWidth = FrontImage.PhysicalDimension.Width; double UploadedImageHeight = FrontImage.PhysicalDimension.Height; double isoscalar = 0; double newWidth = 0; double newHeight = 0; isoscalar = Math.Min((356 / UploadedImageWidth), (500 / UploadedImageHeight)); newWidth = isoscalar * UploadedImageWidth; newHeight = isoscalar * UploadedImageHeight; int nwidth = 0; int wheight = 0; nwidth = Convert.ToInt32(newWidth); wheight = Convert.ToInt32(newHeight); int x = 0; int y = 0; x = (356 - nwidth) / 2; y = (500 - wheight) / 2; Bitmap newImage = default(Bitmap); newImage = new Bitmap(356, 500); newImage.SetResolution(72, 72); //web resolution; //create a graphics object Graphics gr = default(Graphics); gr = Graphics.FromImage(newImage); //just in case it's a transparent GIF force the bg to white SolidBrush sb = default(SolidBrush); sb = new SolidBrush(System.Drawing.Color.Transparent); //sb = New SolidBrush(System.Drawing.Color.Transparent) gr.FillRectangle(sb, 0, 0, newImage.Width, newImage.Height); //Re-draw the image to the specified height and width gr.DrawImage(FrontImage, x, y, nwidth, wheight); newImage.Save(Server.MapPath("../Product/") + concat + ext); strDoc = "Product/" + concat + ext; } else { if (lblId.Text != "") { strDoc = ViewState["img"].ToString(); } else { lblMsg.Text = "Please Select Image"; return; } } //checking isarrival or not bool isaarival; if (rbtNewArriaval.SelectedValue == "1") { isaarival = true; } else { isaarival = false; } //checking special offer or not bool isspecial; if (RbtSpecialOffer.SelectedValue == "1") { isspecial = true; } else { isspecial = false; } //checking ISCOD or not bool iscod; if (rbtCOD.SelectedValue == "1") { iscod = true; } else { iscod = false; } double mrp = 0; if (txtMRP.Text != "") { mrp = Convert.ToDouble(txtMRP.Text); } if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "Product", "ProductName", txtProductname.Text, "and IsActive = 1 and ProductCategoryID ='" + ddlCategory.SelectedValue + "' and ProductSubCategoryID ='" + ddlSubCategory.SelectedValue + "'")) { lblMsg.Text = "This product already exists."; return; } else { Int32 pid; pid = (Int32)cls.ReturnScaler("Insert_Product", new SqlParameter("@ProductCategoryId", Convert.ToInt32(ddlCategory.SelectedValue.ToString())), new SqlParameter("@ProductSubCategoryId", Convert.ToInt32(ddlSubCategory.SelectedValue.ToString())), new SqlParameter("@SupplierId", Convert.ToInt32(ddlsupplier.SelectedValue.ToString())), new SqlParameter("@BrandId", Convert.ToInt32(ddlBrand.SelectedValue.ToString())), new SqlParameter("@ProductName", txtProductname.Text), new SqlParameter("@Productdescp", txtProductline2.Text), new SqlParameter("@ProductCode", txtProductCode.Text), new SqlParameter("@SupplierProductCode", txtSupProductcode.Text), new SqlParameter("@PackSize", txtpacksize.Text), new SqlParameter("@ProductCost", Convert.ToDouble(txtProductcost.Text)), new SqlParameter("@UnitId", Convert.ToInt32(ddlUnit.SelectedValue.ToString())), new SqlParameter("@ProductWeight", Convert.ToDouble(txtProductweight.Text)), new SqlParameter("@Image", strDoc), new SqlParameter("@KeyWords", txtkeywords.Text), new SqlParameter("@Certification", txtCertification.Text), new SqlParameter("@Description", txtDescription.Text), new SqlParameter("@Margin", txtmargin.Text), new SqlParameter("@SalePrice", Convert.ToDouble(txtsalescost.Text)), new SqlParameter("@Tax", Convert.ToDouble(txttax.Text)), new SqlParameter("@SalesPrice_Incl", Convert.ToDouble(txtSalesPriceIncl.Text)), new SqlParameter("@MRP", mrp), new SqlParameter("@Discount", Convert.ToDouble(txtDiscount.Text)), new SqlParameter("@ShippingCost", Convert.ToDouble(txtshippingcost.Text)), new SqlParameter("@FinalSellingPrice", Convert.ToDouble(txtfinalcost.Text)), new SqlParameter("@TaxFinalPrice", Convert.ToDouble(txttaxfinalprice.Text)), new SqlParameter("@Quantity", Convert.ToDouble(txtMinOrdrQty.Text)), new SqlParameter("@ShippingDays", txtShippngDays.Text), new SqlParameter("@IsNewArrival", isaarival), new SqlParameter("@IsSpecialOffer", isspecial), new SqlParameter("@IsCOD", iscod), new SqlParameter("@IsActive", 1)); //insert into product size and product Colour InsertProdSize(pid); InsertProdColour(pid); clearall(); lblMsg.Text = "Details inserted successfully."; BindProduct(); } } else { cls.ExecuteDA("Update_Product", new SqlParameter("@Id", Convert.ToInt32(lblId.Text)), new SqlParameter("@ProductCategoryId", Convert.ToInt32(ddlCategory.SelectedValue.ToString())), new SqlParameter("@ProductSubCategoryId", Convert.ToInt32(ddlSubCategory.SelectedValue.ToString())), new SqlParameter("@SupplierId", Convert.ToInt32(ddlsupplier.SelectedValue.ToString())), new SqlParameter("@BrandId", Convert.ToInt32(ddlBrand.SelectedValue.ToString())), new SqlParameter("@ProductName", txtProductname.Text), new SqlParameter("@Productdescp", "ABC"), new SqlParameter("@ProductCode", txtProductCode.Text), new SqlParameter("@SupplierProductCode", txtSupProductcode.Text), new SqlParameter("@PackSize", txtpacksize.Text), new SqlParameter("@ProductCost", Convert.ToDouble(txtProductcost.Text)), new SqlParameter("@UnitId", Convert.ToInt32(ddlUnit.SelectedValue.ToString())), new SqlParameter("@ProductWeight", Convert.ToDouble(txtProductweight.Text)), new SqlParameter("@Image", strDoc), new SqlParameter("@KeyWords", txtkeywords.Text), new SqlParameter("@Certification", txtCertification.Text), new SqlParameter("@Description", txtDescription.Text), new SqlParameter("@Margin", txtmargin.Text), new SqlParameter("@SalePrice", Convert.ToDouble(txtsalescost.Text)), new SqlParameter("@Tax", Convert.ToDouble(txttax.Text)), new SqlParameter("@SalesPrice_Incl", Convert.ToDouble(txtSalesPriceIncl.Text)), new SqlParameter("@MRP", mrp), new SqlParameter("@Discount", Convert.ToDouble(txtDiscount.Text)), new SqlParameter("@ShippingCost", Convert.ToDouble(txtshippingcost.Text)), new SqlParameter("@FinalSellingPrice", Convert.ToDouble(txtfinalcost.Text)), new SqlParameter("@TaxFinalPrice", Convert.ToDouble(txttaxfinalprice.Text)), new SqlParameter("@Quantity", Convert.ToDouble(txtMinOrdrQty.Text)), new SqlParameter("@ShippingDays", txtShippngDays.Text), new SqlParameter("@IsNewArrival", isaarival), new SqlParameter("@IsSpecialOffer", isspecial), new SqlParameter("@IsCOD", iscod), new SqlParameter("@IsActive", 1)); //Update Product Size nad product Colour cls.ExecuteDA("Delete_ProductColour", new SqlParameter("@ProductId", Convert.ToInt32(lblId.Text))); InsertProdColour(Convert.ToInt32(lblId.Text)); cls.ExecuteDA("Delete_ProductSize", new SqlParameter("@ProductId", Convert.ToInt32(lblId.Text))); InsertProdSize(Convert.ToInt32(lblId.Text)); lblMsg.Text = "Details updated successfully."; clearall(); BindProduct(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { string concat = Guid.NewGuid().ToString(); string strDoc = ""; string strDoc1 = ""; if (fupPhoto.HasFile != false) { string ext = null; ext = Path.GetExtension(fupPhoto.PostedFile.FileName).ToLower(); if ((ext != ".jpg") & (ext != ".jpeg") & (ext != ".gif") & (ext != ".png") & (ext != ".bmp")) { lblMsg.Text = "Please select jpg or gif or png or bmp files only"; fupPhoto.Focus(); return; } //''''''Create an image object from the uploaded file System.Drawing.Image FrontImage = null; FrontImage = System.Drawing.Image.FromStream(fupPhoto.PostedFile.InputStream); ///'''''''''''Determine width and height of uploaded image double UploadedImageWidth = FrontImage.PhysicalDimension.Width; double UploadedImageHeight = FrontImage.PhysicalDimension.Height; double isoscalar = 0; double newWidth = 0; double newHeight = 0; isoscalar = Math.Min((356 / UploadedImageWidth), (500 / UploadedImageHeight)); newWidth = isoscalar * UploadedImageWidth; newHeight = isoscalar * UploadedImageHeight; int nwidth = 0; int wheight = 0; nwidth = Convert.ToInt32(newWidth); wheight = Convert.ToInt32(newHeight); int x = 0; int y = 0; x = (356 - nwidth) / 2; y = (500 - wheight) / 2; Bitmap newImage = default(Bitmap); newImage = new Bitmap(356, 500); newImage.SetResolution(72, 72); //web resolution; //create a graphics object Graphics gr = default(Graphics); gr = Graphics.FromImage(newImage); //just in case it's a transparent GIF force the bg to white SolidBrush sb = default(SolidBrush); sb = new SolidBrush(System.Drawing.Color.Transparent); //sb = New SolidBrush(System.Drawing.Color.Transparent) gr.FillRectangle(sb, 0, 0, newImage.Width, newImage.Height); //Re-draw the image to the specified height and width gr.DrawImage(FrontImage, x, y, nwidth, wheight); newImage.Save(Server.MapPath("../SubCategory/") + concat + ext); strDoc = "SubCategory/" + concat + ext; } else { if (lblId.Text != "") { strDoc = ViewState["img"].ToString(); } else if (imgPhoto.ImageUrl != "") { // lblMsg.Text = "Please Select Image"; } else { lblMsg.Text = "Please Select Image"; return; } } if (fupBannerPhoto.HasFile != false) { string ext = null; ext = Path.GetExtension(fupBannerPhoto.PostedFile.FileName).ToLower(); if ((ext != ".jpg") & (ext != ".jpeg") & (ext != ".gif") & (ext != ".png") & (ext != ".bmp")) { lblMsg.Text = "Please select jpg or gif or png or bmp files only"; fupBannerPhoto.Focus(); return; } //''''''Create an image object from the uploaded file System.Drawing.Image FrontImage = null; FrontImage = System.Drawing.Image.FromStream(fupBannerPhoto.PostedFile.InputStream); ///'''''''''''Determine width and height of uploaded image double UploadedImageWidth = FrontImage.PhysicalDimension.Width; double UploadedImageHeight = FrontImage.PhysicalDimension.Height; double isoscalar = 0; double newWidth = 0; double newHeight = 0; isoscalar = Math.Min((1170 / UploadedImageWidth), (150 / UploadedImageHeight)); newWidth = isoscalar * UploadedImageWidth; newHeight = isoscalar * UploadedImageHeight; int nwidth = 0; int wheight = 0; nwidth = Convert.ToInt32(newWidth); wheight = Convert.ToInt32(newHeight); int x = 0; int y = 0; x = (1170 - nwidth) / 2; y = (150 - wheight) / 2; Bitmap newImage = default(Bitmap); newImage = new Bitmap(1170, 150); newImage.SetResolution(72, 72); //web resolution; //create a graphics object Graphics gr = default(Graphics); gr = Graphics.FromImage(newImage); //just in case it's a transparent GIF force the bg to white SolidBrush sb = default(SolidBrush); sb = new SolidBrush(System.Drawing.Color.Transparent); //sb = New SolidBrush(System.Drawing.Color.Transparent) gr.FillRectangle(sb, 0, 0, newImage.Width, newImage.Height); //Re-draw the image to the specified height and width gr.DrawImage(FrontImage, x, y, nwidth, wheight); newImage.Save(Server.MapPath("../SubCategoryBanner/") + concat + ext); strDoc1 = "SubCategoryBanner/" + concat + ext; } else { if (lblId.Text != "") { strDoc1 = ViewState["imgBanner"].ToString(); } else if (imgBannerPhoto.ImageUrl != "") { // lblMsg.Text = "Please Select Image"; } else { lblMsg.Text = "Please Select Banner Image"; return; } } if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "ProductSubCategory", "SubCategoryName", txtSubCategoryName.Text, "and IsActive = 1 and ProductCategoryId='" + ddlCategory.SelectedValue + "'")) { lblMsg.Text = "This SubCategory Name already exists."; return; } else { cls.ExecuteDA("Insert_ProductSubCategory", new SqlParameter("@ProductCategoryId", ddlCategory.SelectedValue), new SqlParameter("@SubCategoryName", txtSubCategoryName.Text), new SqlParameter("@Image", strDoc), new SqlParameter("@ImageBanner", strDoc1), new SqlParameter("@IsActive", 1)); clearall(); lblMsg.Text = "Details inserted successfully."; BindProductSubCategory(); } } else { if (cls.CheckExistField("CheckExistField", "ProductSubCategory", "SubCategoryName", txtSubCategoryName.Text, "and IsActive = 1 and ProductCategoryId='" + ddlCategory.SelectedValue + "' and Id <> " + lblId.Text + "")) { lblMsg.Text = "This SubCategory Name already exists."; return; } else { cls.ExecuteDA("Update_ProductSubCategory", new SqlParameter("@Id", lblId.Text), new SqlParameter("@ProductCategoryId", ddlCategory.SelectedValue), new SqlParameter("@SubCategoryName", txtSubCategoryName.Text), new SqlParameter("@Image", strDoc), new SqlParameter("@ImageBanner", strDoc1), new SqlParameter("@IsActive", 1)); //update in imagemap table cls.ExecuteDA("Update_ImageMapSubCategory", new SqlParameter("@Id", lblId.Text), new SqlParameter("@url", strDoc1)); clearall(); lblMsg.Text = "Details updated successfully."; BindProductSubCategory(); } } }
//Insert into DB functions protected string InsertIntoDB() { clsCart = new clsAddToCart(); long orderid; A: orderid = (long)cls.ReturnScaler("Select_MaxOrderID"); if (cls.CheckExistField("CheckExistField", "InvoiceMaster", "OrderId", orderid.ToString(), " and IsActive=1")) { goto A; } long Memberid = 0; DataTable dtMember = new DataTable(); dtMember = (DataTable)Session["MemberInfo"]; foreach (DataRow dr in dtMember.Rows) { Memberid = Convert.ToInt64(dr["MemberId"]); } bool IsPaid = false; bool IsCOD = false; double discount = 0; double discountValue = 0; if (Session["Discount"] != null) { discount = (double)Session["Discount"]; discountValue = (double)Session["DiscountValue"]; } //Insert into invoice master Int32 invoiceid; invoiceid = (Int32)cls.ReturnScaler("Insert_InvoiceMasterForOnlinePay", new SqlParameter("MemberId", Memberid), new SqlParameter("@OrderId", orderid), new SqlParameter("@ShippingCharges", "0"), new SqlParameter("@OrderAmount", clsCart.TotalPrice()), new SqlParameter("@OrderQty", clsCart.TotalQty()), new SqlParameter("@PaypalId", ""), new SqlParameter("@IsPaid", IsPaid), new SqlParameter("@IsCOD", IsCOD), new SqlParameter("@PaymentMode", Session["PayMode"].ToString()), new SqlParameter("@DiscountPer", discount), new SqlParameter("@DiscountAmount", discountValue), new SqlParameter("@OriginalAmount", clsCart.TotalPriceWithoutDiscount())); //Insert into invoice coupon if (Session["CouponCode"] != null) { DataTable dtCoupon = new DataTable(); dtCoupon = cls.ReturnDataTable("Select_CouponOnName", new SqlParameter("@CouponName", Session["CouponCode"].ToString())); if (dtCoupon.Rows.Count > 0) { cls.ExecuteDA("Insert_InvoiceCoupon", new SqlParameter("@InvoiceId", invoiceid), new SqlParameter("@CouponName", dtCoupon.Rows[0]["CouponName"]), new SqlParameter("@CriteriaAVal", dtCoupon.Rows[0]["CriteriaAVal"]), new SqlParameter("@CriteriaBVal", dtCoupon.Rows[0]["CriteriaBVal"]), new SqlParameter("@CriteriaCVal", dtCoupon.Rows[0]["CriteriaCVal"])); } } //insert into invoice product table DataTable dt = new DataTable(); dt = clsCart.BindCart(); foreach (DataRow dr in dt.Rows) { cls.ExecuteDA("Insert_InvoiceProduct", new SqlParameter("@InvoiceId", invoiceid), new SqlParameter("@ProductId", Convert.ToInt32(dr["ProductId"])), new SqlParameter("@CategoryName", dr["CategoryName"]), new SqlParameter("@SubCategoryName", dr["SubCategoryName"]), new SqlParameter("@ProductName", dr["ProductName"]), new SqlParameter("@Productdescp", dr["Productdescp"]), new SqlParameter("@BrandName", dr["BrandName"]), new SqlParameter("@SupplierName", dr["SupplierName"]), new SqlParameter("@Unit", dr["Unit"]), new SqlParameter("@ColourName", dr["ColourName"]), new SqlParameter("@SizeName", dr["SizeName"]), new SqlParameter("@ProductCode", dr["ProductCode"]), new SqlParameter("@SupplierProductCode", dr["SupplierProductCode"]), new SqlParameter("@PackSize", dr["PackSize"]), new SqlParameter("@ProductCost", dr["ProductCost"]), new SqlParameter("@ProductWeight", dr["ProductWeight"]), new SqlParameter("@Image", dr["Image"]), new SqlParameter("@Certification", dr["Certification"]), new SqlParameter("@Description", dr["Description"]), new SqlParameter("@Margin", Convert.ToDouble(dr["Margin"])), new SqlParameter("@SalePrice", Convert.ToDouble(dr["SalePrice"])), new SqlParameter("@Tax", Convert.ToDouble(dr["Tax"])), new SqlParameter("@SalesPrice_Incl", Convert.ToDouble(dr["SalesPrice_Incl"])), new SqlParameter("@MRP", Convert.ToDouble(dr["MRP"])), new SqlParameter("@Discount", Convert.ToDouble(dr["Discount"])), new SqlParameter("@CalDiscount", Convert.ToDouble(dr["CalDiscount"])), new SqlParameter("@ShippingCost", Convert.ToDouble(dr["ShippingCost"])), new SqlParameter("@FinalSellingPrice", Convert.ToDouble(dr["FinalSellingPrice"])), new SqlParameter("@TaxFinalPrice", Convert.ToDouble(dr["TaxFinalPrice"])), new SqlParameter("@Quantity", Convert.ToDouble(dr["Qty"])), new SqlParameter("@ShippingDays", dr["ShippingDays"]), new SqlParameter("@IsCOD", Convert.ToBoolean(dr["IsCOD"]))); } //inserting into billing and delivery details clsBSD = new BillingShippingDetails(); DataTable dtbilship = new DataTable(); dtbilship = clsBSD.BindBillShip(); foreach (DataRow drow in dtbilship.Rows) { ViewState["ToMail"] = drow["SEmail"]; cls.ExecuteDA("Insert_InvoiceBillingShipping", new SqlParameter("@InvoiceId", invoiceid), new SqlParameter("@Name", drow["Name"]), new SqlParameter("@Email", drow["Email"]), new SqlParameter("@Company", drow["Company"]), new SqlParameter("@Contact", drow["Contact"]), new SqlParameter("@Address1", drow["Address1"]), new SqlParameter("@Address2", drow["Address2"]), new SqlParameter("@City", drow["City"]), new SqlParameter("@State", drow["State"]), new SqlParameter("@Country", drow["Country"]), new SqlParameter("@Zipcode", drow["Zipcode"]), new SqlParameter("@SName", drow["SName"]), new SqlParameter("@SEmail", drow["SEmail"]), new SqlParameter("@SCompany", drow["SCompany"]), new SqlParameter("@SContact", drow["SContact"]), new SqlParameter("@SAddress1", drow["SAddress1"]), new SqlParameter("@SAddress2", drow["SAddress2"]), new SqlParameter("@SCity", drow["SCity"]), new SqlParameter("@SState", drow["SState"]), new SqlParameter("@SCountry", drow["SCountry"]), new SqlParameter("@SZipcode", drow["SZipcode"])); } // Session["OrderId"] = orderid.ToString(); // lblOredrId.Text = orderid.ToString(); setPdfandMail(invoiceid, orderid); return(orderid.ToString()); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { if (cls.CheckExistField("CheckExistField", "Members", "Email", txtEmail.Text.Trim(), "and IsActive = 1")) { lblMsg.Text = "This Member already exists."; return; } else { cls.ExecuteDA("Insert_Members", new SqlParameter("@Name", txtMemName.Text), new SqlParameter("@Email", txtEmail.Text), new SqlParameter("@Password", txtPassword.Text), new SqlParameter("@Company", txtCompany.Text), new SqlParameter("@Contact", txtContact.Text), new SqlParameter("@Address1", txtAddress1.Text), new SqlParameter("@Address2", txtAddress2.Text), new SqlParameter("@City", txtCity.Text), new SqlParameter("@State", txtState.Text), new SqlParameter("@Country", txtCountry.Text), new SqlParameter("@ZipCode", txtZipCode.Text), new SqlParameter("@Tinno", txtTin.Text), new SqlParameter("@Cstno", txtCst.Text), new SqlParameter("@BCompany", txtCompany.Text), new SqlParameter("@BContact", txtBContact.Text), new SqlParameter("@BAddress1", txtBAddress1.Text), new SqlParameter("@BAddress2", txtBAddress2.Text), new SqlParameter("@BCity", txtBCity.Text), new SqlParameter("@BState", txtBState.Text), new SqlParameter("@BCountry", txtBCountry.Text), new SqlParameter("@BZipCode", txtBZipCode.Text), new SqlParameter("@IsApproved", chkIsActive.Checked)); clearall(); lblMsg.Text = "Details inserted successfully."; BindManageUser(); } } else { if (cls.CheckExistField("CheckExistField", "Members", "Email", txtEmail.Text.Trim(), "and MemberId<>" + lblId.Text + " and IsActive = 1")) { lblMsg.Text = "This Supplier already exists."; return; } else { cls.ExecuteDA("Update_ManageUser", new SqlParameter("@MemberId", lblId.Text), new SqlParameter("@Name", txtMemName.Text), new SqlParameter("@Email", txtEmail.Text), new SqlParameter("@Password", txtPassword.Text), new SqlParameter("@Company", txtCompany.Text), new SqlParameter("@Contact", txtContact.Text), new SqlParameter("@Address1", txtAddress1.Text), new SqlParameter("@Address2", txtAddress2.Text), new SqlParameter("@City", txtCity.Text), new SqlParameter("@State", txtState.Text), new SqlParameter("@Country", txtCountry.Text), new SqlParameter("@ZipCode", txtZipCode.Text), new SqlParameter("@Tinno", txtTin.Text), new SqlParameter("@Cstno", txtCst.Text), new SqlParameter("@BCompany", txtCompany.Text), new SqlParameter("@BContact", txtBContact.Text), new SqlParameter("@BAddress1", txtBAddress1.Text), new SqlParameter("@BAddress2", txtBAddress2.Text), new SqlParameter("@BCity", txtBCity.Text), new SqlParameter("@BState", txtBState.Text), new SqlParameter("@BCountry", txtBCountry.Text), new SqlParameter("@BZipCode", txtBZipCode.Text), new SqlParameter("@IsApproved", chkIsActive.Checked), new SqlParameter("@Flag", "A")); clearall(); lblMsg.Text = "Details updated successfully."; BindManageUser(); } } }