private static void SaveVillage(FromModel.Client client) { Village _village = new Village(); _village.Name = client.full_name; _village.EstablishmentDate = DateTime.Now; _village.CreationDate = DateTime.Now; _village.District = district; _village.City = city.Name; _village.Address = ""; _village.ZipCode = ""; _village.LoanOfficer = user; _village.MeetingDay = null; _village.Branch = branch; bool save = 0 == _village.Id; _village.Name = _village.Name.Trim(); _village.Id = ServicesProvider .GetInstance() .GetClientServices() .SaveNonSolidarityGroup(_village, (tx, id) => { //foreach (var extension in Extensions) extension.Save(_village, tx); }); ServicesProvider.GetInstance().GetClientServices().SetFavouriteLoanOfficerForVillage(_village); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); es.LogClientSaveUpdateEvent(_village, save); foreach (VillageMember member in _village.Members) { member.IsSaved = true; } }
private static void SaveGroup(FromModel.Client client) { Group group = new Group(); group.Name = client.full_name; group.EstablishmentDate = DateTime.Now; group.CreationDate = DateTime.Now; group.Activity = economicActivity; group.District = district; group.City = city.Name; group.Address = ""; group.HomePhone = ""; group.HomeType = ""; group.PersonalPhone = ""; group.Email = ""; group.ZipCode = ""; group.SecondaryDistrict = district; group.SecondaryCity = city.Name; group.SecondaryAddress = ""; group.SecondaryHomePhone = ""; group.SecondaryHomeType = ""; group.SecondaryPersonalPhone = ""; group.SecondaryEmail = ""; group.SecondaryZipCode = ""; group.MeetingDay = null; group.Branch = branch; group.CreatedBy = user; bool save = 0 == group.Id; if (group.Name != null) { group.Name = group.Name.Trim(); } string result = ServicesProvider .GetInstance() .GetClientServices() .SaveSolidarityGroup(ref group, (tx, id) => { //foreach (var extension in Extensions) extension.Save(group, tx); }); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); es.LogClientSaveUpdateEvent(group, save); migrated.Add(client); }
internal bool Save() { try { UpdateVillageDataFromGui(); InitializeTitle(); bool save = 0 == _village.Id; _village.Name = _village.Name.Trim(); _village.Id = ServicesProvider .GetInstance() .GetClientServices() .SaveNonSolidarityGroup(_village, (tx, id) => { foreach (var extension in Extensions) { extension.Save(_village, tx); } }); ServicesProvider.GetInstance().GetClientServices().SetFavouriteLoanOfficerForVillage(_village); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); es.LogClientSaveUpdateEvent(_village, save); btnSave.Text = MultiLanguageStrings.GetString(Ressource.VillageForm, "Update.Text"); tpMembers.Enabled = true; tabPageLoan.Enabled = true; tabPageSavings.Enabled = true; membersSaved = true; foreach (VillageMember member in _village.Members) { member.IsSaved = true; } } catch (OpenCBS.ExceptionsHandler.Exceptions.CustomFieldsExceptions.CustomFieldsAreNotFilledCorrectlyException) { return(false); } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); return(false); } return(true); }
private static void SaveCorporate(FromModel.Client client) { Corporate _corporate = new Corporate(); _corporate.CreationDate = TimeProvider.Now; _corporate.RegistrationDate = DateTime.Now; _corporate.AgrementSolidarity = false; _corporate.Activity = economicActivity; _corporate.ZipCode = ""; _corporate.HomeType = ""; _corporate.Email = ""; _corporate.District = district; _corporate.City = city.Name; _corporate.Address = ""; _corporate.HomePhone = ""; _corporate.PersonalPhone = ""; _corporate.Name = client.full_name; _corporate.SmallName = client.searchname; _corporate.Branch = branch; _corporate.CreatedBy = user; if (_corporate.Name != null) { _corporate.Name = _corporate.Name.Trim(); } _corporate.SmallName = _corporate.SmallName.Trim(); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); FundingLine _fundingLine = null; _corporate.Id = ServicesProvider .GetInstance() .GetClientServices() .SaveCorporate(_corporate, _fundingLine, tx => { //foreach (var extension in Extensions) extension.Save(_corporate, tx); }); es.LogClientSaveUpdateEvent(_corporate, true); }
internal bool Save() { try { UpdateVillageDataFromGui(); InitializeTitle(); bool save = 0 == _village.Id; _village.Name = _village.Name.Trim(); _customizableFieldsControl.Check(); _village.Id = ServicesProvider .GetInstance() .GetClientServices() .SaveNonSolidarityGroup(_village, (tx, id) => _extensionGroups.ForEach(g => g.Save(_village, tx))); if (_village.Id > 0) { _customizableFieldsControl.Save(_village.Id); } ServicesProvider.GetInstance().GetClientServices().SetFavouriteLoanOfficerForVillage(_village); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); es.LogClientSaveUpdateEvent(_village, save); btnSave.Text = MultiLanguageStrings.GetString(Ressource.VillageForm, "Update.Text"); tpMembers.Enabled = true; tabPageLoan.Enabled = true; tabPageSavings.Enabled = true; membersSaved = true; foreach (VillageMember member in _village.Members) { member.IsSaved = true; } } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); return(false); } return(true); }
private void SavePerson() { _personSaved = false; RecoverDatasFromUserControlsAddress(); _tempPerson.Branch = (Branch)cbBranch.SelectedItem; _tempPerson.CreatedBy = User.CurrentUser; try { bool save = 0 == _tempPerson.Id; if (_tempPerson.FirstName != null) { _tempPerson.FirstName = _tempPerson.FirstName.Trim(); } if (_tempPerson.LastName != null) { _tempPerson.LastName = _tempPerson.LastName.Trim(); } if (_tempPerson.FatherName != null) { _tempPerson.FatherName = _tempPerson.FatherName.Trim(); } if (_tempPerson.IdentificationData != null) { _tempPerson.IdentificationData = _tempPerson.IdentificationData.Trim(); } _tempPerson.Nationality = textBoxNationality.Text; string result = ServicesProvider .GetInstance() .GetClientServices() .SavePerson(ref _tempPerson, (tx, id) => { foreach (var extension in Extensions) { extension.Save(_tempPerson, tx); } }); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); es.LogClientSaveUpdateEvent(_tempPerson, save); if (result != string.Empty) { MessageBox.Show(result, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } _personSaved = true; buttonSave.Text = MultiLanguageStrings.GetString(Ressource.PersonUserControl, "Update"); textBoxFirstName.Text = string.Format(_tempPerson.FirstName); textBoxLastname.Text = string.Format(_tempPerson.LastName); if (_tempPerson.FatherName != null) { textBoxFatherName.Text = string.Format(_tempPerson.FatherName); } textBoxIdentificationData.Text = string.Format(_tempPerson.IdentificationData); ResetImagesFlags(); } catch (OpenCBS.ExceptionsHandler.Exceptions.CustomFieldsExceptions.CustomFieldsAreNotFilledCorrectlyException) { } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } }
private void SavePerson() { _personSaved = false; RecoverDatasFromUserControlsAddress(); RecoverDataFromCombobox(); _tempPerson.FirstContact = dateTimePickerFirstContact.Value; _tempPerson.FirstAppointment = dateTimePickerFirstAppointment.Value; _tempPerson.Branch = (Branch)cbBranch.SelectedItem; try { bool save = 0 == _tempPerson.Id; if (_tempPerson.FirstName != null) { _tempPerson.FirstName = _tempPerson.FirstName.Trim(); } if (_tempPerson.LastName != null) { _tempPerson.LastName = _tempPerson.LastName.Trim(); } if (_tempPerson.FatherName != null) { _tempPerson.FatherName = _tempPerson.FatherName.Trim(); } if (_tempPerson.IdentificationData != null) { _tempPerson.IdentificationData = _tempPerson.IdentificationData.Trim(); } _tempPerson.Nationality = textBoxNationality.Text; string result = ServicesProvider .GetInstance() .GetClientServices() .SavePerson(ref _tempPerson, (tx, id) => { foreach (var extension in Extensions) { extension.Save(_tempPerson, tx); } }); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); es.LogClientSaveUpdateEvent(_tempPerson, save); if (result != string.Empty) { MessageBox.Show(result, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } _personSaved = true; buttonSave.Text = MultiLanguageStrings.GetString(Ressource.PersonUserControl, "Update"); var formatInfo = new NameFormatInfo(); var settings = ServicesProvider.GetInstance().GetGeneralSettings(); //var fnFormat = @"{0:" + settings.FirstNameFormat + @"}"; //var lnFormat = @"{0:" + settings.LastNameFormat + @"}"; textBoxFirstName.Text = string.Format(_tempPerson.FirstName); textBoxLastname.Text = string.Format(_tempPerson.LastName); if (_tempPerson.FatherName != null) { textBoxFatherName.Text = string.Format(_tempPerson.FatherName); } textBoxIdentificationData.Text = string.Format(_tempPerson.IdentificationData); //EnableDocuments(); ResetImagesFlags(); if (ApplicationSettings.GetInstance(User.CurrentUser.Md5).UseMandatorySavingAccount&& Person.Savings.Count == 0) { Person.Savings.Add( ServicesProvider.GetInstance().GetSavingServices().AddAndActivateDefaultSavingAccount(Person)); DisplaySavings(Person.Savings); } } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } }
private void SaveCorporate(object sender, EventArgs e) { try { _corporate.CreationDate = TimeProvider.Now; _corporate.RegistrationDate = dateTimePickerDateOfCreate.Value; _corporate.AgrementSolidarity = false; RecoverDatasFromUserControlsAddress(); _corporate.Name = textBoxLastNameCorporate.Text; _corporate.SmallName = textBoxSmallNameCorporate.Text; _corporate.Branch = (Branch)cbBranch.SelectedItem; _corporate.CreatedBy = User.CurrentUser; if (_corporate.Name != null) { _corporate.Name = _corporate.Name.Trim(); } _corporate.SmallName = _corporate.SmallName.Trim(); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); if (_corporate.Id == 0) { _corporate.Id = ServicesProvider .GetInstance() .GetClientServices() .SaveCorporate(_corporate, _fundingLine, tx => { foreach (var extension in Extensions) { extension.Save(_corporate, tx); } }); buttonSave.Text = MultiLanguageStrings.GetString(Ressource.CorporateUserControl, "buttonUpdate.Text"); es.LogClientSaveUpdateEvent(_corporate, true); } else { ServicesProvider. GetInstance() .GetClientServices() .SaveCorporate(Corporate, null, tx => Extensions.ForEach(c => c.Save(Corporate, tx))); es.LogClientSaveUpdateEvent(_corporate, false); } if (SaveCorporateFundingLine != null) { SaveCorporateFundingLine(this, e); } _saved = true; } catch (OpenCBS.ExceptionsHandler.Exceptions.CustomFieldsExceptions.CustomFieldsAreNotFilledCorrectlyException) { } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } finally { _create = false; if (CloseCorporate != null) { CloseCorporate(this, null); } } if (ButtonSaveClick != null) { ButtonSaveClick(this, e); } }
private void SavePerson() { _personSaved = false; RecoverDatasFromUserControlsAddress(); RecoverDataFromCombobox(); _tempPerson.FirstContact = dateTimePickerFirstContact.Value; _tempPerson.FirstAppointment = dateTimePickerFirstAppointment.Value; _tempPerson.Branch = (Branch)cbBranch.SelectedItem; try { bool save = 0 == _tempPerson.Id; if (_tempPerson.FirstName != null) { _tempPerson.FirstName = _tempPerson.FirstName.Trim(); } if (_tempPerson.LastName != null) { _tempPerson.LastName = _tempPerson.LastName.Trim(); } if (_tempPerson.FatherName != null) { _tempPerson.FatherName = _tempPerson.FatherName.Trim(); } if (_tempPerson.IdentificationData != null) { _tempPerson.IdentificationData = _tempPerson.IdentificationData.Trim(); } if (_advancedFieldsControl != null) { _advancedFieldsControl.Check(); } string result = ServicesProvider .GetInstance() .GetClientServices() .SavePerson(ref _tempPerson, (tx, id) => _extensionPersons.ForEach(p => p.Save(_tempPerson, tx))); if (_tempPerson.Id > 0 && _advancedFieldsControl != null) { _advancedFieldsControl.Save(_tempPerson.Id); } EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); es.LogClientSaveUpdateEvent(_tempPerson, save); if (result != string.Empty) { MessageBox.Show(result, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } _personSaved = true; buttonSave.Text = MultiLanguageStrings.GetString(Ressource.PersonUserControl, "Update"); var formatInfo = new NameFormatInfo(); var settings = ServicesProvider.GetInstance().GetGeneralSettings(); var fnFormat = @"{0:" + settings.FirstNameFormat + @"}"; var lnFormat = @"{0:" + settings.LastNameFormat + @"}"; textBoxFirstName.Text = string.Format(_tempPerson.FirstName); textBoxLastname.Text = string.Format(_tempPerson.LastName); if (_tempPerson.FatherName != null) { textBoxFatherName.Text = string.Format(_tempPerson.FatherName); } textBoxIdentificationData.Text = string.Format(_tempPerson.IdentificationData); //EnableDocuments(); ResetImagesFlags(); } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } }
private static void SavePerson(FromModel.Client client) { Person _tempPerson = new Person(); _tempPerson.FirstName = String.IsNullOrEmpty(client.first_name) ? client.full_name : client.first_name; _tempPerson.LastName = String.IsNullOrEmpty(client.surname) ? client.full_name : client.surname; _tempPerson.FirstName = String.IsNullOrEmpty(_tempPerson.FirstName) ? " " : _tempPerson.FirstName; _tempPerson.LastName = String.IsNullOrEmpty(_tempPerson.LastName) ? " " : _tempPerson.LastName; //_tempPerson.FullName = client.full_name; _tempPerson.DateOfBirth = DateTime.Now.AddDays(-20); _tempPerson.Activity = economicActivity; _tempPerson.Sex = client.gender == 1 ? OGender.Male : OGender.Female; _tempPerson.RelationshipOfficerId = user.Id; _tempPerson.RelationshipOfficer = user; _tempPerson.ImagePath = " "; _tempPerson.Image2Path = " "; _tempPerson.Image3Path = " "; _tempPerson.ParticularsIDNumber = client.cid_no.ToString();// "0000000000"; _tempPerson.ParticularsIssueDate = DateTime.Now; _tempPerson.ParticularsExpiryDate = DateTime.Now.AddDays(2); _tempPerson.ZipCode = ""; _tempPerson.HomeType = ""; _tempPerson.Email = ""; _tempPerson.District = district; _tempPerson.City = city.Name; _tempPerson.Address = ""; _tempPerson.HomePhone = ""; _tempPerson.PersonalPhone = ""; _tempPerson.CreationDate = DateTime.Now; _tempPerson.SMSDelivery = false; _tempPerson.EmailDelivery = true; _tempPerson.SecondaryZipCode = ""; _tempPerson.SecondaryHomeType = ""; _tempPerson.SecondaryEmail = ""; _tempPerson.SecondaryDistrict = district; _tempPerson.SecondaryCity = city.Name; _tempPerson.SecondaryAddress = ""; _tempPerson.SecondaryHomePhone = ""; _tempPerson.SecondaryPersonalPhone = ""; _tempPerson.Branch = branch; _tempPerson.CreatedBy = User.CurrentUser; bool save = 0 == _tempPerson.Id; if (_tempPerson.FirstName != null) { _tempPerson.FirstName = _tempPerson.FirstName.Trim(); } if (_tempPerson.LastName != null) { _tempPerson.LastName = _tempPerson.LastName.Trim(); } if (_tempPerson.FatherName != null) { _tempPerson.FatherName = _tempPerson.FatherName.Trim(); } if (_tempPerson.IdentificationData != null) { _tempPerson.IdentificationData = _tempPerson.IdentificationData.Trim(); } _tempPerson.Nationality = province.Name; _tempPerson.IsNew = false; _tempPerson.IsUpdated = true; string result = ServicesProvider .GetInstance() .GetClientServices() .SavePerson(ref _tempPerson, (tx, id) => { //foreach (var extension in Extensions) extension.Save(_tempPerson, tx); }); EventProcessorServices es = ServicesProvider.GetInstance().GetEventProcessorServices(); es.LogClientSaveUpdateEvent(_tempPerson, save); if (result != string.Empty) { Console.WriteLine(result); } }