Example #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     var obj = new ZONE();
     obj.ZONE_CODE = popTxtZoneCode.Text;
     obj.ZONE_NAME = popTxtZoneName.Text;
     var cmd = new ZoneService(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.ZONE_ID = Convert.ToInt32(ViewState["zoneID"].ToString());
         obj.UPDATE_DATE = DateTime.Now;
         obj.UPDATE_EMPLOYEE_ID = 0;
         obj.SYE_DEL = true;
         cmd.Edit();
     }
     flag.Text = "Add";
     ViewState["zoneID"] = null;
     Response.Redirect("SearchZone.aspx");
 }
Example #2
0
 protected void btnAddPromotion_Click(object sender, EventArgs e)
 {
     if (ViewState["PromotionId"] != null)
     {
         var cmd = new ProductPromotionService();
         PRODUCT_PROMOTION item = new PRODUCT_PROMOTION();
         item.PROMOTION_ID = Convert.ToInt32(ViewState["PromotionId"].ToString());
         item.PRODUCT_CONDITION_QTY = Convert.ToInt32(txtQty.Text);
         item.PRODUCT_FREE_QTY = Convert.ToInt32(txtFreeQty.Text);
         item.ZONE_ID = Convert.ToInt32(ddlZonePromotion.SelectedValue);
         item.UPDATE_DATE = DateTime.Now;
         item.UPDATE_EMPLOYEE_ID = 0;
         cmd.Edit(item);
     }
     else
     {
         var cmdZonePromotion = new ZoneService();
         PRODUCT_PROMOTION item = new PRODUCT_PROMOTION();
         item.Action = ActionEnum.Create;
         item.PRODUCT_CONDITION_QTY = Convert.ToInt32(txtQty.Text);
         item.PRODUCT_FREE_QTY = Convert.ToInt32(txtFreeQty.Text);
         item.ZONE_ID = Convert.ToInt32(ddlZonePromotion.SelectedValue);
         item.CREATE_DATE = DateTime.Now;
         item.CREATE_EMPLOYEE_ID = 0;
         item.UPDATE_DATE = DateTime.Now;
         item.UPDATE_EMPLOYEE_ID = 0;
         item.SYE_DEL = true;
         listPromotion.Add(item);
     }
     InitialDataPopup();
     this.popup.Show();
 }
Example #3
0
        private void InitialDataPopupPromotion()
        {
            var cmdCat = new ZoneService();
            var list = cmdCat.GetALL();
            ddlZonePromotion.Items.Clear();
            foreach (var item in list)
            {
                ddlZonePromotion.Items.Add(new ListItem(item.ZONE_NAME, item.ZONE_ID.ToString()));
            }

            if (ViewState["PromotionId"] != null)
            {
                flag2.Text = "Edit";
                var cmdPro = new ProductPromotionService();
                PRODUCT_PROMOTION promotion = cmdPro.Select(Convert.ToInt32(ViewState["PromotionId"].ToString()));
                txtQty.Text = promotion.PRODUCT_CONDITION_QTY.ToString();
                txtFreeQty.Text = promotion.PRODUCT_FREE_QTY.ToString();
                ddlZonePromotion.SelectedValue = promotion.ZONE_ID.ToString();
            }
            else
            {
                txtQty.Text = "";
                txtFreeQty.Text = "";
                flag2.Text = "Add";
            }
        }
