protected void btnSubmit_Click(object sender, EventArgs e) { try { int StyleId = 0; if (ddlStyle.SelectedItem.Text == "--Select Style--" && txtStyle.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Style')", true); return; } if (chkNewstyle.Checked == true) { LC_Style aLC_Style = new LC_Style(); aLC_Style.StyleName = txtStyle.Text; aLC_Style.CreateDate = DateTime.Today; aLC_Style.CreateUser = ((SessionUser)Session["SessionUser"]).UserId; aLC_Style.OCode = ((SessionUser)Session["SessionUser"]).OCode; var result = _Buyerbll.AddStyle(aLC_Style); StyleId = result; } int SesonId = 0; if (ddlSeason.SelectedItem.Text == "---Select One---" && txtSeason.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Season')", true); return; } if (chkSeason.Checked == true) { LC_Season _LC_Season = new LC_Season(); _LC_Season.Season_Name = txtSeason.Text; _LC_Season.CreateUser = ((SessionUser)Session["SessionUser"]).UserId; _LC_Season.CreateDate = DateTime.Now; _LC_Season.OCode = ((SessionUser)Session["SessionUser"]).OCode; int result = masterBLL.SaveLC_Season(_LC_Season); SesonId = result; } LC_OrderEntry orderEntry = new LC_OrderEntry(); //string seasonname = ddlSeason.SelectedItem.ToString(); //string[] values = seasonname.Split('-'); orderEntry.OrderReceiveDate = Convert.ToDateTime(txtOrderReceivedDate.Text); //orderEntry.Season = values[0].ToString(); orderEntry.Buyer_Department = txtBuyerDepartment.Text; orderEntry.Supplier_No = txtSupplierNo.Text; orderEntry.OrderNo = txtOrder.Text; orderEntry.LCNo = lblLCNo.Text; orderEntry.Article = txtArticle.Text; orderEntry.ColorSpecification = txtColor.Text; orderEntry.OrderQuantity = txtOrderQty.Text; orderEntry.FobQty = Convert.ToDouble(txtFob.Text); if (chkNewstyle.Checked == true) { orderEntry.StyleId = StyleId; } else { orderEntry.StyleId = Convert.ToInt32(ddlStyle.SelectedValue); } if (chkSeason.Checked == true) { orderEntry.SeasonId = SesonId; } else { orderEntry.SeasonId = Convert.ToInt32(ddlSeason.SelectedValue); } orderEntry.Size = txtsize.Text; orderEntry.Shipment_Mode = ddlShipmentMode.SelectedValue; orderEntry.ShipmentDate = Convert.ToDateTime(txtDate.Text); orderEntry.FiberContent1 = txtFiberContent1.Text; orderEntry.FiberContent2 = txtFiberContent2.Text; orderEntry.Create_Date = DateTime.Today; orderEntry.Create_User = ((SessionUser)Session["SessionUser"]).UserId; orderEntry.OCODE = ((SessionUser)Session["SessionUser"]).OCode; orderEntry.TotalQty = Convert.ToDouble(txtValue.Text); if (btnSubmit.Text == "Add") { var result = masterBLL.InsertOrderEntry(orderEntry); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true); } } else { int orderid = Convert.ToInt32(hidorderid.Value); var result = masterBLL.UpdateOrderEntry(orderEntry, orderid); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true); } } LoadGrid(lblLCNo.Text.ToString()); Clear(); } catch (Exception ex) { throw ex; } }