private async void sendEmail() { //if (txt_for.Text == "Required") if (txt_for.Text == MainWindow.resourcemanager.GetString("trRequired")) { string total = txt_total.Text; SysEmails email = new SysEmails(); EmailClass mailtosend = new EmailClass(); Agent toAgent = new Agent(); User toUser = new User(); ShippingCompanies toShipCompanies = new ShippingCompanies(); string emailto = ""; bool toemailexist = false; email = await email.GetByBranchIdandSide((int)MainWindow.branchID, "accounting"); switch (selectedTab) { case 0: //vendor var objct0 = cb_vendors.SelectedItem as VendorCombo; int agentId = (int)objct0.VendorId; toAgent = await toAgent.getAgentById(agentId); emailto = toAgent.email; if (emailto is null || emailto == "") { toemailexist = false; this.Dispatcher.Invoke(() => { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trTheVendorHasNoEmail"), animation: ToasterAnimation.FadeIn); }); } else { toemailexist = true; } break;
private async Task fillShippingCompanies() { companies = await companyModel.Get(); cb_company.ItemsSource = companies; cb_company.DisplayMemberPath = "name"; cb_company.SelectedValuePath = "shippingCompanyId"; if (shippingCompanyId != 0) { cb_company.SelectedValue = shippingCompanyId; companyModel = companies.Find(c => c.shippingCompanyId == (int)cb_company.SelectedValue); if (companyModel.deliveryType == "local") { cb_user.Visibility = Visibility.Visible; } else { cb_user.Visibility = Visibility.Collapsed; } } }
private void Cb_company_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (sender != null) { SectionData.StartAwait(grid_delivery); } if (cb_company.SelectedIndex != -1) { companyModel = companies.Find(c => c.shippingCompanyId == (int)cb_company.SelectedValue); if (companyModel.deliveryType == "local") { cb_user.Visibility = Visibility.Visible; } else { cb_user.SelectedIndex = -1; cb_user.Visibility = Visibility.Collapsed; } } if (sender != null) { SectionData.EndAwait(grid_delivery); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_delivery); } SectionData.ExceptionMessage(ex, this); } }