protected bool IsExistItemInspectSortName(string itemInspectSortName) { string strwhere = "ItemInspectSortName='" + itemInspectSortName + "'"; DataTable checkClassCollections = CheckClassAction.GetCheckClassCollections(strwhere); return(checkClassCollections.Rows.Count != 0); }
private void bind(string pk) { CheckClassInfo checkClassInfo = CheckClassAction.GetCheckClassInfo(pk); this.TextBox_name.Text = checkClassInfo.ItemInspectSortName; this.TextBox_remark.Text = checkClassInfo.Remark; }
protected void Button_save_Click(object sender, EventArgs e) { if (this.TextBox_remark.Text.Trim().Length > 150) { return; } if (string.IsNullOrEmpty(this.TextBox_name.Text.Trim())) { this.TextBox_name.Focus(); this.JavaScriptControl1.Text = "alert('系统提示:\\n检查类别名称不能为空!')"; return; } CheckClassInfo checkClassInfo = new CheckClassInfo(); if (base.Request["pk"] != null) { checkClassInfo.SortID = int.Parse(base.Request["pk"].ToString()); } checkClassInfo.ItemInspectSortName = this.TextBox_name.Text.Trim(); checkClassInfo.Remark = this.TextBox_remark.Text.Trim(); bool flag = this.IsExistItemInspectSortName(checkClassInfo.ItemInspectSortName); bool flag2; if (string.IsNullOrEmpty(base.Request["pk"])) { if (flag) { this.TextBox_name.Focus(); this.JavaScriptControl1.Text = "top.ui.alert('n检查类别名已经存在,请重新输入!')"; return; } flag2 = CheckClassAction.CheckClassInfoOp(checkClassInfo, "Insert"); } else { if (flag) { CheckClassInfo checkClassInfo2 = CheckClassAction.GetCheckClassInfo(base.Request["pk"]); if (!checkClassInfo2.ItemInspectSortName.Equals(checkClassInfo.ItemInspectSortName)) { base.RegisterScript("top.ui.alert('检查类别名已经存在,请重新输入!')"); return; } } flag2 = CheckClassAction.CheckClassInfoOp(checkClassInfo, "Update"); } if (flag2) { base.RegisterScript("top.ui.tabSuccess({ parentName: '_checkclasslist' });"); return; } base.RegisterScript("top.ui.alert('保存失败')"); }
protected void Button_del_Click(object sender, EventArgs e) { if (this.hidenSortID.Value.Trim() == "") { this.JavaScriptControl1.Text = "alert('请选择删除的记录!')"; return; } int checkCount = CheckAction.GetCheckCount("AcceptCheckSort=" + this.hidenSortID.Value); if (checkCount > 0) { this.JavaScriptControl1.Text = "alert('该类别对应的有检查记录,请删除对应的检查记录后再删除该类别!');"; return; } bool flag = CheckClassAction.Delete(this.hidenSortID.Value); if (flag) { this.JavaScriptControl1.Text = "alert('删除成功!');window.location.href=window.location.href"; return; } this.JavaScriptControl1.Text = "alert('删除失败!')"; }
private void bind() { CheckClassAction.GetCheckClassCollections(""); this.DataGrid1.DataSource = CheckClassAction.GetCheckClassCollections(""); this.DataGrid1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { this.ViewState["Mark"] = string.Empty; if (!base.IsPostBack) { this.lbTitle.Text = "项目检查"; this.DateBox_jcrq.Text = DateTime.Now.ToString("d"); if (!string.IsNullOrWhiteSpace(this.pk)) { this.bind(this.pk); } DataTable allCheckClassCollections = CheckClassAction.GetAllCheckClassCollections(); this.DropDownList_lb.DataSource = allCheckClassCollections; this.DropDownList_lb.DataTextField = "ItemInspectSortName"; this.DropDownList_lb.DataValueField = "SortID"; this.DropDownList_lb.DataBind(); if (!string.IsNullOrWhiteSpace(this.pk)) { this.FileLink1.MID = 1755; this.FileLink1.FID = this.pk; this.FileLink1.Type = 1; this.FileLink2.MID = 1755; this.FileLink2.Type = 1; if (string.IsNullOrEmpty(this.rectifyMarkID)) { this.rectifyMarkID = Guid.NewGuid().ToString(); } this.ViewState["rmid"] = this.rectifyMarkID; this.FileLink2.FID = this.rectifyMarkID; } else { this.id_max = this.dl.getMaxID("Prj_ItemInspect"); this.FileLink1.Type = 1; this.FileLink1.MID = 1755; this.FileLink1.FID = this.id_max.ToString(); this.FileLink2.Type = 1; this.FileLink2.MID = 1755; this.rectifyMarkID = Guid.NewGuid().ToString(); this.ViewState["rmid"] = this.rectifyMarkID; this.FileLink2.FID = this.rectifyMarkID; } if (base.Request.Params["Type"] != null) { if (base.Request["Levels"] != null && base.Request["Levels"].ToString() == "0") { if (base.Request.Params["Type"].ToString() == PageType.Edit.ToString()) { this.DateBox_sjwcsj.Enabled = false; this.DateBox_jhwcsj.Enabled = false; this.TextBox_sjjg.Enabled = false; this.ddlCertifiResult.Enabled = false; this.TextBox_xmjh.Enabled = false; this.Textbox_zgnr.Enabled = false; } if (base.Request.Params["Type"].ToString() == PageType.Rectify.ToString()) { this.SetDisplayControl(); this.DateBox_sjwcsj.Enabled = true; this.DateBox_jhwcsj.Enabled = true; this.TextBox_xmjh.Enabled = true; this.lbTitle.Text = "项目整改"; this.FileLink1.Visible = false; this.Literal1.Text = FileView.FilesBind(1755, base.Request["pk"].ToString()); } if (base.Request.Params["Type"].ToString() == PageType.Certify.ToString()) { this.SetDisplayControl(); this.ddlCertifiResult.Enabled = true; this.lbTitle.Text = "项目验证"; this.FileLink1.Visible = false; this.Literal1.Text = FileView.FilesBind(1755, base.Request["pk"].ToString()); this.FileLink2.Visible = false; this.Literal2.Text = FileView.FilesBind(1755, this.ViewState["rmid"].ToString()); } } if (base.Request.Params["Type"].ToString() == "View") { this.Button_save.Visible = false; this.Button1.Style.Add("display", ""); this.Button1.Value = "关 闭"; this.SetDisplayControl(); this.FileLink1.Type = 0; this.FileLink1.Visible = false; this.Literal1.Text = FileView.FilesBind(1755, this.pk); this.FileLink2.Visible = false; this.Literal2.Text = FileView.FilesBind(1755, this.ViewState["rmid"].ToString()); } } } }