public CorporateUserControl(Corporate corporate, Form pMdiParent, IApplicationController applicationController)
 {
     _applicationController = applicationController;
     _mdifrom = pMdiParent;
        _corporate = corporate;
     _fundingLine = null;
     InitializeComponent();
     InitializeUserControlsAddress();
     InitializeCorporate();
     PicturesServices ps = ServicesProvider.GetInstance().GetPicturesServices();
     if (ps.IsEnabled())
     {
         pictureBox1.Image = ps.GetPicture("CORPORATE", corporate.Id, true, 0);
         pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
         pictureBox2.Image = ps.GetPicture("CORPORATE", corporate.Id, true, 1);
         pictureBox2.SizeMode = PictureBoxSizeMode.Zoom;
     }
     else
     {
         pictureBox1.Visible = false;
         pictureBox2.Visible = false;
         linkLabelChangePhoto.Visible = false;
         linkLabelChangePhoto2.Visible = false;
     }
 }
 public CorporateUserControl(FundingLine pFundingLine)
 {
     _fundingLine = pFundingLine;
     InitializeComponent();
     InitializeUserControlsAddress();
     _corporate = new Corporate();
 }
 public CorporateUserControl(Corporate corporate, Form pMdiParent, IExtensionActivator extensionActivator)
     : base(extensionActivator)
 {
     _mdifrom = pMdiParent;
        _corporate = corporate;
     _fundingLine = null;
     InitializeComponent();
     InitializeUserControlsAddress();
     InitializeCorporate();
     PicturesServices ps = ServicesProvider.GetInstance().GetPicturesServices();
     if (ps.IsEnabled())
     {
         pictureBox1.Image = ps.GetPicture("CORPORATE", corporate.Id, true, 0);
         pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
         pictureBox2.Image = ps.GetPicture("CORPORATE", corporate.Id, true, 1);
         pictureBox2.SizeMode = PictureBoxSizeMode.Zoom;
     }
     else
     {
         pictureBox1.Visible = false;
         pictureBox2.Visible = false;
         linkLabelChangePhoto.Visible = false;
         linkLabelChangePhoto2.Visible = false;
     }
     InitializeCustomizableFields(_corporate.Id);
 }
Exemple #4
0
        public int AddBodyCorporate(Corporate body, FundingLine pFundingLine, SqlTransaction sqlTransac)
        {
            body.Id = AddTiers(body, sqlTransac);

            const string q = @"INSERT INTO [Corporates] ([id],[name],[deleted],[sigle],[small_name],[volunteer_count],
            [agrement_date],[agrement_solidarity],[insertionType],[employee_count],[siret],[activity_id],[legalForm],[fiscal_status],[registre],[date_create])
            VALUES(@id,@name,@deleted,@sigle,@small_name,@volunteer_count,@agrement_date,@agrement_solidarity,
            @insertionType,@employee_count,@siret,@activity_id,@legalForm,@fiscalStatus,@registre, @date_create)";

            using (OpenCbsCommand c = new OpenCbsCommand(q, sqlTransac.Connection, sqlTransac))
            {
                c.AddParam("@id", body.Id);
                c.AddParam("@name", body.Name);
                c.AddParam("@deleted", body.IsDeleted);
                c.AddParam("@sigle", body.Sigle);
                c.AddParam("@small_name", body.SmallName);
                c.AddParam("@volunteer_count", body.VolunteerCount);

                c.AddParam("@agrement_solidarity", body.AgrementSolidarity);
                c.AddParam("@employee_count", body.EmployeeCount);
                c.AddParam("@siret", body.Siret);
                c.AddParam("@fiscalStatus", body.FiscalStatus);
                c.AddParam("@registre", body.Registre);

                c.AddParam("@insertionType", body.InsertionType);
                c.AddParam("@legalForm", body.LegalForm);

                if (body.Activity != null)
                    c.AddParam("@activity_id", body.Activity.Id);
                else
                    c.AddParam("@activity_id", null);

                c.AddParam("@agrement_date"
                    , body.AgrementDate != DateTime.MinValue ? body.AgrementDate : null
                    );

                c.AddParam("@date_create"
                    , body.CreationDate != DateTime.MinValue ? (object)body.RegistrationDate : null
                    );

                c.ExecuteScalar();
            }
            return body.Id;
        }
 public CorporateUserControl(Form pMdiParent)
 {
     _mdifrom = pMdiParent;
     InitializeComponent();
     _corporate = new Corporate();
     _fundingLine = null;
     InitializeUserControlsAddress();
 }
 public void Save(Corporate corporate, SqlTransaction tx)
 {
 }
