Esempio n. 1
0
 internal int SaveCategory(LC_StyleCategor aLC_StyleCategor)
 {
     using (var _Context = new ERPSSL_MerchandisingEntities())
     {
         _Context.LC_StyleCategor.AddObject(aLC_StyleCategor);
         _Context.SaveChanges();
         return(aLC_StyleCategor.Style_Category_Id);
     }
 }
Esempio n. 2
0
 internal int AddStyleCategor(LC_StyleCategor _LC_StyleCategor)
 {
     try
     {
         _Context.LC_StyleCategor.AddObject(_LC_StyleCategor);
         _Context.SaveChanges();
         return(_LC_StyleCategor.Style_Category_Id);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime?NullDate   = null;
                int      StyleId    = 0;
                int      BuyDept    = 0;
                int      StyleCatId = 0;
                if (txtPOrder.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Enter Order No!')", true);
                    return;
                }
                if (ddlStyle.SelectedItem.Text == "--Select Style--" && txtStyle.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Style!')", true);
                    return;
                }
                if (ddlSeason.SelectedItem.Text == "--Select Season--" && txtSeason.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Season!')", true);
                    return;
                }
                if (ddlBuyer.SelectedItem.Text == "--Select Buyer--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Buyer!')", true);
                    return;
                }



                LC_Season aLC_Season = new LC_Season();

                if (ChkSeason.Checked == true)
                {
                    aLC_Season.Season_Name = txtSeason.Text;
                    aLC_Season.CreateDate  = DateTime.Today;
                    aLC_Season.CreateUser  = ((SessionUser)Session["SessionUser"]).UserId;
                    aLC_Season.OCode       = ((SessionUser)Session["SessionUser"]).OCode;

                    var result = _orderSheetbll.AddSeason(aLC_Season);
                }
                LC_BuyerDepartment _LC_BuyerDepartment = new LC_BuyerDepartment();

                if (chkBuyerDepartment.Checked == true)
                {
                    int count = (from Bd in _Context.LC_BuyerDepartment
                                 where Bd.BuyerDepartment_Name == _LC_BuyerDepartment.BuyerDepartment_Name
                                 select Bd.BuyerDepartment_Name).Count();
                    if (count > 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Buyer Department already Exist')", true);
                        return;
                    }
                    _LC_BuyerDepartment.BuyerDepartment_Name = txtBuyerDepartment.Text;
                    _LC_BuyerDepartment.Create_Date          = DateTime.Today;
                    _LC_BuyerDepartment.Create_User          = ((SessionUser)Session["SessionUser"]).UserId;
                    _LC_BuyerDepartment.OCode = ((SessionUser)Session["SessionUser"]).OCode;

                    int result = _orderSheetbll.AddBuyerDepartment(_LC_BuyerDepartment);
                    BuyDept = result;
                }

                LC_StyleCategor _LC_StyleCategor = new LC_StyleCategor();

                if (chkCategory.Checked == true)
                {
                    int count = (from Bd in _Context.LC_StyleCategor
                                 where Bd.Style_Category_Name == _LC_StyleCategor.Style_Category_Name
                                 select Bd.Style_Category_Name).Count();
                    if (count > 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Style Category already Exist')", true);
                        return;
                    }
                    _LC_StyleCategor.Style_Category_Name = txtCategory.Text;
                    _LC_StyleCategor.CreateDate          = DateTime.Today;
                    _LC_StyleCategor.CreateUser          = ((SessionUser)Session["SessionUser"]).UserId;
                    _LC_StyleCategor.OCode = ((SessionUser)Session["SessionUser"]).OCode;

                    int result = _orderSheetbll.AddStyleCategor(_LC_StyleCategor);
                    StyleCatId = result;
                }

                LC_OrderEntry orderEntry = new LC_OrderEntry();


                orderEntry.OrderReceiveDate = Convert.ToDateTime(txtOrderConfirmationDate.Text);


                if (ChkSeason.Checked == true)
                {
                    orderEntry.SeasonId = aLC_Season.Season_Id;
                    hidSeasonID.Value   = orderEntry.Season;
                }
                else
                {
                    orderEntry.SeasonId = Convert.ToInt32(ddlSeason.SelectedValue);
                    hidSeasonID.Value   = orderEntry.Season;
                }
                if (chkBuyerDepartment.Checked == true)
                {
                    orderEntry.Buyer_DepartmentId = BuyDept;
                }
                else
                {
                    orderEntry.Buyer_DepartmentId = Convert.ToInt32(ddlBuyerDepartment.SelectedValue);
                }

                orderEntry.OrderQuantity = txtOrderQty.Text;
                //orderEntry.FobQty = Convert.ToDouble(txtFob.Text);
                // orderEntry.UnitPrice = Convert.ToDecimal(txtFob.Text);
                if (chkStleWise.Checked == true)
                {
                    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;
                    }

                    if (chkNewstyle.Checked == true)
                    {
                        orderEntry.StyleId = StyleId;
                    }
                    else
                    {
                        orderEntry.StyleId = Convert.ToInt32(ddlStyle.SelectedValue);
                    }
                    orderEntry.OrderNo = txtPOrder.Text;
                }
                else
                {
                    if (chkNewstyle2.Checked == true)
                    {
                        LC_Style aLC_Style = new LC_Style();

                        aLC_Style.StyleName  = txtStyle2.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;
                    }

                    if (chkNewstyle.Checked == true)
                    {
                        orderEntry.StyleId = StyleId;
                    }
                    else
                    {
                        orderEntry.StyleId = Convert.ToInt32(ddlStyle2.SelectedValue);
                    }
                    orderEntry.OrderNo = txtPOrder2.Text;
                    // orderEntry.OrderNo = txtPOrder2.Text;
                }

                orderEntry.Style_Description = txtCustomerStyle.Text;

                orderEntry.EID = ddlMerchandiserName.SelectedValue;

                if (chkCategory.Checked == true)
                {
                    orderEntry.Style_Category_Id = StyleCatId;
                }
                else
                {
                    orderEntry.Style_Category_Id = Convert.ToInt32(ddlCategory.SelectedValue);
                }
                orderEntry.Currency = ddlCurrency.SelectedItem.Text;

                orderEntry.Unit_Id    = Convert.ToInt32(ddlUnit.SelectedValue);
                orderEntry.Office_ID  = Convert.ToInt32(ddlTTOffice.SelectedValue);
                orderEntry.Buyer_Name = ddlBuyer.SelectedValue;


                orderEntry.FOB_Port = txtFOBPort.Text;
                if (txtShipmentDate.Text == "")
                {
                    orderEntry.ShipmentDate = NullDate;
                }
                else
                {
                    orderEntry.ShipmentDate = Convert.ToDateTime(txtShipmentDate.Text);
                }
                if (txtOrderConfirmationDate.Text == "")
                {
                    orderEntry.LC_Reveived_Date = NullDate;
                }
                else
                {
                    orderEntry.LC_Reveived_Date = Convert.ToDateTime(txtOrderConfirmationDate.Text);
                }
                orderEntry.Shipment_Mode = ddlShipmentMode.SelectedItem.Text;

                orderEntry.Create_Date = DateTime.Today;
                orderEntry.Create_User = ((SessionUser)Session["SessionUser"]).UserId;
                orderEntry.OCODE       = ((SessionUser)Session["SessionUser"]).OCode;

                if (btnSubmit.Text == "Add")
                {
                    int count = (from orderentry in _Context.LC_OrderEntry
                                 where orderentry.OrderNo == orderEntry.OrderNo
                                 select orderentry.OrderNo).Count();
                    if (count > 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('PO Number already Exist')", true);
                    }
                    else
                    {
                        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);
                    }
                }
                LoadLCOrderGrid();
                Clear();
                ShowDiv.Visible  = false;
                ShowGrid.Visible = true;
                //AddOrder.Visible = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
 internal int AddStyleCategor(LC_StyleCategor _LC_StyleCategor)
 {
     return(_orderSheetdal.AddStyleCategor(_LC_StyleCategor));
 }
