public void UpdateWarranty(string[] currentEventPayload) { var warrantyId = currentEventPayload[1]; var warrantyIndex = Warranties.FindIndex(proposal => proposal.Id == warrantyId); Warranties[warrantyIndex] = new Warranty(currentEventPayload); }
private void textBoxPaymentCashmemo_KeyPress(object sender, KeyPressEventArgs e) { Reciept = null; if (e.KeyChar == Convert.ToChar(Keys.Enter)) { ((FormExtendedWarrenty)Owner).IsBusy = true; Reciept = LSExtendedWarrenty.AppBase.DataHelper.DataProvider.GetCashMemo( this.textBoxPaymentCashmemo.Text, LSExtendedWarrenty.Properties.Resources.Selection ); if (Reciept == null) { MessageBox.Show(this, "Cash Memo Not Found.", "Not Found"); } ((FormExtendedWarrenty)Owner).IsBusy = false; } if (Reciept != null) { this.IsValid = Warranties.IsValid(Reciept); if (IsValid) { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } }
private void addWarrentyButton1_Click(object sender, EventArgs e) { try { WarrentyItemSelction WarrentyItemSelction = new WarrentyItemSelction(); WarrentyItemSelction.Item = addWarrentyButton1.Item; var result = WarrentyItemSelction.ShowDialog(this); if (result == System.Windows.Forms.DialogResult.OK) { if (Warranties == null) { Warranties = new Warranty(); } try { Warranties.AddWarrenty(WarrentyItemSelction.WarrentyItem); } catch (Exception ex) { MessageBox.Show(this, "Error Occurred While Adding Warranty. " + Environment.NewLine + "Please Check the Error Message." + Environment.NewLine + "Please take a screen shot and send to System Administrator" + Environment.NewLine + Environment.NewLine + ex.Message, "Error Occurred"); } } } catch (LSExtendedWarrenty.AppBase.DataHelper.NoWarrentySettingFoundException ex) { MessageBox.Show(ex.InnerException.Message, ex.Message); } }
private void buttonRemove_Click(object sender, EventArgs e) { if (Warranties != null) { foreach (var warranty in Warranties) { if (warranty.ItemId == this.comboBoxWarrenties.Text) { Warranties.RemoveWarrenty(warranty); break; } } } }
void Warrenties_WarrentyItemAddedEvent() { BindingSource source = new BindingSource(); source.DataSource = Warranties; this.comboBoxWarrenties.Text = ""; this.comboBoxWarrenties.DataSource = source; this.comboBoxWarrenties.DisplayMember = "ItemId"; //Tender var netAmount = Warranties.GetNetAmount(); this.buttonPay.Text = "Tender ( " + netAmount + " )"; this.comboBoxWarrenties.SelectedIndex = this.comboBoxWarrenties.Items.Count - 1; comboBoxWarrenties_SelectedIndexChanged(this.comboBoxWarrenties.SelectedIndex, new EventArgs()); }
private void buttonPay_Click(object sender, EventArgs e) { if (Warranties != null) { if (this.ValidateForPrint()) { ConfirmPayment ConfirmPayment = new ConfirmPayment(); var temp = this.Warranties; DialogResult Result = ConfirmPayment.ShowDialog(this, ref temp); this.Warranties = temp; if (Result == DialogResult.OK && ConfirmPayment.IsValid == true) { this.IsBusy = true; this.Warranties.CustomerName = this.textBoxCustomerName.Text; this.Warranties.Email = this.textBoxEmail.Text; this.Warranties.Phone = this.textBoxPhoneNumber.Text; this.Warranties.Country = this.comboBoxCountry.Text; this.Warranties.Address = this.textBoxAddress.Text; bool succesCommit = false; try { this.Warranties.Commit(); succesCommit = true; } catch (Exception ex) { this.Warranties.RollBack(); MessageBox.Show("Error Occurred While Committing Warranty. " + Environment.NewLine + "Please Check the Error Message." + Environment.NewLine + "Please take a screen shot and send to System Administrator" + Environment.NewLine + Environment.NewLine + ex.Message, "Error Occurred."); succesCommit = false; } if (succesCommit) { const string ReportPath = @"LSExtendedWarrenty.WarrentySlip.rdlc"; const string DataSourceName = @"WarrentyItem"; String PrinterName = SettingsProvider.GetDefaultPrinter(); Microsoft.Reporting.WinForms.ReportParameter[] ReportParameter = new Microsoft.Reporting.WinForms.ReportParameter[] { new Microsoft.Reporting.WinForms.ReportParameter(@"PrintDateTime", DateTime.Now.ToString()), new Microsoft.Reporting.WinForms.ReportParameter(@"IssueDateTime", DateTime.Now.ToString()), new Microsoft.Reporting.WinForms.ReportParameter(@"CashMemo", Warranties.Reciept.RecieptID), new Microsoft.Reporting.WinForms.ReportParameter(@"CashMemoDate", Warranties.Reciept.TransactionDate.ToString()), new Microsoft.Reporting.WinForms.ReportParameter(@"CustomerName", Warranties.CustomerName), new Microsoft.Reporting.WinForms.ReportParameter(@"CustomerPhone", Warranties.Phone), new Microsoft.Reporting.WinForms.ReportParameter(@"CustomerEmail", Warranties.Email), new Microsoft.Reporting.WinForms.ReportParameter(@"StaffCode", Warranties.Reciept.Staff), new Microsoft.Reporting.WinForms.ReportParameter(@"StaffName", Warranties.Reciept.StaffName) }; Warranty TempWarrenties = (Warranty)Warranties.Clone(); try { foreach (var warranty in Warranties) { TempWarrenties.Clear(); TempWarrenties.Add(warranty); Microsoft.Reporting.WinForms.ReportDataSource DataSource = new Microsoft.Reporting.WinForms.ReportDataSource (DataSourceName, TempWarrenties); using (ReportPriner Printer = new ReportPriner(ReportPath, DataSource, ReportParameter)) { Printer.Run(PrinterName); Printer.Run(PrinterName); } } this.Warranties = null; this.Reciept = null; } catch (Exception ex) { MessageBox.Show("Problem Printing Warranty Certificate.\nPlease Try again." + Environment.NewLine + "Please Check the Error Message." + Environment.NewLine + "Please take a screen shot and send to System Administrator" + Environment.NewLine + Environment.NewLine + ex.Message , "Cannot Print."); this.Warranties.RollBack(); } } else { MessageBox.Show(this, "Problem saving Warranty.", "Cannot Save.", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (ConfirmPayment.IsValid) { MessageBox.Show(this, "Invalid Payment", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show(this, "Please Enter All the user Fields.", "Complete the form.", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.IsBusy = false; } }
public void RemoveWarranty(string[] currentEventPayload) { var toRemoveWarrantyId = currentEventPayload[1]; Warranties = Warranties.Where(warranty => warranty.Id != toRemoveWarrantyId).ToList(); }
public void AddWarranty(string[] currentEventPayload) { Warranties.Add(new Warranty(currentEventPayload)); }
public Warranty FindWarranty(Predicate <Warranty> match) { return(Warranties.Find(match)); }
public Proposal RemoveWarrantyBy(Guid id) { Warranties.RemoveAll(warranty => warranty.Id == id); return(this); }
public Proposal Add(Warranty warranty) { Warranties.Add(warranty); return(this); }