Exemplo n.º 1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ManagerInfo model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.manager model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string Add(Model.manager model, Model.manager manager)
        {
            if (model.role_id == 0)
            {
                return("请选择用户角色");
            }
            if (string.IsNullOrEmpty(model.user_name))
            {
                return("用户名不能为空");
            }
            if (Exists(model.user_name))
            {
                return("用户名已经存在");
            }
            if (string.IsNullOrEmpty(model.password))
            {
                return("密码不能为空");
            }
            if (string.IsNullOrEmpty(model.real_name))
            {
                return("姓名不能为空");
            }
            if (string.IsNullOrEmpty(model.telephone))
            {
                return("电话不能为空");
            }
            if (model.departID == 0)
            {
                return("岗位不能为空");
            }
            Model.department de = new BLL.department().GetModel(model.departID);
            if (de == null)
            {
                return("岗位不存在");
            }
            if (de.de_type != 3)
            {
                return("请选择到岗位级别");
            }
            model.area      = de.de_area;
            model.user_name = model.user_name.ToUpper();
            model.area      = model.area.ToUpper();
            int    id     = 0;
            string result = dal.Add(model, out id);

            if (string.IsNullOrEmpty(result))
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("用户名:" + model.user_name + "<br/>");
                sb.Append("管理角色:" + model.role_id + "<br/>");
                sb.Append("姓名:" + model.real_name + "<br/>");
                sb.Append("邮箱:" + model.email + "<br/>");
                sb.Append("电话:" + model.telephone + "<br/>");
                sb.Append("岗位:" + model.departTree + "<br/>");
                sb.Append("区域:" + model.area + "<br/>");
                Model.business_log logmodel = new Model.business_log();
                logmodel.ol_relateID    = id;
                logmodel.ol_title       = "添加用户";
                logmodel.ol_content     = sb.ToString();
                logmodel.ol_operateDate = DateTime.Now;
                new business_log().Add(DTEnums.ActionEnum.Add.ToString(), logmodel, manager.user_name, manager.real_name);
                return("");
            }
            return(result);
        }