private void BindData() { WHSiteBLL bll = null; DataPage dp = new DataPage(); WHSite condition = new WHSite(); string whID = Request.QueryString["whID"]; try { bll = BLLFactory.CreateBLL <WHSiteBLL>(); this.hiWHID.Value = whID; condition.Code = this.Code.Text.Trim(); condition.WHID = whID; condition.Description = this.Description.Text.Trim(); PagerHelper.InitPageControl(this.AspNetPager1, dp, true); dp = bll.GetList(condition, dp); List <WHSite> list = dp.Result as List <WHSite>; this.GvList.DataSource = list; this.GvList.DataBind(); for (int i = 0; i < this.GvList.Rows.Count; i++) { string click = string.Format("return edit('{0}');", this.GvList.DataKeys[i]["ID"].ToString()); (this.GvList.Rows[i].Cells[6].Controls[0] as WebControl).Attributes.Add("onclick", click); } PagerHelper.SetPageControl(AspNetPager1, dp, true); } catch (Exception ex) { throw ex; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentEncoding = Encoding.UTF8; context.Response.ContentType = "application/json"; string whID = context.Request.QueryString["whID"]; List <WHSite> list = new WHSiteBLL().GetList(whID); context.Response.Write(LAF.Common.Serialization.JsonConvertHelper.GetSerializes(list)); }
protected void btDelete_Click(object sender, EventArgs e) { ArrayList pkArray = null; WHSiteBLL bll = null; List <string> msgList = new List <string>(); try { bll = BLLFactory.CreateBLL <WHSiteBLL>(); pkArray = GvHelper.GetPKValueByChk(this.GvList, 0, "cbxSelect", 0); for (int i = 0; i < this.GvList.Rows.Count; i++) { CheckBox cbxSelect = this.GvList.Rows[i].Cells[0].FindControl("cbxSelect") as CheckBox; if (cbxSelect.Checked == false) { continue; } WHSite site = new WHSite(); site.ID = this.GvList.DataKeys[i]["ID"].ToString(); site.Description = this.GvList.Rows[i].Cells[1].Text; //判断是否已使用 bool r = bll.IsUse(site); if (r == true) { msgList.Add(site.Description); continue; } //删除 bll.Delete(site); } string msg = string.Join(",", msgList.ToArray()); if (msg != "") { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSI('提示','" + msg + "仓位已使用,无法删除');", true); } this.BindData(); } catch (Exception ex) { throw ex; } }
protected void btSave_Click(object sender, EventArgs e) { WHSite info = new WHSite(); WHSiteBLL bll = null; DataResult <int> result = null; try { UIBindHelper.BindModelByControls(this.Page, info); bll = BLLFactory.CreateBLL <WHSiteBLL>(); info.WHID = this.Warehouse.SelectedValue; if (this.hiID.Value == "") { result = bll.Insert(info); } else { info.CREATEUSER = this.HiCREATEUSER.Value; info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value); info.ID = this.hiID.Value; result = bll.Update(info); } if (string.IsNullOrEmpty(result.Msg) == false) { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSI('提示','" + result.Msg + "')", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true); } } catch (Exception ex) { throw ex; } }
private void BindData() { string id = Request.QueryString["id"]; WHSiteBLL bll = null; WHSite info = new WHSite(); string whID = Request.QueryString["whID"]; try { if (string.IsNullOrEmpty(whID) == false) { this.Warehouse.Enabled = false; } else { this.Warehouse.Enabled = true; } bll = BLLFactory.CreateBLL <WHSiteBLL>(); if (string.IsNullOrEmpty(id) == false) { info.ID = id; info = bll.Get(info); UIBindHelper.BindForm(this.Page, info); this.Warehouse.SelectedValue = info.WHID; this.hiID.Value = info.ID; this.HiCREATEUSER.Value = info.CREATEUSER; this.HiCREATETIME.Value = info.CREATETIME.ToString(); this.Warehouse.Enabled = false; } else { info = new WHSite(); if (string.IsNullOrEmpty(whID) == false) { this.Warehouse.SelectedValue = whID; } } List <DictInfo> dicts = null; //绑定区域 if (string.IsNullOrEmpty(this.Warehouse.SelectedValue) == false) { List <WHArea> whList = BLLFactory.CreateBLL <WHAreaBLL>().GetList(this.Warehouse.SelectedValue); dicts = whList.Select(p => new DictInfo { ID = p.ID, Des = p.Description }).ToList <DictInfo>(); Tools.BindDataToDDL(this.AreaID, dicts, null); if (string.IsNullOrEmpty(info.AreaID) == false) { this.AreaID.SelectedValue = info.AreaID; } } } catch (Exception ex) { throw ex; } }