/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LCustTagBB custTagBB = new LCustTagBB(); vLCustTagData model = new vLCustTagData(); try { model = custTagBB.GetVModel(id); this.id.Text = model.id.ToString(); this.custNo.Text = model.custNo; this.materialNo.Text = model.materialNo; this.bigTagFileId.Text = model.bigTagFileId.ToString(); this.smallTagFileId.Text = model.smallTagFileId.ToString(); } finally { custTagBB.Dispose(); } }
/// <summary> /// 绑定Grid /// </summary> protected void BindGrid() { LCustTagBB custTagBB = new LCustTagBB(); DataSet ds = new DataSet(); try { string strwhere = this.StrWhere; if (!string.IsNullOrEmpty(txtMaterialNo.Text)) { strwhere += " and materialNo like '%" + txtMaterialNo.Text + "%'"; } if (!string.IsNullOrEmpty(txtMaterialNo.Text)) { strwhere += " and materialDesc like '%" + txtMaterialNm.Text + "%'"; } if (!string.IsNullOrEmpty(txtCustNo.Text)) { strwhere += " and custNo like '%" + txtCustNo.Text + "%'"; } if (!string.IsNullOrEmpty(txtCustNm.Text)) { strwhere += " and custNm like '%" + txtCustNm.Text + "%'"; } ds = custTagBB.GetVList(strwhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { custTagBB.Dispose(); } }
/// <summary> /// 数据保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { LCustTagData model = new LCustTagData(); LCustTagBB custTagBB = new LCustTagBB(); try { if (this.State == "1") { this.SetModel(ref model); model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; model.smallTagSql = this.smallSQL.Text.ToString(); model.bigTagSql = this.bigSQL.Text.ToString(); this.IdValue = custTagBB.AddRecord(model); this.State = "1"; } else if (this.State == "2") { model = custTagBB.GetModel(this.IdValue); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; model.smallTagSql = this.smallSQL.Text.ToString(); model.bigTagSql = this.bigSQL.Text.ToString(); custTagBB.ModifyRecord(model); } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { custTagBB.Dispose(); } Response.Redirect("LCustTagList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false); }
/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LCustTagBB custTagBB = new LCustTagBB(); vLCustTagData model = new vLCustTagData(); SFileBB fileBB = new SFileBB(); try { model = custTagBB.GetVModel(id); this.hidCustNo.Value = model.custNo; this.hidMaterialNo.Value = model.materialNo; this.bigSQL.Text = model.bigTagSql; this.smallSQL.Text = model.smallTagSql; SFileData smdtata = fileBB.GetModel(model.smallTagFileId); if (smdtata != null) { this.smallfileNm.InnerHtml = "<a href='" + smdtata.absolutPath + smdtata.preFileNm + "' >" + smdtata.preFileNm + "</a>"; } SFileData bgdata = fileBB.GetModel(model.bigTagFileId); if (bgdata != null) { this.bigfileNm.InnerHtml = "<a href='" + bgdata.absolutPath + bgdata.preFileNm + "' >" + bgdata.preFileNm + "</a>"; } this.custNm.Text = model.custNm; this.materialNm.Text = model.materialDesc; this.bigTagFileId.Value = model.bigTagFileId.ToString(); this.smallTagFileId.Value = model.smallTagFileId.ToString(); this.tbEachPrintBigTagNum.Text = model.eachPrintBigTagNum.ToString(); this.tbEachPrintSmallTagNum.Text = model.eachPrintSmallTagNum.ToString(); this.tbUnit.Text = model.unit; this.tbUnits.Text = model.units; } finally { custTagBB.Dispose(); fileBB.Dispose(); } }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; LCustTagBB custTagBB = new LCustTagBB(); try { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int id = int.Parse(chkId.ValidationGroup); custTagBB.DeleteRecord(id); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { custTagBB.Dispose(); } if (retChecked) { this.BindGrid(); } }