Exemple #7
0
        private void OnClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult.OK == DialogResult) return;
            _person = null;
            _corporate = null;
            _client = null;

            if (_group != null)
                _group.Dispose();

            //if (_project != null)
            //    _project.Dispose();

            //_credit.Dispose();
            //DialogResult = DialogResult.Cancel;
        }
Exemple #8
0
        public void DisplayClient(IClient pClient, Project project)
        {
            if (pClient is Person)
            {
                _person = (Person)pClient;
                _oClientType = OClientTypes.Person;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(string.Format("{0} {1}", _person.FirstName, _person.LastName));
            }
            if (pClient is Group)
            {
                _group = (Group)pClient;
                _oClientType = OClientTypes.Group;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(_group.Name);
            }
            if (pClient is Corporate)
            {
                _corporate = (Corporate)pClient;
                _oClientType = OClientTypes.Corporate;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(_corporate.Name);
            }

            tabControlPerson.TabPages.Add(tabPageProject);
            DisplaySelectedProject(_project);
        }
 /// <summary>
 /// The method sets favourite loan officer to a corporate (individual client)
 /// </summary>
 /// <param name="corporate">an instance of type Corporate</param>
 ///  <param name="loanOfficerId">loan officer id</param>
 public void SetFavouriteLoanOfficerForCorporate(Corporate corporate, int loanOfficerId)
 {
     _clientManagement.SetFavourLoanOfficerForCorporate(corporate.Id, loanOfficerId);
 }
Exemple #10
0
 public ShowPictureForm(Corporate corporate, CorporateUserControl corporateUserControl, int photoSubId)
 {
     InitializeComponent();
     CaptionText = MultiLanguageStrings.GetString(Ressource.ClientForm, "Corporate.Text") + ": " + corporate.Name;
     this.corporateUserControl = corporateUserControl;
     this.corporate = corporate;
     this.photoSubId = photoSubId;
     addPhotoButton.Text = MultiLanguageStrings.GetString(Ressource.ShowPictureForm, "captionAdd.Text");
     changePhotoButton.Text = MultiLanguageStrings.GetString(Ressource.ShowPictureForm, "captionChange.Text");
     ShowPicture();
     InitializeButtons();
 }
        public bool ClientCanBeAddToCorporate(IClient client, Corporate corporate)
        {
            Person person = (Person)client;

            if (corporate.Contacts.Any(selectedPerson => selectedPerson.Tiers.Id == person.Id))
            {
                throw new OpenCbsTiersSaveException(OpenCbsTiersSaveExceptionEnum.PersonAlreadyInThisGroup);
            }

            if (person.Active && !ApplicationSettings.GetInstance(_user != null ? _user.Md5 : "").IsAllowMultipleGroups)
                throw new OpenCbsTiersSaveException(OpenCbsTiersSaveExceptionEnum.PersonIsActive);

            return true;
        }
 public int SaveCorporate(Corporate client, FundingLine fundingLine, Action<SqlTransaction> action)
 {
     if (client.Id == 0)
         client.Id = AddBodyCorporate(client, fundingLine, action);
     else
         UpdateBodyCorporate(client, action);
     return client.Id;
 }
        public int AddBodyCorporate(Corporate body, FundingLine pFundingLine, Action<SqlTransaction> action)
        {
            using (SqlConnection connection = _clientManagement.GetConnection())
            using (SqlTransaction sqlTransac = connection.BeginTransaction())
            {
                try
                {
                    body.Type = OClientTypes.Corporate;
                    body.LoanCycle = 0;
                    body.Active = false;
                    body.BadClient = false;
                    ValidateCorporate(body);
                    body.Id = _clientManagement.AddBodyCorporate(body, pFundingLine, sqlTransac);
                    if (action != null) action(sqlTransac);
                    sqlTransac.Commit();
                    SavePicture(body);
                    SaveCorporatePerson(body.Id, body.Contacts);

                    return body.Id;
                }
                catch (Exception up)
                {
                    sqlTransac.Rollback();
                    throw up;
                }
            }
        }
 private void ValidateCorporate(Corporate body)
 {
     if (body.Activity == null)
         throw new OpenCbsTiersSaveException(OpenCbsTiersSaveExceptionEnum.EconomicActivityIsNull);
     if (string.IsNullOrEmpty(body.Name))
         throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.NameIsEmpty);
     if (string.IsNullOrEmpty(body.City))
         throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.CityIsEmpty);
     if (body.District == null)
         throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.DistrictIsEmpty);
     if (null == body.Branch)
         throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.BranchIsEmpty);
 }
        private void SavePicture(Corporate corporate)
        {
            if (corporate.IsImageUpdated)
                _picturesServices.UpdatePicture("CORPORATE", corporate.Id, 0, corporate.ImagePath);
            if (corporate.IsImageDeleted)
                _picturesServices.DeletePicture("CORPORATE", corporate.Id, 0);
            if (!string.IsNullOrEmpty(corporate.ImagePath) && corporate.IsImageAdded)
                _picturesServices.AddPicture("CORPORATE", corporate.Id, 0, corporate.ImagePath);

            if (corporate.IsImage2Updated)
                _picturesServices.UpdatePicture("CORPORATE", corporate.Id, 1, corporate.Image2Path);
            if (corporate.IsImage2Deleted)
                _picturesServices.DeletePicture("CORPORATE", corporate.Id, 1);
            if (!string.IsNullOrEmpty(corporate.Image2Path) && corporate.IsImage2Added)
                _picturesServices.AddPicture("CORPORATE", corporate.Id, 1, corporate.Image2Path);
        }
