//User pressed delete public void Delete() { var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var bankbranchtoremove = (FIN_BankAccount)CollectionViewSource.GetDefaultView(BankAccounts).CurrentItem; if (client.BankAccountExists(bankbranchtoremove)) { var ans = MessageBox.Show("Are you sure you want to delete this record?", "Message", MessageBoxButton.YesNo, MessageBoxImage.Question); if (ans == MessageBoxResult.Yes) { BankAccounts.Remove(bankbranchtoremove); ApiAck ack = client.DeleteBankAccount(bankbranchtoremove); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Deleted Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } else { MessageBox.Show("No such record found to delete", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
//Normal Search method has been made resuable public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); DocumentAttributesRefQuery query = new DocumentAttributesRefQuery(); if (SearchControl.OptionOne.IsChecked == true) { query = new DocumentAttributesRefQuery() { DocCode = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionTwo.IsChecked == true) { query = new DocumentAttributesRefQuery() { TxCode = SearchControl.SearchTextBox.Text }; } SearchControl.Search = Search; int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryDocumentAttributesRefAsync(query, pagesize, pagePosition); if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; var servicelist = response.Result.ToList <ERP_DocumentAttributesRef>(); var DocumentAttributes = new ObservableCollection <ERP_DocumentAttributesRef>(servicelist); SearchControl.ResultsGrid.ItemsSource = DocumentAttributes; }
//User pressed delete public void Delete() { var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var BenefitToRemove = (HR_CASH_BENEFIT)CollectionViewSource.GetDefaultView(LastBenefitInformation).CurrentItem; if (client.HRCashBenefitExists(BenefitToRemove)) { var ans = MessageBox.Show("Are you sure you want to delete this record?", "Message", MessageBoxButton.YesNo, MessageBoxImage.Question); if (ans == MessageBoxResult.Yes) { LastBenefitInformation.Remove(BenefitToRemove); ApiAck ack = client.DeleteHRCashBenefit(BenefitToRemove); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Deleted Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } else { MessageBox.Show("No such record found to delete", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); ProcessControlQuery query = new ProcessControlQuery(); //by default we have an empty query if (SearchControl.OptionOne.IsChecked == true) { query = new ProcessControlQuery() { ProductCode = SearchControl.SearchTextBox.Text }; } int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryProcessControlAsync(query, pagesize, pagePosition); //No response; exit if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; //Fill the datagrid with the results SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <ERP_ProcessControl>(response.Result.ToList <ERP_ProcessControl>());; }
public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); WarningQuery query = new WarningQuery(); //by default we have an empty query if (SearchControl.OptionOne.IsChecked == true) { query = new WarningQuery() { EmployeeNumber = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionTwo.IsChecked == true) { query = new WarningQuery() { WarningID = Int32.Parse(SearchControl.SearchTextBox.Text) }; } int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryWarningAsync(query, pagesize, pagePosition); //No response; exit if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; //Fill the datagrid with the results SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <HR_EMP_WARNINGS>(response.Result.ToList <HR_EMP_WARNINGS>());; }
//User pressed delete public void Delete() { var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var RemoveProcessControlInformation = (ERP_ProcessControl)CollectionViewSource.GetDefaultView(Production.ProcessControlGrid.DataContext).CurrentItem; if (client.ExistProcessControl(RemoveProcessControlInformation)) { var ans = MessageBox.Show("Are you sure you want to delete this record?", "Message", MessageBoxButton.YesNo, MessageBoxImage.Question); if (ans == MessageBoxResult.Yes) { ProcessControlInformation.Remove(RemoveProcessControlInformation); ApiAck ack = client.DeleteProcessControl(RemoveProcessControlInformation); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Deleted Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } else { MessageBox.Show("No such record found to delete", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public void Save() { //Get an instance of the service using Helper class var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var SaveProcessControlInformation = (ERP_ProcessControl)CollectionViewSource.GetDefaultView(Production.ProcessControlGrid.DataContext).CurrentItem; //Checking if all controls are in valid state if (!Helper.IsValid(Production.ProcessControlGrid)) { MessageBox.Show("Please fix errors before continuing", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } //A user is trying to add a record here if (Production.BtnAdd.IsChecked == true) { if (!client.ExistProcessControl(SaveProcessControlInformation)) { ApiAck ack = client.CreateProcessControl(SaveProcessControlInformation); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Added Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); //Complete the Add operation. i.e.; Re-enable tabs,textboxes and datagrid CompleteAdd(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { MessageBox.Show("Record Already Exists", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } //Else the user is trying to update a record else { ApiAck ack = client.UpdateProcessControl(SaveProcessControlInformation); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Updated Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); CompleteUpdate(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } catch (NullReferenceException) { MessageBox.Show("Nothing to Update", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); CurrencyQuery query = new CurrencyQuery(); if (SearchControl.OptionOne.IsChecked == true) { query = new CurrencyQuery() { CurrencyCode = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionTwo.IsChecked == true) { query = new CurrencyQuery() { CurrencyName = SearchControl.SearchTextBox.Text }; } SearchControl.Search = Search; int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryCurrencyAsync(query, pagesize, pagePosition); if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; //Fill the datagrid with the results SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <FIN_Currency>(response.Result.ToList <FIN_Currency>());; }
public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); HRCashBenefitQuery query = new HRCashBenefitQuery(); //by default we have an empty query if (SearchControl.OptionOne.IsChecked == true) { query = new HRCashBenefitQuery() { BenefitCode = SearchControl.SearchTextBox.Text } } ; //The search control needs to know the method it has to use inorder to search. So we pass a method SearchControl.Search = Search; int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryHRCashBenefitsAsync(query, pagesize, pagePosition); //No response; exit if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; //Fill the datagrid with the results SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <HR_CASH_BENEFIT>(response.Result.ToList <HR_CASH_BENEFIT>()); }
//User pressed delete public void Delete() { var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var eexptoremove = (HR_EMP_WORK_EXPERIENCE)CollectionViewSource.GetDefaultView(HRWorkExperiences).CurrentItem; if (client.EMPWORKExists(eexptoremove)) { var ans = MessageBox.Show("Are you sure you want to delete this record?", "Message", MessageBoxButton.YesNo, MessageBoxImage.Question); if (ans == MessageBoxResult.Yes) { HRWorkExperiences.Remove(eexptoremove); ApiAck ack = client.DeleteEMPWORK(eexptoremove); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Deleted Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } else { MessageBox.Show("No such record found to delete", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); var query = new BankAccountQuery(); //by default we have an empty query if (SearchControl.OptionOne.IsChecked == true) { query = new BankAccountQuery() { BankCode = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionTwo.IsChecked == true) { query = new BankAccountQuery() { BankBranchCode = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionThree.IsChecked == true) { int _AccountSEQNo; if (int.TryParse(SearchControl.SearchTextBox.Text, out _AccountSEQNo)) { query = new BankAccountQuery() { AccountSEQNo = _AccountSEQNo }; } else { SearchControl.ResultCount = 0; SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <FIN_TxnReference>(); MessageBox.Show("AccountSEQNo has to be a number "); return; } } int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryBankAccountAsync(query, pagesize, pagePosition); //No response; exit if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; //Fill the datagrid with the results SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <FIN_BankAccount>(response.Result.ToList <FIN_BankAccount>());; }
private void RefreshReports() { var service = Helper.getServiceClient(); var list = service.GetReportNames(); listbox.Items.Clear(); SearchBox.Clear(); foreach (string s in list) { listbox.Items.Add(s); } CountLabel.Content = listbox.Items.Count.ToString() + " Items"; }
public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); HRWorkExperienceQuery query = new HRWorkExperienceQuery(); //by default we have an empty query if (SearchControl.OptionOne.IsChecked == true) { query = new HRWorkExperienceQuery() { EmployeeNumber = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionTwo.IsChecked == true) { query = new HRWorkExperienceQuery() { Company = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionThree.IsChecked == true) { int value = 0; if (int.TryParse(SearchControl.SearchTextBox.Text, out value)) { query = new HRWorkExperienceQuery() { Years = value }; } } int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryEMPWORKEXPERIENCEAsync(query, pagesize, pagePosition); //No response; exit if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; //Fill the datagrid with the results SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <HR_EMP_WORK_EXPERIENCE>(response.Result.ToList <HR_EMP_WORK_EXPERIENCE>());; }
//Normal Search method has been made resuable public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); GeneralLedgerAccountQuery query = new GeneralLedgerAccountQuery(); if (SearchControl.OptionOne.IsChecked == true) { query = new GeneralLedgerAccountQuery() { AccountNo = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionTwo.IsChecked == true) { query = new GeneralLedgerAccountQuery() { AccountType = int.Parse(SearchControl.SearchTextBox.Text) }; } else if (SearchControl.OptionThree.IsChecked == true) { query = new GeneralLedgerAccountQuery() { AccountSubtype = int.Parse(SearchControl.SearchTextBox.Text) }; } SearchControl.Search = Search; int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryGeneralLedgerAccountAsync(query, pagesize, pagePosition); if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; var servicelist = response.Result.ToList <FIN_GeneralLedgerAccount>(); var GeneralLedgerAccounts = new ObservableCollection <FIN_GeneralLedgerAccount>(servicelist); SearchControl.ResultsGrid.ItemsSource = GeneralLedgerAccounts; }
public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); UnitConversionQuery query = new UnitConversionQuery(); //by default we have an empty query if (SearchControl.OptionOne.IsChecked == true) { query = new UnitConversionQuery() { FromUnitCode = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionTwo.IsChecked == true) { query = new UnitConversionQuery() { ToUnitCode = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionThree.IsChecked == true) { query = new UnitConversionQuery() { ConversionFactor = int.Parse(SearchControl.SearchTextBox.Text) }; } //The search control needs to know the method it has to use inorder to search. So we pass a method SearchControl.Search = Search; int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryUnitConversionAsync(query, pagesize, pagePosition); //No response; exit if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; //Fill the datagrid with the results SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <ERP_UnitConversion>(response.Result.ToList <ERP_UnitConversion>());; }
public static async void Search(CustomSearchControl SearchControl) { var client = Helper.getServiceClient(); AreaQuery query = new AreaQuery(); if (SearchControl.OptionOne.IsChecked == true) { query = new Service.AreaQuery() { AreaCode = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionTwo.IsChecked == true) { query = new Service.AreaQuery() { AreaName = SearchControl.SearchTextBox.Text }; } else if (SearchControl.OptionThree.IsChecked == true) { query = new Service.AreaQuery() { RegionCode = SearchControl.SearchTextBox.Text }; } //The search control needs to know the method it has to use inorder to search. So we pass a method SearchControl.Search = Search; int pagesize = SearchControl.PageSize; int pagePosition = SearchControl.PagePosition; var response = await client.QueryAreaAsync(query, pagesize, pagePosition); //No response; exit if (response == null) { MessageBox.Show("Service isn't responding, please try again later", "Message", MessageBoxButton.OK, MessageBoxImage.Information); return; } SearchControl.ResultCount = response.TotalResultCount; //Fill the datagrid with the results SearchControl.ResultsGrid.ItemsSource = new ObservableCollection <FIN_Area>(response.Result.ToList <FIN_Area>());; }
public void Save() { //Get an instance of the service using Helper class var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var LastLanguageInfoToSave = (HR_EMP_LANGUAGE)CollectionViewSource.GetDefaultView(language.HREmpLanguageGrid.DataContext).CurrentItem; LastLanguageInfoToSave.EMP_NUMBER = LastLanguageInfoToSave.HR_EMPLOYEE.EMP_NUMBER; LastLanguageInfoToSave.LANG_CODE = LastLanguageInfoToSave.HR_LANGUAGE.LANG_CODE; //This is used incase a user never enters a textbox but still needs validating language.EmpLanguageEmpIdDropDown.GetBindingExpression(CustomSearchDropDown.CustomSelectedItemProperty).UpdateSource(); language.EmpLanguageLangCodeDropDown.GetBindingExpression(CustomSearchDropDown.CustomSelectedItemProperty).UpdateSource(); //Checking if all controls are in valid state if (!Helper.IsValid(language.HREmpLanguageGrid)) { MessageBox.Show("Please fix errors before continuing", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } //A user is trying to add a record here if (language.BtnAdd.IsChecked == true) { var LanguageToSave = (LastLanguageInfoToSave); if (!client.HREmpLanguageExists(LanguageToSave)) { ApiAck ack = client.CreateHREmpLanguage(LanguageToSave); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Added Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); //Complete the Add operation. i.e.; Re-enable tabs,textboxes and datagrid CompleteAdd(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { MessageBox.Show("Record Already Exists", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } //Else the user is trying to update a record else { ApiAck ack = client.UpdateHREmpLanguage(LastLanguageInfoToSave); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Updated Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); CompleteUpdate(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } catch (NullReferenceException) { MessageBox.Show("Nothing to Update", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public void Save() { //Get an instance of the service using Helper class var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var SaveTrainingInformation = (HR_EMP_TRAININGS)CollectionViewSource.GetDefaultView(Training.TrainingGrid.DataContext).CurrentItem; //This is used incase a user never enters a textbox but still needs validating /*EmergencyContact.txt_FullName.GetBindingExpression(TextBox.TextProperty).UpdateSource(); * EmergencyContact.txt_Relationship.GetBindingExpression(TextBox.TextProperty).UpdateSource(); * EmergencyContact.txt_PermanentAddress.GetBindingExpression(TextBox.TextProperty).UpdateSource(); * EmergencyContact.txt_OfficialAddress.GetBindingExpression(TextBox.TextProperty).UpdateSource(); * EmergencyContact.txt_TelephoneHome.GetBindingExpression(TextBox.TextProperty).UpdateSource(); * EmergencyContact.txt_TelephoneMobile.GetBindingExpression(TextBox.TextProperty).UpdateSource(); * EmergencyContact.txt_TelephoneOffice.GetBindingExpression(TextBox.TextProperty).UpdateSource();*/ //Checking if all controls are in valid state if (!Helper.IsValid(Training.TrainingGrid)) { MessageBox.Show("Please fix errors before continuing", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } //A user is trying to add a record here if (Training.BtnAdd.IsChecked == true) { if (!client.ExistTraining(SaveTrainingInformation)) { ApiAck ack = client.CreateTraining(SaveTrainingInformation); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Added Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); //Complete the Add operation. i.e.; Re-enable tabs,textboxes and datagrid CompleteAdd(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { MessageBox.Show("Record Already Exists", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } //Else the user is trying to update a record else { ApiAck ack = client.UpdateTraining(SaveTrainingInformation); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Updated Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); CompleteUpdate(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } catch (NullReferenceException) { MessageBox.Show("Nothing to Update", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public void Save() { //Get an instance of the service using Helper class var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var AgentBrokerSalesManToSave = (ERP_AgentBrokerSalesMan)CollectionViewSource.GetDefaultView(agentbrokersalesman.AgentBrokerSalesManGrid.DataContext).CurrentItem; //This is used incase a user never enters a textbox but still needs validating agentbrokersalesman.cmb_AgentBrokerSalesManFlag.GetBindingExpression(TextBox.TextProperty).UpdateSource(); agentbrokersalesman.txt_Code.GetBindingExpression(TextBox.TextProperty).UpdateSource(); //agentbrokersalesman.txt_ProductCodeLTI.GetBindingExpression(TextBox.TextProperty).UpdateSource(); //agentbrokersalesman.txt_SubSystemCodeLTI.GetBindingExpression(TextBox.TextProperty).UpdateSource(); //Checking if all controls are in valid state if (!Helper.IsValid(agentbrokersalesman.AgentBrokerSalesManGrid)) { MessageBox.Show("Please fix errors before continuing", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } //A user is trying to add a record here if (agentbrokersalesman.BtnAdd.IsChecked == true) { var absmtosave = (AgentBrokerSalesManToSave); if (!client.AgentBrokerSalesManExists(absmtosave)) { ApiAck ack = client.CreateAgentBrokerSalesMan(absmtosave); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Added Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); //Complete the Add operation. i.e.; Re-enable tabs,textboxes and datagrid CompleteAdd(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { MessageBox.Show("Record Already Exists", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } //Else the user is trying to update a record else { ApiAck ack = client.UpdateAgentBrokerSalesMan(AgentBrokerSalesManToSave); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Updated Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); CompleteUpdate(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } catch (NullReferenceException) { MessageBox.Show("Nothing to Update", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public void Save() { //Get an instance of the service using Helper class var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var BankAccountToSave = (FIN_BankAccount)CollectionViewSource.GetDefaultView(bank.BankAccountGrid.DataContext).CurrentItem; //This is used incase a user never enters a textbox but still needs validating bank.BankAccountBankBranchDropDown.GetBindingExpression(CustomSearchDropDown.CustomSelectedItemProperty).UpdateSource(); bank.txt_BankAccount_AccountSEQNo.GetBindingExpression(TextBox.TextProperty).UpdateSource(); //Checking if all controls are in valid state if (!Helper.IsValid(bank.BankAccountGrid)) { MessageBox.Show("Please fix errors before continuing", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } //A user is trying to add a record here if (bank.BtnAdd.IsChecked == true) { if (!client.BankAccountExists(BankAccountToSave)) { ApiAck ack = client.CreateBankAccount(BankAccountToSave); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Added Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); //Complete the Add operation. i.e.; Re-enable tabs,textboxes and datagrid CompleteAdd(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { MessageBox.Show("Record Already Exists", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } //Else the user is trying to update a record else { ApiAck ack = client.UpdateBankAccount(BankAccountToSave); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Updated Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); CompleteUpdate(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } catch (NullReferenceException) { MessageBox.Show("Nothing to Update", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
public void Save() { //Get an instance of the service using Helper class var client = Helper.getServiceClient(); try { //Get the current object in the EditGrid var EmployeeExpToSave = (HR_EMP_WORK_EXPERIENCE)CollectionViewSource.GetDefaultView(HREmployeeWorkExperienceUI.EMPWORKGrid.DataContext).CurrentItem; //This is used incase a user never enters a textbox but still needs validating HREmployeeWorkExperienceUI.HREmployeeWEDropDown.GetBindingExpression(CustomSearchDropDown.CustomSelectedItemProperty).UpdateSource(); HREmployeeWorkExperienceUI.txt_EMPWORK_EEXP_TELEPHONE.GetBindingExpression(TextBox.TextProperty).UpdateSource(); HREmployeeWorkExperienceUI.txt_EMPWORK_EEXP_EMAIL.GetBindingExpression(TextBox.TextProperty).UpdateSource(); HREmployeeWorkExperienceUI.dpk_EMPWORK_EEXP_FROM_DATE.GetBindingExpression(DatePicker.SelectedDateProperty).UpdateSource(); HREmployeeWorkExperienceUI.dpk_EMPWORK_EEXP_TO_DATE.GetBindingExpression(DatePicker.SelectedDateProperty).UpdateSource(); //Checking if all controls are in valid state if (!Helper.IsValid(HREmployeeWorkExperienceUI.EMPWORKGrid)) { MessageBox.Show("Please fix errors before continuing", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } //A user is trying to add a record here if (HREmployeeWorkExperienceUI.BtnAdd.IsChecked == true) { if (!client.EMPWORKExists(EmployeeExpToSave)) { ApiAck ack = client.CreateEMPWORK(EmployeeExpToSave); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Added Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); //Complete the Add operation. i.e.; Re-enable tabs,textboxes and datagrid CompleteAdd(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { MessageBox.Show("Record Already Exists", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } //Else the user is trying to update a record else { ApiAck ack = client.UpdateEMPWORK(EmployeeExpToSave); if (ack.CallStatus == EApiCallStatus.Success) { MessageBox.Show("Record Updated Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information); CompleteUpdate(); } else { MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } catch (NullReferenceException) { MessageBox.Show("Nothing to Update", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }