protected void btnSave_Click(object sender, EventArgs e) { if (!this.timecompare(this.txt_StartDate.Text.ToString(), this.txt_EndDate.Text.ToString())) { this.js.Text = "alert('结束时间不能早于开始时间!')"; return; } PrjInfoModel prjInfoModel = new PrjInfoModel(); prjInfoModel = this.GetTextValue(); if (base.Request.QueryString["OpType"] == "ADD") { if (!PrjInfoAction.CheckCode(prjInfoModel.PrjCode)) { this.js.Text = "alert('项目编号重复,请更改后保存!');"; return; } if (PrjInfoAction.ADD(prjInfoModel) == 1) { StringBuilder stringBuilder = new StringBuilder(); if (this.ManagerCodeYW.Value.ToString() != "") { stringBuilder.Append(this.ManagerCodeYW.Value.ToString()).Append("-").AppendLine(); } if (this.Txt_businessman.Text.Trim().ToString() != "") { stringBuilder.Append(this.Txt_businessman.Text.Trim().ToString()).AppendLine(); } this.BLL_n.Add(prjInfoModel.PrjGuid.ToString(), this.Txt_grade.Text.ToString().Trim(), stringBuilder.ToString(), this.Txt_telphone.Text.Trim().ToString()); this.js.Text = "alert('保存成功!');window.returnValue=true;window.close();"; return; } this.js.Text = "alert('保存失败!');window.returnValue=false;window.close();"; return; } else { if (this.ddt_state.SelectedValue == "16") { if (string.IsNullOrEmpty(this.HideManagerCode.Value)) { this.js.Text = "alert('项目经理不能为空!')"; return; } prjInfoModel.PrjState = "4"; try { string text = string.Empty; if (this.fatherPrj.SelectedValue != "---请选择---") { text = PMAction.MakeClassCode(this.fatherPrj.SelectedValue.ToString()); } else { text = PMAction.MakeClassCode(""); } if (text != null && text.ToString() != "") { PrjInfoAction.ADD2(text, this.Session["yhdm"].ToString(), DateTime.Now.ToString(), prjInfoModel); } else { text = "001"; PrjInfoAction.ADD2(text, this.Session["yhdm"].ToString(), DateTime.Now.ToString(), prjInfoModel); } string mes = string.Concat(new string[] { "项目立项通知:编号为", prjInfoModel.PrjCode, "的", prjInfoModel.PrjName, "项目已经立项。" }); this.getOrganiger(prjInfoModel.PrjGuid.ToString(), mes, this.HideManagerCode.Value.ToString()); } catch { this.js.Text = "alert('插入失败!')"; base.Response.End(); } } int num = PrjInfoAction.Update(prjInfoModel); if (num == 1) { StringBuilder stringBuilder2 = new StringBuilder(); if (this.ManagerCodeYW.Value.ToString() != "") { stringBuilder2.Append(this.ManagerCodeYW.Value.ToString()).Append("-").AppendLine(); } if (this.Txt_businessman.Text.Trim().ToString() != "") { stringBuilder2.Append(this.Txt_businessman.Text.Trim().ToString()).AppendLine(); } this.BLL_n.update(prjInfoModel.PrjGuid.ToString(), this.Txt_grade.Text.ToString().Trim(), stringBuilder2.ToString(), this.Txt_telphone.Text.Trim().ToString()); this.js.Text = "alert('编辑成功!');window.returnValue=true;window.close();"; return; } this.js.Text = "alert('" + sqlErr.sqlerr(num) + "'+'编辑失败!');window.returnValue=false;window.close();"; return; } }
protected void Page_Load(object sender, System.EventArgs e) { if (!this.Page.IsPostBack) { string sqlString = "select NoteID,CodeName from dbo.XPM_Basic_CodeList where TypeID=146 and IsValid='true' and IsVisible='true'"; System.Data.DataTable dataSource = publicDbOpClass.DataTableQuary(sqlString); this.ddlXmgroup.DataSource = dataSource; this.ddlXmgroup.DataValueField = "NoteID"; this.ddlXmgroup.DataTextField = "CodeName"; this.ddlXmgroup.DataBind(); this.ddlXmgroup.Items.Insert(0, new ListItem("--请选择--", "-1")); this.txt_StartDate.Attributes["onactivate"] = "getBeginDate();"; this.txt_EndDate.Attributes["onactivate"] = "getEndDate();"; this.Drop_QualityClass_Bind(); this.Drop_PrjKindClass_Bind(); this.ddt_Area_Bind(); this.Drop_zzGrade_Bind(); this.Drop_ysType_Bind(); this.Drop_cbType_Bind(); this.Drop_Payment_Bind(); this.Drop_zbType_Bind(); this.Drop_jsType_Bind(); this.Drop_PrimaryGrade_Bind(); this.Drop_jzType_Bind(); if (base.Request.QueryString["TypeCode"] == null) { this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">alert(\"参数不正确!\");window.close();</script>"); } else { this.ViewState["TYPECODE"] = base.Request.QueryString["TypeCode"].ToString(); } if (base.Request.QueryString["op"] == null) { this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">alert(\"参数不正确!\");window.close();</script>"); } else { this.ViewState["OP"] = base.Request.QueryString["op"].ToString(); } string a; if ((a = this.ViewState["OP"].ToString().ToLower()) != null) { if (a == "add") { this.txt_StartDate.Text = System.DateTime.Now.ToString("yyyy-M-dd"); this.txt_EndDate.Text = System.DateTime.Now.ToString("yyyy-M-dd"); base.Header.Title = "添加资源分类"; this.tbxPreCode.Text = this.ViewState["TYPECODE"].ToString(); this.tbxPreCode.ReadOnly = true; this.TxtTypeCode.ReadOnly = true; if (this.ViewState["TYPECODE"].ToString().Trim() != "") { string text = PMAction.MakeClassCode(this.ViewState["TYPECODE"].ToString().Trim()); this.TxtTypeCode.Text = text.Substring(this.tbxPreCode.Text.Trim().Length, text.Length - this.tbxPreCode.Text.Trim().Length); } else { string text = PMAction.MakeClassCode(""); this.TxtTypeCode.Text = text; } this.hdfGuid.Value = System.Guid.NewGuid().ToString(); this.FileLink1.MID = 18; this.FileLink1.FID = this.hdfGuid.Value; this.FileLink1.Type = 1; return; } if (a == "upd") { PMModel pIM = new PMModel(); pIM = PMAction.GetSingleInfo(this.ViewState["TYPECODE"].ToString()); this.TextBind(pIM); base.Header.Title = "更新资源分类"; this.tbxPreCode.Visible = false; this.TxtTypeCode.Columns = 20; this.TxtTypeCode.ReadOnly = true; this.SetModuleState(this.ViewState["TYPECODE"].ToString()); this.FileLink1.MID = 18; this.FileLink1.FID = this.hdfGuid.Value; this.FileLink1.Type = 1; return; } } this.Page.RegisterStartupScript("warn", "<script language=\"JavaScript\">alert(\"参数不正确!\");window.close();</script>"); } }