Example #4
0
        private void InitialDataPopup()
        {
            var cmdCat = new CategoryService();
            var list = cmdCat.GetALL();
            foreach (var item in list)
            {
                ddlCategory.Items.Add(new ListItem(item.CATEGORY_NAME, item.CATEGORY_ID.ToString()));
            }
            var cmdPro = new ProductService();
            var listddlPakUDesc = cmdPro.GetUDescPacking();
            foreach (var item in listddlPakUDesc)
            {
                ddlPakUDesc.Items.Add(new ListItem(item, item));
            }

            var listddlPakPDesc = cmdPro.GetPDescPacking();
            foreach (var item in listddlPakPDesc)
            {
                ddlPakPDesc.Items.Add(new ListItem(item, item));
            }

            var cmd = new ZoneService();
            var listZone = cmd.GetALL();
            DataSouceList = new List<PRODUCT_PRICELIST>();
            foreach (var item in listZone)
            {
                PRODUCT_PRICELIST pd = new PRODUCT_PRICELIST();
                pd.ZONE_ID = item.ZONE_ID;
                pd.ZONE = new ZONE();
                pd.ZONE.ZONE_CODE = item.ZONE_CODE;
                pd.ZONE.ZONE_NAME = item.ZONE_NAME;
                DataSouceList.Add(pd);
            }

            if (ViewState["proId"] != null)
            {
                _product = cmdPro.Select(Convert.ToInt32(ViewState["proId"].ToString()));
                popTxtProductCode.Text = _product.PRODUCT_CODE;
                poptxtProductName.Text = _product.PRODUCT_NAME;
                txtPacking.Text = _product.PRODUCT_PACKING_QTY.ToString();
                //txtPackingDesc.Text = _product.PRODUCT_PACKING_DESC;
                txtWeight.Text = _product.PRODUCT_WEIGHT.ToString();
                txtUnit.Text = _product.PRODUCT_WEIGHT_DEFINE;
                ddlCategory.SelectedValue = _product.CATEGORY_ID.ToString();
                ddlkind.SelectedValue = _product.PRODUCT_TYPE_CODE.ToString();
                //txtSize.Text = _product.PRODUCT_SIZE;
                ddlPakUDesc.SelectedValue = _product.PRODUCT_PACKING_PER_UDESC;
                ddlPakPDesc.SelectedValue = _product.PRODUCT_PACKING_PER_PDESC;
                var cmdPD = new ProductPriceListService();
                var listPD = cmdPD.Select(Convert.ToInt32(ViewState["proId"].ToString()));
                foreach (var itemPD in listPD)
                {
                    foreach (var itemDST in DataSouceList)
                    {
                        if (itemDST.ZONE_ID == itemPD.ZONE_ID)
                        {
                            itemDST.PRODUCT_PRICE = itemPD.PRODUCT_PRICE;
                            itemDST.PRODUCT_ID = itemPD.PRODUCT_ID;
                            break;
                        }
                    }
                }

                List<PRODUCT_PROMOTION> listPromotionItem = new List<PRODUCT_PROMOTION>();
                var cmdPromotion = new ProductPromotionService();
                DataSoucePromotion = cmdPromotion.GetALLIncludeZone(Convert.ToInt32(ViewState["proId"].ToString()));
                listPromotionItem.AddRange(DataSoucePromotion);

                listPromotionItem.AddRange(listPromotion);

                gridPromotion.DataSource = listPromotionItem;
                gridPromotion.DataBind();

                flag.Text = "Edit";
            }
            gridProductDetail.DataSource = DataSouceList;
            gridProductDetail.DataBind();
        }
Example #5
0
        private void InitialDataPopup()
        {
            var cmdEmp = new EmployeeService();
            foreach (var item in cmdEmp.GetALLInclude())
            {
                ddlSell.Items.Add(new ListItem(("แผนก " + item.DEPARTMENT.DEPARTMENT_NAME + " ชื่อ " + item.EMPLOYEE_NAME + " " + item.EMPLOYEE_SURNAME), item.EMPLOYEE_ID.ToString()));
            }

            if (ViewState["zoneID"] != null)
            {
                var cmd = new ZoneService();
                _zone = cmd.Select(Convert.ToInt32(ViewState["zoneID"].ToString()));
                if (_zone != null)
                {
                    popTxtZoneCode.Text = _zone.ZONE_CODE;
                    popTxtZoneName.Text = _zone.ZONE_NAME;
                    flag.Text = "Edit";
                }
            }
        }
Example #6
0
 private void InitialData()
 {
     var cmd = new ZoneService();
     DataSouce = cmd.GetALL();
     gridZone.DataSource = DataSouce;
     gridZone.DataBind();
 }
