예제 #1
0
        public void AddNewUserCompany(Entities.User user)
        {
            try
            {
                SharepointHelper spHelper = new SharepointHelper(Web);
                SPList list = spHelper.GetListItems("UserCompanyNew");

                SPListItem newItem = list.Items.Add();

                newItem["SecondName"] = user.SecondName;
                newItem["SecondSurname"] = user.SecondSurname;
                newItem["FirstName"] = user.FirstName;
                newItem["FirstSurname"] = user.FirstSurname;
                newItem["NIT"] = user.NIT;
                newItem["SubNIT"] = user.SubNIT;
                newItem["Company"] = user.Company;
                newItem["IdentificationNumber"] = user.IdentificationNumber;
                newItem["IdentificationType"] = user.IdentificationType;
                newItem["Ocupattion"] = user.Ocupattion;
                newItem["CompanyEmail"] = user.CompanyEmail;
                newItem["CompanyMobile"] = user.CompanyMobile;
                newItem["CompanyTel"] = user.CompanyTel;
                newItem["TelExtension"] = user.TelExtension;
                newItem["PersonalManager"] = user.PersonalManager;

                newItem.Update();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
 public DataSet GetIncomeLevelList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("IncomeLevel");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 public DataSet GetOccupationList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("Position");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public DataSet GetEPSList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("EPS");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
 public DataSet GetIdentificationTypeList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("IdentificationType");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #6
0
 public SPList GetIdentificationTypeSPList()
 {
     try
     {
         SharepointHelper SPHelpter = new SharepointHelper(Web);
         return SPHelpter.GetListItems("IdentificationType");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #7
0
 public DataSet GetFalseAddressList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("FalseAddress");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #8
0
 public DataSet GetSecurityQuestionList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("SecurityQuestion");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #9
0
 public DataSet GetMaritalStateList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("MaritalState");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #10
0
 public DataSet GetCompensationFundList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("CompensationFund");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #11
0
 public DataSet GetTopicOfInterestList()
 {
     try
     {
         SharepointHelper SPHelper = new SharepointHelper(Web);
         return SPHelper.GetListDataSet("TopicOfInterest");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #12
0
        public bool ExistsIdentificationInList(string identificationType, string identificationNumber)
        {
            try
            {
                SharepointHelper SPHelper = new SharepointHelper(Web);
                SPList list = SPHelper.GetListItems("UserCompanyNew");

                SPQuery query = new SPQuery();

                query.Query = string.Format("<Where><And><Eq><FieldRef Name='IdentificationType'/><Value Type='Text'>{0}</Value></Eq><Eq><FieldRef Name='IdentificationNumber'/><Value Type='Text'>{1}</Value></Eq></And></Where>", identificationType, identificationNumber);

                return (list.GetItems(query).Count > 0);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #13
0
        public bool ExistsCompanyInList(string nit, string subnit)
        {
            try
            {
                SharepointHelper SPHelper = new SharepointHelper(Web);
                SPList list = SPHelper.GetListItems("UserCompanyNew");

                SPQuery query = new SPQuery();

                query.Query = string.Format("<Where><And><Eq><FieldRef Name='NIT'/><Value Type='Text'>{0}</Value></Eq><Eq><FieldRef Name='SubNIT'/><Value Type='Text'>{1}</Value></Eq></And></Where>", nit, subnit);

                return (list.GetItems(query).Count > 0);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #14
0
        public List<Entities.User> FilterUsers(Entities.Filter filter)
        {
            try
            {
                SharepointHelper SPHelper = new SharepointHelper(Web);
                List<UserProfile> upList = SPHelper.GetUserProfileList();

                List<Entities.User> listUsers = new List<Entities.User>();

                foreach (UserProfile uProfile in upList)
                {
                    if (uProfile["AccountName"] != null &&
                         uProfile["AccountName"].ToString().ToUpper().Contains(System.Configuration.ConfigurationSettings.AppSettings["ProviderName"].ToUpper()))
                    {
                        if (OperatePropertyValue(uProfile[filter.Property].Value, filter))
                        {
                            listUsers.Add(GetUser(uProfile));
                        }
                    }
                }

                return listUsers;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #15
0
        public void CreateUser(Entities.User user)
        {
            try
            {
                SharepointHelper SPHelper = new SharepointHelper(Web);

                UserProfileManager upManager = SPHelper.GetUserProfileManager();
                upManager.CreateUserProfile(user.UserName);

                ModifyUser(user);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #16
0
        public void ModifyUser(Entities.User user)
        {
            try
            {
                SharepointHelper SPHelper = new SharepointHelper(Web);
                UserProfile uProfile = SPHelper.GetUserProfile(user.UserName);

                uProfile["CreationDate"].Value = user.CreationDate;
                uProfile["UserType"].Value = user.UserType.ToString();
                uProfile["FirstName"].Value = user.FirstName;
                uProfile["SecondName"].Value = user.SecondName;
                uProfile["FirstSurname"].Value = user.FirstSurname;
                uProfile["SecondSurname"].Value = user.SecondSurname;
                uProfile["IdentificationType"].Value = user.IdentificationType;
                uProfile["IdentificationNumber"].Value = user.IdentificationNumber;
                uProfile["NIT"].Value = user.NIT;
                uProfile["SubNIT"].Value = user.SubNIT;
                uProfile["Audience"].Value = user.Audience;
                uProfile["TradeName"].Value = user.TradeName;
                uProfile["BirthDate"].Value = user.BirthDate;
                uProfile["MaritalState"].Value = user.MaritalState;
                uProfile["Ocupattion"].Value = user.Ocupattion;
                uProfile["CompensationFund"].Value = user.CompensationFund;
                uProfile["Company"].Value = user.Company;
                uProfile["Position"].Value = user.Position;
                uProfile["PrivateEmail"].Value = user.PrivateEmail;
                uProfile["CompanyEmail"].Value = user.CompanyEmail;
                uProfile["PrivateTel"].Value = user.PrivateTel;
                uProfile["PrivateMobile"].Value = user.PrivateMobile;
                uProfile["CompanyMobile"].Value = user.CompanyMobile;
                uProfile["CompanyTel"].Value = user.CompanyTel;
                uProfile["TelExtension"].Value = user.TelExtension;
                uProfile["AddressCombo1"].Value = user.Address.AddressCombo1;
                uProfile["AddressCombo2"].Value = user.Address.AddressCombo2;
                uProfile["AddressCombo3"].Value = user.Address.AddressCombo3;
                uProfile["AddressCombo4"].Value = user.Address.AddressCombo4;
                uProfile["AddressCombo5"].Value = user.Address.AddressCombo5;
                uProfile["AddressCombo6"].Value = user.Address.AddressCombo6;
                uProfile["AddressText1"].Value = user.Address.AddressText1;
                uProfile["AddressText2"].Value = user.Address.AddressText2;
                uProfile["AddressText3"].Value = user.Address.AddressText3;
                uProfile["AddressText4"].Value = user.Address.AddressText4;
                uProfile["AddressText5"].Value = user.Address.AddressText5;
                uProfile["EPS"].Value = user.EPS;
                uProfile["ChildrenQuantity"].Value = user.ChildrenQuantity;
                uProfile["IncomeLevel"].Value = user.IncomeLevel;
                uProfile["PersonalManager"].Value = user.PersonalManager;
                uProfile["MarketSales"].Value = user.TopicOfInterest.MarketSales;
                uProfile["Recreation"].Value = user.TopicOfInterest.Recreation;
                uProfile["Education"].Value = user.TopicOfInterest.Education;
                uProfile["Home"].Value = user.TopicOfInterest.Home;
                uProfile["Health"].Value = user.TopicOfInterest.Health;
                uProfile["Subsidy"].Value = user.TopicOfInterest.Subsidy;
                uProfile["Credits"].Value = user.TopicOfInterest.Credits;
                uProfile["AuthorizedBy"].Value = user.AuthorizedBy;
                uProfile["AuthorizationDate"].Value = user.AuthorizationDate;
                uProfile["AuthorizedToGetBasicData"].Value = user.AuthorizedToGetBasicData;
                uProfile["AuthorizedToGetContibutionData"].Value = user.AuthorizedToGetContibutionData;
                uProfile["AuthorizedToGetMemberData"].Value = user.AuthorizedToGetMemberData;
                uProfile["SecurityAnswer"].Value = user.SecurityAnswer;
                uProfile["SecurityQuestion"].Value = user.SecurityQuestion;

                uProfile.Commit();

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #17
0
        public Entities.User GetUserByWS(string profile, string username, string pass, string domain)
        {
            try
            {
                SharepointHelper spHelper = new SharepointHelper();
                UserProfileWS.PropertyData[] propertiesData = spHelper.GetUserProfileByWS(profile, username, pass, domain);

                Entities.User user = new CAFAM.WebPortal.Entities.User();
                foreach (UserProfileWS.PropertyData propertyData in propertiesData)
                {
                    if (propertyData.Values.Length > 0)
                    {
                        switch (propertyData.Name)
                        {
                            case "CreationDate":
                                user.CreationDate = GetPropertyValueDateTime(propertyData.Values[0].Value);
                                break;
                            case "UserType":
                                user.UserType = (Entities.EnumUserType)Enum.Parse(typeof(Entities.EnumUserType), GetPropertyValueString(propertyData.Values[0].Value));
                                break;
                            case "AccountName":
                                user.UserName = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "FirstName":
                                user.FirstName = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "SecondName":
                                user.SecondName = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "FirstSurname":
                                user.FirstSurname = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "SecondSurname":
                                user.SecondSurname = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "IdentificationType":
                                user.IdentificationType = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "IdentificationNumber":
                                user.IdentificationNumber = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "NIT":
                                user.NIT = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "SubNIT":
                                user.SubNIT = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "Audience":
                                user.Audience = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "TradeName":
                                user.TradeName = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "BirthDate":
                                user.BirthDate = GetPropertyValueDateTime(propertyData.Values[0].Value);
                                break;
                            case "MaritalState":
                                user.MaritalState = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "Ocupattion":
                                user.Ocupattion = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "CompensationFund":
                                user.CompensationFund = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "Company":
                                user.Company = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "Position":
                                user.Position = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "PrivateEmail":
                                user.PrivateEmail = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "CompanyEmail":
                                user.CompanyEmail = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "PrivateTel":
                                user.PrivateTel = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "PrivateMobile":
                                user.PrivateMobile = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "CompanyMobile":
                                user.CompanyMobile = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "CompanyTel":
                                user.CompanyTel = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "TelExtension":
                                user.TelExtension = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressCombo1":
                                user.Address.AddressCombo1 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressCombo2":
                                user.Address.AddressCombo2 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressCombo3":
                                user.Address.AddressCombo3 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressCombo4":
                                user.Address.AddressCombo4 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressCombo5":
                                user.Address.AddressCombo5 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressCombo6":
                                user.Address.AddressCombo6 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressText1":
                                user.Address.AddressText1 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressText2":
                                user.Address.AddressText2 = GetPropertyValueInt(propertyData.Values[0].Value);
                                break;
                            case "AddressText3":
                                user.Address.AddressText3 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressText4":
                                user.Address.AddressText4 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AddressText5":
                                user.Address.AddressText5 = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "EPS":
                                user.EPS = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "ChildrenQuantity":
                                user.ChildrenQuantity = GetPropertyValueInt(propertyData.Values[0].Value);
                                break;
                            case "IncomeLevel":
                                user.IncomeLevel = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "PersonalManager":
                                user.PersonalManager = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "MarketSales":
                                user.TopicOfInterest.MarketSales = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "Recreation":
                                user.TopicOfInterest.Recreation = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "Education":
                                user.TopicOfInterest.Education = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "Home":
                                user.TopicOfInterest.Home = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "Health":
                                user.TopicOfInterest.Health = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "Subsidy":
                                user.TopicOfInterest.Subsidy = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "Credits":
                                user.TopicOfInterest.Credits = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "AuthorizedBy":
                                user.AuthorizedBy = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "AuthorizationDate":
                                user.AuthorizationDate = GetPropertyValueDateTime(propertyData.Values[0].Value);
                                break;
                            case "AuthorizedToGetBasicData":
                                user.AuthorizedToGetBasicData = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "AuthorizedToGetContibutionData":
                                user.AuthorizedToGetContibutionData = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "AuthorizedToGetMemberData":
                                user.AuthorizedToGetMemberData = GetProperyValueBool(propertyData.Values[0].Value);
                                break;
                            case "SecurityAnswer":
                                user.SecurityAnswer = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                            case "SecurityQuestion":
                                user.SecurityQuestion = GetPropertyValueString(propertyData.Values[0].Value);
                                break;
                        }
                    }
                }
                return user;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #18
0
 public void DeleteUser(string profile)
 {
     try
     {
         SharepointHelper spHelper = new SharepointHelper(Web);
         UserProfileManager upManager = spHelper.GetUserProfileManager();
         upManager.RemoveUserProfile(profile);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #19
0
        public Entities.User GetUser(int id)
        {
            try
            {
                SharepointHelper SPHelper = new SharepointHelper(Web);
                UserProfile uProfile = SPHelper.GetUserProfile(id);

                return GetUser(uProfile);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #20
0
        public bool UserExistSP(string profile)
        {
            try
            {
                SharepointHelper spHelper = new SharepointHelper(Web);
                UserProfileManager manager = spHelper.GetUserProfileManager();

                return manager.UserExists(profile) ;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #21
0
        public Entities.User FilterUser(List<Entities.Filter> filters)
        {
            try
            {
                SharepointHelper SPHelper = new SharepointHelper(Web);
                List<UserProfile> upList = SPHelper.GetUserProfileList();

                Entities.User returnUProfile = null;

                foreach (UserProfile uProfile in upList)
                {
                    if (uProfile["AccountName"] != null &&
                         uProfile["AccountName"].ToString().ToUpper().Contains(System.Configuration.ConfigurationSettings.AppSettings["ProviderName"].ToUpper()))
                    {
                        bool correctValue = true;

                        foreach (Entities.Filter filter in filters)
                        {
                            if (!OperatePropertyValue(uProfile[filter.Property].Value, filter))
                            {
                                correctValue = false;
                            }
                        }

                        if (correctValue)
                        {
                            returnUProfile = GetUser(uProfile);
                            break;
                        }
                    }
                }

                return returnUProfile;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }