Beispiel #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;
            }
        }
 public SPList GetIdentificationTypeSPList()
 {
     try
     {
         SharepointHelper SPHelpter = new SharepointHelper(Web);
         return SPHelpter.GetListItems("IdentificationType");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        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;
            }
        }
        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;
            }
        }