Exemple #16
0
        public Corporate SelectBodyCorporateById(int id)
        {
            int? activityId = null;
            int? districtId = null;
            int? secondaryDistrictId = null;

            Corporate body = null;
            const string q = @" SELECT * FROM Tiers
            INNER JOIN Corporates ON Tiers.id = Corporates.id
            WHERE [deleted] = 0 AND Tiers.id=@id";

            using (SqlConnection conn = GetConnection())
            using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
            {
                c.AddParam("@id", id);

                using (OpenCbsReader r = c.ExecuteReader())
                {
                    if (r != null && !r.Empty)
                    {
                        r.Read();
                        body = new Corporate
                                   {
                                       Id = r.GetInt("id"),
                                       Name = r.GetString("name"),
                                       Status = (OClientStatus)r.GetSmallInt("status"),
                                       IsDeleted = r.GetBool("deleted"),
                                       CashReceiptIn = r.GetNullInt("cash_input_voucher_number"),
                                       CashReceiptOut =
                                           r.GetNullInt("cash_output_voucher_number"),
                                       Type = r.GetChar("client_type_code") == 'I'
                                                  ? OClientTypes.Person
                                                  : r.GetChar("client_type_code") == 'G'
                                                        ? OClientTypes.Group
                                                        : OClientTypes.Corporate,
                                       Scoring = r.GetNullDouble("scoring"),
                                       LoanCycle = r.GetInt("loan_cycle"),
                                       Active = r.GetBool("active"),
                                       BadClient = r.GetBool("bad_client"),
                                       OtherOrgName = r.GetString("other_org_name"),
                                       OtherOrgAmount = r.GetMoney("other_org_amount"),
                                       OtherOrgDebts = r.GetMoney("other_org_debts"),
                                       City = r.GetString("city"),
                                       Address = r.GetString("address"),
                                       SecondaryCity = r.GetString("secondary_city"),
                                       SecondaryAddress = r.GetString("secondary_address"),
                                       HomePhone = r.GetString("home_phone"),
                                       PersonalPhone = r.GetString("personal_phone"),
                                       SecondaryHomePhone = r.GetString("secondary_home_phone"),
                                       SecondaryPersonalPhone = r.GetString("secondary_personal_phone"),
                                       VolunteerCount = r.GetNullInt("volunteer_count"),
                                       EmployeeCount = r.GetNullInt("employee_count"),
                                       Sigle = r.GetString("sigle"),
                                       Siret = r.GetString("siret"),
                                       SmallName = r.GetString("small_name"),
                                       CreationDate = r.GetDateTime("creation_date"),
                                       AgrementDate = r.GetNullDateTime("agrement_date"),
                                       FollowUpComment = r.GetString("follow_up_comment"),
                                       HomeType = r.GetString("home_type"),
                                       SecondaryHomeType = r.GetString("secondary_hometype"),
                                       ZipCode = r.GetString("zipCode"),
                                       SecondaryZipCode = r.GetString("secondary_zipCode"),
                                       Sponsor1 = r.GetString("sponsor1"),
                                       Sponsor2 = r.GetString("sponsor2"),
                                       Sponsor1Comment = r.GetString("sponsor1_Comment"),
                                       Sponsor2Comment = r.GetString("sponsor2_comment"),
                                       FiscalStatus = r.GetString("fiscal_status"),
                                       Registre = r.GetString("registre"),
                                       LegalForm = r.GetString("legalForm"),
                                       InsertionType = r.GetString("insertionType"),
                                       Email = r.GetString("e_mail"),
                                       FavouriteLoanOfficerId = r.GetNullInt("loan_officer_id"),
                                       Branch = new Branch { Id = r.GetInt("branch_id") },
                                       RegistrationDate = r.GetNullDateTime("date_create") ?? TimeProvider.Today
                                   };

                        districtId = r.GetNullInt("district_id");
                        secondaryDistrictId = r.GetNullInt("secondary_district_id");
                        activityId = r.GetNullInt("activity_id");
                    }
                }
            }
            if (body != null)
            {
                if (body.FavouriteLoanOfficerId != null)
                {
                    UserManager userManager = new UserManager(User.CurrentUser);
                    body.FavouriteLoanOfficer = userManager.SelectUser((int)body.FavouriteLoanOfficerId, true);
                }
            }

            if (districtId.HasValue) body.District = _locations.SelectDistrictById(districtId.Value);

            if (secondaryDistrictId.HasValue) body.SecondaryDistrict = _locations.SelectDistrictById(secondaryDistrictId.Value);

            if (activityId.HasValue) body.Activity = _doam.SelectEconomicActivity(activityId.Value);

            if (body != null)
            {
                if (_projectManager != null)
                    body.AddProjects(_projectManager.SelectProjectsByClientId(body.Id));
                if (_savingManager != null)
                    body.AddSavings(_savingManager.SelectSavings(body.Id));
            }

            // Selecting Corporate contacts - Not very logical, but asked by Julien M.
            const string sqlContactText = @"
                                 SELECT Persons.id,
                                        Persons.first_name,
                                        Persons.last_name,
                                        Tiers.home_phone,
                                        Tiers.personal_phone,
                                        CorporatePersonBelonging.position
                                 FROM Tiers
                                 INNER JOIN CorporatePersonBelonging ON Tiers.id = CorporatePersonBelonging.person_id
                                 INNER JOIN Persons ON Tiers.id = Persons.id
                                 WHERE CorporatePersonBelonging.corporate_id = @id";

            Person person = null;
            Contact contact = null;
            List<Contact> contacts = new List<Contact>();

            using (SqlConnection conn = GetConnection())
            using (OpenCbsCommand c = new OpenCbsCommand(sqlContactText, conn))
            {
                c.AddParam("@id", id);

                using (OpenCbsReader r = c.ExecuteReader())
                {
                    if (r != null && !r.Empty)
                    {
                        while (r.Read())
                        {
                            person = new Person()
                                         {
                                             Id = r.GetInt("id"),
                                             FirstName = r.GetString("first_name"),
                                             LastName = r.GetString("last_name"),
                                             PersonalPhone = r.GetString("personal_phone"),
                                             HomePhone = r.GetString("home_phone")
                                         };

                            contact = new Contact()
                                          {
                                              Tiers = person,
                                              Position = r.GetString("position")
                                          };
                            contacts.Add(contact);
                        }
                    }
                }
            }

            body.Contacts = contacts;

            OnClientSelected(body);

            return body;
        }
        public void TestSelectAllAlertsWhenClientIsACorporate()
        {
            ApplicationSettings dataParam = ApplicationSettings.GetInstance("");
            dataParam.DeleteAllParameters();
            dataParam.AddParameter(OGeneralSettings.LOANOFFICERPORTFOLIOFILTER, false);
            dataParam.AddParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, true);

            User _user = new User();
            _user.Id = this.addDataForTesting.AddUserWithMaximumAttributs();
            credit.LoanOfficer = _user;

            Corporate myCorporate = new Corporate();
            myCorporate.Id = 42;
            credit.ClientType = OClientTypes.Corporate;
            FundingLine fund = new FundingLine
                                            {
                                                Purpose = "Funding",
                                                Name = "NJO42",
                                                Deleted = false,
                                                StartDate = DateTime.Now,
                                                EndDate = DateTime.Now,
                                                Currency = new Currency { Id = 1 }
                                            };
            fundingLineManager.AddFundingLine(fund, null);
            credit.FundingLine = fund;

            credit.Id = creditManagement.AddCredit(credit, _project.Id, null);
            Loan corporateCredit = creditManagement.SelectCreditById(credit.Id);

            AlertStock alertStock = creditManagement.SelectAllAlerts("");
            Assert.AreEqual(1, alertStock.GetNumberOfAlerts);
            Assert.AreEqual(credit.Id, alertStock.GetAlert(credit.Id).ContractId);
        }
