Beispiel #1
0
        private void Btn_clear_Click(object sender, RoutedEventArgs e)
        {//clear
            try
            {
                sysEmail         = new SysEmails();
                this.DataContext = sysEmail;

                //tb_name.Clear();
                //tb_email.Clear();
                //tb_password.Clear();
                pb_password.Clear();
                //tb_smtpClient.Clear();
                //tb_port.Clear();
                //pb_password.Clear();
                //tgl_isSSL.IsChecked =
                // tgl_isMajor.IsChecked = false;
                cb_branchId.SelectedIndex = -1;
                cb_side.SelectedIndex     = -1;
                //tb_notes.Clear();
                SectionData.clearValidate(tb_name, p_errorName);
                SectionData.clearValidate(tb_email, p_errorEmail);
                SectionData.clearValidate(tb_port, p_errorPort);
                SectionData.clearValidate(tb_smtpClient, p_errorSmtpClient);
                SectionData.clearComboBoxValidate(cb_side, p_errorSide);
                SectionData.clearComboBoxValidate(cb_branchId, p_errorBranchId);
                SectionData.clearPasswordValidate(pb_password, p_errorPassword);
            }
            catch (Exception ex)
            {
                SectionData.ExceptionMessage(ex, this);
            }
        }
        void Clear()
        {
            sysEmail         = new SysEmails();
            this.DataContext = sysEmail;
            pb_password.Clear();

            // last
            HelpClass.clearValidate(requiredControlList, this);
            p_error_email.Visibility = Visibility.Collapsed;
        }
        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 void Dg_sysEmail_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         HelpClass.StartAwait(grid_main);
         //selection
         if (dg_sysEmail.SelectedIndex != -1)
         {
             sysEmail             = dg_sysEmail.SelectedItem as SysEmails;
             this.DataContext     = sysEmail;
             pb_password.Password = Encoding.UTF8.GetString(Convert.FromBase64String(sysEmail.password));
             if (sysEmail != null)
             {
                 #region delete
                 if (sysEmail.canDelete)
                 {
                     btn_delete.Content = MainWindow.resourcemanager.GetString("trDelete");
                 }
                 else
                 {
                     if (sysEmail.isActive == 0)
                     {
                         btn_delete.Content = MainWindow.resourcemanager.GetString("trActive");
                     }
                     else
                     {
                         btn_delete.Content = MainWindow.resourcemanager.GetString("trInActive");
                     }
                 }
                 #endregion
             }
         }
         HelpClass.clearValidate(requiredControlList, this);
         HelpClass.EndAwait(grid_main);
     }
     catch (Exception ex)
     {
         HelpClass.EndAwait(grid_main);
         HelpClass.ExceptionMessage(ex, this);
     }
 }
Beispiel #5
0
        private void Dg_sysEmail_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {//selection
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                if (dg_sysEmail.SelectedIndex != -1)
                {
                    sysEmail         = dg_sysEmail.SelectedItem as SysEmails;
                    this.DataContext = sysEmail;

                    cb_branchId.SelectedValue = sysEmail.branchId;
                    cb_side.SelectedValue     = sysEmail.side;
                    //   pb_password.Password = sysEmail.password;
                    pb_password.Password = Encoding.UTF8.GetString(Convert.FromBase64String(sysEmail.password));

                    if (sysEmail != null)
                    {
                        #region delete
                        if (sysEmail.canDelete)
                        {
                            txt_deleteButton.Text    = MainWindow.resourcemanager.GetString("trDelete");
                            txt_delete_Icon.Kind     = MaterialDesignThemes.Wpf.PackIconKind.Delete;
                            tt_delete_Button.Content = MainWindow.resourcemanager.GetString("trDelete");
                        }

                        else
                        {
                            if (sysEmail.isActive == 0)
                            {
                                txt_deleteButton.Text = MainWindow.resourcemanager.GetString("trActive");
                                txt_delete_Icon.Kind  =
                                    MaterialDesignThemes.Wpf.PackIconKind.Check;
                                tt_delete_Button.Content = MainWindow.resourcemanager.GetString("trActive");
                            }
                            else
                            {
                                txt_deleteButton.Text    = MainWindow.resourcemanager.GetString("trInActive");
                                txt_delete_Icon.Kind     = MaterialDesignThemes.Wpf.PackIconKind.Cancel;
                                tt_delete_Button.Content = MainWindow.resourcemanager.GetString("trInActive");
                            }
                        }
                        #endregion
                    }
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }