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"; } } }
private void InitialData() { Session["lstOrderDetail"] = null; var cmdStore = new StoreService(); //DataSouce = cmdStore.GetALL(); DataSouce = new List<STORE>(); USER user = Session["user"] as USER; if (user == null) Response.Redirect("MainAdmin.aspx"); var cmdZone = new ZoneDetailService(); foreach (ZONE_DETAIL zoneId in cmdZone.GetALLByUser(user.EMPLOYEE_ID)) { List<STORE> tmp = cmdStore.GetALL().Where(x => x.ZONE_ID == zoneId.ZONE_ID).ToList(); DataSouce.AddRange(tmp); } 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())); } gridStore.DataSource = null; gridStore.DataBind(); }
private void InitialData() { 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 cmdStore = new StoreService(); ViewState["listStore"] = cmdStore.GetALL(); foreach (var item in (List<STORE>)ViewState["listStore"]) { ddlStore.Items.Add(new ListItem(item.STORE_NAME, item.STORE_ID.ToString())); } var cmdOrder = new OrderService(); DataSouce = cmdOrder.GetALLIncludeStore(); grideInOrder.DataSource = DataSouce; grideInOrder.DataBind(); }