示例#1
0
 public popupEmployee()
 {
     this.components = null;
     base();
     this.InitializeComponent();
     this._employeeBll = new EmployeeBll();
 }
示例#2
0
        public ActionResult Login(string account, string pwd)
        {
            bool   success = false;
            string msg     = "";

            EmployeeBll employeeBll = new EmployeeBll();

            DtoEmployee     employee = employeeBll.Login(account, pwd);
            CookieUserModel user     = null;

            if (employee != null)
            {
                success         = true;
                msg             = "登录成功";
                user            = new CookieUserModel();
                user.UserId     = employee.Bem_Id;
                user.UserName   = employee.Bem_Name;
                user.RoleId     = employee.Bro_Id;
                user.RoleName   = employee.Bro_Name;
                user.Grades     = employee.Bem_Grades;
                user.GradesList = CustomEnumHelper.ParseBinaryAnd(typeof(GradeEnum), employee.Bem_Grades).Keys.ToList();
            }
            else
            {
                msg = "登录失败";
            }
            LoginCookieHelper.SetCurrentUser(user);

            return(Json(new JsonSimpleResponse()
            {
                State = success, ErrorMsg = msg
            }));
        }
示例#3
0
 //pmId文本框改变时
 private void txtPMId_TextChanged(object sender, EventArgs e)
 {
     txtPMId.Tag = null;
     listBoxEmpData.Items.Clear();
     if (txtPMId.Text != string.Empty)
     {
         listBoxEmpData.Visible       = true;
         this.listBoxEmpData.Location = new Point(txtPMId.Location.X, txtPMId.Location.Y + 22);
         EmployeeBll empBll = new EmployeeBll();
         var         data   = empBll.QueryLikeThis(txtPMId.Text);
         if (data != null)
         {
             foreach (var item in data)
             {
                 listBoxEmpData.Items.Add(item.Id + "_" + item.Name);
             }
         }
         else
         {
             listBoxEmpData.Visible = false;
         }
     }
     else
     {
         listBoxEmpData.Visible = false;
     }
 }
示例#4
0
文件: BpmBll.cs 项目: sanxchen/MntApp
        /// <summary>
        /// 添加加签,加签在后不发
        /// </summary>
        /// <param name="addSignerEmpNo"></param>
        /// <param name="direct"></param>
        /// <returns></returns>
        public void AddSigner(string addSignerEmpNo, int direct)
        {
            if (base.Form.BaseEmployee.Email == null)
            {
                return;
            }
            if (direct != (int)FormSign.DirectEnum.Befor && direct != (int)FormSign.DirectEnum.Parallel)
            {
                return;
            }

            var addSignerEmployee = new EmployeeBll().Single(addSignerEmpNo);

            base.ListArgs.Add(new EmailFormEventArgs()
            {
                To = new Dictionary <string, string> {
                    { addSignerEmployee.Email, addSignerEmployee.Account }
                },
                Subject  = "表单签核通知【加签】[" + base.Form.FormType.FormName + "]",
                NickName = addSignerEmployee.Account,
                Title    = "表单签核通知【加签】[" + base.Form.FormType.FormName + "]",
                From     = "MINICUT",
                Content  = "<p>系统中有一张由审核人<b> " + base.Emp.Account + "</b> 加签给您的表单;</p><p>表单号为:" + base.Form.FormNo + ";</p>",
                Date     = DateTime.Now,
                Link     = $"进入系统处理表单<a href='{HostUrl}{"/eForm/Signing/Index"}' >进入系统</a>"
            });
        }