Exemple #18
0
        public void UpdateBodyCorporate(Corporate body, SqlTransaction sqlTransac)
        {
            UpdateTiers(body, sqlTransac);

            const string q = @"UPDATE [Corporates] SET [name]=@name,[deleted]=@deleted,[sigle]=@sigle,[small_name]=@small_name,
                [volunteer_count]=@volunteer_count,[agrement_solidarity]=@agrement_solidarity,[employee_count]=@employee_count,
                [siret]=@siret,[insertionType]=@insertionType,[activity_id]=@activity_id,[fiscal_status]=@fiscalStatus,[registre]=@registre,
                [legalForm]=@legalForm,[agrement_date]=@agrement_date,[date_create]=@date_create WHERE [id] = @id";

            using (OpenCbsCommand c = new OpenCbsCommand(q, sqlTransac.Connection, sqlTransac))
            {
                c.AddParam("@id", body.Id);
                c.AddParam("@name", body.Name);
                c.AddParam("@deleted", body.IsDeleted);

                c.AddParam("@fiscalStatus", body.FiscalStatus);
                c.AddParam("@registre", body.Registre);

                c.AddParam("@sigle", body.Sigle);
                c.AddParam("@small_name", body.SmallName);
                c.AddParam("@volunteer_count", body.VolunteerCount);

                c.AddParam("@agrement_solidarity", body.AgrementSolidarity);
                c.AddParam("@employee_count", body.EmployeeCount);
                c.AddParam("@siret", body.Siret);
                c.AddParam("@legalForm", body.LegalForm);
                c.AddParam("@insertionType", body.InsertionType);

                if (body.Activity != null)
                    c.AddParam("@activity_id", body.Activity.Id);
                else
                    c.AddParam("@activity_id", null);

                c.AddParam("@agrement_date", body.AgrementDate != DateTime.MinValue ? body.AgrementDate : null);
                c.AddParam("@date_create"
                           , body.CreationDate != DateTime.MinValue ? (object)body.RegistrationDate : null
                    );

                c.ExecuteNonQuery();
            }
        }
