예제 #1
0
        public BusinessPartner_Ger_List()
        {
            // Get required service
            this.businessPartnerService                 = DependencyResolver.Kernel.Get <IBusinessPartnerService>();
            this.businessPartnerLocationService         = DependencyResolver.Kernel.Get <IBusinessPartnerLocationService>();
            this.businessPartnerPhoneService            = DependencyResolver.Kernel.Get <IBusinessPartnerPhoneService>();
            this.businessPartnerOrganizationUnitService = DependencyResolver.Kernel.Get <IBusinessPartnerOrganizationUnitService>();
            this.businessPartnerBankService             = DependencyResolver.Kernel.Get <IBusinessPartnerBankService>();
            this.businessPartnerInstitutionService      = DependencyResolver.Kernel.Get <IBusinessPartnerInstitutionService>();
            this.businessPartnerTypeService             = DependencyResolver.Kernel.Get <IBusinessPartnerTypeService>();
            this.businessPartnerNoteService             = DependencyResolver.Kernel.Get <IBusinessPartnerNoteService>();

            // Initialize form components
            InitializeComponent();

            this.DataContext = this;
        }
        public BusinessPartner_Institution_AddEdit(BusinessPartnerViewModel businessPartner)
        {
            businessPartnerService            = DependencyResolver.Kernel.Get <IBusinessPartnerService>();
            businessPartnerInstitutionService = DependencyResolver.Kernel.Get <IBusinessPartnerInstitutionService>();

            InitializeComponent();

            this.DataContext = this;

            CurrentBusinessPartner = businessPartner;
            CurrentBusinessPartnerInstitutionForm            = new BusinessPartnerInstitutionViewModel();
            CurrentBusinessPartnerInstitutionForm.Identifier = Guid.NewGuid();
            CurrentBusinessPartnerInstitutionForm.ItemStatus = ItemStatus.Added;

            Thread displayThread = new Thread(() => DisplayBusinessPartnerInstitutionData());

            displayThread.IsBackground = true;
            displayThread.Start();

            txtCode.Focus();
        }
