protected void ddl_yzjb_SelectedIndexChanged(object sender, EventArgs e) { if (this.ddl_yzjb.SelectedIndex == 0) { this.txtReceiverIds.Text = ","; this.db_Jbmc.Text = ""; this.db_Jbnr.Text = ""; this.db_fsdx.Text = ""; this.db_newSxr.Text = ""; Src = "Txl_Tree.aspx?dxjbId="; return; } Src = "Txl_Tree.aspx?type=dxjb&dxjbId=" + this.ddl_yzjb.SelectedValue; DataTable dt = BLL.ReadSzgkjc_Dxjb(this.ddl_yzjb.SelectedValue).Result; List <IDataItem> list = dt.Rows[0].ToDataItem(); this.SetControlValue(list); string jbnr = list.GetDataItem("Jbnr").ItemData; string jbnrNew = string.Copy(jbnr); List <SqlPara> sqls = WebCommon.ConvertSql(jbnr); if (sqls.Count > 0) { foreach (SqlPara item in sqls) { string str = BLL.ExecuteSql(item.executeSql); item.newStr = str; jbnrNew = jbnrNew.Replace(item.oldStr, item.newStr); } } this.db_Jbnr.Text = jbnrNew; dt = BLL.ReadSzgkjc_DxjbAndSjml(this.ddl_yzjb.SelectedValue).Result; if (dt.Rows.Count > 0) { string txt = "", txt2 = ""; foreach (DataRow item in dt.Rows) { txt += "," + item["SjmlID"]; txt2 += item["SjmlName"] + "【" + item["sjmlMobile"] + "】,"; } this.txtReceiverIds.Text = txt; this.db_fsdx.Text = txt2.Trim(new char[] { ',' }); } }
protected void Page_Load(object sender, EventArgs e) { DxjbId = Request.QueryString["dxjbId"]; BLL = new ZlctBLL(this.WorkUser); if (!this.IsPostBack) { PageIndex = Request.QueryString["pageIndex"]; this.lblPageIndex.Text = PageIndex; DataTable dt = BLL.ReadSzgkjc_Dxjb(DxjbId).Result; List <IDataItem> list = dt.Rows[0].ToDataItem(); this.SetControlValue(list); bool isDsfs = bool.Parse(dt.Rows[0]["IsDsfs"].ToString()); if (isDsfs) { this.db_fslx.Text = "定时发送"; } else { this.db_fslx.Text = "手动发送"; } int month = 0, week = 0, quarter = 0; week = int.Parse(dt.Rows[0]["EveryWeekOne"].ToString2()); month = int.Parse(dt.Rows[0]["EveryMonthOne"].ToString2()); quarter = int.Parse(dt.Rows[0]["EveryQuarterOne"].ToString2()); if (week > 0) { this.db_fszq.Text = "每周发送一次,"; } if (month > 0) { this.db_fszq.Text += "每月发送一次,"; } if (quarter > 0) { this.db_fszq.Text += "每季度发送一次"; } this.db_fszq.Text = this.db_fszq.Text.TrimEnd(','); string jbnr = list.GetDataItem("Jbnr").ItemData; string jbnrNew = string.Copy(jbnr); List <SqlPara> sqls = WebCommon.ConvertSql(jbnr); if (sqls.Count > 0) { foreach (SqlPara item in sqls) { string str = BLL.ExecuteSql(item.executeSql); item.newStr = str; jbnrNew = jbnrNew.Replace(item.oldStr, item.newStr); } } this.db_Jbnr.Text = jbnrNew; dt = BLL.ReadSzgkjc_DxjbAndSjml(DxjbId).Result; if (dt.Rows.Count > 0) { string txt = ",", txt2 = ""; foreach (DataRow item in dt.Rows) { txt += item["SjmlID"] + ","; txt2 += item["SjmlName"] + "【" + item["sjmlMobile"] + "】,"; } this.db_fsdx.Text = txt2.Trim(new char[] { ',' }); } } }
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; } } }