示例#5
0
        private static void BatchDeleteEmployee()
        {
            try
            {
                BatchDeleteEmployee model = new Model.BatchDeleteEmployee();

                List <string> list = new List <string>();
                list.Add("landonzeng");
                list.Add("landon");
                model.useridlist = list;

                string param = model.ToJson();

                Result Result = EmployeeBll.BatchDelete(param);
                if (Result != null)
                {
                    if (Result.errcode == "0")
                    {
                        Console.Write("删除成功," + Result.errmsg);
                    }
                    else
                    {
                        Console.Write(Result.errmsg);
                    }
                }
                else
                {
                    Console.Write("无返回数据");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
示例#6
0
        /// <summary>
        /// 将id部门下的人员转到parentid部门下
        /// </summary>
        /// <param name="id"></param>
        /// <param name="parentid"></param>
        private static void DepartmentUserMove(string id, int parentid)
        {
            GetDepartmentList DepartmentList = DepartmentBll.GetList();

            var dddd = DepartmentList.department.Where(e => e.id.Equals(id)).ToList().FirstOrDefault();

            if (dddd != null)
            {
                //钉钉中存在该部门,检查该部门下是否有人,没人的并且重复的部门删除钉钉中该部门,并且删除钉钉关系表和钉钉树关系表
                GetDepartmentForUserList UserList = DepartmentBll.GetByDepartmentIdForUserInfoList(dddd.id);
                Console.Write("\n" + dddd.name + " DD_ID=" + dddd.id + ",其下共有" + UserList.userlist.Count + "个人!\r\n");
                foreach (var Useritem in UserList.userlist)
                {
                    string         EmployeeJson = EmployeeForDingTalkBll.GetEmployee(Useritem.userid);
                    EmployeeEntity Emodel       = JsonHelper.JsonToModel <EmployeeEntity>(EmployeeJson);
                    Emodel.department = new List <int>()
                    {
                        parentid
                    };
                    string param = Emodel.ToJson();

                    Result uResult = EmployeeBll.Update(param);
                    if (uResult.errcode != "0")
                    {
                        Console.Write("\r\n" + uResult.errmsg + "\r\n");
                    }
                }
            }
        }
示例#7
0
        //private static void UpdateEmployee()
        //{
        //    try
        //    {
        //        string EmployeeJson = GetEmployee("016630184325983798");
        //        EmployeeEntity model = Newtonsoft.Json.JsonConvert.DeserializeObject<EmployeeEntity>(EmployeeJson);

        //        model.remark = "测试";
        //        model.email = "*****@*****.**";

        //        string param = model.ToJson();

        //        Result Result = EmployeeBll.Update(param);
        //        if (Result != null)
        //        {
        //            if (Result.errcode == "0")
        //            {
        //                Console.Write("更新成功," + Result.errmsg);
        //            }
        //            else
        //            {
        //                Console.Write(Result.errmsg);
        //            }
        //        }
        //        else
        //        {
        //            Console.Write("无返回数据");
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.Write(ex.Message);
        //    }
        //}

        private static void DeleteEmployee()
        {
            try
            {
                Result Result = EmployeeBll.Delete("landon1");
                if (Result != null)
                {
                    if (Result.errcode == "0")
                    {
                        Console.Write("更新成功," + Result.errmsg);
                    }
                    else
                    {
                        Console.Write(Result.errmsg);
                    }
                }
                else
                {
                    Console.Write("无返回数据");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
示例#8
0
        private void listBoxPro_SelectedIndexChanged(object sender, EventArgs e)
        {
            EPRelationBll eprBll = new EPRelationBll();
            EmployeeBll   empBll = new EmployeeBll();

            lblProName.Text = listBoxPro.SelectedItem.ToString();
            listBoxEmp.Items.Clear();
            listBoxOtherEmp.Items.Clear();

            //显示PL,PM
            var pro = eprBll.QueryProByName(listBoxPro.SelectedItem.ToString());

            lblPL.Text = pro.PLId + "   " + empBll.QueryById(pro.PLId).Name;
            lblPM.Text = pro.PMId + "   " + empBll.QueryById(pro.PMId).Name;

            var proEmp   = eprBll.QueryProEmp(listBoxPro.SelectedItem.ToString());
            var otherEmp = eprBll.QueryOtherEmp(listBoxPro.SelectedItem.ToString());


            if (proEmp.Count != 0)
            {
                foreach (var item in proEmp)
                {
                    listBoxEmp.Items.Add(item.Id + "   " + item.Name);//项目员工
                }
            }

            if (otherEmp.Count != 0)
            {
                foreach (var item in otherEmp)
                {
                    listBoxOtherEmp.Items.Add(item.Id + "   " + item.Name);//其他员工
                }
            }
        }
        public ActionResult _Material(long roomId)
        {
            ViewBag.RoomId = roomId;

            var room = RoomBll.GetById(roomId);

            ViewBag.RoomTypeId = room.RoomTypeId;
            ViewBag.RoomRegId  = room.RoomRegId;

            if (room.LastCleanEmployeeId != 0)
            {
                if (room.FjState != FjStateEnum.脏房)
                {
                    ViewBag.EmployeeId = room.LastCleanEmployeeId;
                    var employee = EmployeeBll.GetById(room.LastCleanEmployeeId);
                    ViewBag.EmployeeName = employee.Name;
                }


                ViewBag.IsMaterialChangeEveryday = room.IsMaterialChangeEveryday;
                ViewBag.IsMaterialChangeWash     = room.IsMaterialChangeWash;
            }
            else
            {
                ViewBag.IsMaterialChangeEveryday = true;
                ViewBag.IsMaterialChangeWash     = true;
            }



            return(View());
        }
示例#10
0
        public async Task Add(EmployeeBll employee, int departamentId, int jobId, DateTime?hireDate)
        {
            var model = _mapper.Map <EmployeeDal>(employee);

            var dept = _db.Departaments.FirstOrDefault(x => x.Id == departamentId);

            if (dept == null)
            {
                throw new KeyNotFoundException($"Не найден отдел с идентификационным номером {departamentId}");
            }

            var job = _db.Jobs.FirstOrDefault(x => x.Id == jobId);

            if (job == null)
            {
                throw new KeyNotFoundException($"Не найдена должность с идентификационным номером {jobId}");
            }

            var jobHistory = new JobHistoryDal
            {
                DepartamentId = dept.Id,
                JobId         = job.Id,
                StartDate     = hireDate,
                EmployeeId    = model.Id,
                Salary        = model.Salary
            };

            model.JobHistory.Add(jobHistory);

            _db.Employees.Add(model);

            await _db.SaveChangesAsync();
        }
示例#11
0
        //private static void DepartmentImputDingTalk()
        //{
        //    LogHelper log = LogFactory.GetLogger("ImputEsbDepartment");
        //    SqlSugarClient Ddb = new SqlSugarClient(new ConnectionConfig()
        //    {
        //        ConnectionString = Config.DingTalkConnectionString,
        //        DbType = DbType.SqlServer,
        //        IsAutoCloseConnection = true,
        //        InitKeyType = InitKeyType.Attribute
        //    });
        //    Ddb.CodeFirst.InitTables(typeof(DepartmentTrees));

        //    int treeCount = Ddb.Queryable<DepartmentTrees>().Count();
        //    int maxlevel = Ddb.Queryable<DepartmentTrees>().Max(it => it.level);
        //    int countRow = 0;
        //    log.Info("\r\n------------------------------------------------钉钉组织框架根据ESB部门树数据调整------------------------------------------------\r\n");
        //    for (int i = 1; i <= maxlevel; i++)
        //    {
        //        List<DepartmentTrees> list = new List<DepartmentTrees>();
        //        list = Ddb.Queryable<DepartmentTrees>().Where(it => it.level == i).ToList();
        //        foreach (var item in list)
        //        {
        //            countRow++;
        //            try
        //            {
        //                string DepartmentJson = GetDepartment(item.DD_Id);

        //                DepartmentEntity model = new DepartmentEntity();
        //                model = Newtonsoft.Json.JsonConvert.DeserializeObject<DepartmentEntity>(DepartmentJson);
        //                model.parentid = item.DD_ParentId;
        //                model.order = list.IndexOf(item).ToString();
        //                string param = model.ToJson();
        //                Result result = DepartmentBll.Update(param);
        //                if (result != null)
        //                {
        //                    if (result.errcode == "0")
        //                    {
        //                        Console.Write("第" + i + "级数据更新成功," + result.errmsg + ",已更新:" + countRow + "条,当前进度:" + (Math.Round(Convert.ToDecimal(Convert.ToDouble(countRow) / Convert.ToDouble(treeCount)), 2, MidpointRounding.AwayFromZero) * 100) + "%\n\n");
        //                    }
        //                    else
        //                    {
        //                        Console.Write(result.errmsg);
        //                    }
        //                }
        //                else
        //                {
        //                    Console.Write("\r\n无返回数据\r\n");
        //                }
        //            }
        //            catch (Exception ex)
        //            {
        //                log.Error("\r\n" + ex.Message + "\r\n");
        //                Console.Write(ex.Message);
        //            }
        //        }
        //    }
        //    Console.Write("更新成功,共更新 " + countRow + " 条数据");
        //}

        private static void DeleteEmployee(string UserId)
        {
            try
            {
                Result Result = EmployeeBll.Delete(UserId);
                if (Result != null)
                {
                    if (Result.errcode == "0")
                    {
                        Console.Write("\r\n更新成功," + Result.errmsg + "\r\n");
                    }
                    else
                    {
                        Console.Write("\r\n" + Result.errmsg + "\r\n");
                    }
                }
                else
                {
                    Console.Write("\r\n无返回数据\r\n");
                }
            }
            catch (Exception ex)
            {
                Console.Write("\r\n" + ex.Message + "\r\n");
            }
        }
示例#12
0
        private static string GetEmployee(string userid)
        {
            string json = "";

            try
            {
                GetEmployee Result = EmployeeBll.Get(userid);

                if (Result != null)
                {
                    if (Result.errcode == "0")
                    {
                        json = Result.ToJson();
                    }
                    else
                    {
                        Console.Write(Result.errmsg);
                    }
                }
                else
                {
                    Console.Write("无返回数据");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
            return(json);
        }
示例#13
0
 public EmployeeForm()
 {
     this.components = null;
     base();
     this.InitializeComponent();
     this._employee = new EmployeeBll();
 }
示例#14
0
        public ActionResult GetRoleCode()
        {
            EmployeeBll employeeBll              = new EmployeeBll();
            Dictionary <string, string> dicRole  = new Dictionary <string, string>();
            List <Bas_Role>             rolelist = employeeBll.GetRoleList();
            var list = rolelist.Select(s => { return(new { id = s.Bro_Id, text = s.Bro_Name }); });

            return(Select2(list, JsonRequestBehavior.AllowGet));
        }
示例#15
0
        public ActionResult ChangePassword()
        {
            var model = new EmployeeBll().Single(base.EmpNo);

            return(PartialView("~/Areas/eForm/Views/Personal/ChangePassword.cshtml", new Carlzhu.Iooin.Entity.MANAGER.SystemAccount()
            {
                EmpNo = model.EmpNo,
                UserName = model.Account,
            }));
        }
示例#16
0
        // GET: Base

        public Employee getCurrent()
        {
            Employee emp = new Employee();

            if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                EmployeeBll bll = new EmployeeBll();
                emp = bll.getbyAccount(System.Web.HttpContext.Current.User.Identity.Name);
            }
            return(emp);
        }
 public IHttpActionResult GetAll()
 {
     try
     {
         var q = EmployeeBll.GetAllEmployees();
         return(Ok(q));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
示例#18
0
        public void Query(string str, string txtName)
        {
            listBox1.Items.Clear();
            this.txtBoxName = txtName;
            var data = new EmployeeBll().QueryLikeThis(str);

            if (data != null)
            {
                foreach (var item in data)
                {
                    listBox1.Items.Add(item.Id + "_" + item.Name);
                }
            }
        }
        public override bool ValidateUser(string username, string password)
        {
            EmployeeWithAuthes employeeWithAuthes = EmployeeBll.Login(username, password);

            if (employeeWithAuthes.employee != null && employeeWithAuthes.employee.id > 0)
            {
                if (username.Equals("admin"))
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, username, DateTime.Now, DateTime.Now.AddMinutes(20), true, "{\"0\":\"all\"}", "/");
                    var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
                    cookie.HttpOnly = true;
                    HttpContext.Current.Response.Cookies.Add(cookie);
                    addCookieForEmployee(employeeWithAuthes.employee);

                    HttpContext.Current.Session["login_code"] = 0;
                    return(true);
                }
                else if (employeeWithAuthes.roleAuthes != null && employeeWithAuthes.roleAuthes.Length > 0)
                {
                    Dictionary <string, string> purviews = new Dictionary <string, string>(employeeWithAuthes.roleAuthes.Length);
                    foreach (RoleAuth auth in employeeWithAuthes.roleAuthes)
                    {
                        purviews.Add(auth.menu_id.ToString(), auth.purview);
                    }
                    //add userid
                    purviews.Add("-1", employeeWithAuthes.employee.id.ToString());
                    string roleString = Json.Encode(purviews);
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, username, DateTime.Now, DateTime.Now.AddMinutes(20), true, roleString, "/");
                    var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket));
                    cookie.HttpOnly = true;
                    HttpContext.Current.Response.Cookies.Add(cookie);
                    addCookieForEmployee(employeeWithAuthes.employee);

                    HttpContext.Current.Session["login_code"] = 0;
                    return(true);
                }
                else
                {
                    //未激活或权限未分配
                    HttpContext.Current.Session["login_code"] = -2;
                }
            }
            else
            {
                //用户名或密码错误
                HttpContext.Current.Session["login_code"] = -1;
            }
            return(false);
        }
示例#20
0
        public ActionResult GetTeachers(DtoEmployeeSearch search)
        {
            search.Status   = StatusEnum.效;
            search.RoleCode = "teacher";

            EmployeeBll bll       = new EmployeeBll();
            var         employees = bll.GetEmployees(search);

            Dictionary <int, string> dic = new Dictionary <int, string>();

            employees.ToList().ForEach(e => dic.Add(e.Id, e.Name));
            var result = OptionFactory.CreateOptions(dic);

            return(Select2(result));
        }
示例#21
0
        public ActionResult GetOwners()
        {
            EmployeeBll bll       = new EmployeeBll();
            var         employees = bll.GetPagingEmployee(
                new PagingObject(1, int.MaxValue),
                string.Empty,
                0,
                (int)StatusEnum.效);

            Dictionary <int, string> dic = new Dictionary <int, string>();

            employees.ForEach(e => dic.Add(e.Bem_Id, e.Bem_Name));
            var result = OptionFactory.CreateOptions(dic);

            return(Select2(result));
        }
示例#22
0
        public async Task Update(EmployeeBll model)
        {
            var emp = _db.Employees.FirstOrDefault(x => x.Id == model.Id);

            if (emp == null)
            {
                throw new KeyNotFoundException($"Не найден сотрудник с идентификационным номером {model.Id}");
            }

            emp.Birthday   = model.Birthday;
            emp.Email      = model.Email;
            emp.FirstName  = model.FirstName;
            emp.SecondName = model.SecondName;
            emp.ThirdName  = model.ThirdName;

            await _db.SaveChangesAsync();
        }
示例#23
0
 //
 // GET: /Account/
 public ActionResult Login(string username, string password)
 {
     if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
     {
         EmployeeBll bll = new EmployeeBll();
         Employee    emp = bll.getbyAccountAndPwd(username.Trim(), password.Trim());
         if (emp != null)
         {
             FormsAuthentication.SetAuthCookie(username, false);
             return(Redirect(Url.Action("index", "Home")));
         }
         else
         {
             return(View());
         }
     }
     return(View());
 }
示例#24
0
        //listboxshow  单击选择
        private void listBoxShow_Click(object sender, EventArgs e)
        {
            if (listBoxShow.SelectedItem != null)
            {
                var item = listBoxShow.SelectedItem.ToString();
                myTxtProName.SetText(item);


                EmployeeBll empBll = new EmployeeBll();
                ProjectBll  proBll = new ProjectBll();
                string      choose = myTxtProName.GetText();             //现在textbox中的字符串
                string      pl     = proBll.QueryByName(choose)[0].PLId; //项目PL的id
                string      plName = empBll.QueryById(pl).Name;          //项目的PL的名字
                myTxtProPLName.Clear();
                myTxtProPLName.SetText(plName);                          //加载项目Pl
                listBoxShow.Visible = false;                             //选择后隐藏
            }
        }
示例#25
0
        private static void AddEmployee()
        {
            try
            {
                EmployeeEntity model = new EmployeeEntity();
                model.userid     = "wangzezheng";
                model.name       = "王五";
                model.department = new List <int>(new int[] { 123456 });
                model.position   = "软件工程师";
                model.mobile     = "137*****334";
                model.tel        = "";
                model.workPlace  = "";
                model.remark     = "";
                model.email      = "";
                model.jobnumber  = "";
                model.isHide     = false;
                model.isSenior   = false;

                string param = model.ToJson();

                EmployeeResult Result = EmployeeBll.Create(param);
                if (Result != null)
                {
                    if (Result.errcode == "0")
                    {
                        Console.Write("创建成功,UserId=" + Result.userid);
                    }
                    else
                    {
                        Console.Write(Result.errmsg);
                    }
                }
                else
                {
                    Console.Write("无返回数据");
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
示例#26
0
文件: BpmBll.cs 项目: sanxchen/MntApp
        /// <summary>
        /// 转签
        /// </summary>
        /// <returns></returns>
        public void RedirectSigner(string redirectSignerEmpNo)
        {
            if (base.Form.BaseEmployee.Email == null)
            {
                return;
            }
            var redirectSignerEmployee = new EmployeeBll().Single(redirectSignerEmpNo);

            base.ListArgs.Add(new EmailFormEventArgs()
            {
                To = new Dictionary <string, string> {
                    { redirectSignerEmployee.Email, redirectSignerEmployee.Account }
                },
                Subject  = "表单签核通知【转签】[" + base.Form.FormType.FormName + "]",
                NickName = redirectSignerEmployee.Account,
                Title    = "表单签核通知【转签】[" + base.Form.FormType.FormName + "]",
                From     = "MINICUT",
                Content  = "<p>系统中有一张由 " + base.Form.BaseEmployee.Account + " 申请,审核人<b> " + base.Emp.Account + "</b> 转签给您的表单需要您的处理;</p><p>表单号为:" + base.Form.FormNo + ";</p>",
                Date     = DateTime.Now,
                Link     = $"进入系统处理表单<a href='{HostUrl}{"/eForm/Signing/Index"}' >进入系统</a>"
            });
        }
示例#27
0
        public bool CheckPhone(string phone, AccountVerifyTypeEnum type)
        {
            bool result = false;

            switch (type)
            {
            case AccountVerifyTypeEnum.学生未注册:
                result = StudentBll.CheckUniqueAccount(phone) == 0;
                break;

            case AccountVerifyTypeEnum.学生已注册:
                result = StudentBll.CheckUniqueAccount(phone) > 0;
                break;

            case AccountVerifyTypeEnum.校区教师未注册:
                result = SchoolTeacherBll.GetSchoolTeacherCountByPhone(phone) == 0;
                break;

            case AccountVerifyTypeEnum.校区教师已注册:
            case AccountVerifyTypeEnum.校区找回密码:
                result = SchoolTeacherBll.GetSchoolTeacherCountByPhone(phone) > 0;
                break;

            case AccountVerifyTypeEnum.教研教师未注册:
                result = EmployeeBll.CheckUniqueAccount(phone) == 0;
                break;

            case AccountVerifyTypeEnum.教研教师已注册:
                result = EmployeeBll.CheckUniqueAccount(phone) > 0;
                break;

            default:
                result = true;
                break;
            }
            return(result);
        }
示例#28
0
文件: BpmBll.cs 项目: sanxchen/MntApp
 /// <summary>
 /// 催签
 /// </summary>
 public void Urge(List <string> signsEmps)
 {
     if (base.Form.BaseEmployee.Email == null)
     {
         return;
     }
     signsEmps.ForEach(e =>
     {
         var signEmployee = new EmployeeBll().Single(e);
         base.ListArgs.Add(new EmailFormEventArgs()
         {
             To = new Dictionary <string, string> {
                 { signEmployee.Email, signEmployee.Account }
             },
             Subject  = "表单催签通知[" + base.Form.FormType.FormName + "]",
             NickName = signEmployee.Account,
             Title    = "表单催签通知[" + base.Form.FormType.FormName + "]",
             From     = "MINICUT",
             Content  = "<p>系统中有一张表单已被申请人 <b>" + base.Form.BaseEmployee.Account + "</b> 催签:" + base.Form.FormNo + "</p>",
             Date     = DateTime.Now,
             Link     = $"进入系统处理表单<a href='{HostUrl}{"/eForm/Signing/Index"}' >进入系统</a>"
         });
     });
 }
示例#29
0
 public void Dispose()
 {
     this._DataDictionaryBll = null;
     this._EmployeeBll = null;
     this._IPBlacklistBll = null;
     this._MenuInfoBll = null;
     this._OrganizationBll = null;
     this._PurviewInfoBll = null;
     this._RoleInfoBll = null;
     this._RolePurviewBll = null;
     this._SysLogBll = null;
     this._SysLoginLogBll = null;
     this._SystemExceptionLogBll = null;
     this._SystemInfoBll = null;
     this._UserInfoBll = null;
     this._UserPurviewBll = null;
     this._UserRoleBll = null;
 }
示例#30
0
        private static void EmployeeImputDingTalk()
        {
            LogHelper log = LogFactory.GetLogger("EmployeeImputDingTalk");

            try
            {
                List <DepartmentResult> resultList = new List <DepartmentResult>();
                SqlSugarClient          Edb        = new SqlSugarClient(new ConnectionConfig()
                {
                    ConnectionString      = Config.ESBConnectionString,
                    DbType                = DbType.SqlServer,
                    IsAutoCloseConnection = true
                });

                List <V_EmployeeToDingTalk> ESB_EmployeeList = Edb.Queryable <V_EmployeeToDingTalk>().ToList();

                var _DepartmentId = new[] { "1000000360", "1000000575", "1000000010" };

                ESB_EmployeeList = ESB_EmployeeList.Where(it => _DepartmentId.Contains(it.ESB_DepartmentId) && it.Enabled.Equals(1)).ToList();

                SqlSugarClient Ddb = new SqlSugarClient(new ConnectionConfig()
                {
                    ConnectionString      = Config.DingTalkConnectionString,
                    DbType                = DbType.SqlServer,
                    IsAutoCloseConnection = true
                });
                List <DepartmentResult> DTDepartList = Ddb.Queryable <DepartmentResult>().ToList();


                foreach (var item in ESB_EmployeeList)
                {
                    try
                    {
                        EmployeeEntity model = new EmployeeEntity();
                        model.userid     = item.UserId;
                        model.name       = item.Name;
                        model.department = new List <int>(new int[] { Convert.ToInt32(GetDingTalkDepartmentId(DTDepartList, item.ESB_DepartmentId)) });
                        model.position   = item.PositionName;
                        model.mobile     = item.Mobile;
                        model.tel        = item.Telephone;
                        model.workPlace  = "";
                        model.remark     = "";
                        model.email      = item.Email;
                        model.jobnumber  = item.UserId;
                        model.isHide     = false;
                        model.isSenior   = false;

                        string param = model.ToJson();

                        EmployeeResult Result = EmployeeBll.Create(param);
                        if (Result != null)
                        {
                            if (Result.errcode == "0")
                            {
                                Console.Write("创建成功,UserId=" + Result.userid);
                            }
                            else
                            {
                                Console.Write(Result.errmsg);
                            }
                        }
                        else
                        {
                            Console.Write("无返回数据");
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error(ex);
                        continue;
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                Console.Write(ex.Message);
            }
        }
示例#31
0
        private static void OperationRepeatData3()
        {
            GetDepartmentList DepartmentList = DepartmentBll.GetList();

            string sql  = @"
                            with ta as(
                            select *   from DepartmentResult where ESB_DepartmentID in(
                            select ESB_DepartmentID from DepartmentResult group by ESB_DepartmentID having count(1)>1
                            )
                            ),tb as(
                            select a.* from [PM.WebApi].dbo.V_Effective_Tbiz_DepartmentInfo a inner join [PM.WebApi].dbo.V_Effective_Tbiz_DepartmentTreeas b
                            on a.DepartmentId=b.TreeNode
                            ),tc as(
                            select tb.fullname a,ta.* from ta left join tb 
                            on ta.ESB_DepartmentName=tb.FullName
                            where tb.fullname is null
                            ),td as(
                            select a.* from [PM.WebApi].dbo.V_Effective_Tbiz_DepartmentInfo a inner join tc
                            on tc.ESB_DepartmentId=a.DepartmentId
                            )
                            select distinct td.fullname aa,tc.* from tc right join  td
                            on tc.ESB_DepartmentId=td.DepartmentId
                            order by td.fullname
                        ";
            string sql2 = @"
                            with ta as(
                            select *   from DepartmentResult where ESB_DepartmentID in(
                            select ESB_DepartmentID from DepartmentResult group by ESB_DepartmentID having count(1)>1
                            )
                            ),tb as(
                            select a.* from [PM.WebApi].dbo.V_Effective_Tbiz_DepartmentInfo a inner join [PM.WebApi].dbo.V_Effective_Tbiz_DepartmentTreeas b
                            on a.DepartmentId=b.TreeNode
                            ),tc as(
                            select tb.fullname a,ta.* from ta left join tb 
                            on ta.ESB_DepartmentName=tb.FullName
                            where tb.fullname is null
                            ),td as(
                            select a.* from [PM.WebApi].dbo.V_Effective_Tbiz_DepartmentInfo a inner join tc
                            on tc.ESB_DepartmentId=a.DepartmentId
                            ),te as(
                            select a.* from td inner join DepartmentResult a
                            on td.DepartmentID=a.ESB_DepartmentID and td.FullName=a.ESB_DepartmentName
                            )select '' aa,'' a  ,* from te
                            order by ESB_DepartmentID
                        ";

            SqlSugarClient Ddb = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString      = Config.DingTalkConnectionString,
                DbType                = DbType.SqlServer,
                IsAutoCloseConnection = true,
                InitKeyType           = InitKeyType.Attribute
            });

            List <DepartmentResult> list = Ddb.Ado.SqlQuery <DepartmentResult>(sql);

            List <DepartmentResult> list2 = Ddb.Ado.SqlQuery <DepartmentResult>(sql2);

            foreach (var item in list)
            {
                var dddd = DepartmentList.department.Where(e => e.id.Equals(item.id)).ToList().FirstOrDefault();
                if (dddd != null)
                {
                    //钉钉中存在该部门,检查该部门下是否有人,没人的并且重复的部门删除钉钉中该部门,并且删除钉钉关系表和钉钉树关系表
                    GetDepartmentForUserList UserList = DepartmentBll.GetByDepartmentIdForUserInfoList(dddd.id);
                    Console.Write("\n" + dddd.name + " DD_ID=" + dddd.id + ",其下共有" + UserList.userlist.Count + "个人!\r\n");
                    string id = list2.Where(it => it.ESB_DepartmentID.Equals(item.ESB_DepartmentID)).FirstOrDefault().id;
                    if (UserList.userlist.Count != 0)
                    {
                        //将该部门下的人迁移到正确的部门下
                        foreach (var Useritem in UserList.userlist)
                        {
                            string         EmployeeJson = EmployeeForDingTalkBll.GetEmployee(Useritem.userid);
                            EmployeeEntity Emodel       = JsonHelper.JsonToModel <EmployeeEntity>(EmployeeJson);
                            Emodel.department = new List <int>()
                            {
                                Convert.ToInt32(id)
                            };
                            string param = Emodel.ToJson();

                            Result uResult = EmployeeBll.Update(param);
                            if (uResult.errcode != "0")
                            {
                                Console.Write("\r\n" + uResult.errmsg + "\r\n");
                            }
                        }


                        //删除钉钉中的部门
                        var a = DepartmentBll.Delete(dddd.id);
                        //删除钉钉关系表和钉钉树关系表
                        int i = Ddb.Deleteable <DepartmentResult>().Where(it => it.id.Equals(item.id)).ExecuteCommand();
                        i = Ddb.Deleteable <DepartmentTrees>().Where(it => it.DD_Id.Equals(item.id)).ExecuteCommand();
                    }
                }
            }
            Console.Write("\r\n处理完毕");
        }