/// <summary> /// 类别修改 /// </summary> public void EditTypes() { this.Ucsys1.AddTable(); this.Ucsys1.AddCaptionLeft("<a href='Bill.aspx?FK_Flow=" + this.FK_Flow + "&NodeID=" + this.NodeID + "'>返回</a> -单据类别维护"); this.Ucsys1.AddTR(); this.Ucsys1.AddTDTitle("类别编号"); this.Ucsys1.AddTDTitle("类别名称"); this.Ucsys1.AddTREnd(); BillTypes ens = new BillTypes(); ens.RetrieveAll(); for (int i = 1; i < 18; i++) { this.Ucsys1.AddTR(); this.Ucsys1.AddTD(i.ToString().PadLeft(2, '0')); TextBox tb = new TextBox(); tb.ID = "TB_" + i; tb.Columns = 50; try { BillType en = ens[i - 1] as BillType; tb.Text = en.Name; this.Ucsys1.AddTD(tb); } catch { this.Ucsys1.AddTD(tb); } this.Ucsys1.AddTREnd(); } this.Ucsys1.AddTableEndWithHR(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.Text = "Save"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_SaveTypes_Click); this.Ucsys1.Add(btn); }
protected void btn_SaveTypes_Click(object sender, EventArgs e) { BillTypes ens = new BillTypes(); ens.RetrieveAll(); ens.Delete(); for (int i = 1; i < 18; i++) { string name = this.Ucsys1.GetTextBoxByID("TB_" + i).Text; if (string.IsNullOrEmpty(name)) { continue; } BillType en = new BillType(); en.No = i.ToString().PadLeft(2, '0'); en.Name = name; en.FK_Flow = this.FK_Flow; en.Insert(); } this.Alert("保存成功."); }