private void bind(string pk) { ProgSortInfo progSortInfo = ProgSortAction.GetProgSortInfo(pk); this.TextBox_name.Text = progSortInfo.ProgSortName; this.TextBox_remark.Text = progSortInfo.Remark; this.HiddenField1.Value = progSortInfo.ProgSortName; }
protected void Button_save_Click(object sender, EventArgs e) { if (this.TextBox_remark.Text.Length > this.TextBox_remark.MaxLength) { this.JavaScriptControl1.Text = "alert('备注输入的长度过长!')"; return; } ProgSortInfo progSortInfo = new ProgSortInfo(); if (base.Request["pk"] != null) { progSortInfo.ProgSortCode = int.Parse(base.Request["pk"].ToString()); } progSortInfo.ProgSortName = this.TextBox_name.Text; progSortInfo.Remark = this.TextBox_remark.Text; bool flag = false; progLogic progLogic = new progLogic(); if (this._pk == "") { if (progLogic.Exists(progSortInfo.ProgSortName)) { this.JavaScriptControl1.Text = "top.ui.alert('奖罚类别名称已存在!');"; return; } flag = ProgSortAction.ProgSortInfoOp(progSortInfo, "Insert"); } else { if (this._pk != "") { if (this.HiddenField1.Value.ToString() != progSortInfo.ProgSortName) { if (progLogic.Exists(progSortInfo.ProgSortName)) { this.JavaScriptControl1.Text = "top.ui.alert('奖罚类别名称已存在!');"; return; } flag = ProgSortAction.ProgSortInfoOp(progSortInfo, "Update"); } else { flag = ProgSortAction.ProgSortInfoOp(progSortInfo, "Update"); } } } if (flag) { base.RegisterScript("top.ui.tabSuccess({ parentName: '_progsortlist' });"); return; } base.RegisterScript("top.ui.alert('保存失败!');"); }
public static ProgSortInfo GetProgSortInfo(string ProgSortCode) { ProgSortInfo info = new ProgSortInfo(); DataTable table = publicDbOpClass.DataTableQuary("select * from Prj_ProgSort where ProgSortCode=" + ProgSortCode); if (table.Rows[0]["ProgSortCode"].ToString() != "") { info.ProgSortCode = int.Parse(table.Rows[0]["ProgSortCode"].ToString()); } info.ProgSortName = table.Rows[0]["ProgSortName"].ToString(); info.Remark = table.Rows[0]["Remark"].ToString(); return(info); }
public static bool ProgSortInfoOp(ProgSortInfo objinfo, string OpType) { string sqlString = ""; if (OpType == "Insert") { sqlString = "Insert into Prj_ProgSort(ProgSortName,Remark) values('" + objinfo.ProgSortName + "','" + objinfo.Remark + "')"; } else if (OpType == "Update") { sqlString = string.Concat(new object[] { "update Prj_ProgSort set ProgSortName='", objinfo.ProgSortName, "',Remark='", objinfo.Remark, "' where ProgSortCode='", objinfo.ProgSortCode, "'" }); } return(publicDbOpClass.NonQuerySqlString(sqlString)); }