/// <summary> /// 数据保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { LBOMDetailData model = new LBOMDetailData(); LBOMDetailBB bOMDetailBB = new LBOMDetailBB(); try { if (this.State == "1") { this.SetModel(ref model); model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; this.IdValue = bOMDetailBB.AddRecord(model); } else if (this.State == "2") { model = bOMDetailBB.GetModel(this.IdValue); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; bOMDetailBB.ModifyRecord(model); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { bOMDetailBB.Dispose(); } Response.Redirect("LBOMDetailList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false); }
/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LBOMDetailBB bOMDetailBB = new LBOMDetailBB(); vLBOMDetailData model = new vLBOMDetailData(); try { model = bOMDetailBB.GetVModel(id); this.id.Text = model.id.ToString(); this.BOMId.Text = model.BOMId.ToString(); this.materialNo.Text = model.materialNo; this.num.Text = model.num.ToString(); } finally { bOMDetailBB.Dispose(); } }
/// <summary> /// 初始化页面 /// </summary> protected void InitFirstPageData(int id) { LBOMDetailBB BOMDetailBB = new LBOMDetailBB(); string strWhere = "bomid=@bomid"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@bomid", id) }; try { DataSet ds = BOMDetailBB.GetVList(strWhere, param); if (ds != null && ds.Tables.Count > 0) { this.GridView1.DataSource = ds.Tables[0]; this.GridView1.DataBind(); } } finally { BOMDetailBB.Dispose(); } }
/// <summary> /// 初始化页面 /// </summary> protected void InitFirstPageData() { LBOMDetailBB BOMDetailBB = new LBOMDetailBB(); string strWhere = "bomid=@bomid"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@bomid", this.IdValue) }; try { DataSet ds = BOMDetailBB.GetVList(strWhere, param); if (ds != null && ds.Tables.Count > 0) { this.DtResult = ds.Tables[0]; this.DtResult.Columns.Add(new DataColumn("rowId", typeof(string))); this.DtResult.Columns.Add(new DataColumn("isdel", typeof(string))); foreach (DataRow dr in this.DtResult.Rows) { dr["rowId"] = Guid.NewGuid().ToString(); dr["isdel"] = "0"; } } } finally { BOMDetailBB.Dispose(); } }