Exemple #1
0
        //protected void ddlDepartment_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    GetStoreIncharge();
        //}

        protected void btnStore_Click(object sender, EventArgs e)
        {
            try
            {
                Inv_Store astore = new Inv_Store();

                if (txtStoreName.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Enter Store Name')", true);
                    return;
                }
                if (txtStoreTrack.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Enter Store Code')", true);
                    return;
                }
                astore.StoreName   = txtStoreName.Text;
                astore.Store_Code  = txtStoreTrack.Text;
                astore.Location    = txtLocation.Text;
                astore.Description = txtDescription.Text;

                astore.OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                astore.EDIT_DATE = DateTime.Now;
                astore.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId;

                if (BtnSave.Text == "Submit")
                {
                    aStore_BLL.SaveStore(astore);
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true);
                    BindStore();
                    ClearData();
                }
                else
                {
                    aStore_BLL.UpdateStore(astore, hdfStoreID.Value);
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                    BindStore();
                    ClearData();
                    BtnSave.Text = "Submit";
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Exemple #2
0
        public int UpdateStore(Inv_Store astore, string Id)
        {
            try
            {
                int       storeId   = Convert.ToInt32(Id);
                Inv_Store storeType = _context.Inv_Store.First(x => x.Store_Id == storeId);

                storeType.StoreName   = astore.StoreName;
                storeType.Store_Code  = astore.Store_Code;
                storeType.Location    = astore.Location;
                storeType.Description = astore.Description;
                astore.Store_Code     = astore.Store_Code;
                storeType.OCODE       = astore.OCODE;
                storeType.EDIT_DATE   = astore.EDIT_DATE;
                storeType.EDIT_USER   = astore.EDIT_USER;

                _context.SaveChanges();
                return(1);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #3
0
 public int UpdateStore(Inv_Store astore, string Id)
 {
     return(repository_DAL.UpdateStore(astore, Id));
 }
Exemple #4
0
 public int SaveStore(Inv_Store astore)
 {
     return(repository_DAL.SaveStore(astore));
 }
Exemple #5
0
 public int SaveStore(Inv_Store astore)
 {
     _context.Inv_Store.AddObject(astore);
     _context.SaveChanges();
     return(1);
 }