Exemple #1
0
        public bool Save(IEnumerable <BusinessToCustomerModel> businessToCustomer, int requestId)
        {
            try
            {
                bool status = false;
                List <Persistance.BusinessToCustomer> businessToCustomers = new List <BusinessToCustomer>();

                businessToCustomers.AddRange(
                    businessToCustomer.Select(
                        x => new Persistance.BusinessToCustomer
                {
                    Address       = x.Address?.Trim(),
                    Address2      = x.Address2,
                    AnnualSalary  = x.AnnualSalary?.Trim(),
                    Area          = x.Area?.Trim(),
                    Caste         = x.Caste?.Trim(),
                    City          = x.City?.Trim(),
                    Country       = x.Country?.Trim(),
                    Dob           = x.Dob,
                    Email         = x.Email?.Trim(),
                    Employer      = x.Employer?.Trim(),
                    Experience    = x.Experience?.Trim(),
                    Gender        = x.Gender?.Trim(),
                    Industry      = x.Industry?.Trim(),
                    KeySkills     = x.KeySkills?.Trim(),
                    Location      = x.Location?.Trim(),
                    Mobile2       = x.Mobile2?.Trim(),
                    MobileNew     = x.MobileNew?.Trim(),
                    Name          = x.Name?.Trim(),
                    Network       = x.Network?.Trim(),
                    PhoneNew      = x.PhoneNew?.Trim(),
                    Pincode       = x.Pincode?.Trim(),
                    Qualification = x.Qualification?.Trim(),
                    Roles         = x.Roles?.Trim(),
                    State         = x.State?.Trim(),
                    RequestId     = requestId
                }));
                _customerDataManagementContext.Database.SetCommandTimeout(CommonSetting.TimeOut);

                _customerDataManagementContext.BulkInsert(businessToCustomers,
                                                          new BulkConfig
                {
                    PreserveInsertOrder = true,
                    SetOutputIdentity   = true,
                    BatchSize           = CommonSetting.BulkInsertRange,
                },
                                                          (a) => WriteProgress(a));

                status = (CommonSetting.BulkInsertRange <= businessToCustomer.Count()) ? (int)_percentage >= 1 : true;
                return(status);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #2
0
        public bool Save(IEnumerable <BusinessToBusinesModel> customerToBusiness, int requestId)
        {
            bool status = false;

            List <Persistance.BusinessToBusiness> businessToBusinesses = new List <Persistance.BusinessToBusiness>();

            businessToBusinesses.AddRange(customerToBusiness.Select(x => new Persistance.BusinessToBusiness()
            {
                Add1           = x.Add1?.Trim(),
                Add2           = x.Add2?.Trim(),
                Area           = x.Area?.Trim(),
                CategoryId     = x.CategoryId,
                City           = x.City?.Trim(),
                CompanyName    = x.CompanyName?.Trim(),
                ContactPerson  = x.ContactPerson?.Trim(),
                Contactperson1 = x.Contactperson1?.Trim(),
                Country        = x.Country?.Trim(),
                Designation    = x.Designation?.Trim(),
                Designation1   = x.Designation1?.Trim(),
                Email          = x.Email?.Trim(),
                Email1         = x.Email1?.Trim(),
                EstYear        = x.EstYear,
                Fax            = x.Fax?.Trim(),
                LandMark       = x.LandMark?.Trim(),
                Mobile1        = x.Mobile1?.Trim(),
                Mobile2        = x.Mobile2?.Trim(),
                MobileNew      = x.MobileNew?.Trim(),
                NoOfEmp        = x.NoOfEmp,
                Phone1         = x.Phone1?.Trim(),
                Phone2         = x.Phone2?.Trim(),
                PhoneNew       = x.PhoneNew?.Trim(),
                Pincode        = x.Pincode?.Trim(),
                State          = x.State?.Trim(),
                Web            = x.Web?.Trim(),
                RequestId      = requestId
            }));
            _customerDataManagementContext.Database.SetCommandTimeout(CommonSetting.TimeOut);

            _customerDataManagementContext.BulkInsert(businessToBusinesses,
                                                      new BulkConfig
            {
                PreserveInsertOrder = true,
                SetOutputIdentity   = true,
                BatchSize           = CommonSetting.BulkInsertRange,
            },
                                                      (a) => WriteProgress(a));

            status = (CommonSetting.BulkInsertRange <= businessToBusinesses.Count()) ? (int)_percentage >= 1 : true;
            return(status);
        }
        public bool Save(IEnumerable <CustomerDataModel> customerDataModels, int requestId)
        {
            bool saveStatus = false;

            try
            {
                List <CustomerDataManagement> customerDataManagements = new List <CustomerDataManagement>();

                customerDataManagements.AddRange(
                    customerDataModels.Select(x => new CustomerDataManagement
                {
                    Circle = x.Circle?.Trim(),
                    ClientBusinessVertical = x.ClientBusinessVertical?.Trim(),
                    ClientCity             = x.ClientCity?.Trim(),
                    ClientName             = x.ClientName?.Trim(),
                    DateOfUse    = x.DateOfUse,
                    Numbers      = x.Numbers?.Trim(),
                    Operator     = x.Operator?.Trim(),
                    Dbquality    = x.DBQuality?.Trim(),
                    CreatedBy    = x.UpdatedBy?.Trim(),
                    CreatedDate  = x.UpdatedOn,
                    ModifiedBy   = x.UpdatedBy?.Trim(),
                    ModifiedDate = x.UpdatedOn,
                    RequestId    = requestId,
                    Country      = x.Country,
                    State        = x.State
                }));
                _customerDataManagementContext.Database.SetCommandTimeout(CommonSetting.TimeOut);
                _customerDataManagementContext.BulkInsert(customerDataManagements,
                                                          new BulkConfig
                {
                    PreserveInsertOrder = true,
                    SetOutputIdentity   = true,
                    BatchSize           = CommonSetting.BulkInsertRange,
                },
                                                          (a) => WriteProgress(a));

                saveStatus = (CommonSetting.BulkInsertRange <= customerDataManagements.Count()) ? (int)_percentage >= 1 : true;
            }
            catch (Exception)
            {
                throw;
            }
            return(saveStatus);
        }