Exemple #1
0
        protected void btn_send_Click(object sender, EventArgs e)
        {
            string msg = this.CheckControlValue();

            if (!string.IsNullOrEmpty(msg))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showWarn('" + msg + "');", true);
                return;
            }
            if (this.db_IsDsfs.Checked &&
                string.IsNullOrEmpty(this.txtReceiverIds.Text.Trim(new char[] { ',' })) && string.IsNullOrEmpty(this.db_newSxr.Text.Trim().Trim(',')))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showWarn('您设置为定时发送,请选择或输入收信人!');", true);
                return;
            }
            //if (this.db_IsDsfs.Checked&&string.IsNullOrEmpty(this.db_fxr.Text))
            //{
            //    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showWarn('请选择发信人!');", true);
            //    return;
            //}

            List <SqlPara> sqls = WebCommon.ConvertSql(this.db_Jbnr.Text);

            if (sqls != null && sqls.Count > 0)
            {
                foreach (SqlPara item in sqls)
                {
                    try
                    {
                        BLL.ExecuteSql(item.executeSql);
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showWarn(\"保存失败,可执行sql脚本有错误!<br/>" + ex.Message.Trim('\'').Trim('"') + "\");", true);
                        return;
                    }
                }
            }

            List <IDataItem> list = this.GetControlValue();

            if (this.db_IsDsfs.Checked)
            {
                if (this.db_dsfs_1.Checked)
                {
                    WebCommon.AddDataItem(list, "EveryWeekOne", "1");
                    WebCommon.AddDataItem(list, "EveryMonthOne", "0");
                    WebCommon.AddDataItem(list, "EveryQuarterOne", "0");
                }
                else
                if (this.db_dsfs_2.Checked)
                {
                    WebCommon.AddDataItem(list, "EveryWeekOne", "0");
                    WebCommon.AddDataItem(list, "EveryMonthOne", "1");
                    WebCommon.AddDataItem(list, "EveryQuarterOne", "0");
                }
                else
                if (this.db_dsfs_3.Checked)
                {
                    WebCommon.AddDataItem(list, "EveryWeekOne", "0");
                    WebCommon.AddDataItem(list, "EveryMonthOne", "0");
                    WebCommon.AddDataItem(list, "EveryQuarterOne", "1");
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showWarn('请选择一种自动发送类型!');", true);
                    return;
                }
            }
            else
            {
                WebCommon.AddDataItem(list, "EveryWeekOne", "0");
                WebCommon.AddDataItem(list, "EveryMonthOne", "0");
                WebCommon.AddDataItem(list, "EveryQuarterOne", "0");
            }

            WebCommon.AddDataItem(list, "sxrIds", this.txtReceiverIds.Text.Trim(new char[] { ',' }));
            WebCommon.AddDataItem(list, "UserID", "");
            WebCommon.AddDataItem(list, "Fxr", "");

            if (Operate == OperateSt.add.ToString())
            {
                FunctionResult <string> fr = BLL.SaveDxjb(list);
                if (fr.Status != FunctionResultStatus.Error)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "SaveResult('" + fr.Result + "');", true);
                    return;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showWarn('" + fr.Result + "');", true);
                    return;
                }
            }
            else
            {
                FunctionResult <string> fr = BLL.SaveDxjb(DxjbId, list);
                if (fr.Status != FunctionResultStatus.Error)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "SaveResult('" + fr.Result + "');", true);
                    return;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showWarn('" + fr.Result + "');", true);
                    return;
                }
            }
        }