Пример #1
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Add(YJ_DCSMS_TMP_Model m)
        {
            if (string.IsNullOrEmpty(m.ORDERBY) == true)
            {
                m.ORDERBY = "0";
            }
            if (string.IsNullOrEmpty(m.ISENABLE) == true)
            {
                m.ISENABLE = "0";
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("INSERT INTO  YJ_DCSMS_TMP( SMSGROUPNAME, SMSGROUPTYPE, DANGERCLASS, TMPCONTENT,SMSSENDUSERLIST, ORDERBY, ISENABLE)");
            sb.AppendFormat("VALUES(");
            sb.AppendFormat("'{0}'", ClsSql.EncodeSql(m.SMSGROUPNAME));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.SMSGROUPTYPE));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.DANGERCLASS));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.TMPCONTENT));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.SMSSENDUSERLIST));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.ORDERBY));
            sb.AppendFormat(",'{0}'", ClsSql.EncodeSql(m.ISENABLE));

            sb.AppendFormat(")");
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "添加成功!", ""));
            }
            else
            {
                return(new Message(false, "添加失败,请检查各输入框是否正确!", ""));
            }
        }
Пример #2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message MdyISENABLE(YJ_DCSMS_TMP_Model m)
        {
            if (string.IsNullOrEmpty(m.YJ_DCSMS_TMPID))
            {
                return(new Message(false, "修改失败,请选择要修改的记录!", ""));
            }
            StringBuilder sb = new StringBuilder();

            //HID, HNAME, SN, PHONE, SEX, BIRTH, ONSTATE, BYORGNO
            sb.AppendFormat("UPDATE YJ_DCSMS_TMP");
            sb.AppendFormat(" set ");
            sb.AppendFormat(" ISENABLE='{0}'", ClsSql.EncodeSql(m.ISENABLE));


            sb.AppendFormat(" where YJ_DCSMS_TMPID in ({0})", ClsSql.EncodeSql(m.YJ_DCSMS_TMPID));
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "修改成功!", ""));
            }
            else
            {
                return(new Message(false, "修改失败,请检查各输入框是否正确!", ""));
            }
        }
Пример #3
0
 /// <summary>
 /// 增、删、改
 /// </summary>
 /// <param name="m">参见模型</param>
 /// <returns>参见模型</returns>
 public static Message Manager(YJ_DCSMS_TMP_Model m)
 {
     if (m.opMethod == "Add")
     {
         //SystemCls.LogSave("3", "通知公告:" + m.INFOTITLE, ClsStr.getModelContent(m));
         Message msgUser = BaseDT.YJ_DCSMS_TMP.Add(m);
         return(new Message(msgUser.Success, msgUser.Msg, m.returnUrl));
     }
     if (m.opMethod == "Mdy")
     {
         //SystemCls.LogSave("4", "通知公告:" + m.INFOTITLE, ClsStr.getModelContent(m));
         Message msgUser = BaseDT.YJ_DCSMS_TMP.Mdy(m);
         if (msgUser.Success == true)
         {
             //获取模板tid
             var smstemplate = getModel(new YJ_DCSMS_TMP_SW {
                 YJ_DCSMS_TMPID = m.YJ_DCSMS_TMPID
             });
             if (smstemplate != null)
             {
                 string content = m.TMPCONTENT.Replace("[num]", "@").Replace("[cityconty]", "@");
                 string tid     = smstemplate.TID;//选出你要修改记录的数据model.tid
                 if (string.IsNullOrEmpty(tid))
                 {
                     var sm = SmsHelp.SmsCom.SmsTemplateModify(content, "", "operate_templet");
                     if (sm.Success == true)
                     {
                         m.TID   = sm.Msg.Trim();
                         msgUser = BaseDT.YJ_DCSMS_TMP.Mdy(m);
                     }
                 }
                 else
                 {
                     var sm = SmsHelp.SmsCom.SmsTemplateModify(content, tid, "operate_templet");
                 }
             }
         }
         return(new Message(msgUser.Success, msgUser.Msg, m.returnUrl));
     }
     if (m.opMethod == "MdyISENABLE")
     {
         //SystemCls.LogSave("3", "通知公告:" + m.INFOTITLE, ClsStr.getModelContent(m));
         Message msgUser = BaseDT.YJ_DCSMS_TMP.MdyISENABLE(m);
         return(new Message(msgUser.Success, msgUser.Msg, m.returnUrl));
     }
     if (m.opMethod == "Del")
     {
         //SystemCls.LogSave("5", "通知公告:" + m.INFOTITLE, ClsStr.getModelContent(m));
         Message msgUser = BaseDT.YJ_DCSMS_TMP.Del(m);
         return(new Message(msgUser.Success, msgUser.Msg, m.returnUrl));
     }
     return(new Message(false, "无效操作", ""));
 }
Пример #4
0
        /// <summary>
        /// 模板列表
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static IEnumerable <YJ_DCSMS_TMP_Model> GetListModel(YJ_DCSMS_TMP_SW sw)
        {
            var       result      = new List <YJ_DCSMS_TMP_Model>();
            DataTable dt          = BaseDT.YJ_DCSMS_TMP.getDT(sw);//获取模板
            DataTable dtFIRELEVEL = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "24"
            });                                                                                     //预案

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                YJ_DCSMS_TMP_Model m = new YJ_DCSMS_TMP_Model();
                m.YJ_DCSMS_TMPID  = dt.Rows[i]["YJ_DCSMS_TMPID"].ToString();
                m.SMSGROUPNAME    = dt.Rows[i]["SMSGROUPNAME"].ToString();
                m.SMSGROUPTYPE    = dt.Rows[i]["SMSGROUPTYPE"].ToString();
                m.SMSSENDUSERLIST = dt.Rows[i]["SMSSENDUSERLIST"].ToString();
                m.TMPCONTENT      = dt.Rows[i]["TMPCONTENT"].ToString();
                m.DANGERCLASS     = dt.Rows[i]["DANGERCLASS"].ToString();
                m.ORDERBY         = dt.Rows[i]["ORDERBY"].ToString();
                m.ISENABLE        = dt.Rows[i]["ISENABLE"].ToString();
                m.TID             = dt.Rows[i]["TID"] == null ? "" : dt.Rows[i]["TID"].ToString();
                m.ISENABLEName    = (m.ISENABLE == "1") ? "启用" : "未启用";

                if (m.SMSGROUPTYPE == "0")
                {
                    m.SMSGROUPTYPEName = "通讯录";
                }
                else if (m.SMSGROUPTYPE == "1")
                {
                    m.SMSGROUPTYPEName = "值班员";
                }
                else if (m.SMSGROUPTYPE == "2")
                {
                    m.SMSGROUPTYPEName = "护林员";
                }
                else
                {
                    m.SMSGROUPTYPEName = "设置错误";
                }
                m.FIRELEVELName = BaseDT.T_SYS_DICT.getName(dtFIRELEVEL, m.DANGERCLASS);
                m.dicModel      = T_SYS_DICTCls.getModel(new T_SYS_DICTSW {
                    DICTTYPEID = "24", DICTVALUE = m.DANGERCLASS
                });
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            dtFIRELEVEL.Clear();
            dtFIRELEVEL.Dispose();
            return(result);
        }
Пример #5
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Mdy(YJ_DCSMS_TMP_Model m)
        {
            //if (string.IsNullOrEmpty(m.ORDERBY) == true)
            //    m.ORDERBY = "0";
            //if (string.IsNullOrEmpty(m.ISENABLE) == true)
            //    m.ISENABLE = "0";
            StringBuilder sb = new StringBuilder();

            //HID, HNAME, SN, PHONE, SEX, BIRTH, ONSTATE, BYORGNO
            sb.AppendFormat("UPDATE YJ_DCSMS_TMP");
            sb.AppendFormat(" set ");
            sb.AppendFormat("TMPCONTENT='{0}'", ClsSql.EncodeSql(m.TMPCONTENT));
            sb.AppendFormat(",SMSSENDUSERLIST='{0}'", ClsSql.EncodeSql(m.SMSSENDUSERLIST));
            if (string.IsNullOrEmpty(m.SMSGROUPNAME) == false)
            {
                sb.AppendFormat(",SMSGROUPNAME='{0}'", ClsSql.EncodeSql(m.SMSGROUPNAME));
            }
            if (string.IsNullOrEmpty(m.SMSGROUPTYPE) == false)
            {
                sb.AppendFormat(",SMSGROUPTYPE='{0}'", ClsSql.EncodeSql(m.SMSGROUPTYPE));
            }
            if (string.IsNullOrEmpty(m.DANGERCLASS) == false)
            {
                sb.AppendFormat(",DANGERCLASS='{0}'", ClsSql.EncodeSql(m.DANGERCLASS));
            }
            if (string.IsNullOrEmpty(m.ORDERBY) == false)
            {
                sb.AppendFormat(",ORDERBY='{0}'", ClsSql.EncodeSql(m.ORDERBY));
            }
            if (string.IsNullOrEmpty(m.ISENABLE) == false)
            {
                sb.AppendFormat(",ISENABLE='{0}'", ClsSql.EncodeSql(m.ISENABLE));
            }
            if (string.IsNullOrEmpty(m.TID) == false)
            {
                sb.AppendFormat(",TID='{0}'", ClsSql.EncodeSql(m.TID));
            }

            sb.AppendFormat(" where YJ_DCSMS_TMPID= '{0}'", ClsSql.EncodeSql(m.YJ_DCSMS_TMPID));
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "修改成功!", ""));
            }
            else
            {
                return(new Message(false, "修改失败,请检查各输入框是否正确!", ""));
            }
        }
