Beispiel #1
0
        protected void SaveToolsButton_ServerClick(object sender, System.EventArgs e)
        {
            try
            {
                string Action        = Request.QueryString["Action"] + "";
                string strRemindType = "";
                switch (Action.ToUpper())
                {
                //新增提醒
                case "INSERT":
                    EntityData entityInsert = DAL.EntityDAO.RemindDAO.GetAllRemindStrategy();
                    DataRow    drInsert     = entityInsert.GetNewRecord();
                    drInsert["RemindStrategyCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("RemindStrategyCode");
                    if (this.rblRemindType.SelectedValue == "1")
                    {
                        drInsert["RemindDay"] = int.Parse(this.txtRemindDay.Text.Trim());
                    }
                    else
                    {
                        drInsert["RemindDay"] = int.Parse("-" + this.txtRemindDay.Text.Trim());
                    }

                    if (this.rblActive.SelectedValue == "1")
                    {
                        drInsert["IsActive"] = 1;
                    }
                    else
                    {
                        drInsert["IsActive"] = 0;
                    }
                    strRemindType = this.lstRemindType.Value;
                    if (strRemindType == "0" || strRemindType == "3")
                    {
                        string strObject = "";
                        if (this.chkMaster.Checked)
                        {
                            strObject += "2";
                        }
                        if (this.chkMonitor.Checked)
                        {
                            strObject += "1";
                        }
                        if (this.chkExecuter.Checked)
                        {
                            strObject += "0";
                        }
                        drInsert["ObjectCode"] = strObject;
                    }
                    else
                    {
                        drInsert["ObjectCode"] = this.lstRemindObject.Value;
                    }

                    drInsert["Type"]        = strRemindType;
                    drInsert["ProjectCode"] = (string)Session["ProjectCode"];
                    drInsert["Remark"]      = this.taRemark.Value.Trim();
                    entityInsert.AddNewRecord(drInsert);
                    RemindDAO.InsertRemindStrategy(entityInsert);
                    entityInsert.Dispose();
                    break;

                //修改
                case "MODIFY":
                    string     RemindCode   = Request.QueryString["Code"] + "";
                    EntityData entityModify = DAL.EntityDAO.RemindDAO.GetRemindStrategyByCode(RemindCode);
                    DataRow    drModify     = entityModify.CurrentRow;
                    if (this.rblRemindType.SelectedValue == "1")
                    {
                        drModify["RemindDay"] = int.Parse(this.txtRemindDay.Text.Trim());
                    }
                    else
                    {
                        drModify["RemindDay"] = int.Parse("-" + this.txtRemindDay.Text.Trim());
                    }

                    if (this.rblActive.SelectedValue == "1")
                    {
                        drModify["IsActive"] = 1;
                    }
                    else
                    {
                        drModify["IsActive"] = 0;
                    }
                    strRemindType = this.lstRemindType.Value;
                    if (strRemindType == "0" || strRemindType == "3")
                    {
                        string strObject = "";
                        if (this.chkMaster.Checked)
                        {
                            strObject += "2";
                        }
                        if (this.chkMonitor.Checked)
                        {
                            strObject += "1";
                        }
                        if (this.chkExecuter.Checked)
                        {
                            strObject += "0";
                        }
                        drModify["ObjectCode"] = strObject;
                    }
                    else
                    {
                        drModify["ObjectCode"] = this.lstRemindObject.Value;
                    }

                    drModify["Type"]   = strRemindType;
                    drModify["Remark"] = StringRule.FormartInput(this.taRemark.Value.Trim());
                    RemindDAO.UpdateRemindStrategy(entityModify);
                    entityModify.Dispose();
                    break;
                }

                Response.Write(JavaScript.ScriptStart);
                Response.Write("window.opener.location.reload();");
                Response.Write("window.close();");
                Response.Write(JavaScript.ScriptEnd);
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "保存提醒信息失败!");
            }
        }