private void initheatdevice() { bi_heatdevice bh = new bi_heatdevice(); System.Data.DataTable dt = bh.getheatdevice(); bdevice.DataTextField = "hdname"; bdevice.DataValueField = "hdname"; bdevice.DataSource = dt; bdevice.DataBind(); }
private void initinfo(string strID) { bi_heatdevice bhd = new bi_heatdevice(); System.Data.DataTable dt = bhd.getEditdata(strID); DataRow r = dt.Rows[0]; editID.Text = strID; hdname.Text = r["hdname"].ToString().Trim(); hdcode.Text = r["hdcode"].ToString().Trim(); hdtype.Text = r["hdtype"].ToString().Trim(); hdmodel.Text = r["hdmodel"].ToString().Trim(); hdstatu.SelectedValue = r["hdstatu"].ToString().Trim(); }
protected void btnDelete_Click(object sender, EventArgs e) { int[] intRowindexarray = mainGrid.SelectedRowIndexArray; if (intRowindexarray.Length > 0) { bi_heatdevice bhd = new bi_heatdevice(); object[] keys = mainGrid.DataKeys[intRowindexarray[0]]; string strID = keys[0].ToString(); List <Dictionary <string, string> > listdic = new List <Dictionary <string, string> >(); Dictionary <string, string> dic = new Dictionary <string, string>(); List <string> listTablename = new List <string>(); dic.Add("ID", " cast(ID as varchar(36))='" + strID + "' "); listdic.Add(dic); dic = new Dictionary <string, string>(); dic.Add("hdid", " cast(hdid as varchar(36))='" + strID + "' "); listdic.Add(dic); listTablename.Add("bi_heatdevice"); listTablename.Add("bi_heatdevice_repair"); int intresult = bhd.deleteMutri(listdic, listTablename); setPageContent(5); childGrid.DataSource = null; childGrid.DataBind(); erasechild(); Alert alert = new Alert(); if (intresult > 0) { alert.Icon = Icon.Information; alert.Message = "成功移除数据"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据移除失败"; } alert.Show(); } }
protected void btnSave_Click(object sender, EventArgs e) { Dictionary <string, string> dic = initDatadic(); string strID = editID.Text.ToString().Trim(); bi_heatdevice bhd = new bi_heatdevice(); int intresult = 0; if (strID == "") { dic.Add("ID", Guid.NewGuid().ToString()); intresult = bhd.add(dic, "bi_heatdevice"); } else { intresult = bhd.update(dic, "bi_heatdevice", "ID", strID); } if (CurPage.Text.Trim() == "") { setPageContent(1); } else { setPageContent(5); } Alert alert = new Alert(); if (intresult == 1) { alert.Icon = Icon.Information; alert.Message = "数据保存成功"; } else { alert.MessageBoxIcon = MessageBoxIcon.Error; alert.Message = "数据保存失败"; } alert.Show(); }
private string getconcode() { bi_heatdevice bhd = new bi_heatdevice(); string strpdcode = bhd.getmaxconcode(); string strprecode = "h"; if (strpdcode.Length == 1) { strpdcode = strprecode + "00" + strpdcode; } else if (strpdcode.Length == 2) { strpdcode = strprecode + "0" + strpdcode; } else { strpdcode = strprecode + strpdcode; } return(strpdcode); }
private void BindGrid() { string strf_hdname = f_hdname.Text.Trim(); string strf_hdtype = f_hdtype.Text.Trim(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("hdname", strf_hdname); dic.Add("hdtype", strf_hdtype); int intPageindex = Convert.ToInt32(CurPage.Text.Trim()); int intPagesize = Convert.ToInt32(GridPageSize.Text.Trim()); string strSort = mainGrid.SortField; string strSortDirection = mainGrid.SortDirection; bi_heatdevice bhd = new bi_heatdevice(); DataTable dt = bhd.getBindDataAsdt(dic, strSort, strSortDirection, intPagesize, intPageindex); TotalPage.Text = bhd.gettotalpage(dic); mainGrid.DataSource = dt; mainGrid.DataBind(); }