Пример #1
0
        T IIntegrate <T> .Save(string jsonKeys, ParamsIntegrateErp configErp, List <Object> parameterAditional)
        {
            DealerShopIntegrate     dealerShopIntegrate = null;
            CloudCatalogDealerShops dealerShop          = null;

            if (Enum.TryParse(configErp.DllType, out ErpsTypes dllType))
            {
                dealerShop = DataAccesErpContract.GetDealerShop(jsonKeys, dllType, configErp.ConfigParamsToErp);
                if (dealerShop != null)
                {
                    dealerShop = new DealerShopsSystime(configErp.ConectionStringToSystime).SaveDealerShop(dealerShop);
                }
            }

            if (dealerShop != null)
            {
                dealerShopIntegrate = new DealerShopIntegrate()
                {
                    DealerShopSystime = dealerShop
                };
                if (configErp.SaveInAzure)
                {
                    dealerShopIntegrate.DealerShopUbicar = SaveInAzure(dealerShop, configErp);
                }

                return((T)Convert.ChangeType(dealerShopIntegrate, typeof(T)));
            }
            return(default(T));
        }
Пример #2
0
        T IIntegrate <T> .Save(string jsonKeys, ParamsIntegrateErp configErp, List <Object> parameterAditional)
        {
            CustomerIntegrate customerIntegrate = null;
            Customers         customer          = null;

            if (Enum.TryParse(configErp.DllType, out ErpsTypes dllType))
            {
                customer = DataAccesErpContract.GetCustomer(jsonKeys, dllType, configErp.ConfigParamsToErp);
                if (customer != null)
                {
                    customer = new CustomersSystime(configErp.ConectionStringToSystime).SaveCustomer(customer, configErp.UserModify);
                }
            }

            if (customer != null)
            {
                customerIntegrate = new CustomerIntegrate()
                {
                    CustomerSystime = customer
                };
                if (configErp.SaveInAzure)
                {
                    customerIntegrate.CustomerUbicar = SaveAzure(customer, configErp);
                }

                return((T)Convert.ChangeType(customerIntegrate, typeof(T)));
            }

            return(default(T));
        }
Пример #3
0
        T IIntegrate <T> .Save(string jsonKeys, ParamsIntegrateErp configErp, List <Object> parameterAditional)
        {
            InsuranceCompanyIntegrate      insuranceCompanyIntegrate = null;
            CloudCatalogInsuranceCompanies insuranceCompany          = null;

            if (Enum.TryParse(configErp.DllType, out ErpsTypes dllType))
            {
                insuranceCompany = DataAccesErpContract.GetInsuranceCompany(jsonKeys, dllType, configErp.ConfigParamsToErp);
                if (insuranceCompany != null)
                {
                    insuranceCompany = new InsuranceCompaniesSystime(configErp.ConectionStringToSystime).SaveInsuranceCompay(insuranceCompany);
                }
            }

            if (insuranceCompany != null)
            {
                insuranceCompanyIntegrate = new InsuranceCompanyIntegrate()
                {
                    InsuranceCompnaySystime = insuranceCompany
                };

                if (configErp.SaveInAzure)
                {
                    insuranceCompanyIntegrate.InsuranceCompnayUbicar = SaveInAzure(insuranceCompany, configErp);
                }
                return((T)Convert.ChangeType(insuranceCompanyIntegrate, typeof(T)));
            }
            return(default(T));
        }
