예제 #1
0
        /// <summary>
        /// 获取人员TreeJson数据
        /// </summary>
        /// <returns></returns>
        public JsonResult GetDeptUserTree(string userids)
        {
            var checkUsers = new List <string>();   //已经选择的人员

            if (!string.IsNullOrEmpty(userids))
            {
                var splitUsers = userids.Split(',');
                checkUsers.AddRange(splitUsers.Where(splitUser => !string.IsNullOrEmpty(splitUser)));
            }

            var roleList        = new BaseDepartmentBll().GetAllDetachments(); //部门
            var userList        = new BaseUserBll().GetAllBaseUsers();         //人员
            var crmDeptEntities = roleList as BaseDepartmentEntity[] ?? roleList.ToArray();


            var topRole = new BaseCompanyBll().GetAllCompany();

            var result = (from crmRoleEntity in topRole
                          let childs = ChildTree(crmDeptEntities, crmRoleEntity.CompanyId.ToString(), userList, checkUsers)
                                       select new TreeNode()
            {
                id = crmRoleEntity.CompanyId,
                text = crmRoleEntity.FullName,
                img = "/Content/Images/Icon16/molecule.png",
                showcheck = true,
                isexpand = true,
                complete = true,
                hasChildren = childs.Count > 0,
                ChildNodes = childs
            }).ToList();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="oldpassword">旧密码</param>
        /// <param name="newpassword">新密码</param>
        /// <returns></returns>
        public bool ChangePassword(string userId, string oldpassword, string newpassword)
        {
            var isOk = false;

            try
            {
                var user = new BaseUserBll().Get(userId);
                if (user != null && !string.IsNullOrEmpty(user.Id))
                {
                    ////调用接口进行密码解密
                    //var passwordDecode = AppConfig.PasswordDecode;
                    //var responseWord = CommonMethod.SendRequestByGetMethod(string.Format(passwordDecode, user.Secretkey, oldpassword), System.Text.Encoding.UTF8);
                    var responseWord = DESHelper.ToDESEncrypt(oldpassword, AppConst.EncryptKey);  //将密码进行加密

                    //验证旧密码是否正确
                    if (user.PassWord.Equals(responseWord))
                    {
                        //responseWord = CommonMethod.SendRequestByGetMethod(string.Format(passwordDecode, user.Secretkey, newpassword), System.Text.Encoding.UTF8);

                        responseWord = DESHelper.ToDESEncrypt(newpassword, AppConst.EncryptKey);  //将密码进行加密
                        //修改密码
                        isOk = new BaseUserBll().UpdatePassWord(userId, responseWord);
                    }
                }
            }
            catch (Exception ex)
            {
                isOk = false;
            }
            return(isOk);
        }
예제 #3
0
        /// <summary>
        ///用户列表JSON
        /// </summary>
        /// <param name="keyword">模糊查询</param>
        /// <returns></returns>
        public ActionResult OptionUserJson(string keyword)
        {
            BaseUserBll   userBLL  = new BaseUserBll();
            DataTable     ListData = userBLL.OptionUserList(keyword);
            StringBuilder sb       = new StringBuilder();

            sb.Append("[");
            if (!DataHelper.IsExistRows(ListData))
            {
                foreach (DataRow item in ListData.Rows)
                {
                    sb.Append("{");
                    sb.Append("\"id\":\"" + item["userid"] + "\",");
                    sb.Append("\"text\":\"" + item["realname"] + "(" + item["account"] + ")\",");
                    sb.Append("\"account\":\"" + item["account"] + "\",");
                    sb.Append("\"code\":\"" + item["code"] + "\",");
                    sb.Append("\"realname\":\"" + item["realname"] + "\",");
                    string Genderimg = "user_female.png";
                    if (item["Gender"].ToString() == "男")
                    {
                        Genderimg = "user_green.png";
                    }
                    sb.Append("\"img\":\"/Content/Images/Icon16/" + Genderimg + "\",");
                    sb.Append("\"isexpand\":true,");
                    sb.Append("\"hasChildren\":false");
                    sb.Append("},");
                }
                sb = sb.Remove(sb.Length - 1, 1);
            }
            sb.Append("]");
            return(Content(sb.ToString()));
        }
예제 #4
0
        public string GetUserList(string context)
        {
            bool   Status  = false;
            var    msg     = "";
            object obj     = null;
            string results = "";

            try
            {
                var user = new BaseUserBll().GetAllUserNew();

                if (!string.IsNullOrEmpty(context))
                {
                    context  = Regex.Replace(context, @"[\{\}]", "");
                    context += ",";
                    var userId = Regex.Match(context, @"(?<=""UserId""\:"").*?(?="",)").Value;
                    user = user.Where(p => p.UserName == userId).ToList();
                }
                results += "[";

                for (int i = 0; i < user.Count; i++)
                {
                    results += "{\"UserId\":\"" + user[i].Id + "\",\"UserName\":\"" + user[i].UserName + "\"},";
                }
                results  = results.Substring(0, results.Length - 1);
                results += "]";


                Status = true;
                obj    = results;
            }
            catch (Exception ex)
            {
                Status = false;
                msg    = ex.Message;
            }

            var result = new StatusModel()
            {
                Status  = Status,
                msg     = msg,
                Content = obj
            };

            return(JsonConvert.SerializeObject(result));
        }
예제 #5
0
        /// <summary>
        /// 发送短信
        /// 添加人:周 鹏
        /// 添加时间:2015-07-08
        /// </summary>
        /// <history>
        /// 修改描述:时间+作者+描述
        /// </history>
        /// <param name="userId">UserId</param>
        /// <param name="msg">消息内容</param>
        /// <returns></returns>
        public void SendNote(string userId, string msg)
        {
            if (!AppConfig.IsEnableNote)
            {
                return;
            }
            if (string.IsNullOrEmpty(userId))
            {
                return;
            }
            var userEntity = new BaseUserBll().Get(userId);

            if (userEntity == null || string.IsNullOrEmpty(userEntity.Mobile) || userEntity.Mobile.Equals("&nbsp;"))
            {
                return;
            }

            if (userEntity.Mobile.Equals("13913573300"))    //高局的手机号发送给倪局
            {
                userEntity.Mobile = "18896729504";
            }

            ////2018.6.20 至 2018.06.27
            //if (userEntity.Mobile.Equals("18896729504") || userEntity.Mobile.Equals("18662590709"))
            //{
            //    return;
            //}

            if (!msg.Contains("null"))
            {
                var entity = new ComNoteEntity()
                {
                    Id           = Guid.NewGuid().ToString(),
                    ResourcesId  = "",
                    ReceivePhone = userEntity.Mobile,
                    MistakeInfo  = msg,
                    ReceiveTime  = DateTime.Now,
                    Status       = 0,
                    RowStatus    = 1
                };
                Add(entity);
            }
        }