/// <summary>
        /// konstruktor repository paraméterekkel
        /// </summary>
        /// <param name="contactPersonRepository"></param>
        /// <param name="changePasswordRepository"></param>
        /// <param name="visitorRepository"></param>
        public ContactPersonService(CompanyGroup.Domain.PartnerModule.IContactPersonRepository contactPersonRepository, 
                                    CompanyGroup.Domain.PartnerModule.IChangePasswordRepository changePasswordRepository, 
                                    CompanyGroup.Domain.PartnerModule.IForgetPasswordRepository forgetPasswordRepository, 
                                    CompanyGroup.Domain.PartnerModule.IVisitorRepository visitorRepository) : base(visitorRepository)
        {
            if (contactPersonRepository == null)
            {
                throw new ArgumentNullException("ContactPersonRepository");
            }

            if (changePasswordRepository == null)
            {
                throw new ArgumentNullException("ChangePasswordRepository");
            }

            if (forgetPasswordRepository == null)
            {
                throw new ArgumentNullException("ForgetPasswordRepository");
            }

            this.contactPersonRepository = contactPersonRepository;

            this.changePasswordRepository = changePasswordRepository;

            this.forgetPasswordRepository = forgetPasswordRepository;
        }
        /// <summary>
        ///  vevő regisztrációs adatok kiolvasása látogatóazonosító és vállalatkód alapján  
        /// </summary>
        /// <param name="customerId"></param>
        /// <param name="dataAreaId"></param>
        /// <returns></returns>
        public CompanyGroup.Dto.RegistrationModule.Registration GetCustomerRegistration(CompanyGroup.Dto.PartnerModule.GetCustomerRegistrationRequest request)
        {
            try
            {
                //ha üres a látogató azonosító
                if (String.IsNullOrEmpty(request.VisitorId))
                {
                    return new CompanyGroup.Dto.RegistrationModule.Registration();
                }

                CompanyGroup.Domain.PartnerModule.Visitor visitor = this.GetVisitor(request.VisitorId);

                //ha nincs bejelentkezve
                if (!visitor.IsValidLogin)
                {
                    return new CompanyGroup.Dto.RegistrationModule.Registration();
                }

                CompanyGroup.Dto.RegistrationModule.Registration result = new CompanyGroup.Dto.RegistrationModule.Registration();

                List<CompanyGroup.Domain.PartnerModule.BankAccount> bankAccounts = customerRepository.GetBankAccounts(visitor.CustomerId, request.DataAreaId);

                List<CompanyGroup.Domain.PartnerModule.ContactPerson> contactPersons = customerRepository.GetContactPersons(visitor.CustomerId, request.DataAreaId);

                CompanyGroup.Domain.PartnerModule.Customer customer = customerRepository.GetCustomer(visitor.CustomerId, request.DataAreaId);

                List<CompanyGroup.Domain.PartnerModule.DeliveryAddress> deliveryAddresses = customerRepository.GetDeliveryAddress(visitor.CustomerId, request.DataAreaId);

                CompanyGroup.Domain.PartnerModule.MailAddress mailAddress = customerRepository.GetMailAddress(visitor.CustomerId, request.DataAreaId);

                //válasz objektum feltöltés
                result.BankAccounts = bankAccounts.ConvertAll(x => new BankAccountToBankAccount().Map(x));

                List<CompanyGroup.Domain.PartnerModule.ContactPerson> contactPersonList = contactPersons.FindAll(x => x.WebAdmin == false);

                result.ContactPersons = contactPersonList.ConvertAll(x => new ContactPersonToContactPerson().Map(x));

                result.CompanyData = new CustomerToCustomer().Map(customer);

                result.DataRecording = new Dto.RegistrationModule.DataRecording() { Email = "", Name = "", Phone = "" };

                result.DeliveryAddresses = deliveryAddresses.ConvertAll(x => new DeliveryAddressToDeliveryAddress().MapDomainToRegistrationModuleDto(x));

                result.InvoiceAddress = new CustomerToInvoiceAddress().Map(customer);

                result.MailAddress = new MailAddressToMailAddress().Map(mailAddress);

                CompanyGroup.Domain.PartnerModule.ContactPerson webAdministrator = contactPersons.FirstOrDefault(x => x.WebAdmin == true);

                result.WebAdministrator = (webAdministrator == null) ? new ContactPersonToWebAdministrator().Map(new CompanyGroup.Domain.PartnerModule.ContactPerson()) : new ContactPersonToWebAdministrator().Map(webAdministrator);

                result.Visitor = new VisitorToVisitor().Map(visitor);

                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        public Registration(List<CompanyGroup.Dto.RegistrationModule.BankAccount> bankAccounts, 
                            CompanyGroup.Dto.RegistrationModule.CompanyData companyData, 
                            List<CompanyGroup.Dto.RegistrationModule.ContactPerson> contactPersons, 
                            CompanyGroup.Dto.RegistrationModule.DataRecording dataRecording,
                            List<CompanyGroup.Dto.RegistrationModule.DeliveryAddress> deliveryAddresses,
                            CompanyGroup.Dto.RegistrationModule.InvoiceAddress invoiceAddress,
                            CompanyGroup.Dto.RegistrationModule.MailAddress mailAddress,
                            string registrationId, string visitorId, 
                            CompanyGroup.Dto.RegistrationModule.WebAdministrator webAdministrator)
        {
            this.BankAccounts = new Cms.PartnerInfo.Models.BankAccounts() { Items = bankAccounts, SelectedId = "" };

            this.CompanyData = new CompanyData(companyData);

            this.ContactPersons = new ContactPersons() { Items = contactPersons, SelectedId = "" };

            this.DataRecording = new DataRecording(dataRecording);

            this.DeliveryAddresses = new DeliveryAddresses() { Items = deliveryAddresses, SelectedId = "" };

            this.InvoiceAddress = new InvoiceAddress(invoiceAddress);

            this.MailAddress = new MailAddress(mailAddress);

            this.RegistrationId = registrationId;

            this.VisitorId = visitorId;

            this.WebAdministrator = new WebAdministrator(webAdministrator);
        }
        /// <summary>
        /// domain product -> dto product
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        public CompanyGroup.GlobalServices.Dto.Product Map(CompanyGroup.Dto.WebshopModule.Product product)
        {
            try
            {
                decimal price = 0;

                return new CompanyGroup.GlobalServices.Dto.Product()
                           {
                               DataAreaId = product.DataAreaId,
                               Description = product.Description,
                               EndOfSales = product.EndOfSales,
                               FirstLevelCategory = new CategoryToCategory().Map(product.FirstLevelCategory),
                               GarantyMode = product.GarantyMode,
                               GarantyTime = product.GarantyTime,
                               IsInNewsletter = product.IsInNewsletter,
                               Stock = product.InnerStock + product.OuterStock,
                               ItemName = product.ItemName,
                               Manufacturer = new ManufacturerToManufacturer().Map(product.Manufacturer),
                               New = product.New,
                               PartNumber = product.PartNumber,
                               Pictures = new PicturesToPictures().Map(new CompanyGroup.Dto.WebshopModule.Pictures()),
                               Price = decimal.TryParse(product.Price, out price) ? price : 0,
                               ProductId = product.ProductId,
                               PurchaseInProgress = product.PurchaseInProgress,
                               SecondLevelCategory = new CategoryToCategory().Map(product.SecondLevelCategory),
                               ShippingDate = product.ShippingDate,
                               ThirdLevelCategory = new CategoryToCategory().Map(product.ThirdLevelCategory),
                           };
            }
            catch { return new CompanyGroup.GlobalServices.Dto.Product(); }
        }
        /// <summary>
        /// konstruktor repository interfész paraméterrel
        /// </summary>
        /// <param name="productRepository"></param>
        /// <param name="shoppingCartRepository"></param>
        /// <param name="pictureRepository"></param>
        /// <param name="changeTrackingRepository"></param>
        /// <param name="financeRepository"></param>
        /// <param name="visitorRepository"></param>
        public ProductService(CompanyGroup.Domain.WebshopModule.IProductRepository productRepository,
                              CompanyGroup.Domain.WebshopModule.IShoppingCartRepository shoppingCartRepository,
                              CompanyGroup.Domain.WebshopModule.IPictureRepository pictureRepository,  
                              CompanyGroup.Domain.WebshopModule.IChangeTrackingRepository changeTrackingRepository, 
                              CompanyGroup.Domain.WebshopModule.IFinanceRepository financeRepository,
                              CompanyGroup.Domain.PartnerModule.IVisitorRepository visitorRepository) : base(financeRepository, visitorRepository)
        {
            if (productRepository == null)
            {
                throw new ArgumentNullException("ProductRepository");
            }

            if (shoppingCartRepository == null)
            {
                throw new ArgumentNullException("ShoppingCartRepository");
            }

            if (pictureRepository == null)
            {
                throw new ArgumentNullException("PictureRepository");
            }

            if (changeTrackingRepository == null)
            {
                throw new ArgumentNullException("PictureRepository");
            }

            this.productRepository = productRepository;

            this.shoppingCartRepository = shoppingCartRepository;

            this.pictureRepository = pictureRepository;

            this.changeTrackingRepository = changeTrackingRepository;
        }
        /// <summary>
        /// kulcs alapján a megkezdett regisztrációs adatok kiolvasása a cacheDb-ből
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public CompanyGroup.Dto.RegistrationModule.Registration GetByKey(CompanyGroup.Dto.ServiceRequest.GetRegistrationByKey request)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(request.Id))
                {
                    return new CompanyGroup.Dto.RegistrationModule.Registration();
                }

                CompanyGroup.Domain.RegistrationModule.Registration registration = registrationRepository.GetByKey(request.Id);

                //ha nincs az azonosítóval rendelkező regisztráció, akkor új regisztráció létrehozása szükséges
                if (registration == null)
                {
                    registration = CompanyGroup.Domain.RegistrationModule.Factory.CreateRegistration();
                }

                registration.BankAccountList.ForEach(x => x.SplitBankAccount());

                CompanyGroup.Dto.RegistrationModule.Registration response = new RegistrationToRegistration().MapDomainToDto(registration);

                //látogató adatok lekérdezése
                CompanyGroup.Domain.PartnerModule.Visitor visitor = this.GetVisitor(request.VisitorId);

                response.Visitor = new CompanyGroup.ApplicationServices.PartnerModule.VisitorToVisitor().Map(visitor);

                return response;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// képek listát visszaadó service
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public CompanyGroup.Dto.WebshopModule.Pictures GetListByProduct(CompanyGroup.Dto.WebshopModule.PictureFilterRequest request) 
        {
            try
            {
                CompanyGroup.Helpers.DesignByContract.Require((request != null), "The GetListByProduct request parameter can not be null!");

                CompanyGroup.Helpers.DesignByContract.Require(!String.IsNullOrEmpty(request.ProductId), "The GetListByProduct request parameter can not be null!");

                List<CompanyGroup.Domain.WebshopModule.Picture> pictureList = pictureRepository.GetListByProduct(request.ProductId);

                CompanyGroup.Helpers.DesignByContract.Ensure((pictureList != null), "Repository GetListByProduct result cannot be null!");

                if (pictureList.Count == 0) { return new CompanyGroup.Dto.WebshopModule.Pictures(); }

                CompanyGroup.Domain.WebshopModule.Pictures pictures = new CompanyGroup.Domain.WebshopModule.Pictures();

                pictures.AddRange(pictureList);

                return new PicturesToPictures().Map(pictures);
            }
            catch(Exception ex) 
            { 
                throw ex; 
            }
        }
 /// <summary>
 /// Domain kapcsolattartó -> DTO. kapcsolattartó      
 /// </summary>
 /// <param name="from"></param>
 /// <returns></returns>
 public CompanyGroup.Dto.RegistrationModule.WebAdministrator Map(CompanyGroup.Domain.PartnerModule.ContactPerson from)
 {
     return new CompanyGroup.Dto.RegistrationModule.WebAdministrator() 
     { 
         AllowOrder = from.AllowOrder, 
         AllowReceiptOfGoods = from.AllowReceiptOfGoods,
         ContactPersonId = from.ContactPersonId,
         Email = from.Email,
         EmailArriveOfGoods = from.EmailArriveOfGoods,
         EmailOfDelivery = from.EmailOfDelivery,
         EmailOfOrderConfirm = from.EmailOfOrderConfirm,
         FirstName = from.FirstName,
         InvoiceInfo = from.InvoiceInfo,
         LastName = from.LastName,
         LeftCompany = from.LeftCompany,
         Newsletter = from.Newsletter,
         Password = from.Password,
         PriceListDownload = from.PriceListDownload,  
         SmsArriveOfGoods = from.SmsArriveOfGoods,
         SmsOfDelivery = from.SmsOfDelivery,
         SmsOrderConfirm = from.SmsOrderConfirm,
         Telephone = from.Telephone,
         UserName = from.UserName, RecId = 0, RefRecId = 0 
     };
 }
        /// <summary>
        /// domain CompanyGroup.Domain.WebshopModule.Pager -> DTO CompanyGroup.Dto.WebshopModule.Pager 
        /// </summary>
        /// <param name="pager"></param>
        /// <returns></returns>
        public CompanyGroup.Dto.WebshopModule.Pager Map(CompanyGroup.Domain.WebshopModule.Pager pager, int itemsOnPage)
        {
            CompanyGroup.Dto.WebshopModule.Pager result = new CompanyGroup.Dto.WebshopModule.Pager();

            result.FirstEnabled = pager.FirstEnabled;

            result.LastEnabled = pager.LastEnabled;

            result.LastPageIndex = pager.LastPageIndex;

            result.NextEnabled = pager.NextEnabled;

            result.PageItemList = pager.PageItemList.ConvertAll(x => new CompanyGroup.Dto.WebshopModule.PageItem() { Index = x.Index, Selected = x.Selected, Value = x.Value });

            result.PreviousEnabled = pager.PreviousEnabled;

            CompanyGroup.Domain.WebshopModule.PageItem pageItem = pager.PageItemList.Find(x => x.Selected);

            result.NextPageIndex = (pageItem != null) ? ( (pager.NextEnabled) ? pageItem.Index + 1 : pager.LastPageIndex ) : 1;

            result.PreviousPageIndex = (pageItem != null) ? ( (pager.PreviousEnabled) ? pageItem.Index - 1 : 1) : 1;

            //elemek száma az oldalon
            result.VisibleItemList = new List<CompanyGroup.Dto.WebshopModule.VisibleItem>();

            for (int i = 1; i <= 10; i++)
            {
                result.VisibleItemList.Add(new CompanyGroup.Dto.WebshopModule.VisibleItem() { Value = i * 10, Selected = itemsOnPage.Equals(i * 10) });
            }

            return result;
        }
        /// <summary>
        /// eseményregisztráció hozzáadás   
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public bool AddNew(CompanyGroup.Dto.PartnerModule.EventRegistration request)
        { 
            try
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder(request.Data.Keys.Count);

                sb.Append("<EventRegistration>");

                foreach( string key in request.Data.Keys)
                {
                    sb.AppendFormat("<{0}>{1}</{2}>", key, request.Data[key], key);
                }

                sb.Append("</EventRegistration>");

                bool response = eventRegistrationRepository.AddNew(request.EventId, request.EventName, sb.ToString());

                //this.SendMail(request);

                return response;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public CompanyGroup.Dto.WebshopModule.Category Map(CompanyGroup.Domain.WebshopModule.Category category)
 {
     try
     {
         return new CompanyGroup.Dto.WebshopModule.Category() { Id = category.CategoryId, Name = category.CategoryName, EnglishName = category.CategoryEnglishName };
     }
     catch { return new CompanyGroup.Dto.WebshopModule.Category(); }
 }
        private CompanyGroup.Dto.PartnerModule.Representatives ConvertRepresentatives(CompanyGroup.Domain.PartnerModule.Representatives representative)
        {
            CompanyGroup.Dto.PartnerModule.Representatives response = new Dto.PartnerModule.Representatives();

            response.Items = representative.ConvertAll(x => ConvertRepresentative(x));

             return response;
        }
Пример #13
0
        public UndoChangePassword(CompanyGroup.Dto.PartnerModule.UndoChangePassword undoChangePassword, Cms.CommonCore.Models.Visitor visitor)
        {
            this.Message = undoChangePassword.Message;

            this.Succeeded = undoChangePassword.Succeeded;

            this.Visitor = visitor;
        }
 public CompanyGroup.GlobalServices.Dto.Category Map(CompanyGroup.Dto.WebshopModule.Category category)
 {
     try
     {
         return new CompanyGroup.GlobalServices.Dto.Category() { Id = category.Id, Name = category.Name };
     }
     catch { return new CompanyGroup.GlobalServices.Dto.Category(); }
 }
        public Catalogue(CompanyGroup.Dto.WebshopModule.Products products, CompanyGroup.Dto.WebshopModule.Structures structures, List<CompanyGroup.Dto.WebshopModule.BannerProduct> bannerProducts)
        {
            this.Products = products;

            this.Structures = structures;

            this.BannerProducts = bannerProducts;
        }
        /// <summary>
        /// konstruktor terméklista cache karbantartó interfészt megvalósító példánnyal
        /// </summary>
        /// <param name="service"></param>
        public MaintainController(CompanyGroup.ApplicationServices.MaintainModule.ISyncService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException("MaintainService");
            }

            this.service = service;
        }
        /// <summary>
        /// konstruktor service paraméterrel
        /// </summary>
        /// <param name="service"></param>
        public ContactPersonController(CompanyGroup.ApplicationServices.PartnerModule.IContactPersonService service)
        {
            if (service == null)
            {
                throw new ArgumentNullException("ContactPersonService");
            }

            this.service = service;
        }
        /// <summary>
        /// konstruktor
        /// </summary>
        /// <param name="customerRepository"></param>
        public CustomerService(CompanyGroup.Domain.PartnerModule.ICustomerRepository customerRepository, CompanyGroup.Domain.PartnerModule.IVisitorRepository visitorRepository) : base(visitorRepository)
        {
            if (customerRepository == null)
            {
                throw new ArgumentNullException("CustomerRepository");
            }

            this.customerRepository = customerRepository;
        }
        /// <summary>
        /// konstruktor financeRepository -val
        /// </summary>
        /// <param name="financeRepository"></param>
        /// <param name="visitorRepository"></param>
        public ServiceBase(CompanyGroup.Domain.WebshopModule.IFinanceRepository financeRepository, CompanyGroup.Domain.PartnerModule.IVisitorRepository visitorRepository) : base(visitorRepository)
        {
            if (financeRepository == null)
            {
                throw new ArgumentNullException("FinanceRepository");
            }

            this.financeRepository = financeRepository;
        }
        public PictureService(CompanyGroup.Domain.WebshopModule.IPictureRepository pictureRepository)
        {
            if (pictureRepository == null)
            {
                throw new ArgumentNullException("PictureRepository");
            }

            this.pictureRepository = pictureRepository;
        }
 /// <summary>
 /// Domain Completion -> DTO Completion
 /// </summary>
 /// <param name="from"></param>
 /// <returns></returns>
 private CompanyGroup.Dto.WebshopModule.Completion MapItem(CompanyGroup.Domain.WebshopModule.Completion from)
 {
     return new CompanyGroup.Dto.WebshopModule.Completion()
     {
         DataAreaId = from.DataAreaId, 
         ProductId = from.ProductId, 
         ProductName = from.ProductName,
         PictureId = from.PictureId
     };
 }
        public AddContactPerson(string registrationId, string languageId, CompanyGroup.Dto.RegistrationModule.ContactPerson contactPerson, string visitorId)
        {
            this.RegistrationId = registrationId;

            this.LanguageId = languageId;

            this.ContactPerson = contactPerson;

            this.VisitorId = visitorId;
        }
        /// <summary>
        /// konstruktor eseményregisztráció repository-val és
        /// visitor repository-val. 
        /// </summary>
        /// <param name="eventRegistrationRepository"></param>
        /// <param name="visitorRepository"></param>
        public EventRegistrationService(CompanyGroup.Domain.PartnerModule.IEventRegistrationRepository eventRegistrationRepository, 
                                        CompanyGroup.Domain.PartnerModule.IVisitorRepository visitorRepository) : base(visitorRepository)
        {
            if (eventRegistrationRepository == null)
            {
                throw new ArgumentNullException("EventRegistrationRepository");
            }

            this.eventRegistrationRepository = eventRegistrationRepository;
        }
        /// <summary>
        /// konstruktor repository interfész paraméterrel
        /// </summary>
        /// <param name="productRepository"></param>
        public ProductService(CompanyGroup.Domain.MaintainModule.IProductRepository productMaintainRepository, CompanyGroup.Domain.WebshopModule.IProductRepository productWebshopRepository)
        {
            if (productMaintainRepository == null)
            {
                throw new ArgumentNullException("ProductRepository");
            }

            this.productMaintainRepository = productMaintainRepository;

            this.productWebshopRepository = productWebshopRepository;
        }
 /// <summary>
 /// Domain vevő adatok -> DTO. vevő adatok   
 /// </summary>
 /// <param name="from"></param>
 /// <returns></returns>
 public CompanyGroup.Dto.PartnerModule.InvoiceAddress Map(CompanyGroup.Domain.PartnerModule.Customer from)
 {
     return new CompanyGroup.Dto.PartnerModule.InvoiceAddress() 
     { 
         City = from.InvoiceCity, 
         CountryRegionId = from.InvoiceCountry,
         Phone = from.InvoicePhone, 
         Street = from.InvoiceStreet, 
         ZipCode = from.InvoiceZipCode
     };
 }
 /// <summary>
 /// Domain Completion -> DTO Completion
 /// </summary>
 /// <param name="from"></param>
 /// <returns></returns>
 private CompanyGroup.Dto.WebshopModule.CatalogueDetailsLog MapItem(CompanyGroup.Domain.WebshopModule.CatalogueDetailsLog from)
 {
     return new CompanyGroup.Dto.WebshopModule.CatalogueDetailsLog()
     {
         DataAreaId = from.DataAreaId, 
         ProductId = from.ProductId, 
         ProductName = from.ProductName,
         PictureId = from.PictureId, 
         EnglishProductName = from.EnglishProductName
     };
 }
        /// <summary>
        /// megrendelés információk lista
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public CompanyGroup.Dto.PartnerModule.OrderInfoList GetOrderInfo(CompanyGroup.Dto.PartnerModule.GetOrderInfoRequest request)
        {
            Helpers.DesignByContract.Require(!String.IsNullOrWhiteSpace(request.VisitorId), "VisitorId cannot be null, or empty!");

            try
            {
                //látogató kiolvasása
                CompanyGroup.Domain.PartnerModule.Visitor visitor = this.GetVisitor(request.VisitorId);

                //vevőrendelések változáskövetése   
                List<CompanyGroup.Domain.PartnerModule.OrderDetailedLineInfoCT> lineInfosCt = changeTrackingRepository.SalesLineCT(0);

                List<CompanyGroup.Domain.PartnerModule.OrderDetailedLineInfoCT>  lineInfosCtCustomer = lineInfosCt.Where( y => y.CustomerId.Equals(visitor.CustomerId, StringComparison.OrdinalIgnoreCase)).ToList();

                List<CompanyGroup.Domain.PartnerModule.OrderDetailedLineInfo> lineInfos = lineInfosCtCustomer.ConvertAll(x =>
                {
                    return new CompanyGroup.Domain.PartnerModule.OrderDetailedLineInfo(0, x.DataAreaId, x.SalesId, x.CreatedDate, x.ShippingDateRequested, x.CurrencyCode, x.Payment,
                                                                                       x.SalesHeaderType, x.SalesHeaderStatus, x.CustomerOrderNo, x.WithDelivery, x.LineNum, x.SalesStatus,
                                                                                       x.ProductId, x.ProductName, x.Quantity, x.SalesPrice, x.LineAmount, x.SalesDeliverNow, x.RemainSalesPhysical,
                                                                                       (int) x.StatusIssue, x.InventLocationId, x.ItemDate, x.FileName, x.InStock, x.AvailableInWebShop);
                });

                //látogató alapján kikeresett vevő rendelések listája
                List<CompanyGroup.Domain.PartnerModule.OrderDetailedLineInfo> lineInfosRepository = salesOrderRepository.GetOrderDetailedLineInfo(visitor.CustomerId, request.CanBeTaken, request.SalesStatus, request.CustomerOrderNo, request.ItemName, request.ItemId, request.SalesOrderId);

                lineInfos.AddRange(lineInfosRepository);

                 //megrendelés info aggregátum elkészítése
                IEnumerable<IGrouping<string, CompanyGroup.Domain.PartnerModule.OrderDetailedLineInfo>> groupedLineInfos = lineInfos.GroupBy(x => x.SalesId).OrderByDescending(x => x.Key);   //IEnumerable<IGrouping<string, CompanyGroup.Domain.PartnerModule.OrderDetailedLineInfo>>

                List<CompanyGroup.Domain.PartnerModule.OrderInfo> orderInfos = new List<CompanyGroup.Domain.PartnerModule.OrderInfo>();

                foreach (var lineInfo in groupedLineInfos)
                { 
                    CompanyGroup.Domain.PartnerModule.OrderInfo orderInfo = CompanyGroup.Domain.PartnerModule.OrderInfo.Create(lineInfo.ToList());

                    orderInfos.Add(orderInfo);
                }

                //nyitott rendelések összesen
                decimal openOrderAmount = salesOrderRepository.OpenOrderAmount(visitor.CustomerId);

                CompanyGroup.Domain.PartnerModule.OrderInfoList orderInfoList = new CompanyGroup.Domain.PartnerModule.OrderInfoList(openOrderAmount, orderInfos);

                //konverzió dto-ra
                List<CompanyGroup.Dto.PartnerModule.OrderInfo> orderInfoListDTO = new OrderInfoToOrderInfo().Map(orderInfoList);

                return new CompanyGroup.Dto.PartnerModule.OrderInfoList(openOrderAmount, orderInfoListDTO);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 private CompanyGroup.Dto.PartnerModule.Representative ConvertRepresentative(CompanyGroup.Domain.PartnerModule.Representative representative)
 {
     return new CompanyGroup.Dto.PartnerModule.Representative() 
            {
                Email = representative.Email,
                Id = representative.Id,
                Mobile = representative.Mobile,
                Name = representative.Name,
                Phone = representative.Phone
            };
 }
 private CompanyGroup.Dto.PartnerModule.Permission ConvertPermission(CompanyGroup.Domain.PartnerModule.Permission permission)
 {
     return new CompanyGroup.Dto.PartnerModule.Permission()
     {
         CanOrder = permission.CanOrder,
         InvoiceInfoEnabled = permission.InvoiceInfoEnabled,
         IsWebAdministrator = permission.IsWebAdministrator,
         PriceListDownloadEnabled = permission.PriceListDownloadEnabled,
         RecieveGoods = permission.RecieveGoods
     };
 }
 /// <summary>
 /// domain CompletionList -> DTO CompletionList
 /// </summary>
 /// <param name="from"></param>
 /// <returns></returns>
 public CompanyGroup.Dto.WebshopModule.CompletionList Map(CompanyGroup.Domain.WebshopModule.CompletionList from)
 {
     try
     {
         return new CompanyGroup.Dto.WebshopModule.CompletionList()
         {
             Items = from.ConvertAll<CompanyGroup.Dto.WebshopModule.Completion>(x => MapItem(x)),
         };
     }
     catch { return new CompanyGroup.Dto.WebshopModule.CompletionList() { Items = new List<Dto.WebshopModule.Completion>() }; }
 }
Пример #31
0
        public BL_Result <CompanyGroup> CompanyGroupUpdate(string db_name, BL_Result <CompanyGroup> updatedCompanyGroup)   //tedarikci guncelleniyor.
        {
            Repository <CompanyGroup> repo_companyGroup = new Repository <CompanyGroup>(db_name);
            CompanyGroup companyGroup = repo_companyGroup.Find(x => x.Id == updatedCompanyGroup.Result.Id);

            if (companyGroup != null)
            {
                companyGroup.Name         = updatedCompanyGroup.Result.Name;
                companyGroup.Confirmation = updatedCompanyGroup.Result.Confirmation;
            }
            repo_companyGroup.Update(companyGroup);
            return(result_companyGroup);
        }
Пример #32
0
        /// <summary>
        /// 修改公司组
        /// </summary>
        /// <param name="company">当前公司Id</param>
        /// <param name="companyGroup">公司组Id</param>
        /// <param name="companyGroupView">公司组信息</param>
        /// <param name="operatorAccount">操作员账号</param>
        public static void UpdateCompanyGroup(Guid company, Guid companyGroup, CompanyGroupView companyGroupView, string operatorAccount)
        {
            var model = new CompanyGroup(companyGroup);

            model.Company              = company;
            model.Description          = companyGroupView.Description;
            model.Name                 = companyGroupView.Name;
            model.UpdateAccount        = operatorAccount;
            model.UpdateTime           = DateTime.Now;
            model.PurchaseMyPolicyOnly = companyGroupView.PurchaseMyPolicyOnly;
            if (companyGroupView.Limitations != null)
            {
                foreach (var item in companyGroupView.Limitations)
                {
                    var limitationItem = new PurchaseLimitation();
                    limitationItem.Airlines = item.Airlines;
                    limitationItem.DefaultRebateForNonePolicy = item.DefaultRebateForNonePolicy;
                    limitationItem.Departures = item.Departures;
                    limitationItem.PurchaseMyPolicyOnlyForNonePolicy = item.PurchaseMyPolicyOnlyForNonePolicy;
                    model.AppendLimitaion(limitationItem);
                }
            }
            var reposity = Factory.CreateCompanyGroupRepository();

            reposity.UpdateCompanyGroup(model);
            // 记录日志
            var    view            = QueryCompanyGroup(companyGroup);
            string originalContent = string.Format("公司组Id:{0},组别名称:{1},组别描述:{2},是否采购其他代理政策:{3},公司Id:{4},限制信息集合:",
                                                   companyGroup, view.Name, view.Description, view.PurchaseMyPolicyOnly, company);

            if (view.Limitations != null)
            {
                foreach (var item in companyGroupView.Limitations)
                {
                    originalContent += string.Format("受限航空公司{0},限制出港城市{1},未发布政策时,是否只能采购自己的政策{2},未发布政策时,设置默认返点{3};", item.Airlines,
                                                     item.Departures, item.PurchaseMyPolicyOnlyForNonePolicy, item.DefaultRebateForNonePolicy);
                }
            }
            string newContent = string.Format("公司组Id:{0},组别名称:{1},组别描述:{2},是否采购其他代理政策:{3},更新操作者账号:{4},更新时间:{5},公司Id:{6},限制信息集合:",
                                              model.Id, model.Name, model.Description, model.PurchaseMyPolicyOnly, model.UpdateAccount, model.UpdateTime.Value.Date.ToString("yyyy-MM-dd HH:mm:ss"), model.Company);

            if (companyGroupView.Limitations != null)
            {
                foreach (var item in companyGroupView.Limitations)
                {
                    newContent += string.Format("受限航空公司{0},限制出港城市{1},未发布政策时,是否只能采购自己的政策{2},未发布政策时,设置默认返点{3};", item.Airlines,
                                                item.Departures, item.PurchaseMyPolicyOnlyForNonePolicy, item.DefaultRebateForNonePolicy);
                }
            }
            saveUpdateLog("公司组", originalContent, newContent, "公司Id:" + company.ToString() + "公司组Id:" + companyGroup.ToString(), operatorAccount);
        }
Пример #33
0
 private void UpdateObject(CompanyGroup _newCompanyGroup, ref CompanyGroup _oldCompanyGroup)
 {
     try
     {
         foreach (PropertyInfo CompanyGroupPropInfo in _newCompanyGroup.GetType().GetProperties().ToList())
         {
             _oldCompanyGroup.GetType().GetProperty(CompanyGroupPropInfo.Name).SetValue(_oldCompanyGroup, _newCompanyGroup.GetType().GetProperty(CompanyGroupPropInfo.Name).GetValue(_newCompanyGroup));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
Пример #34
0
        public async Task <IActionResult> EditGroup(CompanyGroup item)
        {
            var model = await _context.CompanyGroups.SingleOrDefaultAsync(b => b.Id == item.Id);

            await TryUpdateModelAsync(model);

            if (item.MotherOrgUnitId.HasValue)
            {
                model.Name    = null;
                model.OthName = null;
            }
            await _context.SaveChangesAsync();

            return(RedirectToAction("GroupsList"));
        }
Пример #35
0
 public CompanyGroup AddNewCompanyGroup(CompanyGroup _CompanyGroup)
 {
     try
     {
         using (var context = new VeraEntities())
         {
             context.CompanyGroup.Add(_CompanyGroup);
             int numOfInserted = context.SaveChanges();
             return(numOfInserted > 0 ? _CompanyGroup : null);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #36
0
 public CompanyGroup GetSingleCompanyGroupById(int id)
 {
     using (HrTrackEntities db = new DataContext().Context)
     {
         try
         {
             CompanyGroup retVal = new CompanyGroup();
             retVal = db.CompanyGroup.Find(id);
             return(retVal);
         }
         catch (Exception exc)
         {
             Console.WriteLine("[Error] " + exc.Message);
             return(null);
         }
     }
 }
Пример #37
0
 public bool ModifyCompanyGroup(CompanyGroup modifiedItem)
 {
     using (HrTrackEntities db = new DataContext().Context)
     {
         try
         {
             db.Entry(modifiedItem).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(true);
         }
         catch (Exception exc)
         {
             Console.WriteLine("[Error] " + exc.Message);
             return(false);
         }
     }
 }
Пример #38
0
 public CompanyGroup CreatCompanyGroup(CompanyGroup createItem)
 {
     using (HrTrackEntities db = new DataContext().Context)
     {
         try
         {
             db.CompanyGroup.Add(createItem);
             db.SaveChanges();
             return(createItem);
         }
         catch (Exception exc)
         {
             Console.WriteLine("[Error] " + exc.Message);
             return(null);
         }
     }
 }
Пример #39
0
        public BL_Result <CompanyGroup> SupplierAdd(string db_name, CompanyGroup companyGroup)
        {
            if (companyGroup != null)
            {
                Repository <CompanyGroup> repo_companyGroup = new Repository <CompanyGroup>(db_name);
                int db = repo_companyGroup.Insert(new CompanyGroup()
                {
                    Name         = companyGroup.Name,
                    Confirmation = companyGroup.Confirmation
                });

                if (db > 0)
                {
                    result_companyGroup.Result = repo_companyGroup.Find(x => x.Id == companyGroup.Id);
                }
            }
            return(result_companyGroup);
        }
Пример #40
0
        public long CreateGroup(int companyId, string groupName, string description)
        {
            using (var tran = new TransactionScope())
            {
                using (objDataContext = GetDataContext())
                {
                    var newGroup = new CompanyGroup
                    {
                        Company_Id  = companyId,
                        Description = description,
                        GroupName   = groupName
                    };

                    objDataContext.CompanyGroups.InsertOnSubmit(newGroup);

                    objDataContext.SubmitChanges();
                    tran.Complete();

                    return(newGroup.Id);
                }
            }
        }
Пример #41
0
 public ActionResult AddCompanyGroup(CompanyGroup companyGroup)
 {
     if (!ModelState.IsValid)
     {
         return(View("Add", companyGroup));
     }
     else
     {
         HorseplayContext db = new HorseplayContext();
         if (db.CompanyGroups.Any(x => x.Name == companyGroup.Name))
         {
             ModelState.AddModelError(string.Empty, "Grupa o takiej nazwie już istnieje!");
             return(View("Add", companyGroup));
         }
         else
         {
             db.CompanyGroups.Add(companyGroup);
             db.SaveChanges();
             return(View("companyGroupCreated", companyGroup));
         }
     }
 }
Пример #42
0
        public void CreateCompanyGroupTest()
        {
            Guid         ownerId = new Guid("67007e18-a8ee-4ce0-b860-ae81ddd2a4f3"); // TODO: 初始化为适当的值
            CompanyGroup group   = new CompanyGroup()
            {
                Id                    = Guid.NewGuid(),
                Name                  = "复仇者联盟",
                Description           = "都是英雄",
                AllowExternalPurchase = true,
                Company               = ownerId,
                CreateTime            = DateTime.Now,
                LastModifyTime        = DateTime.Now,
                Creator               = "lanlan"
            };
            IEnumerable <Guid> members = new List <Guid>();
            IEnumerable <CompanyGroupLimitation> limitations = new List <CompanyGroupLimitation>();
            string creator  = "lanlan";
            bool   expected = true;
            bool   actual;

            actual = CompanyService.CreateCompanyGroup(ownerId, group, members, limitations, creator);
            Assert.AreEqual(expected, actual);
        }
Пример #43
0
        public CompanyGroup UpdateCompanyGroup(CompanyGroup _CompanyGroup)
        {
            try
            {
                using (var context = new VeraEntities())
                {
                    var oldCompanyGroup = context.CompanyGroup.FirstOrDefault(u => u.Id == _CompanyGroup.Id);
                    if (oldCompanyGroup != null)
                    {
                        UpdateObject(_CompanyGroup, ref oldCompanyGroup);
                        var numberOfUpdatedCompanyGroup = context.SaveChanges();
                        return(numberOfUpdatedCompanyGroup > 0 ? _CompanyGroup : null);
                    }

                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Пример #44
0
        /// <summary>
        /// This is a Geotab API console example of importing groups from a CSV file.
        /// 1) Process command line arguments: Server, Database, Username, Password, Input File and load CSV file.
        /// Note: the CSV file in this project is a sample, you may need to change entries (such as group names) for the example to work.
        /// 2) Create Geotab API object and Authenticate.
        /// 3) Import groups into database.
        /// A complete Geotab API object and method reference is available at the Geotab Developer page.
        /// </summary>
        /// <param name="args">The command line arguments for the application. Note: When debugging these can be added by: Right click the project &gt; Properties &gt; Debug Tab &gt; Start Options: Command line arguments.</param>
        static void Main(string[] args)
        {
            try
            {
                if (args.Length != 5)
                {
                    // ImportNodes
                    Console.WriteLine();
                    Console.WriteLine("Command line parameters:");
                    Console.WriteLine("dotnet run <server> <database> <username> <password> <inputfile>");
                    Console.WriteLine();
                    Console.WriteLine("Command line:     dotnet run server database login password inputfile");
                    Console.WriteLine("server          - The server name (Example: my.geotab.com)");
                    Console.WriteLine("database        - The database name (Example: G560)");
                    Console.WriteLine("username        - MyGeotab user name (Example: [email protected])");
                    Console.WriteLine("password        - MyGeotab password");
                    Console.WriteLine("inputfile       - File name of the CSV file to import.");
                    Console.WriteLine();
                    return;
                }

                // Process command line arguments
                string server   = args[0];
                string database = args[1];
                string username = args[2];
                string password = args[3];
                string fileName = args[4];

                // Load GroupRow collection from the given .csv file
                Console.WriteLine("Loading .csv file...");
                List <GroupRow> groupRows;
                try
                {
                    groupRows = LoadGroupRowsFromCSV(fileName);
                }
                catch (Exception exception)
                {
                    Console.WriteLine($"Could not load CSV file: {exception.Message}");
                    return;
                }

                // Create Geotab API object
                API api = new API(username, password, null, database, server);

                // Authenticate
                Console.WriteLine("Authenticating...");
                api.Authenticate();

                // Start import
                Console.WriteLine("Importing...");

                // When adding a Group you must include the Group's Parent. There is a base Group structure which is immutable which you can add child nodes to.
                // For example: The system will always have a RootGroup (ObjectModel.RootGroup) with an CompanyGroup (ObjectModel.CompanyGroup) as a child.

                // Load the all the nodes in the system this user has access to into this dictionary.
                Dictionary <string, Group> existingGroupDictionary = PopulateGroupDictionary(api);

                // Start adding the new Groups we retrieved from the file.
                foreach (GroupRow row in groupRows)
                {
                    // Assigning the parent node. //

                    // When adding a node it, must have a parent.
                    Group  parentGroup;
                    string parentGroupName = row.ParentGroupName;

                    // If there is no parent node name or if the parent node's name matches organization or entire organization create a new CompanyGroup object.
                    if (string.IsNullOrEmpty(parentGroupName) || parentGroupName.ToLowerInvariant() == "organization" || parentGroupName.ToLowerInvariant() == "entire organization")
                    {
                        parentGroup = new CompanyGroup();
                    }
                    else
                    {
                        // This will need re-loading when there is a node we previously added that we now want to assign children to.
                        if (!existingGroupDictionary.ContainsKey(parentGroupName.ToLowerInvariant()))
                        {
                            existingGroupDictionary = PopulateGroupDictionary(api);
                        }

                        // Check for non-organization Group in the dictionary of nodes that exist in the system.
                        if (!existingGroupDictionary.TryGetValue(parentGroupName.ToLowerInvariant(), out parentGroup))
                        {
                            Console.WriteLine($"Non-existent parent Group: {parentGroupName}");
                            continue;
                        }
                    }

                    // If the parent is null then we cannot add the Group. So we write to the console and try to add the next node.
                    if (parentGroup == null)
                    {
                        Console.WriteLine($"No parent for Group {row.GroupName}");
                        continue;
                    }

                    // Adding the new node //

                    // If a node exists with this name we wont add it and try to add the next node.
                    if (existingGroupDictionary.ContainsKey(row.GroupName.ToLowerInvariant()))
                    {
                        Console.WriteLine($"A group with the name '{row.GroupName}' already exists, please change this group name.");
                        continue;
                    }

                    try
                    {
                        // Make API call to add the node.
                        var groupToAdd = new Group(null, parentGroup, row.GroupName);
                        api.Call <Id>("Add", typeof(Group), new { entity = groupToAdd });
                        Console.WriteLine($"Successfully added: {row.GroupName}");
                    }
                    catch (Exception exception)
                    {
                        // Catch exceptions here so we can continue trying to add nodes.
                        Console.WriteLine($"Could not add {row.GroupName}: {exception.Message}");
                    }
                }
            }
            catch (Exception ex)
            {
                // Show miscellaneous exceptions
                Console.WriteLine($"Error: {ex.Message}\n{ex.StackTrace}");
            }
            finally
            {
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
            }
        }
Пример #45
0
        /// <summary>
        /// This is a console example of importing Zones from a .csv file.
        ///
        /// 1) Process command line arguments: Server, Database, Username, Password, Options and Load .csv file.
        ///    Note: the .csv file in this project is a sample, you may need to change entries (such as group names) for the example to work.
        /// 2) Create Geotab API object and Authenticate.
        /// 3) Import zones into database.
        ///
        /// A complete Geotab API object and method reference is available at the Geotab Developer page.
        /// </summary>
        /// <param name="args">The command line arguments for the application. Note: When debugging these can be added by: Right click the project > Properties > Debug Tab > Start Options: Command line arguments.</param>
        static void Main(string[] args)
        {
            try
            {
                if (args.Length < 5)
                {
                    Console.WriteLine();
                    Console.WriteLine("Command line parameters:");
                    Console.WriteLine("dotnet run <server> <database> <username> <password> [-poly=<##>] [-type=<name>] <inputfile>");
                    Console.WriteLine();
                    Console.WriteLine("Command line:      dotnet run server database username password -poly=6 -type=home inputfile");
                    Console.WriteLine("server             - The server name (Example: my.geotab.com)");
                    Console.WriteLine("database           - The database name (Example: G560)");
                    Console.WriteLine("username           - The Geotab user name");
                    Console.WriteLine("password           - The Geotab password");
                    Console.WriteLine("--poly=##           - Optional - Draw the zone as an N-sided polygon. (Default: 4)");
                    Console.WriteLine("--type=<name>       - Optional - Specify zone type as customer, home, or office. (Default: customer)");
                    Console.WriteLine("inputfile          - File name of the CSV file to import.");
                    Console.WriteLine();
                    return;
                }

                // Variables from command line
                int    last         = args.Length - 1;
                string server       = args[0];
                string database     = args[1];
                string username     = args[2];
                string password     = args[3];
                string filename     = args[last];
                int    polygonSides = 4;

                IList <ZoneType> zoneTypes = new List <ZoneType>();

                // Options from args
                for (int i = 4; i < last; i++)
                {
                    string option = args[i].ToLowerInvariant();

                    // Poly sides option
                    if (option.Contains("poly"))
                    {
                        int index = option.IndexOf('=');
                        if (index >= 0 && option.Length > index + 1)
                        {
                            if (int.TryParse(option.Substring(index + 1), out int value) && value > 2)
                            {
                                polygonSides = value;
                            }
                        }
                    }

                    // Zone type option
                    else if (option.Contains("type"))
                    {
                        int index = option.IndexOf('=');
                        if (index >= 0 && option.Length > index + 1)
                        {
                            string   value    = option.Substring(index + 1).ToLowerInvariant();
                            ZoneType zoneType = null;
                            if (value.Contains("customer"))
                            {
                                zoneType = ZoneTypeCustomer.Value;
                            }
                            else if (value.Contains("home"))
                            {
                                zoneType = ZoneTypeHome.Value;
                            }
                            else if (value.Contains("office"))
                            {
                                zoneType = ZoneTypeOffice.Value;
                            }
                            if (zoneType != null && !zoneTypes.Contains(zoneType))
                            {
                                zoneTypes.Add(zoneType);
                            }
                        }
                    }
                }

                // Use Customer Zone Type for default.
                if (zoneTypes.Count == 0)
                {
                    zoneTypes.Add(ZoneTypeCustomer.Value);
                }

                // Load .csv file entries into a collection of customers
                Console.WriteLine("Loading CSV file...");
                List <ZoneRow> zoneRows;
                try
                {
                    zoneRows = LoadZonesFromCSV(filename);
                }
                catch (Exception exception)
                {
                    Console.WriteLine($"Could not load CSV file: {exception.Message}");
                    return;
                }

                // Create Geotab API object
                API api = new API(username, password, null, database, server);

                // Authenticate
                Console.WriteLine("Authenticating...");
                api.Authenticate();

                // Get user
                User user = api.Call <User>("RefreshUser");

                // Start import
                Console.WriteLine("Importing...");

                IList <Zone>  zones     = api.Call <IList <Zone> >("Get", typeof(Zone));
                IList <Group> allGroups = api.Call <IList <Group> >("Get", typeof(Group));

                // We only want to be able to assign Organization Group if the API user has this in their scope.
                bool hasOrgGroupScope = false;

                // See if the API user has Organization Group in their Groups
                foreach (Group group in user.CompanyGroups)
                {
                    if (group is CompanyGroup || group is RootGroup)
                    {
                        hasOrgGroupScope = true;
                        break;
                    }
                }

                // Set the zone color based on type.
                // Geotab uses standard colors for the stock zone types. Colors are noted at the top of this class.
                Color zoneColor = customerZoneColor;
                if (zoneTypes.Count > 0)
                {
                    ZoneType type = zoneTypes[0];
                    if (type is ZoneTypeHome)
                    {
                        zoneColor = homeZoneColor;
                    }
                    else if (type is ZoneTypeOffice)
                    {
                        zoneColor = officeZoneColor;
                    }
                }

                // Add zones
                foreach (ZoneRow zoneRow in zoneRows)
                {
                    Group group;

                    // If there are no nodes for the zone specified in the .csv we will try to assign to Organization
                    if (hasOrgGroupScope && string.IsNullOrEmpty(zoneRow.NodeName))
                    {
                        group = new CompanyGroup();
                    }

                    // Organization group
                    else if (hasOrgGroupScope && zoneRow.NodeName.Trim().ToLowerInvariant() == "organization" || zoneRow.NodeName.Trim().ToLowerInvariant() == "entire organization")
                    {
                        group = new CompanyGroup();
                    }
                    else
                    {
                        // Get the group from allGroups
                        group = GetGroup(zoneRow.NodeName.Trim(), allGroups);
                        if (group == null)
                        {
                            Console.WriteLine($"Zone Rejected: '{zoneRow.Name}'. Group: '{zoneRow.NodeName}' does not exist.");
                            continue;
                        }
                    }

                    // Check for an existing zone
                    if (ZoneExists(zoneRow.Name, zoneRow.NodeName, zones))
                    {
                        Console.WriteLine($"Zone exists: '{zoneRow.Name}'.");
                        continue;
                    }

                    // Check for an existing zone
                    try
                    {
                        // Create a new zone object
                        Zone zone = CreateCircleZone(zoneRow.Name, "", zoneRow.Latitude, zoneRow.Longitude, zoneRow.Size, polygonSides, zoneTypes, zoneColor, new List <Group> {
                            group
                        });
                        api.Call <Id>("Add", typeof(Zone), new { entity = zone });
                        Console.WriteLine($"Zone: '{zoneRow.Name}' added");
                    }
                    catch (Exception ex)
                    {
                        // Catch and display any error that occur when adding the zone
                        Console.WriteLine($"Error adding zone: '{zoneRow.Name}'\n{ex.Message}");
                    }
                }
            }
            catch (Exception ex)
            {
                // Show miscellaneous exceptions
                Console.WriteLine($"Error: {ex.Message}\n{ex.StackTrace}");
            }
            finally
            {
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
            }
        }