Esempio n. 5
0
 internal int SaveCategory(LC_StyleCategor aLC_StyleCategor)
 {
     return(aNewOrderEntryDAL.SaveCategory(aLC_StyleCategor));
 }
        //--------------------------------------------------------Submit Button Work-------------------------------------------------------------------------------



        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //Check stylewise check box is checked or not--------------------------------------###################################----------------------


                if (chkStleWise.Checked == false)
                {
                    // If style wise is not checked--------------------------------------------------------

                    if (txtOrderReceivedDate.Text == "")
                    {
                        //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input Order Received Date!')", true);
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Order Receive Date');", true);

                        return;
                    }
                    else if (txtPOrder.Text == "")
                    {
                        //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Enter Order No!')", true);
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Order No');", true);
                        return;
                    }

                    if (chkNewstyle.Checked == true || chkNewstyle.Checked == false)
                    {
                        if (chkNewstyle.Checked == false)
                        {
                            if (ddlStyle.SelectedItem.Text == "--Select Style--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Style!')", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Style');", true);
                                return;
                            }
                            else
                            {
                                styleId = Convert.ToInt32(ddlStyle.SelectedValue.ToString());
                            }
                        }
                        else if (chkNewstyle.Checked == true)
                        {
                            if (txtStyle.Text == "")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Style!')", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Style');", true);
                                return;
                            }
                            else
                            {
                                LC_Style aLC_Style = new LC_Style();

                                aLC_Style.StyleName  = txtStyle.Text;
                                aLC_Style.CreateUser = ((SessionUser)Session["SessionUser"]).UserId;
                                aLC_Style.CreateDate = DateTime.Now;
                                aLC_Style.OCode      = ((SessionUser)Session["SessionUser"]).OCode;

                                styleId = aNewOrderEntryBLL.SaveStyle(aLC_Style);
                            }
                        }
                    }

                    if (ChkSeason.Checked == true || ChkSeason.Checked == false)
                    {
                        //Save Season-----------------------------------------------------------------------------------------------------------

                        if (ChkSeason.Checked == false)
                        {
                            if (ddlSeason.SelectedItem.Text == "--Select Season--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Season!')", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Season');", true);
                                return;
                            }
                            else
                            {
                                seasonId = Convert.ToInt32(ddlSeason.SelectedValue.ToString());
                            }
                        }
                        else if (ChkSeason.Checked == false)
                        {
                            if (txtSeason.Text == "--Select Season--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Season!')", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Season');", true);
                                return;
                            }
                            else
                            {
                                LC_Season aLC_Season = new LC_Season();

                                aLC_Season.Season_Name = txtSeason.Text;
                                aLC_Season.CreateUser  = ((SessionUser)Session["SessionUser"]).UserId;
                                aLC_Season.CreateDate  = DateTime.Now;
                                aLC_Season.OCode       = ((SessionUser)Session["SessionUser"]).OCode;

                                seasonId = aNewOrderEntryBLL.SaveSeasion(aLC_Season);
                            }
                        }
                    }

                    if (ddlBuyer.SelectedItem.Text == "--Select Buyer--")
                    {
                        //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Buyer!')", true);
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Buyer');", true);
                        return;
                    }
                    else if (chkBuyerDepartment.Checked == true || chkBuyerDepartment.Checked == false)
                    {
                        //Save Buyer Department-----------------------------------------------------------------------------------------------------------
                        if (chkBuyerDepartment.Checked == false)
                        {
                            if (ddlBuyerDepartment.SelectedItem.Text == "--Select Buyer Department--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "CommonRequiredFiledError('Please Select Buyer Department');", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Buyer Department');", true);
                                return;
                            }
                            else
                            {
                                buyerDepartmentId = Convert.ToInt32(ddlBuyerDepartment.SelectedValue.ToString());
                            }
                        }
                        else if (chkBuyerDepartment.Checked == true)
                        {
                            if (txtBuyerDepartment.Text == "")
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Buyer Department');", true);
                            }
                            else
                            {
                                LC_BuyerDepartment aLC_BuyerDepartment = new LC_BuyerDepartment();

                                aLC_BuyerDepartment.BuyerDepartment_Name = txtBuyerDepartment.Text;
                                aLC_BuyerDepartment.Create_User          = ((SessionUser)Session["SessionUser"]).UserId;
                                aLC_BuyerDepartment.Create_Date          = DateTime.Now;
                                aLC_BuyerDepartment.OCode = ((SessionUser)Session["SessionUser"]).OCode;

                                buyerDepartmentId = aNewOrderEntryBLL.SaveBuyerDepartment(aLC_BuyerDepartment);
                            }
                        }
                    }

                    if (chkCategory.Checked == true || chkCategory.Checked == false)
                    {
                        //Save Category-----------------------------------------------------------------------------------------------------------
                        if (chkCategory.Checked == false)
                        {
                            if (ddlCategory.SelectedItem.Text == "--Select Category--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "CommonRequiredFiledError('Please Select Category');", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Category');", true);
                                return;
                            }
                            else
                            {
                                categoryId = Convert.ToInt32(ddlCategory.SelectedValue.ToString());
                            }
                        }
                        else
                        {
                            if (txtCategory.Text == "")
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Category');", true);
                            }
                            else
                            {
                                LC_StyleCategor aLC_StyleCategor = new LC_StyleCategor();

                                aLC_StyleCategor.Style_Category_Name = txtCategory.Text;
                                aLC_StyleCategor.CreateUser          = ((SessionUser)Session["SessionUser"]).UserId;
                                aLC_StyleCategor.CreateDate          = DateTime.Now;
                                aLC_StyleCategor.OCode = ((SessionUser)Session["SessionUser"]).OCode;

                                categoryId = aNewOrderEntryBLL.SaveCategory(aLC_StyleCategor);
                            }
                        }
                    }

                    orderReceivedDate = Convert.ToDateTime(txtOrderReceivedDate.Text);
                    orderNo           = txtPOrder.Text;
                    buyerId           = Convert.ToInt32(ddlBuyer.SelectedValue.ToString());
                    countryOfBuyer    = countryTextBox.Text;
                    unitId            = Convert.ToInt32(ddlUnit.SelectedValue.ToString());
                    marchaendicherId  = ddlMerchandiserName.SelectedValue.ToString();
                    officeId          = Convert.ToInt32(ddlTTOffice.SelectedValue.ToString());

                    LC_OrderEntry aLC_OrderEntry = new LC_OrderEntry();

                    aLC_OrderEntry.OrderReceiveDate     = Convert.ToDateTime(txtOrderReceivedDate.Text);
                    aLC_OrderEntry.OrderNo              = txtPOrder.Text;
                    aLC_OrderEntry.StyleId              = styleId;
                    aLC_OrderEntry.SeasonId             = seasonId;
                    aLC_OrderEntry.Buyer_ID             = buyerId;
                    aLC_OrderEntry.Countryof_Production = countryTextBox.Text;
                    aLC_OrderEntry.Buyer_DepartmentId   = buyerDepartmentId;
                    aLC_OrderEntry.Style_Category_Id    = categoryId;
                    aLC_OrderEntry.Style_Description    = txtItemDescription.Text;
                    aLC_OrderEntry.OrderQuantity        = txtOrderQty.Text;
                    aLC_OrderEntry.Unit_Id              = Convert.ToInt32(ddlUnit.SelectedValue.ToString());
                    aLC_OrderEntry.Currency             = ddlCurrency.Text;
                    aLC_OrderEntry.FOB_Port             = txtFOBPort.Text;
                    aLC_OrderEntry.Shipment_Mode        = ddlShipmentMode.SelectedItem.Text;
                    aLC_OrderEntry.ShipmentDate         = Convert.ToDateTime(txtShipmentDate.Text);
                    aLC_OrderEntry.EID         = ddlMerchandiserName.SelectedValue.ToString();
                    aLC_OrderEntry.Office_ID   = Convert.ToInt32(ddlTTOffice.SelectedValue.ToString());
                    aLC_OrderEntry.Create_User = ((SessionUser)Session["SessionUser"]).UserId;
                    aLC_OrderEntry.Create_Date = DateTime.Now;
                    aLC_OrderEntry.OCODE       = ((SessionUser)Session["SessionUser"]).OCode;

                    int result = aNewOrderEntryBLL.SaveOrderEntry(aLC_OrderEntry);

                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "successalert('Data Save Successfully!!');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "notsuccessalert('Data Not Save!!');", true);
                    }
                }
                else if (chkStleWise.Checked == true)
                {
                    // If style wise is not checked--------------------------------------------------------

                    if (txtOrderReceivedDate1.Text == "")
                    {
                        //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input Order Received Date!')", true);
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Order Receive Date');", true);

                        return;
                    }
                    else if (txtPOrder2.Text == "")
                    {
                        //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Enter Order No!')", true);
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Order No');", true);
                        return;
                    }
                    else if (chkNewstyle2.Checked == true || chkNewstyle2.Checked == false)
                    {
                        if (chkNewstyle2.Checked == false)
                        {
                            if (ddlStyle2.SelectedItem.Text == "--Select Style--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Style!')", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Style');", true);
                                return;
                            }
                            else
                            {
                                styleId = Convert.ToInt32(ddlStyle2.SelectedValue.ToString());
                            }
                        }
                        else if (chkNewstyle2.Checked == true)
                        {
                            if (txtStyle2.Text == "")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Style!')", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Style');", true);
                                return;
                            }
                            else
                            {
                                LC_Style aLC_Style = new LC_Style();

                                aLC_Style.StyleName  = txtStyle2.Text;
                                aLC_Style.CreateUser = ((SessionUser)Session["SessionUser"]).UserId;
                                aLC_Style.CreateDate = DateTime.Now;
                                aLC_Style.OCode      = ((SessionUser)Session["SessionUser"]).OCode;

                                styleId = aNewOrderEntryBLL.SaveStyle(aLC_Style);
                            }
                        }
                    }
                    else if (ChkSeason.Checked == true || ChkSeason.Checked == false)
                    {
                        //Save Season-----------------------------------------------------------------------------------------------------------

                        if (ChkSeason.Checked == false)
                        {
                            if (ddlSeason.SelectedItem.Text == "--Select Season--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Season!')", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Season');", true);
                                return;
                            }
                            else
                            {
                                seasonId = Convert.ToInt32(ddlSeason.SelectedValue.ToString());
                            }
                        }
                        else if (ChkSeason.Checked == false)
                        {
                            if (txtSeason.Text == "--Select Season--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Season!')", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Season');", true);
                                return;
                            }
                            else
                            {
                                LC_Season aLC_Season = new LC_Season();

                                aLC_Season.Season_Name = txtSeason.Text;
                                aLC_Season.CreateUser  = ((SessionUser)Session["SessionUser"]).UserId;
                                aLC_Season.CreateDate  = DateTime.Now;
                                aLC_Season.OCode       = ((SessionUser)Session["SessionUser"]).OCode;

                                seasonId = aNewOrderEntryBLL.SaveSeasion(aLC_Season);
                            }
                        }
                    }
                    else if (ddlBuyer.SelectedItem.Text == "--Select Buyer--")
                    {
                        //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Buyer!')", true);
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Buyer');", true);
                        return;
                    }
                    else if (chkBuyerDepartment.Checked == true || chkBuyerDepartment.Checked == false)
                    {
                        //Save Buyer Department-----------------------------------------------------------------------------------------------------------
                        if (chkBuyerDepartment.Checked == false)
                        {
                            if (ddlBuyerDepartment.SelectedItem.Text == "--Select Buyer Department--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "CommonRequiredFiledError('Please Select Buyer Department');", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Buyer Department');", true);
                                return;
                            }
                            else
                            {
                                buyerDepartmentId = Convert.ToInt32(ddlBuyerDepartment.SelectedValue.ToString());
                            }
                        }
                        else if (chkBuyerDepartment.Checked == true)
                        {
                            if (txtBuyerDepartment.Text == "")
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Buyer Department');", true);
                            }
                            else
                            {
                                LC_BuyerDepartment aLC_BuyerDepartment = new LC_BuyerDepartment();

                                aLC_BuyerDepartment.BuyerDepartment_Name = txtBuyerDepartment.Text;
                                aLC_BuyerDepartment.Create_User          = ((SessionUser)Session["SessionUser"]).UserId;
                                aLC_BuyerDepartment.Create_Date          = DateTime.Now;
                                aLC_BuyerDepartment.OCode = ((SessionUser)Session["SessionUser"]).OCode;

                                buyerDepartmentId = aNewOrderEntryBLL.SaveBuyerDepartment(aLC_BuyerDepartment);
                            }
                        }
                    }
                    else if (chkCategory.Checked == true || chkCategory.Checked == false)
                    {
                        //Save Category-----------------------------------------------------------------------------------------------------------
                        if (chkCategory.Checked == false)
                        {
                            if (ddlCategory.SelectedItem.Text == "--Select Category--")
                            {
                                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "CommonRequiredFiledError('Please Select Category');", true);
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Select Category');", true);
                                return;
                            }
                            else
                            {
                                categoryId = Convert.ToInt32(ddlCategory.SelectedValue.ToString());
                            }
                        }
                        else
                        {
                            if (txtCategory.Text == "")
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "CommonRequiredFiledError('Please Insert Category');", true);
                            }
                            else
                            {
                                LC_StyleCategor aLC_StyleCategor = new LC_StyleCategor();

                                aLC_StyleCategor.Style_Category_Name = txtCategory.Text;
                                aLC_StyleCategor.CreateUser          = ((SessionUser)Session["SessionUser"]).UserId;
                                aLC_StyleCategor.CreateDate          = DateTime.Now;
                                aLC_StyleCategor.OCode = ((SessionUser)Session["SessionUser"]).OCode;

                                categoryId = aNewOrderEntryBLL.SaveCategory(aLC_StyleCategor);
                            }
                        }
                    }



                    orderReceivedDate = Convert.ToDateTime(txtOrderReceivedDate1.Text);
                    orderNo           = txtPOrder2.Text;
                    buyerId           = Convert.ToInt32(ddlBuyer.SelectedValue.ToString());
                    countryOfBuyer    = countryTextBox.Text;
                    unitId            = Convert.ToInt32(ddlUnit.SelectedValue.ToString());
                    marchaendicherId  = ddlMerchandiserName.SelectedValue.ToString();
                    officeId          = Convert.ToInt32(ddlTTOffice.SelectedValue.ToString());

                    LC_OrderEntry aLC_OrderEntry = new LC_OrderEntry();

                    aLC_OrderEntry.OrderReceiveDate     = Convert.ToDateTime(txtOrderReceivedDate.Text);
                    aLC_OrderEntry.OrderNo              = txtPOrder.Text;
                    aLC_OrderEntry.StyleId              = styleId;
                    aLC_OrderEntry.SeasonId             = seasonId;
                    aLC_OrderEntry.Buyer_ID             = buyerId;
                    aLC_OrderEntry.Countryof_Production = countryTextBox.Text;
                    aLC_OrderEntry.Buyer_DepartmentId   = buyerDepartmentId;
                    aLC_OrderEntry.Style_Category_Id    = categoryId;
                    aLC_OrderEntry.Style_Description    = txtItemDescription.Text;
                    aLC_OrderEntry.OrderQuantity        = txtOrderQty.Text;
                    aLC_OrderEntry.Unit_Id              = Convert.ToInt32(ddlUnit.SelectedValue.ToString());
                    aLC_OrderEntry.Currency             = ddlCurrency.Text;
                    aLC_OrderEntry.FOB_Port             = txtFOBPort.Text;
                    aLC_OrderEntry.Shipment_Mode        = ddlShipmentMode.SelectedItem.Text;
                    aLC_OrderEntry.ShipmentDate         = Convert.ToDateTime(txtShipmentDate.Text);
                    aLC_OrderEntry.EID         = ddlMerchandiserName.SelectedValue.ToString();
                    aLC_OrderEntry.Office_ID   = Convert.ToInt32(ddlTTOffice.SelectedValue.ToString());
                    aLC_OrderEntry.Create_User = ((SessionUser)Session["SessionUser"]).UserId;
                    aLC_OrderEntry.Create_Date = DateTime.Now;
                    aLC_OrderEntry.OCODE       = ((SessionUser)Session["SessionUser"]).OCode;

                    int result = aNewOrderEntryBLL.SaveOrderEntry(aLC_OrderEntry);

                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "successalert('Data Save Successfully!!');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "notsuccessalert('Data Not Save!!');", true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            LoadLCOrderGrid();
        }