Example #1
0
        public bool IntegrateTravelandTransportRateInfotoDB(List <SalesforceRate> TTRates)
        {
            bool result = false;

            foreach (var TTR in TTRates)
            {
                using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
                {
                    var existingrecord = dbc.SalesforceRates.FirstOrDefault(k => k.ServiceId == TTR.ServiceId && k.RateId == TTR.RateId);
                    if (existingrecord == null)
                    {
                        dbc.SalesforceRates.Add(TTR);
                    }
                    else
                    {
                        existingrecord.RateId      = TTR.RateId;
                        existingrecord.ServiceId   = TTR.ServiceId;
                        existingrecord.RateName    = TTR.RateName;
                        existingrecord.Negotiation = TTR.Negotiation;
                        existingrecord.Rate        = TTR.Rate;
                        existingrecord.StartDate   = TTR.StartDate;
                        existingrecord.EndDate     = TTR.EndDate;
                        existingrecord.RateType    = TTR.RateType;
                    }
                    dbc.SaveChanges();
                }
                result = true;
            }
            result = true;
            return(result);
        }
Example #2
0
        /// <summary>
        /// SFDC User information mapped into Operator table
        /// </summary>
        /// <param name="SFDCUsers"></param>
        /// <returns></returns>
        public bool IntegrateAllDriver(List <ClsUsersList> SFDCUsers)
        {
            bool result = false;

            using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
            {
                foreach (var users in SFDCUsers)
                {
                    try
                    {
                        bool option = false;
                        if (_integrationAppSettings.IntegrationforSandbox != null)
                        {
                            option = Convert.ToBoolean(_integrationAppSettings.IntegrationforSandbox);
                        }
                        if (option)
                        {
                            users.UserName = users.UserName.Remove(users.UserName.Length - 9);
                        }
                        var driver = dbc.Drivers.FirstOrDefault(k => k.Username == users.UserName);
                        if (driver != null)
                        {
                            driver.SalesForceUserId = users?.Id ?? "";
                            dbc.SaveChanges();
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            return(result);
        }
Example #3
0
        /// <summary>
        /// Customer information pushed to customer table
        /// </summary>
        /// <param name="customer"></param>
        /// <returns></returns>
        public bool IntegrateCustomerInfotoDB(List <Customer> customer)
        {
            bool result = false;

            using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
            {
                foreach (var cs in customer)
                {
                    var csinfo = dbc.Customers.FirstOrDefault(k => k.CustomerId == cs.CustomerId);
                    if (csinfo == null)
                    {
                        if (cs.Status == 1)
                        {
                            dbc.Customers.Add(cs);
                        }
                    }
                    else
                    {
                        csinfo.CustomerId = cs.CustomerId;
                        csinfo.LumaryId   = cs.LumaryId;
                        csinfo.Name       = cs.Name;
                        csinfo.Street     = cs.Street;
                        csinfo.City       = cs.City;
                        csinfo.State      = cs.State;
                        csinfo.PostalCode = cs.PostalCode;
                        csinfo.Status     = cs.Status;
                        cs.ModifiedDate   = DateTime.Now;
                    }
                    dbc.SaveChanges();
                }
            }
            result = true;
            return(result);
        }
Example #4
0
 public bool IntegrateAssetsintoDB(List <Vehicle> vehicles)
 {
     using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
     {
         // _logger.LogInformation("Method IntegrateAssetsintoDB");
         foreach (var veh in vehicles)
         {
             var vehinfo = dbc.Vehicles.FirstOrDefault(k => k.AssetId == veh.AssetId);
             if (vehinfo == null)
             {
                 dbc.Vehicles.Add(veh);
             }
             else
             {
                 vehinfo.Registration = veh.Registration;
                 vehinfo.Make         = veh.Make;
                 vehinfo.Model        = veh.Model;
                 vehinfo.Type         = veh.Type;
                 vehinfo.Category     = veh.Category;
                 vehinfo.DriverId     = veh.DriverId;
                 vehinfo.ModifiedDate = veh.ModifiedDate;
             }
             dbc.SaveChanges();
         }
     }
     return(true);
 }
Example #5
0
        public Boolean ModifiedCustomerServiceLineIntegratedTime()
        {
            using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
            {
                try
                {
                    var exitingrecords = dbc.ApplicationSettings.FirstOrDefault(k => k.Key == "Last_CustomerLineIntegrate");
                    if (exitingrecords != null)
                    {
                        exitingrecords.Value = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    else
                    {
                        exitingrecords       = new ApplicationSetting();
                        exitingrecords.Key   = "Last_CustomerLineIntegrate";
                        exitingrecords.Value = DateTime.Now.ToString("yyyy-MM-dd");
                    }

                    dbc.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }
Example #6
0
 /// <summary>
 /// Customer Line information pushed to Customer Service Line
 /// </summary>
 /// <param name="cslines"></param>
 /// <returns></returns>
 public bool IntegrateCustomerLineinfointoDB(List <CustomerServiceLine> cslines)
 {
     // _logger.LogInformation("Method IntegrateCustomerLineinfointoDB");
     using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
     {
         foreach (var csl in cslines)
         {
             var cslinfo = dbc.CustomerServiceLines.FirstOrDefault(k => k.ServiceAgreementId == csl.ServiceAgreementId && k.ServiceAgreementItemId == csl.ServiceAgreementItemId && k.ServiceAgreementCustomerId == csl.ServiceAgreementCustomerId);
             if (cslinfo == null)
             {
                 if (csl.ServiceAgreementStatus == 1)
                 {
                     dbc.CustomerServiceLines.Add(csl);
                     dbc.SaveChanges();
                 }
             }
             else
             {
                 cslinfo.ServiceAgreementCustomerId        = csl.ServiceAgreementCustomerId;
                 cslinfo.ServiceAgreementName              = csl.ServiceAgreementName;
                 cslinfo.ServiceAgreementEndDate           = csl.ServiceAgreementEndDate;
                 cslinfo.ServiceAgreementStatus            = csl.ServiceAgreementStatus;
                 cslinfo.ServiceAgreementFundingManagement = csl.ServiceAgreementFundingManagement;
                 cslinfo.ServiceAgreementFundingType       = csl.ServiceAgreementFundingType;
                 cslinfo.ServiceAgreementItemName          = csl.ServiceAgreementItemName;
                 cslinfo.SupportCategoryAmount             = csl.SupportCategoryAmount;
                 cslinfo.SupportCategoryDelivered          = csl.SupportCategoryDelivered;
                 cslinfo.FundsRemaining       = csl.FundsRemaining;
                 cslinfo.ItemOverclaim        = csl.ItemOverclaim;
                 cslinfo.SiteGlcode           = csl.SiteGlcode;
                 cslinfo.CategoryItemId       = csl.CategoryItemId;
                 cslinfo.SiteId               = csl.SiteId;
                 cslinfo.SiteName             = csl.SiteName;
                 cslinfo.SiteServiceProgramId = csl.SiteServiceProgramId;
                 cslinfo.ServiceId            = csl.ServiceId;
                 cslinfo.ServiceName          = csl.ServiceName;
                 cslinfo.TravelServiceId      = csl.TravelServiceId;
                 cslinfo.TransportServiceId   = csl.TransportServiceId;
                 cslinfo.AllowRateNegotiation = csl.AllowRateNegotiation;
                 cslinfo.ModifiedDate         = DateTime.Now;
                 dbc.SaveChanges();
             }
         }
     }
     return(true);
 }
Example #7
0
        /// <summary>
        /// SFDC User information mapped into Operator table
        /// </summary>
        /// <param name="SFDCUsers"></param>
        /// <returns></returns>
        public bool IntegrateAllDriver(List <ClsUsersList> SFDCUsers)
        {
            bool result = false;

            using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
            {
                foreach (var users in SFDCUsers)
                {
                    users.UserName = users.UserName.Remove(users.UserName.Length - 9);
                    var driver = dbc.Drivers.FirstOrDefault(k => k.Username == users.UserName);
                    driver.SalesForceUserId = users.Id;
                    dbc.SaveChanges();
                }
            }
            return(result);
        }
Example #8
0
        /// <summary>
        /// Driver information pushed to driver table
        /// </summary>
        /// <param name="drivers"></param>
        /// <returns></returns>
        public bool IntegrateOpertorintoDB(List <Driver> drivers)
        {
            bool result = false;

            foreach (var drv in drivers)
            {
                using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
                {
                    var existingrecord = dbc.Drivers.FirstOrDefault(k => k.EmployeeCode == drv.EmployeeCode);
                    if (existingrecord == null)
                    {
                        dbc.Drivers.Add(drv);
                    }
                    else
                    {
                        if (drv.Disabled == true)
                        {
                            existingrecord.Disabled = true;
                        }
                        else
                        {
                            existingrecord.FirstName      = drv.FirstName;
                            existingrecord.LastName       = drv.LastName;
                            existingrecord.CostCenter     = drv.CostCenter;
                            existingrecord.Username       = drv.Username;
                            existingrecord.Disabled       = drv.Disabled;
                            existingrecord.Type           = drv.Type;
                            existingrecord.JobDescription = drv.JobDescription;
                            existingrecord.Department     = drv.Department;
                            existingrecord.ManagerName    = drv.ManagerName;
                            existingrecord.IsPortalUser   = drv.IsPortalUser;
                            existingrecord.JobNumber      = drv.JobNumber;
                            existingrecord.PreferedName   = drv.PreferedName;
                            if (existingrecord.SalesForceUserId != "" && drv.SalesForceUserId != "")
                            {
                                existingrecord.SalesForceUserId = drv.SalesForceUserId;
                            }
                        }
                    }
                    dbc.SaveChanges();
                }
                result = true;
            }
            return(result);
        }
Example #9
0
        public bool SFDCActionStatus(int BillingId, bool SentToSalesForceStatus, string SentToSalesForceDescription, string SalesForceBillingID)
        {
            bool result = false;

            using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
            {
                var billlineNew = dbc.BillingLinesNews.FirstOrDefault(k => k.BillingId == BillingId);
                billlineNew.SentToSalesForce            = true;
                billlineNew.SentToSalesForceStatus      = SentToSalesForceStatus;
                billlineNew.SentToSalesForceDescription = SentToSalesForceDescription;
                billlineNew.DateTransferred             = DateTime.Now;
                if (SalesForceBillingID != "")
                {
                    billlineNew.SalesForceBillingId = SalesForceBillingID;
                }
                dbc.SaveChanges();
                result = true;
            }
            return(result);
        }
Example #10
0
        public bool ExistingCustomerLineinfoStatusChanged(List <CustomerServiceLine> cslines)
        {
            bool result = false;

            if (StaticDBACTION.ExitingList.Count > 0)
            {
                using (NDISINT18Apr2021Context dbc = new NDISINT18Apr2021Context(this._integrationAppSettings))
                {
                    foreach (var csl in cslines)
                    {
                        var cslinfo = dbc.CustomerServiceLines.FirstOrDefault(k => k.ServiceAgreementId == csl.ServiceAgreementId && k.ServiceAgreementItemId == csl.ServiceAgreementItemId && k.ServiceAgreementCustomerId == csl.ServiceAgreementCustomerId);
                        if (cslinfo != null)
                        {
                            cslinfo.ServiceAgreementStatus = csl.ServiceAgreementStatus;
                            dbc.SaveChanges();
                        }
                    }
                }
            }
            return(result);
        }