Пример #1
0
        private Entities.SMSTemplate LoadSingleSMSTemplate(DataRow row)
        {
            Entities.SMSTemplate model = new Entities.SMSTemplate();

            if (row["RecID"].ToString() != "")
            {
                model.RecID = int.Parse(row["RecID"].ToString());
            }
            if (row["BGID"].ToString() != "")
            {
                model.BGID = int.Parse(row["BGID"].ToString());
            }
            if (row["SCID"].ToString() != "")
            {
                model.SCID = int.Parse(row["SCID"].ToString());
            }
            model.Title   = row["Title"].ToString();
            model.Content = row["Content"].ToString();
            if (row["Status"].ToString() != "")
            {
                model.Status = int.Parse(row["Status"].ToString());
            }
            if (row["CreateTime"].ToString() != "")
            {
                model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
            }
            if (row["CreateUserID"].ToString() != "")
            {
                model.CreateUserID = int.Parse(row["CreateUserID"].ToString());
            }
            return(model);
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int userID = BLL.Util.GetLoginUserID();
                if (!BLL.Util.CheckRight(userID, "SYS024MOD510401") && !BLL.Util.CheckRight(userID, "SYS024MOD510402"))
                {
                    Response.Write(BLL.Util.GetNotAccessMsgPage("您没有访问该页面的权限"));
                    Response.End();
                }

                if (!string.IsNullOrEmpty(RequestRecID))
                {
                    int _recid = 0;
                    if (int.TryParse(RequestRecID, out _recid))
                    {
                        Entities.SMSTemplate model = BLL.SMSTemplate.Instance.GetSMSTemplate(_recid);
                        BGID       = model.BGID.ToString();
                        SCID       = model.SCID.ToString();
                        smstitle   = model.Title;
                        smscontent = model.Content;
                    }
                }
            }
        }
Пример #3
0
 /// <summary>
 /// 根据分类ID获取短信模板
 /// </summary>
 /// <param name="msg"></param>
 private void GetSMSTemplateByRecID(out string msg)
 {
     msg = string.Empty;
     try
     {
         int recid = -1;
         if (int.TryParse(TemplateID, out recid))
         {
             Entities.SMSTemplate model = BLL.SMSTemplate.Instance.GetSMSTemplate(recid);
             if (model != null)
             {
                 msg = model.Content;
             }
         }
     }
     catch (Exception ex)
     {
         msg = ex.Message;
     }
 }
Пример #4
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(SqlTransaction sqltran, Entities.SMSTemplate model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",        SqlDbType.Int,         4),
                new SqlParameter("@BGID",         SqlDbType.Int,         4),
                new SqlParameter("@SCID",         SqlDbType.Int,         4),
                new SqlParameter("@Title",        SqlDbType.NVarChar,  100),
                new SqlParameter("@Content",      SqlDbType.NVarChar,  500),
                new SqlParameter("@Status",       SqlDbType.Int,         4),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.RecID;
            parameters[1].Value = model.BGID;
            parameters[2].Value = model.SCID;
            parameters[3].Value = model.Title;
            parameters[4].Value = model.Content;
            parameters[5].Value = model.Status;
            parameters[6].Value = model.CreateTime;
            parameters[7].Value = model.CreateUserID;

            return(SqlHelper.ExecuteNonQuery(sqltran, CommandType.StoredProcedure, P_SMSTEMPLATE_UPDATE, parameters));
        }
Пример #5
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public void Insert(Entities.SMSTemplate model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",        SqlDbType.Int,         4),
                new SqlParameter("@BGID",         SqlDbType.Int,         4),
                new SqlParameter("@SCID",         SqlDbType.Int,         4),
                new SqlParameter("@Title",        SqlDbType.NVarChar,  100),
                new SqlParameter("@Content",      SqlDbType.NVarChar,  500),
                new SqlParameter("@Status",       SqlDbType.Int,         4),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.BGID;
            parameters[2].Value     = model.SCID;
            parameters[3].Value     = model.Title;
            parameters[4].Value     = model.Content;
            parameters[5].Value     = model.Status;
            parameters[6].Value     = model.CreateTime;
            parameters[7].Value     = model.CreateUserID;

            SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_SMSTEMPLATE_INSERT, parameters);
        }
Пример #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Insert(Entities.SMSTemplate model)
 {
     Dal.SMSTemplate.Instance.Insert(model);
 }
Пример #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(SqlTransaction sqltran, Entities.SMSTemplate model)
 {
     return(Dal.SMSTemplate.Instance.Update(sqltran, model));
 }
Пример #8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Entities.SMSTemplate model)
 {
     return(Dal.SMSTemplate.Instance.Update(model));
 }
Пример #9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Insert(SqlTransaction sqltran, Entities.SMSTemplate model)
 {
     Dal.SMSTemplate.Instance.Insert(sqltran, model);
 }
        //新增,编辑
        private void EditTemplate(out string msg)
        {
            msg = string.Empty;
            bool flag = false;

            flag = IsCheck(out msg);

            if (flag)
            {
                Entities.SMSTemplate templatemodel = new Entities.SMSTemplate();
                templatemodel.Content = RequestContent;
                int _bgid = 0;
                int.TryParse(RequestBGID, out _bgid);
                templatemodel.BGID = _bgid;
                int _scid = 0;
                int.TryParse(RequestSCID, out _scid);
                templatemodel.SCID    = _scid;
                templatemodel.Title   = RequestSMSTitle;
                templatemodel.Content = RequestContent;
                templatemodel.Status  = 0;
                if (string.IsNullOrEmpty(RequestRecID))
                {
                    try
                    {
                        templatemodel.CreateTime   = System.DateTime.Now;
                        templatemodel.CreateUserID = userid;
                        BLL.SMSTemplate.Instance.Insert(templatemodel);

                        string loginfo = "新增短信模板,模板分组为 " + templatemodel.BGID + ",模板分类为 " + templatemodel.SCID + ",标题为 " + templatemodel.Title + ",内容为 " + templatemodel.Content;
                        BLL.Util.InsertUserLog(loginfo);
                    }
                    catch (Exception ex)
                    {
                        msg = "result:'false',msg:'执行出现异常,操作失败!'";
                        return;
                    }
                }
                else
                {
                    int _recID;
                    if (!int.TryParse(RequestRecID, out _recID))
                    {
                        msg = "result:'false',msg:'未找到主键,操作失败!'";
                        return;
                    }
                    templatemodel.RecID = _recID;
                    try
                    {
                        Entities.SMSTemplate oldmodel = BLL.SMSTemplate.Instance.GetSMSTemplate(_recID);
                        templatemodel.CreateUserID = oldmodel.CreateUserID;
                        templatemodel.CreateTime   = oldmodel.CreateTime;

                        BLL.SMSTemplate.Instance.Update(templatemodel);
                        string loginfo = "修改短信模板,短信模板主键为 " + templatemodel.RecID + ",修改后模板分组为 " + templatemodel.BGID + ",模板分类为 " + templatemodel.SCID + ",标题为 " + templatemodel.Title + ",内容为 " + templatemodel.Content;
                        BLL.Util.InsertUserLog(loginfo);
                    }
                    catch (Exception ex)
                    {
                        msg = "result:'false',msg:'执行出现异常,操作失败!'";
                        return;
                    }
                }
                msg = "result:'true'";
            }
        }