protected void btnSubmit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(lblId.Text)) { lblMsg.Text = "You can not insert new Record. You can only update a record."; return; } else { cls.ExecuteDA("Update_CODLimit", new SqlParameter("@CODLimit", txtAmount.Text)); lblMsg.Text = "Details updated successfully."; BindDescription(); clearall(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { //Check for valid old password object ValidPwd; ValidPwd = cls.ReturnScalerObject("Login_ValidatePassword", new SqlParameter("@UserName", Utils.CurrentLoggedInUser()), new SqlParameter("@Password", txtOldPwd.Text)); //Update the new password in DB if old password check is valid if (ValidPwd != null) { cls.ExecuteDA("Update_UserPassword", new SqlParameter("@UserID", Utils.CurrentUser().UserID), new SqlParameter("@Password", txtConfirmPwd.Text), new SqlParameter("@LastPasswordChangeDate", DateTime.Now)); lblMsg.Text = "Password changed successfully."; txtOldPwd.Text = ""; txtNewPwd.Text = ""; txtConfirmPwd.Text = ""; } else { lblMsg.Text = "Enter valid old password."; txtOldPwd.Focus(); } }
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) { 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((1130 / UploadedImageWidth), (145 / 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 = (1130 - nwidth) / 2; y = (145 - wheight) / 2; Bitmap newImage = default(Bitmap); newImage = new Bitmap(1130, 145); 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("../Advertisement/") + concat + ext); strDoc = "Advertisement/" + 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 (string.IsNullOrEmpty(lblId.Text)) { //cls.ExecuteDA("Insert_HomeAdd", // new SqlParameter("@Image", strDoc), // new SqlParameter("@IsActive", 1)); //clearall(); //lblMsg.Text = "Advertisement Details inserted successfully."; //BindAdvertisement(); lblMsg.Text = "You can insert new record please edit existance data."; return; } else { cls.ExecuteDA("Update_HomeAdd", new SqlParameter("@Id", lblId.Text), new SqlParameter("@Image", strDoc), new SqlParameter("@IsActive", 1)); //update in imagemap table cls.ExecuteDA("Update_ImageMapHomeAdv", new SqlParameter("@Id", lblId.Text), new SqlParameter("@url", strDoc)); clearall(); lblMsg.Text = "Advertisement Details updated successfully."; BindAdvertisement(); } }
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(); } } }
protected void btnGenerate_Click(object sender, EventArgs e) { //checking product selected or not if (checkproducts()) { //insert into db //update order status in invoice master cls.ExecuteDA("Update_InvoiceOrderStatus", new SqlParameter("@InvoiceId", invoiceid), new SqlParameter("@OrderStatus", drpStatus.SelectedItem.Text)); //calculate CalcualtePrices(); //insert into invoice dispatch id = (long)cls.ReturnScaler("Insert_InvoiceDispatch", new SqlParameter("@InvoiceId", Convert.ToInt32(invoiceid)), new SqlParameter("@InvoiceNumber", lblInvoiceNo.Text), new SqlParameter("@InvoiceNo", invno), new SqlParameter("@CourierName", drpCourier.SelectedItem.Text), new SqlParameter("@URL", drpCourier.SelectedValue.ToString()), new SqlParameter("@TrackingNumber", txtTrackingNo.Text), new SqlParameter("@InvoiceDate", cls.FormatDate_IND_US(txtDate.Text)), new SqlParameter("@Barcode", txtTrackingNo.Text), new SqlParameter("@OtherDetails", txtOtherDetails.Text), new SqlParameter("@InvoiceAmount", ViewState["InvoiceAmount"]), new SqlParameter("@InvoiceDiscountPer", ViewState["InvoiceDiscountPer"]), new SqlParameter("@InvoiceDiscountAmount", ViewState["InvoiceDiscountAmount"]), new SqlParameter("@InvoiceOriginalAmount", ViewState["InvoiceOriginalAmount"])); //insert into invoice dispatch product foreach (RepeaterItem ri in rptPendingproducts.Items) { CheckBox chk = (CheckBox)ri.FindControl("chk"); if (chk != null) { if (chk.Checked == true) { cls.ExecuteDA("Insert_InvoiceDispatchProduct", new SqlParameter("@InvoiceId", invoiceid), new SqlParameter("@InvoiceDispatchId", id), new SqlParameter("@ProductId", chk.ToolTip.ToString())); //update isdispatch in invoice product cls.ExecuteDA("Update_InvoiceProductIsDispatch", new SqlParameter("@InvoiceId", Convert.ToInt32(invoiceid)), new SqlParameter("@ProductId", chk.ToolTip.ToString()), new SqlParameter("@IsDispatched", 1)); } } } // create pdf and sending mail string invdisid = id.ToString(); string inid = Request.QueryString["ID"].ToString(); setPdfandMail(invdisid, inid); Response.Redirect("Orders.aspx"); } else { MsgBox("Please select product to generate invoice"); } }
//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(); } } }