Exemplo n.º 1
0
        public string editAccount(SyncUserInfo userInfo)
        {
            string    text      = this.ReturnCode(0);
            DataTable dataTable = deptBll.GetDataTable(string.Format("select userid from base_user where upper(account)='{0}'", userInfo.uid.ToUpper()));

            if (dataTable.Rows.Count > 0)
            {
                if (userInfo.displayName != "")
                {
                    text = this.updateEmployee(userInfo.uid, userInfo.displayName);
                }
                if (text != this.ReturnCode(0))
                {
                    return(text);
                }
                if (userInfo.email != "")
                {
                    text = this.updateEmployeEmail(userInfo.uid, userInfo.email);
                }
                if (text != this.ReturnCode(0))
                {
                    return(text);
                }
                if (userInfo.password != "")
                {
                    text = this.updateEmployeePassword(userInfo.uid, userInfo.password);
                }
            }
            else
            {
                text = this.ReturnCode(3);
            }
            return(text);
        }
Exemplo n.º 2
0
 public string createEmployee(SyncUserInfo userInfo)
 {
     try
     {
         string    str   = ReturnCode(0);
         DataTable table = deptBll.GetDataTable(string.Format("select *from [base_user] where account='{0}'", userInfo.uid));
         if (table.Rows.Count > 0)
         {
             if (!string.IsNullOrEmpty(userInfo.displayName))
             {
                 str = this.updateEmployee(userInfo.uid, userInfo.displayName);
             }
             if (str != this.ReturnCode(0))
             {
                 return(str);
             }
             if (!string.IsNullOrEmpty(userInfo.email))
             {
                 str = this.updateEmployeEmail(userInfo.uid, userInfo.email);
             }
             if (str != this.ReturnCode(0))
             {
                 return(str);
             }
             //if (!string.IsNullOrEmpty(userInfo.password))
             //{
             //    str = this.updateEmployeePassword(userInfo.uid, userInfo.password);
             //}
             str = this.enableOrNotEmployee(userInfo, 1);
         }
         else
         {
             try
             {
                 ERCHTMS.Entity.BaseManage.UserEntity user = new Entity.BaseManage.UserEntity();
                 user.UserId   = Guid.NewGuid().ToString();
                 user.RealName = userInfo.displayName;
                 user.Account  = userInfo.uid;
                 user.Email    = userInfo.email;
                 user.Password = "******";
                 new ERCHTMS.Busines.BaseManage.UserBLL().SaveForm("", user);
                 return(this.ReturnCode(0));
             }
             catch (Exception ex)
             {
                 return(this.ReturnCode(11));
             }
         }
         return(str);
     }
     catch (Exception)
     {
         return(this.ReturnCode(11));
     }
 }
Exemplo n.º 3
0
 public string enableOrNotEmployee(SyncUserInfo userInfo, int active)
 {
     try
     {
         int count = deptBll.ExecuteSql(string.Format("update base_user set enabledmark={1} where account='{0}'", userInfo.uid, active));
         if (count > 0)
         {
             return(this.ReturnCode(0));
         }
         return(this.ReturnCode(3));
     }
     catch (Exception)
     {
         return(this.ReturnCode(3));
     }
 }
Exemplo n.º 4
0
 public string enableOrNotEmployee(SyncUserInfo userInfo, int active)
 {
     try
     {
         int count = deptBll.ExecuteSql(string.Format("update base_user set enabledmark={1} where upper(account)='{0}'", userInfo.uid.ToUpper(), active));
         if (count > 0)
         {
             return(this.ReturnCode(0));
         }
         return(this.ReturnCode(3));
     }
     catch (Exception ex)
     {
         LdapDataLog(Newtonsoft.Json.JsonConvert.SerializeObject(ex), 4);
         return(this.ReturnCode(3));
     }
 }
Exemplo n.º 5
0
 public string synchronism(string username, string password, string requestData)
 {
     if (!isAuth(username, password, requestData))
     {
         return(this.ReturnCode(1));
     }
     try
     {
         string       text2    = SyncXmlUtils.matchRequestData(requestData, "operation-type");
         SyncUserInfo userInfo = SyncUser.parseXMLToUser(requestData);
         string       text3;
         if ((text3 = text2) != null)
         {
             if (text3 == "CREATE")
             {
                 return(this.createEmployee(userInfo));
             }
             if (text3 == "DELETE")
             {
                 return(this.enableOrNotEmployee(userInfo, 0));
             }
             if (text3 == "DISABLE")
             {
                 return(this.enableOrNotEmployee(userInfo, 0));
             }
             if (text3 == "ENABLE")
             {
                 return(this.enableOrNotEmployee(userInfo, 1));
             }
             if (text3 == "EDIT")
             {
                 return(this.editAccount(userInfo));
             }
         }
         return(this.ReturnCode(3));
     }
     catch (Exception ex)
     {
         LdapDataLog(Newtonsoft.Json.JsonConvert.SerializeObject(ex), 4);
         return(this.ReturnCode(10));
     }
 }