Пример #4
0
        public T Save(string jsonKeys, ParamsIntegrateErp configErp, List <object> parameterAditional)
        {
            WorkerIntegrate     workerIntegrate     = null;
            Workers             worker              = null;
            DealerShopIntegrate dealerShopIntegrate = null;

            if (Enum.TryParse(configErp.DllType, out ErpsTypes dllType))
            {
                worker = DataAccesErpContract.GetWorker(jsonKeys, dllType, new ParamsContract()
                {
                    ConectionStringErp     = configErp.ConectionStringErp,
                    ConectionStringSystime = configErp.ConectionStringToSystime,
                    Language    = configErp.LanguageDb,
                    SupportShop = configErp.IdShopsErpArray
                }, out List <Tuple <Type, String> > listOtherAccionPreIntegrate);

                dealerShopIntegrate = UtilsIIntegrateErpToSystime.IntegrateOtherTypes <DealerShopIntegrate>(listOtherAccionPreIntegrate, configErp, null);
                if (dealerShopIntegrate == null)
                {
                    dealerShopIntegrate = UtilsIIntegrateErpToSystime.ResolveTypeParameter <DealerShopIntegrate>(parameterAditional);
                }

                if (worker != null)
                {
                    if (worker?.IdDealerShop != dealerShopIntegrate?.DealerShopSystime?.IdDealerShop)
                    {
                        worker.IdDealerShop = dealerShopIntegrate?.DealerShopSystime?.IdDealerShop;
                    }
                    worker = new WorkersSystime(configErp.ConectionStringToSystime).SaveWorker(worker, configErp.UserModify);

                    if (worker != null)
                    {
                        workerIntegrate = new WorkerIntegrate()
                        {
                            WokerSystime = worker
                        };
                        if (configErp.SaveInAzure)
                        {
                            List <Object> modelsParams = new List <object>();
                            if (dealerShopIntegrate?.DealerShopUbicar != null)
                            {
                                modelsParams.Add(dealerShopIntegrate?.DealerShopUbicar);
                            }

                            workerIntegrate.WorkerUbicar = SaveInAzure(worker, modelsParams, configErp);
                        }
                    }
                }
            }

            if (workerIntegrate != null)
            {
                return((T)Convert.ChangeType(workerIntegrate, typeof(T)));
            }

            return(default(T));
        }
