public Entities.User AssignDataToEntity()
        {
            try
            {

                Entities.User userEntity = new CAFAM.WebPortal.Entities.User();

                Random random = new Random();
                userEntity.Password = random.Next(11111111, 99999999).ToString();
                userEntity.CreationDate = DateTime.Now;
                userEntity.UserType = CAFAM.WebPortal.Entities.EnumUserType.Empresa;
                userEntity.NIT = txtNit.Text;
                userEntity.SubNIT = txtSubNIT.Text;
                userEntity.Company = txtCompanyName.Text;
                userEntity.FirstName = txtFirstName.Text;
                userEntity.SecondName = txtSecondName.Text;
                userEntity.FirstSurname = txtFirstSurname.Text;
                userEntity.SecondSurname = txtSecondSurname.Text;
                userEntity.IdentificationType = rdIdentificationType.SelectedValue;
                userEntity.IdentificationNumber = txtIdentificatioNumber.Text;
                userEntity.Position = txtPosition.Text;
                userEntity.CompanyEmail = txtCompanyEmail.Text;
                WebUI.TelephoneControl telCompany = (WebUI.TelephoneControl)pnlCompanyTel.FindControl("telCompany");
                userEntity.CompanyTel = telCompany.Tel;
                userEntity.TelExtension = txtTelExtension.Text;
                WebUI.TelephoneControl telCompanyMobile = (WebUI.TelephoneControl)pnlCompanyMobile.FindControl("telCompanyMobile");
                userEntity.CompanyMobile = telCompanyMobile.Tel;
                userEntity.AuthorizedBy = txtAuthorizedBy.Text;
                WebUI.DateTimeCustomControl dateTimeCustomControl = (WebUI.DateTimeCustomControl)this.pnlAuthorizationDate.FindControl("dateTimeCustomControl");
                if (dateTimeCustomControl != null)
                {
                    userEntity.BirthDate = dateTimeCustomControl.Date;
                }
                    userEntity.AuthorizedToGetBasicData = chkAuthorizedToGetBasicData.Checked;
                    userEntity.AuthorizedToGetContibutionData = chkAuthorizedToGetContibutionData.Checked;
                    userEntity.AuthorizedToGetMemberData = chkAuthorizedToGetMemberData.Checked;
                userEntity.UserName = string.Format("{0}:{1}", ConfigurationManager.AppSettings["ProviderName"], txtUserName.Text);

                return userEntity;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
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;
            }
        }
예제 #3
0
        public Entities.User AssignDataToEntity()
        {
            try
            {
                int outInt;

                Entities.User userEntity = new CAFAM.WebPortal.Entities.User();

                userEntity.NIT = lblNit.Text;
                userEntity.SubNIT = lblSubNIT.Text;
                userEntity.Company = lblCompanyName.Text;
                userEntity.FirstName = txtFirstName.Text;
                userEntity.SecondName = txtSecondName.Text;
                userEntity.FirstSurname = txtFirstSurname.Text;
                userEntity.SecondSurname = txtSecondSurname.Text;
                userEntity.IdentificationType = lblIdentificationType.Text;
                userEntity.IdentificationNumber = lblIdentificatioNumber.Text;
                userEntity.Position = txtPosition.Text;
                userEntity.CompanyEmail = txtCompanyEmail.Text;
                WebUI.TelephoneControl telCompany = (WebUI.TelephoneControl)pnlCompanyTel.FindControl("telCompany");
                userEntity.CompanyTel = telCompany.Tel;
                userEntity.TelExtension = txtTelExtension.Text;
                WebUI.TelephoneControl telCompanyMobile = (WebUI.TelephoneControl)pnlCompanyMobile.FindControl("telCompanyMobile");
                userEntity.CompanyMobile = telCompanyMobile.Tel;
                userEntity.PersonalManager = txtPersonalManager.Text;

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