예제 #3
0
        public Home()
        {
            businessPartnerService            = DependencyResolver.Kernel.Get <IBusinessPartnerService>();
            businessPartnerTypeService        = DependencyResolver.Kernel.Get <IBusinessPartnerTypeService>();
            businessPartnerBankService        = DependencyResolver.Kernel.Get <IBusinessPartnerBankService>();
            businessPartnerDocumentService    = DependencyResolver.Kernel.Get <IBusinessPartnerDocumentService>();
            businessPartnerInstitutionService = DependencyResolver.Kernel.Get <IBusinessPartnerInstitutionService>();
            businessPartnerLocationService    = DependencyResolver.Kernel.Get <IBusinessPartnerLocationService>();
            businessPartnerNoteService        = DependencyResolver.Kernel.Get <IBusinessPartnerNoteService>();
            //businessPartnerOrganizationUnitService = DependencyResolver.Kernel.Get<IBusinessPartnerOrganizationUnitService>();
            businessPartnerPhoneService = DependencyResolver.Kernel.Get <IBusinessPartnerPhoneService>();


            employeeService           = DependencyResolver.Kernel.Get <IEmployeeService>();
            employeeProfessionService = DependencyResolver.Kernel.Get <IEmployeeProfessionService>();
            employeeNoteService       = DependencyResolver.Kernel.Get <IEmployeeNoteService>();
            employeeLicenceService    = DependencyResolver.Kernel.Get <IEmployeeLicenceService>();
            employeeItemService       = DependencyResolver.Kernel.Get <IEmployeeItemService>();
            employeeDocumentService   = DependencyResolver.Kernel.Get <IEmployeeDocumentService>();
            employeeCardService       = DependencyResolver.Kernel.Get <IEmployeeCardService>();

            licenceTypeService  = DependencyResolver.Kernel.Get <ILicenceTypeService>();
            familyMemberService = DependencyResolver.Kernel.Get <IFamilyMemberService>();

            physicalPersonService           = DependencyResolver.Kernel.Get <IPhysicalPersonService>();
            physicalPersonProfessionService = DependencyResolver.Kernel.Get <IPhysicalPersonProfessionService>();
            physicalPersonNoteService       = DependencyResolver.Kernel.Get <IPhysicalPersonNoteService>();
            physicalPersonLicenceService    = DependencyResolver.Kernel.Get <IPhysicalPersonLicenceService>();
            physicalPersonItemService       = DependencyResolver.Kernel.Get <IPhysicalPersonItemService>();
            physicalPersonDocumentService   = DependencyResolver.Kernel.Get <IPhysicalPersonDocumentService>();
            physicalPersonCardService       = DependencyResolver.Kernel.Get <IPhysicalPersonCardService>();


            outputInvoiceService = DependencyResolver.Kernel.Get <IOutputInvoiceService>();
            inputInvoiceService  = DependencyResolver.Kernel.Get <IInputInvoiceService>();

            countryService      = DependencyResolver.Kernel.Get <ICountryService>();
            regionService       = DependencyResolver.Kernel.Get <IRegionService>();
            municipalityService = DependencyResolver.Kernel.Get <IMunicipalityService>();
            cityService         = DependencyResolver.Kernel.Get <ICityService>();

            sectorService     = DependencyResolver.Kernel.Get <ISectorService>();
            professionService = DependencyResolver.Kernel.Get <IProfessionService>();
            bankService       = DependencyResolver.Kernel.Get <IBankService>();
            agencyService     = DependencyResolver.Kernel.Get <IAgencyService>();

            constructionSiteService            = DependencyResolver.Kernel.Get <IConstructionSiteService>();
            constructionSiteDocumentService    = DependencyResolver.Kernel.Get <IConstructionSiteDocumentService>();
            constructionSiteCalculationService = DependencyResolver.Kernel.Get <IConstructionSiteCalculationService>();
            constructionSiteNoteService        = DependencyResolver.Kernel.Get <IConstructionSiteNoteService>();


            //employeeByBusinessPartnerService = DependencyResolver.Kernel.Get<IEmployeeByBusinessPartnerService>(); //radnici po firmama?
            //employeeByConstructionSiteService = DependencyResolver.Kernel.Get<IEmployeeByConstructionSiteService>(); // radnici po gradilistu
            //businessPartnerByConstructionSiteService = DependencyResolver.Kernel.Get<IBusinessPartnerByConstructionSiteService>(); //firme po gradilistu

            taxAdministrationService = DependencyResolver.Kernel.Get <ITaxAdministrationService>();

            limitationService      = DependencyResolver.Kernel.Get <ILimitationService>();
            userService            = DependencyResolver.Kernel.Get <IUserService>();
            vatService             = DependencyResolver.Kernel.Get <IVatService>();
            discountService        = DependencyResolver.Kernel.Get <IDiscountService>();
            serviceDeliveryService = DependencyResolver.Kernel.Get <IServiceDeliveryService>();
            statusService          = DependencyResolver.Kernel.Get <IStatusService>();
            shipmentService        = DependencyResolver.Kernel.Get <IShipmentService>();

            toDoService = DependencyResolver.Kernel.Get <IToDoService>();

            phonebookService  = DependencyResolver.Kernel.Get <IPhonebookService>();
            callCentarService = DependencyResolver.Kernel.Get <ICallCentarService>();

            employeeByConstructionSiteService        = DependencyResolver.Kernel.Get <IEmployeeByConstructionSiteService>();
            businessPartnerByConstructionSiteService = DependencyResolver.Kernel.Get <IBusinessPartnerByConstructionSiteService>();
            employeeByBusinessPartnerService         = DependencyResolver.Kernel.Get <IEmployeeByBusinessPartnerService>();

            documentFolderService = DependencyResolver.Kernel.Get <IDocumentFolderService>();
            documentFileService   = DependencyResolver.Kernel.Get <IDocumentFileService>();

            InitializeComponent();

            this.DataContext = this;

            var resp = new CompanyUserSQLiteRepository().GetCompanyUser(MainWindow.CurrentCompanyId, MainWindow.CurrentUser?.Identifier ?? Guid.Empty);

            if (resp.Success)
            {
                var userRoles = resp.CompanyUser?.UserRoles ?? new List <UserRoleViewModel>();
                if (userRoles.Any(x => x.Name == "CallCentar") || userRoles.Any(x => x.Name == "Admin"))
                {
                    CallCentarList.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    CallCentarList.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
        }
 public BusinessPartnerInstitutionController(IServiceProvider provider)
 {
     businessPartnerInstitutionService = provider.GetRequiredService <IBusinessPartnerInstitutionService>();
 }
        public void Sync(IBusinessPartnerInstitutionService BusinessPartnerInstitutionService, Action <int, int> callback = null)
        {
            try
            {
                SyncBusinessPartnerInstitutionRequest request = new SyncBusinessPartnerInstitutionRequest();
                request.CompanyId     = MainWindow.CurrentCompanyId;
                request.LastUpdatedAt = GetLastUpdatedAt(MainWindow.CurrentCompanyId);

                int toSync      = 0;
                int syncedItems = 0;

                BusinessPartnerInstitutionListResponse response = BusinessPartnerInstitutionService.Sync(request);
                if (response.Success)
                {
                    toSync = response?.BusinessPartnerInstitutions?.Count ?? 0;
                    List <BusinessPartnerInstitutionViewModel> businessPartnerInstitutionsFromDB = response.BusinessPartnerInstitutions;

                    using (SqliteConnection db = new SqliteConnection(SQLiteHelper.SqLiteTableName))
                    {
                        db.Open();
                        using (var transaction = db.BeginTransaction())
                        {
                            SqliteCommand deleteCommand = db.CreateCommand();
                            deleteCommand.CommandText = "DELETE FROM BusinessPartnerInstitutions WHERE Identifier = @Identifier";

                            SqliteCommand insertCommand = db.CreateCommand();
                            insertCommand.CommandText = SqlCommandInsertPart;

                            foreach (var businessPartnerInstitution in businessPartnerInstitutionsFromDB)
                            {
                                deleteCommand.Parameters.AddWithValue("@Identifier", businessPartnerInstitution.Identifier);
                                deleteCommand.ExecuteNonQuery();
                                deleteCommand.Parameters.Clear();

                                if (businessPartnerInstitution.IsActive)
                                {
                                    businessPartnerInstitution.IsSynced = true;

                                    insertCommand = AddCreateParameters(insertCommand, businessPartnerInstitution);
                                    insertCommand.ExecuteNonQuery();
                                    insertCommand.Parameters.Clear();

                                    syncedItems++;
                                    callback?.Invoke(syncedItems, toSync);
                                }
                            }

                            transaction.Commit();
                        }
                        db.Close();
                    }
                }
                else
                {
                    throw new Exception(response.Message);
                }
            }
            catch (Exception ex)
            {
                MainWindow.ErrorMessage = ex.Message;
            }
        }