Пример #5
0
        public bool ErpSyncToSystime(Config.Config config)
        {
            ParamsIntegrateErp configIntegrateErp = config.GetConfigIntegrate();
            int countTotal   = 0;
            int countTotalOk = 0;

            if (Enum.TryParse(configIntegrateErp.DllType, out ErpsTypes dllType))
            {
                List <NotificationSystimeIntegrate> listIntegrateSystime = DataAccesErpContract.GetNotificationSystime(configIntegrateErp.ConfigParamsToErp, dllType);
                List <NotificationSystimeIntegrate> deleteItems          = new List <NotificationSystimeIntegrate>();
                NotificationSystimeIntegrate        itemSave             = null;
                if (listIntegrateSystime.Count == 0)
                {
                    return(true);
                }
                countTotal = listIntegrateSystime.Count;
                listIntegrateSystime?.ForEach(/*listIntegrateSystime, new ParallelOptions { MaxDegreeOfParallelism = 4 },*/ l =>
                {
                    try
                    {
                        if (!deleteItems.Contains(l))
                        {
                            itemSave = listIntegrateSystime.OrderByDescending(i => i.CreatedAt).FirstOrDefault(i => i.TableName == l.TableName && i.JsonKeys == l.JsonKeys && i.Event == l.Event);
                            deleteItems.Add(l);
                            if (SyncNotifyItemErp(config, itemSave))
                            {
                                countTotalOk++;
                            }
                            if (DataAccesErpContract.DeleteNotifcationSystimeGroup(itemSave.JsonKeys, itemSave.TableName, itemSave.Event, itemSave.CreatedAt, configIntegrateErp.ConfigParamsToErp, dllType))
                            {
                                deleteItems.AddRange(listIntegrateSystime.Where(i => i.TableName == itemSave.TableName && i.JsonKeys == itemSave.JsonKeys && i.Event == itemSave.Event && i.CreatedAt < itemSave.CreatedAt));
                            }
                        }
                    }
#pragma warning disable S2486 // Generic exceptions should not be ignored
                    catch (Exception ex)
#pragma warning disable S108  // Nested blocks of code should not be left empty
                    {
                    }
#pragma warning restore S108  // Nested blocks of code should not be left empty
#pragma warning restore S2486 // Generic exceptions should not be ignored
                });



                if (countTotal == countTotalOk)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #6
0
 public bool SuportItem(string jsonKeys, ParamsIntegrateErp configErp)
 {
     if (Enum.TryParse(configErp.DllType, out ErpsTypes dllType))
     {
         return(DataAccesErpContract.SupportItemWorkOrder(jsonKeys, dllType, new ParamsContract()
         {
             ConectionStringErp = configErp.ConectionStringErp,
             ConectionStringSystime = configErp.ConectionStringToSystime,
             Language = configErp.LanguageDb,
             SupportShop = configErp.IdShopsErpArray
         }));
     }
     return(false);
 }
Пример #7
0
        public bool SaveAll(ParamsIntegrateErp configErp, DateTime dateTimeMin)
        {
            List <String> listKsonKeys = null;
            int?          countTotal   = 0;
            int           countOk      = 0;

            if (Enum.TryParse(configErp.DllType, out ErpsTypes dllType))
            {
                listKsonKeys = DataAccesErpContract.GetAllJsonKeysWorkORder(dllType, new ParamsContract()
                {
                    ConectionStringErp     = configErp.ConectionStringErp,
                    ConectionStringSystime = configErp.ConectionStringToSystime,
                    Language    = configErp.LanguageDb,
                    SupportShop = configErp.IdShopsErpArray
                }, dateTimeMin);

                countTotal = listKsonKeys?.Count;

                Parallel.ForEach(listKsonKeys, k => {
                    try
                    {
                        WorkOrderIntegrate wokrOrerIntegrarte = null;
                        wokrOrerIntegrarte = Save(k, configErp, null);
                        if (wokrOrerIntegrarte?.WorkOrderSystime != null)
                        {
                            countOk++;
                        }
                    }
#pragma warning disable S2486 // Generic exceptions should not be ignored
                    catch (Exception ex)
#pragma warning disable S108  // Nested blocks of code should not be left empty
                    {
                    }
#pragma warning restore S108  // Nested blocks of code should not be left empty
#pragma warning restore S2486 // Generic exceptions should not be ignored
                });

                //listKsonKeys.ForEach(

                if (countOk != 0 && countTotal != 0)
                {
                    return(countOk == countTotal);
                }
            }
            return(false);
        }
Пример #8
0
        public T Save(string jsonKeys, ParamsIntegrateErp configErp, List <object> parameterAditional)
        {
            WorkOrders workOrder = null;

            if (Enum.TryParse(configErp.DllType, out ErpsTypes dllType))
            {
                workOrder = DataAccesErpContract.GetWorkOrder(jsonKeys, dllType, new ParamsContract()
                {
                    ConectionStringErp     = configErp.ConectionStringErp,
                    ConectionStringSystime = configErp.ConectionStringToSystime,
                    Language    = configErp.LanguageDb,
                    SupportShop = configErp.IdShopsErpArray
                }, out List <Tuple <Type, String> > listOtherAccionPreIntegrate);
                return(Saving(workOrder, listOtherAccionPreIntegrate, configErp));
            }
            return(default(T));
        }
Пример #9
0
        public Models.Person SaveAzure(Customers customers, ParamsIntegrateErp configErp)
        {
            ServiceUbicar.Save(new Models.Person()
            {
                IdCity         = customers?.IdCity,
                IdCountry      = customers?.IdCountry,
                Email          = customers?.Email,
                Address        = customers?.Address,
                FullName       = customers?.FullName,
                IdentityNumber = customers?.DocumentNumber
            }, configErp.ReturnModelService, configErp.UrlService, configErp.LanguageDb, configErp.Token);

            if (ServiceUbicar.CodErrorRequest().HasValue&& (ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.OperationOk.GetHashCode() || ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.NotDataFromUpdate.GetHashCode()))
            {
                return(ServiceUbicar.CastObjectResponse <Models.Person>());
            }

            return(null);
        }
Пример #10
0
        public Models.DealerShop SaveInAzure(CloudCatalogDealerShops dealerShop, ParamsIntegrateErp configErp)
        {
            ServiceUbicar.Save(new Models.DealerShop()
            {
                IdCity    = dealerShop?.IdCity,
                IdDealer  = configErp.IdDealerUbicarService,
                IdErpShop = dealerShop?.IdDealerShop,
                Email     = dealerShop?.Email,
                Latitude  = dealerShop?.Latitude,
                Longitude = dealerShop?.Longitude,
                Address   = dealerShop?.Address,
                Mobile    = dealerShop?.Mobile,
                Phone     = dealerShop?.Phone,
                FullName  = dealerShop?.Shop
            }, configErp.ReturnModelService, configErp.UrlService, configErp.LanguageDb, configErp.Token);

            if (ServiceUbicar.CodErrorRequest().HasValue&& (ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.OperationOk.GetHashCode() || ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.NotDataFromUpdate.GetHashCode()))
            {
                return(ServiceUbicar.CastObjectResponse <Models.DealerShop>());
            }

            return(null);
        }
Пример #11
0
        public bool SyncNotifyItemErp(Config.Config config, NotificationSystimeIntegrate itemNotify)
        {
            ParamsIntegrateErp configIntegrateErp = config.GetConfigIntegrate();
            Boolean?           SupoortItem        = null;
            Object             objectResponseSync = null;

            if (Enum.TryParse(itemNotify.TableName, out TableName table) && Enum.TryParse(itemNotify.Event, out TableAction actionTable))
            {
                SupoortItem = UtilsSystimeCore.ResolverIntanceFromTable <IManager>(table).SuportItemData(config, itemNotify.JsonKeys, actionTable);
                if (SupoortItem.HasValue && SupoortItem.Value)
                {
                    objectResponseSync = UtilsSystimeCore.ResolverIntanceFromTable <IManager>(table).FillterAccionSql(config, itemNotify.JsonKeys, actionTable);
                }
            }
            else
            {
                SupoortItem = false;
            }
            if ((Enum.TryParse(configIntegrateErp.DllType, out ErpsTypes dllType) && objectResponseSync != null) || (SupoortItem.HasValue && !SupoortItem.Value))
            {
                return(DataAccesErpContract.DeleteNotificationSystime(itemNotify.IdNotification, configIntegrateErp.ConfigParamsToErp, dllType));
            }
            return(false);
        }
Пример #12
0
        T IIntegrate <T> .Save(string jsonKeys, ParamsIntegrateErp configErp, List <Object> parameterAditional)
        {
            VehicleIntegrate          vehicleIntegrate          = null;
            Vehicles                  vehicles                  = null;
            CustomerIntegrate         customerParam             = null;
            InsuranceCompanyIntegrate integrateinsuranceCompany = null;
            InsuranceCompanyIntegrate insuranceCompanyParam     = null;
            int?mileageParam = null;

            if (Enum.TryParse(configErp.DllType, out ErpsTypes dllType))
            {
                vehicles = DataAccesErpContract.GetVehicle(jsonKeys, dllType, configErp.ConfigParamsToErp, out List <Tuple <Type, string> > listOtherAccionPreIntegrate);


                if (vehicles != null)
                {
                    integrateinsuranceCompany = UtilsIIntegrateErpToSystime.IntegrateOtherTypes <InsuranceCompanyIntegrate>(listOtherAccionPreIntegrate, configErp, null);
                    insuranceCompanyParam     = UtilsIIntegrateErpToSystime.ResolveTypeParameter <InsuranceCompanyIntegrate>(parameterAditional);
                    customerParam             = UtilsIIntegrateErpToSystime.ResolveTypeParameter <CustomerIntegrate>(parameterAditional);
                    mileageParam = UtilsIIntegrateErpToSystime.ResolveTypeParameter <int>(parameterAditional);

                    if (customerParam?.CustomerSystime?.IdCustomer > 0 && customerParam?.CustomerSystime?.IdCustomer != vehicles.IdCustomerOwner)
                    {
                        vehicles.IdCustomerOwner = customerParam.CustomerSystime.IdCustomer;
                    }

                    if (mileageParam.HasValue && mileageParam.Value > vehicles.LastMileage)
                    {
                        vehicles.LastMileage = mileageParam.Value;
                    }

                    if (insuranceCompanyParam?.InsuranceCompnaySystime?.IdInsuranceCompany != null && insuranceCompanyParam?.InsuranceCompnaySystime?.IdInsuranceCompany != integrateinsuranceCompany?.InsuranceCompnaySystime?.IdInsuranceCompany)
                    {
                        integrateinsuranceCompany = insuranceCompanyParam;
                    }

                    vehicles.IdInsuranceCompany = integrateinsuranceCompany?.InsuranceCompnaySystime.IdInsuranceCompany;

                    vehicles = new VehiclesSystime(configErp.ConectionStringToSystime).SaveVehicle(vehicles, configErp.UserModify);

                    if (vehicles != null)
                    {
                        vehicleIntegrate = new VehicleIntegrate()
                        {
                            VehicleSystime = vehicles
                        };
                        if (configErp.SaveInAzure)
                        {
                            List <Object> modelsParams = new List <object>();
                            if (insuranceCompanyParam?.InsuranceCompnayUbicar != null)
                            {
                                modelsParams.Add(insuranceCompanyParam?.InsuranceCompnayUbicar);
                            }
                            if (customerParam?.CustomerUbicar != null)
                            {
                                modelsParams.Add(customerParam?.CustomerUbicar);
                            }

                            vehicleIntegrate.VehicleUbicar = SaveInAzure(vehicles, modelsParams, configErp);
                        }
                    }
                    ;
                }
            }

            if (vehicleIntegrate != null)
            {
                return((T)Convert.ChangeType(vehicleIntegrate, typeof(T)));
            }

            return(default(T));
        }
Пример #13
0
 public bool SuportItem(string jsonKeys, ParamsIntegrateErp configErp)
 {
     throw new NotImplementedException();
 }
Пример #14
0
 public bool SaveAll(ParamsIntegrateErp configErp, DateTime dateTimeMin)
 {
     throw new NotImplementedException();
 }
Пример #15
0
        public Models.Vehicle SaveInAzure(Vehicles vehicle, List <Object> paramsService, ParamsIntegrateErp configErp)
        {
            ServiceUbicar.Save(new Models.Vehicle()
            {
                IdDealer             = configErp.IdDealerUbicarService,
                IdCity               = vehicle?.IdCity,
                IdCountry            = vehicle?.IdCountry,
                IdVehicleModel       = vehicle?.IdVehicleModel,
                IdInsuranceCompany   = UtilsIIntegrateErpToSystime.ResolveTypeParameter <Models.InsuranceCompany>(paramsService)?.IdInsuranceCompany ?? ConstansServiceUbicar.ID_DEFAULT_INSURANCECOMPANYCLOUD,
                IdVehicleServiceType = vehicle?.IdVehicleServiceType,
                Vin           = String.IsNullOrEmpty(vehicle?.IdVinNumber) ? vehicle?.Plate : vehicle?.IdVinNumber,
                IdVehicleType = vehicle?.IdVehicleType,
                ModelYear     = vehicle?.ModelYear,
                Plate         = vehicle?.Plate
            }, configErp.ReturnModelService, configErp.UrlService, configErp.LanguageDb, configErp.Token);

            if (ServiceUbicar.CodErrorRequest().HasValue&& (ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.OperationOk.GetHashCode() || ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.NotDataFromUpdate.GetHashCode()))
            {
                return(ServiceUbicar.CastObjectResponse <Models.Vehicle>());
            }

            return(null);
        }
Пример #16
0
        private T Saving(WorkOrders workOrder, List <Tuple <Type, String> > listOtherAccionPreIntegrate, ParamsIntegrateErp configErp)
        {
            WorkOrderIntegrate        workOrderIntegrate        = null;
            InsuranceCompanyIntegrate integrateinsuranceCompany = null;
            CustomerIntegrate         integrateCustoemr         = null;
            WorkerIntegrate           integrateWorker           = null;
            DealerShopIntegrate       integrateDalerShop        = null;
            VehicleIntegrate          vehicleIntegrate          = null;
            int milageWorkOrder = 0;

            if (workOrder != null)
            {
                integrateinsuranceCompany = UtilsIIntegrateErpToSystime.IntegrateOtherTypes <InsuranceCompanyIntegrate>(listOtherAccionPreIntegrate, configErp, null);
                integrateCustoemr         = UtilsIIntegrateErpToSystime.IntegrateOtherTypes <CustomerIntegrate>(listOtherAccionPreIntegrate, configErp, null);
                integrateDalerShop        = UtilsIIntegrateErpToSystime.IntegrateOtherTypes <DealerShopIntegrate>(listOtherAccionPreIntegrate, configErp, null);
                List <Object> paramsFromWorker = new List <object>
                {
                    integrateDalerShop
                };
                integrateWorker = UtilsIIntegrateErpToSystime.IntegrateOtherTypes <WorkerIntegrate>(listOtherAccionPreIntegrate, configErp, paramsFromWorker);
                milageWorkOrder = UtilsIIntegrateErpToSystime.SearchValueFromType <int>(listOtherAccionPreIntegrate);

                List <Object> paramsFromVehicle = new List <object>
                {
                    integrateinsuranceCompany,
                    milageWorkOrder,
                    integrateCustoemr
                };


                vehicleIntegrate = UtilsIIntegrateErpToSystime.IntegrateOtherTypes <VehicleIntegrate>(listOtherAccionPreIntegrate, configErp, paramsFromVehicle);

                if (integrateCustoemr?.CustomerSystime != null && integrateWorker?.WokerSystime != null &&
                    integrateDalerShop?.DealerShopSystime != null)
                {
                    workOrder.IdVinNumber           = vehicleIntegrate?.VehicleSystime?.IdVinNumber;
                    workOrder.IdSalesRepresentative = integrateWorker?.WokerSystime?.IdWorker;
                    workOrder.IdDealerShop          = integrateDalerShop?.DealerShopSystime?.IdDealerShop;
                    workOrder.IdInsuranceCompany    = integrateinsuranceCompany?.InsuranceCompnaySystime?.IdInsuranceCompany;
                    workOrder.IdCustomer            = integrateCustoemr?.CustomerSystime?.IdCustomer ?? 0;

                    workOrder = new WorOrdersSystime(configErp.ConectionStringToSystime).SaveWorkOrder(workOrder, configErp.UserModify);
                    if (workOrder != null)
                    {
                        new WorkOrderLoadErrorLogSystime(configErp.ConectionStringToSystime).DeleteWorkOrderError(workOrder.WorkOrderNumber, workOrder.IdDealerShop);
                        workOrderIntegrate = new WorkOrderIntegrate()
                        {
                            WorkOrderSystime = workOrder
                        };

                        if (configErp.SaveInAzure)
                        {
                            List <Object> modelsParams = new List <object>();
                            if (integrateinsuranceCompany?.InsuranceCompnayUbicar != null)
                            {
                                modelsParams.Add(integrateinsuranceCompany?.InsuranceCompnayUbicar);
                            }
                            if (integrateCustoemr?.CustomerUbicar != null)
                            {
                                modelsParams.Add(integrateCustoemr?.CustomerUbicar);
                            }
                            if (integrateDalerShop?.DealerShopUbicar != null)
                            {
                                modelsParams.Add(integrateDalerShop?.DealerShopUbicar);
                            }
                            if (vehicleIntegrate?.VehicleUbicar != null)
                            {
                                modelsParams.Add(vehicleIntegrate?.VehicleUbicar);
                            }
                            if (integrateWorker?.WorkerUbicar != null)
                            {
                                modelsParams.Add(integrateWorker?.WorkerUbicar);
                            }
                            workOrderIntegrate.WorkOrderUbicar = SaveInAzure(workOrder, modelsParams, configErp);
                        }
                    }
                }
                else if (workOrder != null)
                {
                    new WorkOrderLoadErrorLogSystime(configErp.ConectionStringToSystime).SaveWorkOrderError(new WorkOrderLoadErrorLog()
                    {
                        idCustomerOT         = workOrder.IdCustomer.ToString(),
                        idVehicle            = workOrder.IdVinNumber,
                        IdWorkOrderNumberErp = workOrder.WorkOrderNumber,
                        idDealerShopOtErp    = workOrder.IdDealerShop,
                        idWorkerOT           = workOrder.WorkOrderNumber,
                    }, configErp.UserModify);
                }

                if (workOrderIntegrate != null)
                {
                    return((T)Convert.ChangeType(workOrderIntegrate, typeof(T)));
                }
            }
            return(default(T));
        }
Пример #17
0
        public Models.DealerRepresentative SaveInAzure(Workers worker, List <Object> paramsService, ParamsIntegrateErp configErp)
        {
            ServiceUbicar.Save(new Models.DealerRepresentative()
            {
                IdCity              = worker?.IdCity,
                IdDealer            = configErp.IdDealerUbicarService,
                IdDealerShop        = UtilsIIntegrateErpToSystime.ResolveTypeParameter <Models.DealerShop>(paramsService)?.IdDealerShop,
                IdErpRepresentative = worker?.IdWorker,
                IdentityNumber      = worker?.IdWorker,
                Email    = worker?.Email,
                FullName = worker?.FullName,
                Mobile   = worker?.Mobile,
                Phone    = worker?.Phone
            }, configErp.ReturnModelService, configErp.UrlService, configErp.LanguageDb, configErp.Token);

            if (ServiceUbicar.CodErrorRequest().HasValue&& (ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.OperationOk.GetHashCode() || ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.NotDataFromUpdate.GetHashCode()))
            {
                return(ServiceUbicar.CastObjectResponse <Models.DealerRepresentative>());
            }

            return(null);
        }
Пример #18
0
        public Models.InsuranceCompany SaveInAzure(CloudCatalogInsuranceCompanies insuranceCompany, ParamsIntegrateErp configErp)
        {
            ServiceUbicar.Save(new Models.InsuranceCompany()
            {
                IdCity    = insuranceCompany?.IdCity,
                IdCountry = insuranceCompany?.IdCountry,
                Email     = insuranceCompany?.Email,
                Phone     = insuranceCompany?.Phone,
                Phone2    = insuranceCompany?.Mobile,
                Address   = insuranceCompany?.Address,
                FullName  = insuranceCompany?.InsuranceCompany,
                Tin       = insuranceCompany?.TIN,
                WebSite   = insuranceCompany?.Website
            }, configErp.ReturnModelService, configErp.UrlService, configErp.LanguageDb, configErp.Token);

            if (ServiceUbicar.CodErrorRequest().HasValue&& (ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.OperationOk.GetHashCode() || ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.NotDataFromUpdate.GetHashCode()))
            {
                return(ServiceUbicar.CastObjectResponse <Models.InsuranceCompany>());
            }

            return(null);
        }
Пример #19
0
        public WorkOrder SaveInAzure(WorkOrders workOrder, List <Object> paramsService, ParamsIntegrateErp configErp)
        {
            ServiceUbicar.Save(new WorkOrder()
            {
                IdCustomer             = UtilsIIntegrateErpToSystime.ResolveTypeParameter <Person>(paramsService)?.IdPerson,
                IdDealerRepresentative = UtilsIIntegrateErpToSystime.ResolveTypeParameter <DealerRepresentative>(paramsService)?.IdDealerRepresentative,
                IdDealerShop           = UtilsIIntegrateErpToSystime.ResolveTypeParameter <DealerShop>(paramsService)?.IdDealerShop,
                IdInsuraceConpany      = UtilsIIntegrateErpToSystime.ResolveTypeParameter <InsuranceCompany>(paramsService)?.IdInsuranceCompany,
                IdVehicle           = UtilsIIntegrateErpToSystime.ResolveTypeParameter <Vehicle>(paramsService)?.IdVehicle,
                IdErpQuote          = workOrder?.IdErpQuote?.ToString(),
                WorkOrderIdErp      = workOrder?.WorkOrderNumber,
                EnteredAt           = workOrder?.EnteredAt,
                AutorizedAt         = workOrder?.AuthorizedAt,
                IsTotalLoss         = workOrder?.HasTotalLoss,
                Note                = workOrder?.Note,
                ProgressMessaje     = workOrder?.Note,
                PartsCompletedAt    = workOrder?.PartsCompletedAt,
                ReadyToBePickedUpAt = workOrder?.ReadyToPickUpAt,
                PickedUpAt          = workOrder?.PickedUpAt,
                PromisedAt          = workOrder?.PromisedAt
            }, configErp.ReturnModelService, configErp.UrlService, configErp.LanguageDb, configErp.Token);

            if (ServiceUbicar.CodErrorRequest().HasValue&& (ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.OperationOk.GetHashCode() || ServiceUbicar.CodErrorRequest().Value == TypeErrorWebServicess.NotDataFromUpdate.GetHashCode()))
            {
                new WorkOrderLoadErrorLogSystime(configErp.ConectionStringToSystime).DeleteWorkOrderError(workOrder.WorkOrderNumber, workOrder.IdDealerShop);
            }
            else
            {
                new WorkOrderLoadErrorLogSystime(configErp.ConectionStringToSystime).SaveWorkOrderError(new WorkOrderLoadErrorLog()
                {
                    idCustomerOT         = workOrder.IdCustomer.ToString(),
                    idVehicle            = workOrder.IdVinNumber,
                    IdWorkOrderNumberErp = workOrder.WorkOrderNumber,
                    idDealerShopOtErp    = workOrder.IdDealerShop,
                    idWorkerOT           = workOrder.WorkOrderNumber,
                    CloudUpdateError     = String.Concat(ServiceUbicar.CodErrorRequest(), "-", ServiceUbicar.MessageError())
                }, configErp.UserModify);
            }

            return(null);
        }