Exemple #19
0
        public ClientForm(Corporate pCorporate, Form pMdiParent)
            : this()
        {
            _mdiParent = pMdiParent;
            _corporate = pCorporate;
            _client = pCorporate;
            InitLoanOfficers(_client);
            _listGuarantors = new List<Guarantor>();

            _collaterals = new List<ContractCollateral>();
            _loanShares = new List<LoanShare>();
            InitializeComponent();
            InitControls();
            _oClientType = OClientTypes.Corporate;
            InitializeUserControl(OClientTypes.Corporate, pMdiParent);
            InitializeTitle(_corporate.Name);
        }
        public void UpdateBodyCorporate(Corporate body, Action<SqlTransaction> action)
        {
            IClient oldCorporate = _clientManagement.SelectClientById(body.Id);
            using (SqlConnection connection = _clientManagement.GetConnection())
            using (SqlTransaction sqlTransac = connection.BeginTransaction())
            {
                try
                {
                    if (body.Activity == null)
                        throw new OpenCbsTiersSaveException(OpenCbsTiersSaveExceptionEnum.EconomicActivityIsNull);
                    if (string.IsNullOrEmpty(body.Name))
                        throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.NameIsEmpty);
                    if (string.IsNullOrEmpty(body.City))
                        throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.CityIsEmpty);
                    if (body.District.Name == string.Empty || body.District == null)
                        throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.DistrictIsEmpty);
                    if (body.VolunteerCount == (int)EnumIHM.ErrorSaisieVolunteer)
                        throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.VolunteerIsFalseFormat);
                    if (body.EmployeeCount == (int)EnumIHM.ErrorSaisieEmployeeCount)
                        throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.EmployeeIsFalseFormat);

                    if (null == body.Branch)
                        throw new OpenCbsCorporateException(OpenCbsCorporateExceptionEnum.BranchIsEmpty);

                    _clientManagement.UpdateBodyCorporate(body, sqlTransac);
                    UpdateClientBranchHistory(body, oldCorporate, sqlTransac);
                    if (action != null) action(sqlTransac);
                    sqlTransac.Commit();

                    SaveCorporatePerson(body.Id, body.Contacts);
                    SavePicture(body);
                }
                catch (Exception ex)
                {
                    sqlTransac.Rollback();
                    throw ex;
                }
            }
        }
