Example #1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Insert(Entities.ConsultSolveUserMapping model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",          SqlDbType.Int,      4),
                new SqlParameter("@TemplateID",     SqlDbType.Int,      4),
                new SqlParameter("@SolveUserEID",   SqlDbType.Int,      4),
                new SqlParameter("@SolveUserID",    SqlDbType.Int,      4),
                new SqlParameter("@SolveUserEName", SqlDbType.VarChar),
                new SqlParameter("@CreateUserID",   SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.TemplateID;
            parameters[2].Value     = model.SolveUserEID;
            parameters[3].Value     = model.SolveUserID;
            parameters[4].Value     = model.SolveUserEName;
            parameters[5].Value     = model.CreateUserID;

            SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_CONSULTSOLVEUSERMAPPING_INSERT, parameters);
            return((int)parameters[0].Value);
        }
        protected void Bt_SubClick(object sender, EventArgs e)
        {
            Entities.TemplateInfo template = new Entities.TemplateInfo();

            if (Request["hiddenFile"].ToString() == "0")
            {
                Response.Write("<script> alert('请选择模板分类!') </script>");
                return;
            }
            else
            {
                template.TCID = Convert.ToInt32(Request["hiddenFile"]);
            }

            if (Request["TemplateTile"].ToString() == "")
            {
                Response.Write("<script> alert('请输入模板标题!') </script>");
                return;
            }
            else
            {
                template.Title = Request["TemplateTile"].ToString();
            }
            if (Request["TemplateCon"].ToString() == "")
            {
                Response.Write("<script> alert('请输入文本内容!') </script>");
                return;
            }
            else
            {
                template.Content = Request["TemplateCon"].ToString();
            }
            if (Request["type"].ToString() == "2")
            {//邮件
                Response.Write("<script> alert('邮件!') </script>");
                if (Request["PersonsGetEmailIN"].ToString() == "")
                {
                    Response.Write("<script> alert('请填写邮件接收人!') </script>");
                    return;
                }
            }
            else if (Request["type"].ToString() == "1")
            {//短信
                Response.Write("<script> alert('短信!') </script>");
            }

            template.CreateUserID = 0;
            template.CreateTime   = DateTime.Now;
            template.ReplaceTag   = "-";
            template.Status       = 0;
            //模板写入
            int templateID = BLL.TemplateInfo.Instance.Insert(template);

            //收件人写入
            if (Request["type"].ToString() == "2")
            {
                string[] userIDArr = Request["PersonsGetEmailIN"].ToString().Split(',');
                foreach (string userID in userIDArr)
                {
                    string sqlStr =
                        "insert into ConsultSolveUserMapping TemplateID,SolveUserEID values("
                        + templateID.ToString() + "," + userID + ");";
                    Entities.ConsultSolveUserMapping map = new Entities.ConsultSolveUserMapping();
                    map.CreateUserID   = 100;//创建者
                    map.SolveUserEID   = Convert.ToInt32(userID);
                    map.TemplateID     = templateID;
                    map.SolveUserEName = "";
                    BLL.ConsultSolveUserMapping.Instance.Insert(map);
                }
            }
            Response.Write("<script> alert('添加成功!'); </script>");
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Entities.ConsultSolveUserMapping model)
 {
     return(Dal.ConsultSolveUserMapping.Instance.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Insert(Entities.ConsultSolveUserMapping model)
 {
     return(Dal.ConsultSolveUserMapping.Instance.Insert(model));
 }
Example #5
0
        public void ProcessRequest(HttpContext context)
        {
            BitAuto.YanFa.SysRightManager.Common.UserInfo.Check();

            context.Response.ContentType = "text/plain";
            string recID    = HttpContext.Current.Request["RecID"].ToString();
            string type     = HttpContext.Current.Request["Type"].ToString();
            string userIDs  = HttpContext.Current.Request["Persion"].ToString();
            string tcID     = HttpContext.Current.Request["TCID"].ToString();
            string title    = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request["Title"].ToString());
            string con      = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request["Con"].ToString());
            string userName = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request["PersionName"].ToString());

            Entities.TemplateInfo template = new Entities.TemplateInfo();
            template.RecID        = Convert.ToInt32(recID);
            template.TCID         = Convert.ToInt32(tcID);
            template.Title        = title;
            template.Content      = con;
            template.CreateUserID = 100;
            template.CreateTime   = DateTime.Now;
            template.ReplaceTag   = "-";
            template.Status       = 0;

            if (BLL.TemplateInfo.Instance.IsExistNotThisRecID(int.Parse(recID), (int)template.TCID, template.Title))
            {
                context.Response.Write("repeated");
            }
            else
            {
                DataTable dt = new DataTable();
                Entities.QueryTemplateInfo query = new Entities.QueryTemplateInfo();
                query.TCID = template.TCID;
                int totle = 0;
                dt = BLL.TemplateInfo.Instance.GetTemplateInfo(query, "", 1, 10, out totle);
                Entities.TemplateInfo templateOri = BLL.TemplateInfo.Instance.GetTemplateInfo(template.RecID);
                #region 邮件接收人
                DataTable dtEmailServersOri  = BLL.TemplateInfo.Instance.getEmailServers(template.RecID);
                string    strEmailServersOri = "";
                if (dtEmailServersOri != null && dt.Rows.Count > 0)
                {
                    int intVal = 0;
                    foreach (DataRow drEmailServers in dtEmailServersOri.Rows)
                    {
                        if (int.TryParse(drEmailServers["UserID"].ToString(), out intVal))
                        {
                            strEmailServersOri += BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(intVal) + ",";
                        }
                    }
                    if (strEmailServersOri.ToString().Length > 0)
                    {
                        strEmailServersOri = strEmailServersOri.ToString().Substring(0, strEmailServersOri.ToString().Length - 1);
                    }
                }
                #endregion
                //模板写入
                int templateID = BLL.TemplateInfo.Instance.Update(template);

                //收件人写入
                if (type == "2")
                {
                    //清空原有
                    BLL.TemplateInfo.Instance.ClearUser(template.RecID);
                    string[] userIDArr   = userIDs.Split(',');
                    string[] userNameArr = userName.Split(',');
                    int      length      = userIDArr.Length;
                    for (int i = 0; i < length; i++)
                    {
                        Entities.ConsultSolveUserMapping map = new Entities.ConsultSolveUserMapping();
                        map.CreateUserID   = BLL.Util.GetLoginUserID();//创建者
                        map.SolveUserEID   = Convert.ToInt32(userIDArr[i]);
                        map.TemplateID     = template.RecID;
                        map.SolveUserEName = userNameArr[i];
                        BLL.ConsultSolveUserMapping.Instance.Insert(map);
                    }
                }
                context.Response.Write("success");

                string userLog = "【修改】模板。";
                if (template.Title != templateOri.Title)
                {
                    userLog += "模板标题“" + templateOri.Title + "”改为“" + template.Title + "”;";
                }
                if (template.Content != templateOri.Content)
                {
                    userLog += "模板内容“" + templateOri.Content + "”改为“" + template.Content + "”;";
                }
                if (template.TCID != templateOri.TCID)
                {
                    userLog += "模板分类“"
                               + BLL.TemplateCategory.Instance.GetTemplateCategory(Convert.ToInt32(template.TCID)).Name
                               + "”改为“" + BLL.TemplateCategory.Instance.GetTemplateCategory(Convert.ToInt32(templateOri.TCID)).Name + "”;";
                }
                #region 邮件接收人
                DataTable dtEmailServers  = BLL.TemplateInfo.Instance.getEmailServers(template.RecID);
                string    strEmailServers = "";
                if (dtEmailServers != null && dt.Rows.Count > 0)
                {
                    int intVal = 0;
                    foreach (DataRow drEmailServers in dtEmailServers.Rows)
                    {
                        if (int.TryParse(drEmailServers["UserID"].ToString(), out intVal))
                        {
                            strEmailServers += BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(intVal) + ",";
                        }
                    }
                    if (strEmailServers.ToString().Length > 0)
                    {
                        strEmailServers += strEmailServers.ToString().Substring(0, strEmailServers.ToString().Length - 1);
                    }
                }
                #endregion

                if (strEmailServers != strEmailServersOri)
                {
                    userLog += "邮件接收人“" + strEmailServers + "”改为“" + strEmailServersOri + "”";
                }

                BLL.Util.InsertUserLog("【修改】模板\"" + title + "\"(ID:"
                                       + template.RecID.ToString() + ")。修改者:"
                                       + BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(BLL.Util.GetLoginUserID()));
            }
        }