Пример #6
0
        /// <summary>
        /// 根据查询条件获取某一条用户信息记录,用于修改、删除、用户登录验证
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>参见模型</returns>
        public static YJ_DCSMS_TMP_Model getModel(YJ_DCSMS_TMP_SW sw)
        {
            var result = new List <YJ_DCSMS_TMP_Model>();

            DataTable dt = BaseDT.YJ_DCSMS_TMP.getDT(sw);//列表

            YJ_DCSMS_TMP_Model m = new YJ_DCSMS_TMP_Model();

            DataTable dtFIRELEVEL = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW {
                DICTTYPEID = "22"
            });                                                                                     //预案

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.YJ_DCSMS_TMPID  = dt.Rows[i]["YJ_DCSMS_TMPID"].ToString();
                m.SMSGROUPNAME    = dt.Rows[i]["SMSGROUPNAME"].ToString();
                m.SMSGROUPTYPE    = dt.Rows[i]["SMSGROUPTYPE"].ToString();
                m.SMSSENDUSERLIST = dt.Rows[i]["SMSSENDUSERLIST"].ToString();
                m.TMPCONTENT      = dt.Rows[i]["TMPCONTENT"].ToString();
                m.DANGERCLASS     = dt.Rows[i]["DANGERCLASS"].ToString();
                m.ORDERBY         = dt.Rows[i]["ORDERBY"].ToString();
                m.ISENABLE        = dt.Rows[i]["ISENABLE"].ToString();
                m.TID             = dt.Rows[i]["TID"] == null ? "" : dt.Rows[i]["TID"].ToString();
                m.ISENABLEName    = (m.ISENABLE == "1") ? "启用" : "未启用";
                if (m.SMSGROUPTYPE == "0")
                {
                    m.SMSGROUPTYPEName = "通讯录";
                }
                else if (m.SMSGROUPTYPE == "1")
                {
                    m.SMSGROUPTYPEName = "值班员";
                }
                else if (m.SMSGROUPTYPE == "2")
                {
                    m.SMSGROUPTYPEName = "护林员";
                }
                else
                {
                    m.SMSGROUPTYPEName = "设置错误";
                }
                m.FIRELEVELName = BaseDT.T_SYS_DICT.getName(dtFIRELEVEL, m.DANGERCLASS);
            }
            dt.Clear();
            dt.Dispose();
            dtFIRELEVEL.Clear();
            dtFIRELEVEL.Dispose();
            return(m);
        }
Пример #7
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="m">参见模型</param>
        /// <returns>参见模型</returns>
        public static Message Del(YJ_DCSMS_TMP_Model m)
        {
            if (string.IsNullOrEmpty(m.YJ_DCSMS_TMPID))
            {
                return(new Message(false, "删除失败,请选择要删除的记录!", ""));
            }
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("delete YJ_DCSMS_TMP");
            sb.AppendFormat(" where YJ_DCSMS_TMPID in({0})", ClsSql.EncodeSql(m.YJ_DCSMS_TMPID));
            bool bln = DataBaseClass.ExeSql(sb.ToString());

            if (bln == true)
            {
                return(new Message(true, "删除成功!", ""));
            }
            else
            {
                return(new Message(false, "删除失败,请检查各输入框是否正确!", ""));
            }
        }