Exemple #21
0
 private void checkCorporateFilling(Corporate client)
 {
     checkStandardFormats(client);
 }
Exemple #22
0
        public ClientForm(OClientTypes pClientType, Form pMdiParent, bool pCloseFormAfterSave)
            : this()
        {
            _listGuarantors = new List<Guarantor>();
            _collaterals = new List<ContractCollateral>();
            _loanShares = new List<LoanShare>();
            _closeFormAfterSave = pCloseFormAfterSave;
            _mdiParent = pMdiParent;
            InitializeComponent();
            InitControls();
            _oClientType = pClientType;

            if (pClientType == OClientTypes.Person) _person = new Person();
            else if (pClientType == OClientTypes.Group) _group = new Group();
            else _corporate = new Corporate();
            InitializeUserControl(pClientType, pMdiParent);
            InitializeTitle(null);
        }
Exemple #23
0
        private void OnClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult.OK == DialogResult) return;
            _person = null;
            _corporate = null;
            _client = null;

            if (_group != null)
                _group.Dispose();
        }
Exemple #24
0
 private void CorporateUserControl_ButtonSaveClick(object sender, EventArgs e)
 {
     if (_corporateUserControl.CorporateSaved)
     {
         _corporate = _corporateUserControl.Corporate;
         _client = _corporate;
         ((LotrasmicMainWindowForm)_mdiParent).SetInfoMessage(string.Format("Corporate {0} saved", _corporate.Name));
         InitializeTitle(_corporate.Name);
         if (!tabControlPerson.TabPages.Contains(tabPageContracts))
         {
             tabControlPerson.TabPages.Add(tabPageContracts);
             panelLoansContracts.Controls.Add(pnlLoans);
         }
     }
 }
 public CorporateUserControl(Project pProject)
 {
     InitializeComponent();
     InitializeUserControlsAddress();
     _corporate = new Corporate();
 }
