Beispiel #1
0
        //Lay nguoi ky duyet
        public string getNguoiKyDuyet()
        {
            string s = "";

            if (!string.IsNullOrEmpty(UserIDs))
            {
                s = UserIDs;
                string[] lstUserId = UserIDs.Split(';');
                for (int i = 0; lstUserId != null && i < lstUserId.Length; i++)
                {
                    if (!string.IsNullOrEmpty(lstUserId[i]))
                    {
                        var id = HL.Core.Global.Convert.ToInt(lstUserId[i], 0);
                        if (id > 0)
                        {
                            var    user   = ModUserService.Instance.GetByID(id);
                            string ten    = user.Name;
                            string chucVu = user.getMenu().Name;
                            string coQuan = user.getCoQuan().Name;
                            s = s.Replace(id.ToString(), ten + " - " + chucVu + " " + coQuan);
                        }
                    }
                }
            }

            return(s);
        }
Beispiel #2
0
        /// <summary>
        /// 保存对坐席所属分组的修改
        /// </summary>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        private string SaveBusinessGroupSetting(string errMsg)
        {
            try
            {
                string[] userArr = UserIDs.Split(',');
                string[] bgidArr = BGIDS.Split(',');

                if (bgidArr.Length > 0 && !string.IsNullOrEmpty(bgidArr[0]))
                {
                    EmployeeAgent model;
                    for (int i = 0; i < userArr.Length; i++)
                    {
                        model = BitAuto.ISDC.CC2012.BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(Convert.ToInt32(userArr[i]));
                        if (model == null)
                        {
                            model = new EmployeeAgent();
                        }
                        model.UserID       = Convert.ToInt32(userArr[i]);
                        model.BGID         = Convert.ToInt32(bgidArr[0]);
                        model.RegionID     = ReginId;
                        model.CreateUserID = BLL.Util.GetLoginUserID();

                        BitAuto.ISDC.CC2012.BLL.EmployeeAgent.Instance.Update(model);
                    }
                }
            }
            catch (Exception ex)
            {
                errMsg = "modifyErr";
            }
            return(errMsg);
        }
        /// <summary>
        /// Returns a string representation of the transportable secret key.
        /// </summary>
        /// <returns>A string representation of the transportable secret
        /// key.</returns>
        /// <remarks>No remarks</remarks>
        public override string ToString()
        {
            string strSize   = PrimaryKey.PublicKey.KeyMaterial[0].bitCount().ToString();
            string strUserID = ((UserIDPacket)UserIDs.ToArray()[0]).UserID;

            string strReturn = strUserID + ": 0x" + PrimaryKey.PublicKey.KeyID.ToString("x") + " (" + strSize + ")";

            return(strReturn);
        }
Beispiel #4
0
 private string SaveRolseSetting(string errMsg)
 {
     try
     {
         string[] userArr = UserIDs.Split(',');
         foreach (string userItem in userArr)
         {
             bool isOk = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.InsertUserRole
                             (Convert.ToInt32(userItem), ConfigurationUtil.GetAppSettingValue("ThisSysID"), RoleIDs);
         }
     }
     catch (Exception ex)
     {
         errMsg = "modifyErr";
     }
     return(errMsg);
 }
        /// 批量修改处理逻辑
        /// <summary>
        /// 批量修改处理逻辑
        /// </summary>
        /// <param name="msg"></param>
        private void EmployeeAgentMutilOption(out string msg)
        {
            msg = "";
            try
            {
                string[] userids    = UserIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                string   cc_sysid   = ConfigurationUtil.GetAppSettingValue("ThisSysID");
                string   im_sysid   = ConfigurationUtil.GetAppSettingValue("IMSysID");
                string[] role_ids   = UserRolesID.Split('_');
                string   cc_role_id = role_ids[0];
                string   im_role_id = role_ids[1];
                int      btype      = BLL.Util.GetMutilEnumDataValue <BusinessTypeEnum>(BusinessType);
                BLL.Loger.Log4Net.Info("【批量修改用户数据权限】Start");
                //权限设置
                foreach (string key in userids)
                {
                    //批量清空权限
                    int userid = CommonFunction.ObjectToInteger(key);
                    BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.DeleteUserRole(userid, cc_sysid);
                    BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.DeleteUserRole(userid, im_sysid);

                    //批量设置权限
                    if ((btype & (int)BusinessTypeEnum.CC) == (int)BusinessTypeEnum.CC)
                    {
                        BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.InsertUserRole(userid, cc_sysid, cc_role_id);
                        BLL.Loger.Log4Net.Info("【批量修改用户数据权限】Step1.更新CC系统中[UserID=" + userid + "]的用户的角色ID为:" + cc_role_id);
                    }
                    if ((btype & (int)BusinessTypeEnum.IM) == (int)BusinessTypeEnum.IM)
                    {
                        BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.InsertUserRole(userid, im_sysid, im_role_id);
                        BLL.Loger.Log4Net.Info("【批量修改用户数据权限】Step1.更新IM系统中[UserID=" + userid + "]的用户的角色ID为:" + im_role_id);
                    }
                }
                //批量更新所属业务和所属分组
                string ids = string.Join(",", userids);
                BLL.EmployeeAgent.Instance.UpdateMutilEmployeeAgent(ids, btype, CommonFunction.ObjectToInteger(AtGroupID));
                BLL.Loger.Log4Net.Info("【批量修改用户数据权限】Step2.更新[UserID in (" + ids + ")]的用户的[BusinessType(所属业务)=" + btype + "],[BGID(所属分组)=" + AtGroupID + "]");
                foreach (string key in userids)
                {
                    int userid = CommonFunction.ObjectToInteger(key);
                    UpdateUserSkillGroupDataRightByUserID(userid, out msg);
                    string TrueNameAgentNum = BLL.EmployeeAgent.Instance.GetAgentNumberAndUserNameByUserId(userid);
                    if (!string.IsNullOrEmpty(TrueNameAgentNum))
                    {
                        string[] tnan = TrueNameAgentNum.Split(';');
                        if (tnan.Length == 2)
                        {
                            GetHeLiDataByUserNameAndAgentNum(tnan[0], tnan[1], out msg);
                        }
                        else
                        {
                            msg = "{'result':'failure','msg':'部分用户由于数据异常导致技能组数据未能传给合力厂商接口,请检查坐席的“用户名”和“工号”数据是否存在!'}";
                            BLL.Loger.Log4Net.Info("【批量修改用户数据权限】Step3.由于未能取到UserID=" + userid + "的用户的UserName或AgentNum的值,导致未能调用合力厂商的接口!");
                        }
                    }
                    else
                    {
                        msg = "{'result':'failure','msg':'部分用户由于数据异常导致技能组数据未能传给合力厂商接口,请检查坐席的“用户名”和“工号”数据是否存在!'}";
                        BLL.Loger.Log4Net.Info("【批量修改用户数据权限】Step3.由于未能取到UserID=" + userid + "的用户的UserName或AgentNum的值,导致未能调用合力厂商的接口!");
                    }
                }
                BLL.Loger.Log4Net.Info("【批量修改用户数据权限】End");
                if (msg == "")
                {
                    msg = "{'result':'success'}";
                }
            }
            catch (Exception ex)
            {
                msg = "{'result':'failure','msg':'" + ex.Message + "'}";
            }
        }
