Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var obj = new STORE();

            obj.PROVINCE_ID       = Convert.ToInt32(ddlProvince.SelectedValue);
            obj.SECTOR_ID         = Convert.ToInt32(ddlSector.SelectedValue);
            obj.ROAD_ID           = Convert.ToInt32(ddlRoad.SelectedValue);
            obj.STORE_ADDR1       = txtAddress.Text;
            obj.STORE_CODE        = popTxtStoreCode.Text;
            obj.STORE_DISTRICT    = txtAmpur.Text;
            obj.STORE_FAX         = txtFax.Text;
            obj.STORE_MOBILE      = txtMobli.Text;
            obj.STORE_NAME        = poptxtStoreName.Text;
            obj.STORE_POSTCODE    = txtPostCode.Text;
            obj.STORE_STREET      = txtRoad.Text;
            obj.STORE_SUBDISTRICT = txtTumbon.Text;
            obj.STORE_TEL1        = txtTel1.Text;
            obj.STORE_TEL2        = txtTel2.Text;
            obj.ZONE_ID           = Convert.ToInt32(ddlZone.SelectedValue);
            var cmd = new StoreService(obj);

            if (flag.Text.Equals("Add"))
            {
                obj.Action             = ActionEnum.Create;
                obj.CREATE_DATE        = DateTime.Now;
                obj.CREATE_EMPLOYEE_ID = 0;
                obj.UPDATE_DATE        = DateTime.Now;
                obj.UPDATE_EMPLOYEE_ID = 0;
                obj.SYE_DEL            = true;
                cmd.Add();
            }
            else
            {
                obj.Action             = ActionEnum.Update;
                obj.STORE_ID           = Convert.ToInt32(ViewState["stoId"].ToString());
                obj.UPDATE_DATE        = DateTime.Now;
                obj.UPDATE_EMPLOYEE_ID = 0;
                obj.SYE_DEL            = true;
                cmd.Edit();
            }

            ViewState["stoId"] = null;
            Response.Redirect("SearchStore.aspx");
        }
 public ActionResult Add(Store data)
 {
     _storeService.Add(data);
     return(RedirectToAction("List", "Store", new { area = "Member" }));
 }