Exemplo n.º 6
0
        // Token: 0x0600002C RID: 44 RVA: 0x00002F9C File Offset: 0x0000119

        // Token: 0x0600002D RID: 45 RVA: 0x00003044 File Offset: 0x00001244
        public static SyncUserInfo parseXMLToUser(string soapStr)
        {
            Console.Write("parseXml start .....");
            SyncUserInfo syncUserInfo = new SyncUserInfo();

            try
            {
                Type   type = syncUserInfo.GetType();
                object obj  = Activator.CreateInstance(type);
                foreach (MemberInfo memberInfo in type.GetMethods())
                {
                    if (memberInfo.Name.StartsWith("get") && !memberInfo.Name.Contains("_"))
                    {
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.Append(memberInfo.Name.Substring(3, 1).ToLower());
                        stringBuilder.Append(memberInfo.Name.Substring(4));
                        string        patternStr     = stringBuilder.ToString();
                        string        text           = SyncXmlUtils.matchRequestData(soapStr, patternStr);
                        StringBuilder stringBuilder2 = new StringBuilder();
                        stringBuilder2.Append("set");
                        stringBuilder2.Append(memberInfo.Name.Substring(3, 1).ToUpper());
                        stringBuilder2.Append(memberInfo.Name.Substring(4));
                        object[] array = new object[]
                        {
                            text
                        };
                        type.GetMethod(stringBuilder2.ToString()).Invoke(obj, array);
                    }
                }
                return((SyncUserInfo)obj);
            }
            catch (Exception)
            {
            }
            Console.Write("parseXml end .....");
            return(syncUserInfo);
        }
Exemplo n.º 7
0
        //[WebMethod(Description="新增人员信息")]
        public string createEmployee(SyncUserInfo userInfo)
        {
            try
            {
                string    str   = ReturnCode(0);
                DataTable table = deptBll.GetDataTable(string.Format("select userid from base_user where upper(account)='{0}'", userInfo.uid.ToUpper()));
                if (table.Rows.Count > 0)
                {
                    if (!string.IsNullOrEmpty(userInfo.displayName))
                    {
                        str = this.updateEmployee(userInfo.uid, userInfo.displayName);
                    }
                    if (str != this.ReturnCode(0))
                    {
                        return(str);
                    }
                    if (!string.IsNullOrEmpty(userInfo.email))
                    {
                        str = this.updateEmployeEmail(userInfo.uid, userInfo.email);
                    }
                    if (str != this.ReturnCode(0))
                    {
                        return(str);
                    }
                    if (!string.IsNullOrEmpty(userInfo.password))
                    {
                        str = this.updateEmployeePassword(userInfo.uid, userInfo.password);
                    }
                    str = this.enableOrNotEmployee(userInfo, 1);

                    str = this.UpdateAccountType(userInfo.uid.ToUpper());
                }
                else
                {
                    try
                    {
                        string enCode   = new ERCHTMS.Busines.SystemManage.DataItemDetailBLL().GetItemValue("hrdl", "FactoryEncode"); //查询电厂编码
                        string orgId    = "";                                                                                         //电厂ID
                        string orgCode  = "";                                                                                         //电厂编码
                        string deptId   = "";                                                                                         //部门Id
                        string deptCode = "";                                                                                         //部门编码
                        if (!string.IsNullOrEmpty(enCode))
                        {
                            DepartmentEntity dept = deptBll.GetEntityByCode(enCode);//获取电厂信息
                            if (dept != null)
                            {
                                orgId   = dept.DepartmentId;
                                orgCode = enCode;
                                //判断是否存在临时人员的部门节点,不存在则新建
                                DataTable dtDept = deptBll.GetDataTable(string.Format("select DepartmentId,encode from BASE_DEPARTMENT where parentid='{0}' and fullname='临时人员' and Nature='部门'", orgId));
                                if (dtDept.Rows.Count > 0)
                                {
                                    deptId   = dtDept.Rows[0][0].ToString();
                                    deptCode = dtDept.Rows[0][1].ToString();
                                }
                                else
                                {
                                    //新建临时人员的部门节点
                                    dept = new DepartmentEntity
                                    {
                                        FullName    = "临时人员",
                                        ParentId    = orgId,
                                        Nature      = "部门",
                                        Description = "临时人员",
                                        IsOrg       = 0,
                                        Industry    = "电力"
                                    };
                                    deptBll.SaveForm("", dept);
                                    deptId   = dept.DepartmentId;
                                    deptCode = dept.EnCode;
                                }
                                dtDept.Dispose();
                            }
                        }
                        //新增的人员直接挂在临时人员的部门节点,后期由电厂管理员手动调整人完善员信息
                        ERCHTMS.Entity.BaseManage.UserEntity user = new Entity.BaseManage.UserEntity();
                        user.UserId         = Guid.NewGuid().ToString();
                        user.RealName       = userInfo.displayName;
                        user.Account        = userInfo.uid;
                        user.Email          = userInfo.email;
                        user.Password       = userInfo.password;
                        user.DepartmentId   = deptId;
                        user.DepartmentCode = deptCode;
                        user.OrganizeCode   = orgCode;
                        user.OrganizeId     = orgId;
                        user.RoleId         = "2a878044-06e9-4fe4-89f0-ba7bd5a1bde6";
                        user.RoleName       = "普通用户";
                        user.IsPresence     = "1";
                        user.AccountType    = "1";
                        user.Mobile         = userInfo.mobile;
                        user.EnCode         = userInfo.empno;
                        //user.WeChat = userInfo.deptId;
                        //user.OICQ = userInfo.password;
                        new ERCHTMS.Busines.BaseManage.UserBLL().SaveForm("", user, 1);
                        return(this.ReturnCode(0));
                    }
                    catch (Exception ex)
                    {
                        LdapDataLog(Newtonsoft.Json.JsonConvert.SerializeObject(ex), 4);
                        return(this.ReturnCode(11));
                    }
                }
                return(str);
            }
            catch (Exception ex)
            {
                LdapDataLog(Newtonsoft.Json.JsonConvert.SerializeObject(ex), 4);
                return(this.ReturnCode(10));
            }
        }