Beispiel #6
0
        public virtual void AddFields(IEnumerable <Field> fields)
        {
            if (fields == null)
            {
                return;
            }

            // Add the fields to their corresponding container.
            foreach (Field field in fields)
            {
                if (field.GetType() == typeof(Data.Fields.Name))
                {
                    Names.Add((Data.Fields.Name)field);
                }
                else if (field.GetType() == typeof(Address))
                {
                    Addresses.Add((Address)field);
                }
                else if (field.GetType() == typeof(Phone))
                {
                    Phones.Add((Phone)field);
                }
                else if (field.GetType() == typeof(Email))
                {
                    Emails.Add((Email)field);
                }
                else if (field.GetType() == typeof(Job))
                {
                    Jobs.Add((Job)field);
                }
                else if (field.GetType() == typeof(Education))
                {
                    Educations.Add((Education)field);
                }
                else if (field.GetType() == typeof(Image))
                {
                    Images.Add((Image)field);
                }
                else if (field.GetType() == typeof(Username))
                {
                    Usernames.Add((Username)field);
                }
                else if (field.GetType() == typeof(UserID))
                {
                    UserIDs.Add((UserID)field);
                }
                else if (field.GetType() == typeof(DOB))
                {
                    DOB = (DOB)field;
                }
                else if (field.GetType() == typeof(Gender))
                {
                    Gender = (Gender)field;
                }
                else if (field.GetType() == typeof(Language))
                {
                    Languages.Add((Language)field);
                }
                else if (field.GetType() == typeof(Ethnicity))
                {
                    Ethnicities.Add((Ethnicity)field);
                }
                else if (field.GetType() == typeof(OriginCountry))
                {
                    OriginCountries.Add((OriginCountry)field);
                }
                else if (field.GetType() == typeof(URL))
                {
                    Urls.Add((URL)field);
                }
            }
        }
Beispiel #7
0
        private void CheckedPar(out string errMsg)
        {
            errMsg = "";

            #region 检测用户ID

            if (UserIDs == string.Empty || UserIDs.Split(',').Length == 0)
            {
                errMsg = "noUserPar";
                return;
            }

            #endregion

            #region 检测角色ID

            string[] UserIDsList = UserIDs.Split(',');
            int      intVal      = 0;
            foreach (string item in UserIDsList)
            {
                if (!int.TryParse(item, out intVal))
                {
                    errMsg = "useridFormatErr"; //用户ID格式错误
                    break;
                }
            }
            if (errMsg != "")
            {
                return;
            }
            #endregion

            #region 是单个修改时,判断

            if (IsModfiySingle == "true")
            {
                #region 判断数据权限

                if (int.TryParse(RightType, out intVal))
                {
                    if (intVal != 1 && intVal != 2)
                    {
                        errMsg = "rightTypeErr";
                        return;
                    }
                }
                else
                {
                    errMsg = "rightTypeErr";
                    return;
                }

                #endregion

                #region 判断用户名

                if (UserIDs.Split(',').Length > 1)
                {
                    errMsg = "noUserPar";
                    return;
                }

                #endregion

                //#region 判断工号是否重复,如果IsContinute= "1"则不验证
                if (IsContinute != "1")
                {
                    //判断是否重复
                    Entities.QueryEmployeeAgent query = new Entities.QueryEmployeeAgent();
                    query.AgentNum = AgentNum;

                    int       total = 0;
                    DataTable dt    = BLL.EmployeeAgent.Instance.GetEmployeeAgent(query, "", 1, 10, out total);
                    if (total != 0)
                    {
                        if (dt.Rows[0]["UserID"].ToString() != UserIDs)
                        {
                            //与别人的工号有重复
                            errMsg = "repeated";
                            return;
                        }
                    }
                }

                //#endregion
            }

            #endregion
        }