Example #7
0
        private void InitialDataPopup()
        {
            var cmd = new SectorService();
            var list = cmd.GetALL();
            foreach (var item in list)
            {
                ddlSector.Items.Add(new ListItem(item.SECTOR_NAME, item.SECTOR_ID.ToString()));
            }
            var cmdPro = new ProvinceService();
            ViewState["listProvince"] = cmdPro.GetALL();
            foreach (var item in (List<PROVINCE>)ViewState["listProvince"])
            {
                ddlProvince.Items.Add(new ListItem(item.PROVINCE_NAME, item.PROVINCE_ID.ToString()));
            }

            var cmdRoad = new RoadService();
            ViewState["listRoad"] = cmdRoad.GetALL();
            foreach (var item in (List<ROAD>)ViewState["listRoad"])
            {
                ddlRoad.Items.Add(new ListItem(item.ROAD_NAME, item.ROAD_ID.ToString()));
            }

            var cmdZone = new ZoneService();
            var listZone = cmdZone.GetALL();
            foreach (var item in listZone)
            {
                ddlZone.Items.Add(new ListItem(item.ZONE_NAME, item.ZONE_ID.ToString()));
            }

            if (ViewState["stoId"] != null)
            {
                var cmdStore = new StoreService();
                _store = cmdStore.Select(Convert.ToInt32(ViewState["stoId"].ToString()));
                if (_store != null)
                {
                    txtAddress.Text = _store.STORE_ADDR1;
                    txtAmpur.Text = _store.STORE_DISTRICT;
                    txtFax.Text = _store.STORE_FAX;
                    txtMobli.Text = _store.STORE_MOBILE;
                    txtPostCode.Text = _store.STORE_POSTCODE;
                    popTxtStoreCode.Text = _store.STORE_CODE;
                    poptxtStoreName.Text = _store.STORE_NAME;
                    txtTel1.Text = _store.STORE_TEL1;
                    txtTel2.Text = _store.STORE_TEL2;
                    txtTumbon.Text = _store.STORE_SUBDISTRICT;
                    ddlSector.SelectedValue = _store.SECTOR_ID.ToString();
                    ddlProvince.SelectedValue = _store.PROVINCE_ID.ToString();
                    ddlProvince.Enabled = true;
                    ddlZone.SelectedValue = _store.ZONE_ID.ToString();
                    //if (ddlProvince.SelectedItem.Text.Equals("กรุงเทพมหานคร"))
                    //{
                    ddlRoad.Visible = true;
                    ddlRoad.SelectedValue = _store.ROAD_ID.ToString();
                    txtRoad.Visible = false;
                    //}
                    //else
                    //{
                    //    txtRoad.Text = _store.STORE_STREET;
                    //    ddlRoad.Visible = false;
                    //}
                    flag.Text = "Edit";
                }
            }
        }
Example #8
0
        protected void btnAddZone_Click(object sender, EventArgs e)
        {
            var cmdZone = new ZoneService();
            List<ZONE_DETAIL> list = new List<ZONE_DETAIL>();

            for (int i = 0; i < gridSelectZone.Rows.Count; i++)
            {
                if (((CheckBox)gridSelectZone.Rows[i].Cells[0].FindControl("check")).Checked)
                {
                    if (ViewState["empId"] != null && DataSouceRoleFunction.Where(x => x.ZONE_ID == Convert.ToInt32(gridSelectZone.DataKeys[i].Value.ToString())).FirstOrDefault() == null)
                    {
                        ZONE_DETAIL obj = new ZONE_DETAIL();
                        obj.Action = ActionEnum.Create;
                        obj.EMPLOYEE_ID = Convert.ToInt32(ViewState["empId"].ToString());
                        obj.ZONE_ID = Convert.ToInt32(gridSelectZone.DataKeys[i].Value.ToString());
                        obj.CREATE_DATE = DateTime.Now;
                        obj.CREATE_EMPLOYEE_ID = 0;
                        obj.UPDATE_DATE = DateTime.Now;
                        obj.UPDATE_EMPLOYEE_ID = 0;
                        obj.SYE_DEL = true;
                        list.Add(obj);
                    }
                    else if (DataSouceNewRoleFunction.Where(x => x.ZONE_ID == Convert.ToInt32(gridSelectZone.DataKeys[i].Value.ToString())).FirstOrDefault() == null)
                    {
                        ZONE_DETAIL obj = new ZONE_DETAIL();
                        obj.Action = ActionEnum.Create;
                        obj.EMPLOYEE_ID = 0;
                        obj.ZONE_ID = Convert.ToInt32(gridSelectZone.DataKeys[i].Value.ToString());
                        obj.CREATE_DATE = DateTime.Now;
                        obj.CREATE_EMPLOYEE_ID = 0;
                        obj.UPDATE_DATE = DateTime.Now;
                        obj.UPDATE_EMPLOYEE_ID = 0;
                        obj.SYE_DEL = true;
                        DataSouceNewRoleFunction.Add(obj);
                    }
                }
            }

            if (list.Count > 0)
            {
                var cmd = new ZoneDetailService(list);
                cmd.AddList();
            }

            InitialDataPopup();
            this.popup.Show();
        }
Example #9
0
 private void InitialDataPopupZone()
 {
     var cmd = new ZoneService();
     gridSelectZone.DataSource = cmd.GetALL();
     gridSelectZone.DataBind();
 }