예제 #1
0
        private void btnEditEmailAccount_Click(object sender, EventArgs e)
        {
            if (lvEmailAccounts.SelectedItems.Count == 0)
            {
                return;
            }
            EmailAccount emailAccount = (EmailAccount)lvEmailAccounts.SelectedItems[0].Tag;

            Debug.Assert(emailAccount != null, "Email account not selected!");
            AddEmailAccountForm frm = new AddEmailAccountForm(emailAccount);

            if (DialogResult.OK != frm.ShowDialog())
            {
                return;
            }
            try
            {
                ServicesProvider.GetInstance().GetEmailAccountServices().Update(frm.EmailAccount);
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            LoadEmailAccounts();
        }
예제 #2
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     try
     {
         if (1 == lvMembers.SelectedItems.Count && lvMembers.SelectedItems[0].BackColor != Color.Red)
         {
             VillageMember member = (VillageMember)lvMembers.SelectedItems[0].Tag;
             if (member.ActiveLoans != null && member.ActiveLoans.Count > 0)
             {
                 MessageBox.Show(MultiLanguageStrings.GetString(Ressource.VillageForm, "RemoveProhibited.Text"),
                                 MultiLanguageStrings.GetString(Ressource.VillageForm, "RemoveProhibited.Caption"),
                                 MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else
             {
                 if (DialogResult.Yes == MessageBox.Show(MultiLanguageStrings.GetString(Ressource.VillageForm, "RemoveConfirm.Text"),
                                                         MultiLanguageStrings.GetString(Ressource.VillageForm, "RemoveConfirm.Caption"),
                                                         MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                 {
                     ServicesProvider.GetInstance().GetClientServices().RemoveMember(_village, member);
                     membersSaved = false;
                     DisplayMembers();
                     DisplayLoans();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
     }
 }
예제 #3
0
        private bool InitializeLoanDisburseEvent()
        {
            try
            {
                _loanDisbursmentEvent = ServicesProvider.GetInstance().GetContractServices().DisburseSimulation(_loan,
                                                                                                                _alignInstallmentsDatesOnRealDisbursmentDate,
                                                                                                                _newStartDate,
                                                                                                                _disableFees);

                if (_loanDisbursmentEvent != null)
                {
                    _lbAmountValue.Text    = _loanDisbursmentEvent.Amount.GetFormatedValue(_loan.UseCents);
                    lblAmountCurrency.Text = _loan.Product.Currency.Code;
                    _lbLoanCodeValue.Text  = _loan.Code;
                    if (!_feeModified)
                    {
                        SetFeeAmount();
                    }
                    lblEntryFeeCurrency.Text = _loan.Product.Currency.Code;
                    InitializeExternalCurrency();
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                _exchangeRate = null;
                InitializeExternalCurrency();
                return(false);
            }
            return(true);
        }
예제 #4
0
        private void nudAmount_ValueChanged(object sender, EventArgs e)
        {
            try
            {
                _amount = nudAmount.Value;
                bool isFlat = false;

                if (_saving is SavingBookContract)
                {
                    SavingsBookProduct p = (SavingsBookProduct)_saving.Product;
                    if (IsNormalTransfer())
                    {
                        isFlat = p.FlatTransferFees.HasValue || p.FlatTransferFeesMin.HasValue;
                    }
                    else
                    {
                        isFlat = p.InterBranchTransferFee.IsFlat;
                    }
                }
                if (_bookingDirection == OSavingsOperation.Credit)
                {
                    isFlat = true;
                }
                OCurrency fee = isFlat ? updAmountFees.Value : _amount * updAmountFees.Value / 100;
                nudTotalAmount.Value = (_amount + fee).Value;
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
예제 #5
0
        private Person SelectOwner()
        {
            using (SearchClientForm searchClientForm = SearchClientForm.GetInstance(OClientTypes.Person, true))
            {
                searchClientForm.ShowDialog();

                try
                {
                    if (ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(searchClientForm.Client) &&
                        !searchClientForm.Client.Active)
                    {
                        return((Person)searchClientForm.Client);
                    }
                    else
                    {
                        return(null);
                    }

                    //else
                    //  textBoxName.Text = String.Empty;
                }
                catch (Exception ex)
                {
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                    return(null);
                }
            }
        }
예제 #6
0
파일: FrmRoles.cs 프로젝트: phng/opencbs
        private void UpdateRole()
        {
            _role.RoleName         = txtTitle.Text;
            _role.Description      = txtDescription.Text;
            _role.DefaultStartPage = (OStartPages.StartPages)defaultWindowComboBox.Tag;

            try
            {
                RoleServices.RoleErrors roleErrors = ServicesProvider.GetInstance().GetRoleServices().UpdateRole(_role);
                if (roleErrors.FindError)
                {
                    MessageBox.Show(GetString(roleErrors.ErrorCode), "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                UpdateControlStatus();
                User.CurrentUser = ServicesProvider.GetInstance().GetUserServices().Find(User.CurrentUser.Id, true);
                //clean deid menu
                foreach (MenuObject item in GetDeidMenuItems())
                {
                    ServicesProvider.GetInstance().GetMenuItemServices().DeleteMenuItem(item);
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            EraseRole();
        }
예제 #7
0
        private void _CheckTiersAndDisplayIt(ProjetSearchResult result)
        {
            try
            {
                _client        = ServicesProvider.GetInstance().GetClientServices().FindTiers(result.TiersId, result.Type);
                _projet        = ServicesProvider.GetInstance().GetProjectServices().FindProjectById(result.Id);
                _projet.Client = _client;


                if (result.Type == OClientTypes.Person)
                {
                    ((LotrasmicMainWindowForm)_mdiForm).InitializePersonForm((Person)_client, _projet);
                }
                if (result.Type == OClientTypes.Group)
                {
                    ((LotrasmicMainWindowForm)_mdiForm).InitializeGroupForm((Group)_client, _projet);
                }
                if (result.Type == OClientTypes.Corporate)
                {
                    ((LotrasmicMainWindowForm)_mdiForm).InitializeCorporateForm((Corporate)_client, _projet);
                }

                Close();
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
예제 #8
0
        void lqtToolStrip1_SaveAndNewClick(object sender, EventArgs e)
        {
            try
            {
                LQTUserMessage msg = SaveOrUpdateObject();
                ((LqtMainWindowForm)_mdiparent).ShowStatusBarInfo(msg.Message, _reloadCtr);
                DataRepository.CloseSession();

                ForlabRegion r  = _site.Region;
                SiteCategory sc = _site.SiteCategory;


                _site              = new ForlabSite();
                _site.Region       = r;
                _site.SiteCategory = sc;


                LoadSiteCtr();
                _isedited = false;
                if (_site.SiteCategory != null)//b
                {
                    comCategory.SelectedValue = _site.SiteCategory.Id;
                }
            }
            catch (Exception ex)
            {
                new FrmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
예제 #9
0
        private void SaveUser()
        {
            try
            {
                UserServices.UserErrors userErrors = ServicesProvider.GetInstance().GetUserServices().SaveUser(_user);
                if (userErrors.FindError)
                {
                    MessageBox.Show(userErrors.ResultMessage, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    _InitializeControls(userErrors);
                }
                else
                {
                    InitUsers();

                    foreach (ListViewItem item in lvUsers.Items)
                    {
                        if (((User)item.Tag).Id == _user.Id)
                        {
                            item.Selected = true;
                            listViewUsers_Click(this, new EventArgs());
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
예제 #10
0
        private void CheckContractAndDisplayIt(SavingSearchResult saving)
        {
            if (!_isSearchSavingContractForTransfer)
            {
                try
                {
                    ClientServices clientServices = ServicesProvider.GetInstance().GetClientServices();

                    IClient client = ServicesProvider.GetInstance().GetClientServices().FindTiers(saving.ClientId, saving.ClientType);

                    if (clientServices.CheckIfTiersIsValid(client))
                    {
                        var mainForm = (MainView)Application.OpenForms[0];
                        mainForm.InitializeSavingContractForm(client, saving.Id);
                    }
                }
                catch (Exception ex)
                {
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                }
            }
            else
            {
                groupBoxContractType.Enabled       = true;
                _isSearchSavingContractForTransfer = false;
                SelectedSavingContract             = saving;
                DialogResult = DialogResult.OK;
            }
        }
예제 #11
0
        private void DisplayContracts()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (radioButtonCreditContract.Checked)
                {
                    List <CreditSearchResult> creditResult = ServicesProvider.GetInstance().GetContractServices().
                                                             FindContracts(_currentPageNumber, out _numbersTotalPage, out _numberOfRecords, _query);
                    InitializeListViewContract(creditResult);
                }
                if (radioButtonSavingContract.Checked)
                {
                    bool activeContractsOnly = _isSearchSavingContractForTransfer;
                    List <SavingSearchResult> savingResult = ServicesProvider.GetInstance().GetSavingServices().FindContracts(_currentPageNumber,
                                                                                                                              out _numbersTotalPage, out _numberOfRecords, _query, _isSearchSavingContractForTransfer, activeContractsOnly);
                    _numberOfRecords = savingResult.Count;

                    InitializeListViewContract(savingResult);
                }

                lblTitle.Text             = string.Format("{0} ({1})", MultiLanguageStrings.GetString(Ressource.SearchCreditContractForm, "result.Text"), _numberOfRecords);
                textBoxCurrentlyPage.Text = string.Format("{0}{1} / {2}", MultiLanguageStrings.GetString(Ressource.SearchCreditContractForm, "page.Text"), _currentPageNumber, _numbersTotalPage);
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
예제 #12
0
        private void EditDomain()
        {
            try
            {
                if (buttonEdit.Text.Equals(GetString("buttonEdit")))
                {
                    selectedNode      = tvEconomicActivity.SelectedNode;
                    _economicActivity = (EconomicActivity)selectedNode.Tag;

                    if (_economicActivity != null)
                    {
                        _economicActivity.Parent = (EconomicActivity)selectedNode.Parent.Tag;
                        textBoxName.Text         = _economicActivity.Name;
                        IsSame                     = textBoxName.Text;
                        buttonExit.Enabled         = false;
                        buttonAdd.Enabled          = false;
                        buttonDelete.Enabled       = false;
                        tvEconomicActivity.Enabled = false;

                        buttonEdit.Text = GetString("buttonSave");
                    }
                }
                else
                {
                    if (ServicesProvider.GetInstance().GetEconomicActivityServices().NodeEditable(selectedNode.Tag))
                    {
                        if (selectedNode.Level == 1)
                        {
                            _economicActivity.Parent = new EconomicActivity(); // no parent
                        }
                        if (IsSame != textBoxName.Text)
                        {
                            if (ServicesProvider.GetInstance().GetEconomicActivityServices().ChangeDomainOfApplicationName(_economicActivity, textBoxName.Text))
                            {
                                tvEconomicActivity.BeginUpdate();
                                selectedNode.Tag  = _economicActivity;
                                selectedNode.Text = textBoxName.Text;
                                tvEconomicActivity.EndUpdate();
                            }
                        }
                    }

                    buttonExit.Enabled         = true;
                    buttonAdd.Enabled          = true;
                    buttonDelete.Enabled       = true;
                    tvEconomicActivity.Enabled = true;
                    textBoxName.Text           = string.Empty;

                    buttonEdit.Text = GetString("buttonEdit");
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }

            SelectRootNode();

            tvEconomicActivity.Sort();
        }
예제 #13
0
        private void DisplayTiers()
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                //not active = 0, active = 1, both - 2, none - 3
                int onlyActive = 2;
                if (checkBoxActive.Checked && !checkBoxNotactive.Checked)
                {
                    onlyActive = 1;
                }
                else if (checkBoxNotactive.Checked && !checkBoxActive.Checked)
                {
                    onlyActive = 0;
                }
                else if (!checkBoxNotactive.Checked && !checkBoxActive.Checked)
                {
                    onlyActive = 3;
                }

                if (radioButtonPerson.Checked)
                {
                    List <ClientSearchResult> results;
                    if (OClientTypes.Village == _clientType)
                    {
                        results = ServicesProvider.GetInstance().GetClientServices().FindInactivePersons(_currentPageNumber,
                                                                                                         out _numbersTotalPage, out _numberOfRecords, _query);
                    }
                    else
                    {
                        results = ServicesProvider.GetInstance().GetClientServices().FindTiers(out _numbersTotalPage, out _numberOfRecords,
                                                                                               _query, onlyActive, _currentPageNumber, Convert.ToInt32(checkBoxPersons.Checked),
                                                                                               Convert.ToInt32(checkBoxGroups.Checked), Convert.ToInt32(checkBoxVillages.Checked));
                    }
                    InitializeListViewClientPerson(results);
                }
                else
                {
                    List <ClientSearchResult> result = ServicesProvider.GetInstance().GetClientServices().
                                                       FindTiersCorporates(onlyActive, _currentPageNumber, out _numbersTotalPage, out _numberOfRecords, _query);
                    InitializeListViewClientCorporate(result);
                }

                labelTitleResult.Text =
                    string.Format("{0} ({1})", MultiLanguageStrings.GetString(Ressource.SearchClientForm, "result.Text"), _numberOfRecords);
                textBoxCurrentlyPage.Text =
                    MultiLanguageStrings.GetString(Ressource.SearchClientForm, "nbOfPages.Text") + _currentPageNumber + " / " + _numbersTotalPage;

                buttonPrintReport.Enabled = _numberOfRecords != 0;
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
예제 #14
0
        private void btnEditMessageTemplate_Click(object sender, EventArgs e)
        {
            if (lvMessageTemplates.SelectedItems.Count == 0)
            {
                return;
            }
            MessageTemplate messageTemplate = (MessageTemplate)lvMessageTemplates.SelectedItems[0].Tag;

            Debug.Assert(messageTemplate != null, "Message template not selected!");
            AddMessageTemplateForm frm = new AddMessageTemplateForm(messageTemplate);

            if (DialogResult.OK != frm.ShowDialog())
            {
                return;
            }
            try
            {
                ServicesProvider.GetInstance().GetMessageTemplateServices().Update(frm.MessageTemplate);
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            LoadMessageTemplates();
        }
예제 #15
0
 private void EditStandardBooking()
 {
     if (listBookings.SelectedItems.Count == 1)
     {
         Booking            booking             = (Booking)listBookings.SelectedItems[0].Tag;
         AddStandardBooking editStandardBooking = new AddStandardBooking {
             StandardBooking = booking
         };
         while (editStandardBooking.ShowDialog(this) == DialogResult.OK)
         {
             try
             {
                 var modifiedBooking = editStandardBooking.StandardBooking;
                 modifiedBooking.Id = booking.Id;
                 standardBookingServices.UpdateStandardBookings(modifiedBooking);
                 LoadBookings();
                 string message = GetString("ChangesSaved");
                 string caption = GetString("Message");
                 MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 break;
             }
             catch (Exception e)
             {
                 editStandardBooking.Show(this);
                 new frmShowError(CustomExceptionHandler.ShowExceptionText(e)).ShowDialog();
                 editStandardBooking.Hide();
             }
         }
     }
 }
예제 #16
0
        private void OnDeleteClick(object sender, EventArgs e)
        {
            try
            {
                bool canErase = false;
                if (_user.HasContract)
                {
                    frmUserSelection selectionForm = new frmUserSelection(_user.Id);

                    if (DialogResult.OK == selectionForm.ShowDialog())
                    {
                        canErase = true;
                    }
                }
                else if (Confirm("confirmDelete"))
                {
                    canErase = true;
                }

                if (canErase)
                {
//                    ((MainView)MdiParent).ReloadAlerts();
                    ServicesProvider.GetInstance().GetUserServices().Delete(_user);
                    InitUsers();
                    EraseUser();
                    Notify("deleted");
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            OnSelectedUserChanged(lvUsers, null);
        }
예제 #17
0
        public override bool DeleteSelectedItem()
        {
            if (MessageBox.Show("Are you sure you want to delete this Forecasting Methodology?", "Delete Forecasting Methodology", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    if (GetSelectedConsumption().Status != ForecastStatusEnum.CLOSED.ToString())//b
                    {
                        DataRepository.DeleteForecastInfo(GetSelectedConsumption());
                        MdiParentForm.ShowStatusBarInfo("Forecasting Methodology was deleted successfully.");
                        _selectedForcastId = 0;
                        PopConsumptions();
                        return(true);
                    }
                    else//b
                    {
                        MessageBox.Show("You Can't Delete This Forecast.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    new FrmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                }
            }

            return(false);
        }
예제 #18
0
        void lqtToolStrip1_SaveAndNewClick(object sender, EventArgs e)
        {
            try
            {
                LQTUserMessage msg = SaveOrUpdateObject();
                ((LqtMainWindowForm)_mdiparent).ShowStatusBarInfo(msg.Message, true);

                TestingArea  ta = _test.TestingArea;
                TestingGroup tg = _test.TestingGroup;

                _test              = new Test();
                _test.TestingArea  = ta;
                _test.TestingGroup = tg;

                // LoadTestCtr();
                SetControlState();
                comGroup.Enabled    = true;
                comTestarea.Enabled = true;

                _isedited = false;
            }
            catch (Exception ex)
            {
                new FrmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
예제 #19
0
        private void _DisplayTiers()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                List <ProjetSearchResult> result = ServicesProvider.GetInstance().GetProjectServices().FindProjectByCriteres(_currentPageNumber, out _numbersTotalPage, out _numberOfRecords, _query);
                _InitializeListViewProject(result);

                labelTitleResult.Text     = string.Format("{0} ({1})", MultiLanguageStrings.GetString(Ressource.SearchClientForm, "result.Text"), _numberOfRecords);
                textBoxCurrentlyPage.Text = MultiLanguageStrings.GetString(Ressource.SearchClientForm, "nbOfPages.Text") + _currentPageNumber + " / " + _numbersTotalPage;
                if (_numberOfRecords != 0)
                {
                    buttonPrintReport.Enabled = true;
                }
                else
                {
                    buttonPrintReport.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
예제 #20
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            _selectedNode = tvEconomicActivity.SelectedNode;
            if (_selectedNode == null)
            {
                MessageBox.Show(GetString("messageBoxNoSelection.Text"), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                var  economicActivityServices = ServicesProvider.GetInstance().GetEconomicActivityServices();
                bool isEditable = economicActivityServices.NodeEditable(_selectedNode.Tag);
                if (!isEditable)
                {
                    return;
                }

                var economicActivity = (EconomicActivity)_selectedNode.Tag;
                var format           = GetString("areYouSureMessage.Text");
                var message          = string.Format(format, economicActivity.Name);
                if (MessageBox.Show(message, message, MessageBoxButtons.YesNo) ==
                    DialogResult.Yes)
                {
                    DeleteEconomicActivity(economicActivity);
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
예제 #21
0
        private void treeViewActivities_DoubleClick(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeViewActivities.SelectedNode;

            try
            {
                if (selectedNode.Nodes.Count == 0)
                {
                    if (ServicesProvider.GetInstance().GetEconomicActivityServices().NodeEditable(selectedNode.Tag))
                    {
                        _domain = (EconomicActivity)selectedNode.Tag;
                        Close();
                    }
                }
                else
                {
                    MessageBox.Show(MultiLanguageStrings.GetString(Ressource.FrmActivity, "selectSubitem.Text"),
                                    "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                _domain = null;
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
예제 #22
0
        private void AddRule()
        {
            FrmAddContractAccountingRule frmAddAccountingRule = new FrmAddContractAccountingRule(_maxOrder);
            
            while (frmAddAccountingRule.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    int id =
                        ServicesProvider.GetInstance().GetAccountingRuleServices().SaveAccountingRule(frmAddAccountingRule.AccountingRule);

                    listViewContractsRules.Items.Add(
                        GetListViewItem(
                            ServicesProvider.GetInstance().GetAccountingRuleServices().Select(id) as
                            ContractAccountingRule));
                    CoreDomainProvider.GetInstance().GetChartOfAccounts().AccountingRuleCollection =
                        ServicesProvider.GetInstance().GetAccountingRuleServices().SelectAll();
                    _maxOrder = frmAddAccountingRule.AccountingRule.Order;
                    break;
                }
                catch (Exception ex)
                {
                    frmAddAccountingRule.Show(this);
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                    frmAddAccountingRule.Hide();
                }
            }
        }
예제 #23
0
        private void btnEditPaymentMethod_Click(object sender, EventArgs e)
        {
            if (lvPaymentMethods.SelectedItems.Count == 0)
            {
                return;
            }
            PaymentMethod paymentMethod = (PaymentMethod)lvPaymentMethods.SelectedItems[0].Tag;

            Debug.Assert(paymentMethod != null, "Payment method not selected!");
            AddPaymentMethodForm frm = new AddPaymentMethodForm(paymentMethod);

            if (DialogResult.OK != frm.ShowDialog())
            {
                return;
            }
            try
            {
                ServicesProvider.GetInstance().GetPaymentMethodServices().Update(frm.PaymentMethod);
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            LoadPaymentMethods();
        }
예제 #24
0
        private void EditRule()
        {

            if (listViewContractsRules.SelectedItems.Count > 0)
            {
                ContractAccountingRule rule = listViewContractsRules.SelectedItems[0].Tag as ContractAccountingRule;
                FrmAddContractAccountingRule frmEditAccountingRule = new FrmAddContractAccountingRule {AccountingRule = rule};
                while (frmEditAccountingRule.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        ServicesProvider.GetInstance().GetAccountingRuleServices().UpdateAccountingRule(
                            frmEditAccountingRule.AccountingRule);
                        var editedRule =
                            ServicesProvider.GetInstance().GetAccountingRuleServices().Select(rule.Id) as
                            ContractAccountingRule;

                        int index = listViewContractsRules.Items.IndexOf(listViewContractsRules.SelectedItems[0]);
                        listViewContractsRules.Items[index] = GetListViewItem(editedRule);
                        CoreDomainProvider.GetInstance().GetChartOfAccounts().AccountingRuleCollection =
                            ServicesProvider.GetInstance().GetAccountingRuleServices().SelectAll();

                        break;
                    }
                    catch (Exception ex)
                    {
                        frmEditAccountingRule.Show(this);
                        new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                        frmEditAccountingRule.Hide();
                    }
                }
            }
        }
 private void buttonDeletePackage_Click(object sender, EventArgs e)
 {
     if (descriptionListView.SelectedItems.Count != 0)
     {
         string msg = GetString("DeleteConfirmation.Text");
         if (DialogResult.Yes == MessageBox.Show(msg, "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation))
         {
             try
             {
                 ServicesProvider.GetInstance().GetSavingProductServices().DeleteSavingProduct(retrieveSelectedPackage().Id);
                 refreshListView();
                 _selectedPackage            = null;
                 buttonDeleteProduct.Enabled = false;
                 buttonEditProduct.Enabled   = false;
             }
             catch (Exception ex)
             {
                 new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
             }
         }
     }
     else
     {
         MessageBox.Show(MultiLanguageStrings.GetString(Ressource.PackagesForm, "messageSelection.Text"),
                         MultiLanguageStrings.GetString(Ressource.PackagesForm, "title.Text"), MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #26
0
        private void SelectAGuarantor()
        {
            using (SearchClientForm searchClientForm = SearchClientForm.GetInstance(OClientTypes.Person, false, _applicationController))
            {
                searchClientForm.ShowDialog();
                _guarantor.Tiers = searchClientForm.Client;

                try
                {
                    if (ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(_guarantor.Tiers))
                    {
                        ServicesProvider.GetInstance().GetClientServices().ClientsNumberGuarantee(_guarantor.Tiers);
                        textBoxName.Text = _guarantor.Tiers.Name;
                    }
                    else
                    {
                        textBoxName.Text = String.Empty;
                    }
                }
                catch (Exception ex)
                {
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                }
            }
        }
예제 #27
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ClientForm frm = new ClientForm(OClientTypes.Person, MdiParent, true);

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            try
            {
                Person person = frm.Person;
                if (ServicesProvider.GetInstance().GetClientServices().ClientIsAPerson(person))
                {
                    var member = new VillageMember {
                        Tiers = person, JoinedDate = TimeProvider.Now, CurrentlyIn = true, IsLeader = false, IsSaved = false
                    };
                    member.ActiveLoans = ServicesProvider.GetInstance().GetContractServices().
                                         FindActiveContracts(member.Tiers.Id);

                    _village.AddMember(member);
                    membersSaved = false;
                    DisplayMembers();
                    DisplayLoans();
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
예제 #28
0
        private void DeleteStandardBooking()
        {
            string message = GetString("ConfirmDelete");
            string caption = GetString("Confirmation");

            if (listBookings.SelectedItems.Count > 0)
            {
                if (MessageBox.Show(message, caption,
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        Booking booking = (Booking)listBookings.SelectedItems[0].Tag;
                        standardBookingServices.DeleteStandardBooking(booking.Id);
                        LoadBookings();
                        message = GetString("Deleted");
                        caption = GetString("Message");
                        MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception e)
                    {
                        new frmShowError(CustomExceptionHandler.ShowExceptionText(e)).ShowDialog();
                    }
                }
            }
        }
예제 #29
0
        private void CheckModification()
        {
            _disableFees = false;

            if (ServicesProvider.GetInstance().GetGeneralSettings().ModifyEntryFee)
            {
                try
                {
                    checkBoxFees.Enabled        = ServicesProvider.GetInstance().GetContractServices().CanUserModifyEntryFees();
                    tbEntryFee.Enabled          = ServicesProvider.GetInstance().GetContractServices().CanUserModifyEntryFees();
                    _lbFees.Enabled             = ServicesProvider.GetInstance().GetContractServices().CanUserModifyEntryFees();
                    lblEntryFeeCurrency.Enabled = ServicesProvider.GetInstance().GetContractServices().CanUserModifyEntryFees();
                    InitializeExternalCurrency();
                }
                catch (Exception ex)
                {
                    checkBoxFees.Enabled        = false;
                    tbEntryFee.Enabled          = false;
                    _lbFees.Enabled             = false;
                    lblEntryFeeCurrency.Enabled = false;
                    SetFeeAmount();
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                }
            }
            else
            {
                tbEntryFee.Enabled          = false;
                _lbFees.Enabled             = false;
                lblEntryFeeCurrency.Enabled = false;
            }
        }
예제 #30
0
 private void Reschedule()
 {
     if (startDateTimePicker.Value < _contract.GetLastRepaymentDate())
     {
         Fail(GetString("RescheduleStartDateIsNotCorrect.Text"));
         return;
     }
     if (!Confirm(GetString("Confirm")))
     {
         return;
     }
     try
     {
         _contract.Rescheduled = true;
         _contract             = ServicesProvider
                                 .GetInstance()
                                 .GetContractServices()
                                 .Reschedule(_contract, _client, GetRescheduleConfiguration());
         _contract.NbOfInstallments = _contract.InstallmentList.Count;
         _contract.InterestRate     = _interestRateTextBox.Amount.HasValue ? _interestRateTextBox.Amount.Value : Contract.InterestRate * 100;
         DialogResult = DialogResult.OK;
         Close();
     }
     catch (Exception ex)
     {
         new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
     }
 }