Example #1
0
        //private void GetFactoryList()
        //{
        //    try
        //    {
        //        string Ocode = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode);
        //        List<LC_Factory> _FactoryL = _factorybLL.LoadFactoryList(Ocode);
        //        if (_FactoryL.Count > 0)
        //        {
        //            grdFactory.DataSource = _FactoryL;
        //            grdFactory.DataBind();
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}

        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                LC_Factory _lcFactory = new LC_Factory();
                _lcFactory.FactoryName    = txtFactoryName.Text;
                _lcFactory.FactoryCode    = txtFactoryCode.Text;
                _lcFactory.ContactPerson1 = txtContactPerson.Text;
                _lcFactory.FactoryAddress = txtFactoryAddress.Text;
                _lcFactory.FactoryMobile  = txtFactoryMobile.Text;
                _lcFactory.FactoryEmail   = txtFactoryEmail.Text;

                _lcFactory.CreateDate = DateTime.Now;
                _lcFactory.CreateUser = (((SessionUser)Session["SessionUser"]).UserId);
                _lcFactory.OCode      = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode);

                if (btnSave.Text != "Update")
                {
                    int result = _factorybLL.InsertFactory(_lcFactory);
                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true);
                    }
                }
                else
                {
                    _lcFactory.EditDate  = DateTime.Now;
                    _lcFactory.EditUser  = (((SessionUser)Session["SessionUser"]).UserId);;
                    _lcFactory.FactoryId = Convert.ToInt16(hidFactoryd.Value);
                    int result = _factorybLL.UpdateFactory(_lcFactory);
                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                    }
                }
                //GetFactoryList();
                ClearAllController();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                LC_Factory _lcFactory = new LC_Factory();

                _lcFactory.FactoryName    = txtFactoryName.Text;
                _lcFactory.FactoryCountry = ddlCountry.SelectedItem.Text;
                GenerateFactoryCOde();

                _lcFactory.FactoryCode       = txtFactoryCode.Text;
                _lcFactory.ContactPerson1    = txtContactPerson1.Text;
                _lcFactory.CP1_Designation   = txtP1Designation.Text;
                _lcFactory.CP1_ContactNumber = txtP1ContactNo.Text;
                _lcFactory.CP1_Email         = txtP1Email.Text;

                _lcFactory.ContactPerson2    = txtContactPerson2.Text;
                _lcFactory.CP2_Designation   = txtP2Designation.Text;
                _lcFactory.CP2_ContactNumber = txtP2ContactNo.Text;
                _lcFactory.CP2_Email         = txtP2Email.Text;

                _lcFactory.FactoryAddress = txtFactoryAddress.Text;
                _lcFactory.FactoryMobile  = txtFactoryContactNumber.Text;
                _lcFactory.FactoryEmail   = txtFactoryEmail.Text;
                _lcFactory.FactoryWeb     = txtFactoryWeb.Text;
                if (rdbFactoryIsActive.Checked == true)
                {
                    _lcFactory.FactoryStatus = true;
                }
                else
                {
                    _lcFactory.FactoryStatus = false;
                }
                _lcFactory.CreateDate = DateTime.Now;
                _lcFactory.CreateUser = (((SessionUser)Session["SessionUser"]).UserId);
                _lcFactory.OCode      = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode);

                if (btnSave.Text != "Update")
                {
                    int result = _factorybLL.InsertFactory(_lcFactory);
                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true);
                    }
                }
                else
                {
                    _lcFactory.EditDate  = DateTime.Now;
                    _lcFactory.EditUser  = (((SessionUser)Session["SessionUser"]).UserId);;
                    _lcFactory.FactoryId = Convert.ToInt16(hidFactoryd.Value);
                    int result = _factorybLL.UpdateFactory(_lcFactory);
                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                    }
                }
                GetFactoryList();
                ClearAllController();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }