private void bind() { DataTable progSortCollections = ProgSortAction.GetProgSortCollections(""); this.DataGrid1.DataSource = progSortCollections; this.DataGrid1.DataBind(); }
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('保存失败!');"); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.Textbox_cfrq.Text = DateTime.Now.ToShortDateString().Replace("/", "-"); DataTable allProgSortCollections = ProgSortAction.GetAllProgSortCollections(); this.DropDownList_lb.DataSource = allProgSortCollections; this.DropDownList_lb.DataTextField = "ProgSortName"; this.DropDownList_lb.DataValueField = "ProgSortCode"; this.DropDownList_lb.DataBind(); if (base.Request.Params["Type"] != null && base.Request.Params["Type"].ToString() == "View") { this.Button_save.Visible = false; this.ButtonColse.Style.Add("display", ""); this.ButtonColse.Value = "关 闭"; this.TextBox_cfdw.ReadOnly = true; this.TextBox_bcfdx.ReadOnly = true; this.Textbox_cfje.ReadOnly = true; this.Textbox_fzr.ReadOnly = true; this.TextBox_cfyj.ReadOnly = true; this.TextBox_cfyy.ReadOnly = true; this.Textbox_bz.ReadOnly = true; this.Textbox_cfrq.ReadOnly = true; this.Textbox_cfdkcdw.ReadOnly = true; this.DropDownList_lb.Enabled = false; } if (base.Request["pk"] != null) { this.pk = base.Request["pk"].ToString(); } if (string.IsNullOrWhiteSpace(this.pk) && base.Request["ic"] != null) { this.pk = ItemProgAction.GetIdByUID(base.Request["ic"]); } if (!string.IsNullOrWhiteSpace(this.pk)) { this.bind(this.pk); } } }
protected void Button_del_Click(object sender, EventArgs e) { int itemProgCount = ItemProgAction.GetItemProgCount("ProgSortCode=" + this.TextBox_pk.Text); if (itemProgCount > 0) { this.JavaScriptControl1.Text = "alert('该类别对应的有奖罚记录,请删除对应的奖罚记录后再删除该类别!');"; return; } if (this.TextBox_pk.Text.Trim() == "") { this.JavaScriptControl1.Text = "alert('请选择删除的记录!')"; return; } bool flag = ProgSortAction.Delete(this.TextBox_pk.Text); if (flag) { this.JavaScriptControl1.Text = "alert('删除成功!');window.location.href=window.location.href"; return; } this.JavaScriptControl1.Text = "alert('删除失败!')"; }
protected void Page_Load(object sender, EventArgs e) { if (base.Request["Type"] == "List") { this.Button_add.Visible = false; this.btnAction.Visible = false; this.btnCanCel.Visible = false; this.Button_edit.Visible = false; this.Button_del.Visible = false; this.Button_sp.Visible = false; this.btn_Search.Visible = true; this.TextBox_cfdw.Visible = true; this.TextBox_bcfdx.Visible = true; this.DropDownList_lb.Visible = true; this.Literal1.Visible = true; this.Literal2.Visible = true; this.Literal3.Visible = true; this.Literal4.Text = "项目奖罚查询"; } else { if (base.Request["Type"] == "Edit") { this.Button_add.Visible = true; this.btnAction.Visible = false; this.btnCanCel.Visible = false; this.Button_edit.Visible = true; this.Button_del.Visible = true; this.Button_sp.Visible = false; this.btn_Search.Visible = false; this.TextBox_cfdw.Visible = false; this.TextBox_bcfdx.Visible = false; this.DropDownList_lb.Visible = false; this.Literal1.Visible = false; this.Literal2.Visible = false; this.Literal3.Visible = false; this.TRS.Visible = false; this.Literal4.Text = "项目奖罚"; } else { if (base.Request["Type"] == "ShenHe") { this.Button_add.Visible = false; this.Button_edit.Visible = false; this.btnCanCel.Visible = false; this.btnAction.Visible = false; this.Button_del.Visible = false; this.Button_sp.Visible = true; this.btn_Search.Visible = true; this.TextBox_cfdw.Visible = true; this.TextBox_bcfdx.Visible = true; this.DropDownList_lb.Visible = true; this.Literal1.Visible = true; this.Literal2.Visible = true; this.Literal4.Text = "项目奖罚审核"; this.Literal3.Visible = true; } else { if (base.Request["Type"] == "View") { this.Button_add.Visible = false; this.Button_edit.Visible = false; this.btnAction.Visible = true; this.btnCanCel.Visible = true; this.Button_del.Visible = false; this.Button_sp.Visible = false; this.btn_Search.Visible = true; this.TextBox_cfdw.Visible = true; this.TextBox_bcfdx.Visible = true; this.DropDownList_lb.Visible = true; this.Literal1.Visible = true; this.Literal2.Visible = true; this.Literal3.Visible = true; this.Literal4.Text = "项目奖罚执行"; } } } } this.Button_add.Attributes.Add("onclick", "ShowInsertWindow()"); this.Button_edit.Attributes.Add("onclick", "ShowEditWindow()"); this.Button_sp.Attributes.Add("onclick", "ShowSpWindow()"); this.Button_del.Attributes["onclick"] = "javascript:if(!confirm('确定要删除当前选中数据吗?')){return false;}"; this.btnAction.Attributes["onclick"] = "return ActionRecord();"; this.btnCanCel.Attributes["onclick"] = "return ActionRecord();"; if (!base.IsPostBack) { this.bind(); DataTable allProgSortCollections = ProgSortAction.GetAllProgSortCollections(); this.DropDownList_lb.DataSource = allProgSortCollections; this.DropDownList_lb.DataTextField = "ProgSortName"; this.DropDownList_lb.DataValueField = "ProgSortCode"; this.DropDownList_lb.DataBind(); } }