Exemple #26
0
        private void InitializeClient(IClient pClient, int pContractId)
        {
            if (pClient is Person)
            {
                _person = (Person)pClient;
                _client = _person;
                _oClientType = OClientTypes.Person;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(string.Format("{0} {1}", _person.FirstName, _person.LastName));
            }
            if (pClient is Group)
            {
                _group = (Group)pClient;
                _client = _group;
                _oClientType = OClientTypes.Group;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(_group.Name);
            }
            if (pClient is Corporate)
            {
                _corporate = (Corporate)pClient;
                _client = _corporate;
                _oClientType = OClientTypes.Corporate;
                InitializeUserControl(_oClientType, _mdiParent);
                InitializeTitle(_corporate.Name);
            }

            _project = pClient.SelectProject(pContractId);
            _credit = _project.SelectCredit(pContractId);
            _credit.LoanEntryFeesList = ServicesProvider.GetInstance().GetContractServices().GetInstalledLoanEntryFees(_credit);
            _product = _credit.Product;

            if (_product.CycleId != null && _credit.Disbursed == false)
            {
                ServicesProvider.GetInstance().GetProductServices().SetCyclesParamsForContract(_product, _credit, _client, false);
            }
            else
            {
                if (_credit.Product.Amount.HasValue == false)
                {
                    _amountValueRange = new DecimalValueRange(_credit.Product.AmountMin.Value, _credit.Product.AmountMax.Value);
                    nudLoanAmount.Minimum = _credit.Product.AmountMin.Value;
                    nudLoanAmount.Maximum = _credit.Product.AmountMax.Value;
                }
                else
                {
                    nudLoanAmount.Minimum = nudLoanAmount.Maximum = _credit.Product.Amount.Value;
                }
                if (_credit.Product.NbOfInstallments.HasValue == false)
                {
                    nudLoanNbOfInstallments.Minimum = _credit.Product.NbOfInstallmentsMin.Value;
                    nudLoanNbOfInstallments.Maximum = _credit.Product.NbOfInstallmentsMax.Value;
                }
                else
                {
                    nudLoanNbOfInstallments.Minimum = nudLoanNbOfInstallments.Maximum = _credit.Product.NbOfInstallments.Value;
                }
            }

            if (ServicesProvider.GetInstance().GetGeneralSettings().UseProjects)
            {
                tabControlPerson.TabPages.Add(tabPageProject);
                DisplaySelectedProject(_project);
            }
            else
            {
                AddProject(_project);
            }

            tabControlPerson.TabPages.Add(tabPageLoansDetails);
            tabControlPerson.TabPages.Add(tabPageAdvancedSettings);
            tabControlPerson.TabPages.Add(tabPageLoanGuarantees);

            _credit.LoanInitialOfficer = _credit.LoanOfficer;

            InitializeTabPageLoansDetails(_credit);

            tabControlPerson.TabPages.Add(tabPageCreditCommitee);
            if (_credit.Disbursed)
            {
                tabControlPerson.TabPages.Add(tabPageLoanRepayment);
                //tabControlPerson.TabPages.Add(tabPageLAC);
                tabControlPerson.SelectedTab = tabPageLoanRepayment;
                InitializeTabPageLoanRepayment(_credit);
            }
            else if (_credit.ContractStatus == OContractStatus.Validated && !_credit.Disbursed)
            {
                tabControlPerson.SelectedTab = tabPageLoansDetails;
            }
        }
 public CorporateUserControl(Corporate pCorporate, FundingLine pFundingLine)
 {
     InitializeComponent();
     _corporate = pCorporate;
     _fundingLine = pFundingLine;
     InitializeUserControlsAddress();
     InitializeCorporate();
     InitializeCustomizableFields(_corporate.Id);
 }
        public void InitializeCorporateForm(Corporate corporate, Project project)
        {
            ClientForm corporateForm = new ClientForm(corporate, this) { MdiParent = this };
            if (project != null)
                corporateForm.DisplayUserControl_ViewProject(project, null);

            corporateForm.Show();
        }
 public TabPage[] GetTabPages(Corporate corporate)
 {
     var page = new TabPage("TEST CORPORATE");
     return new[] { page };
 }