void Clear() { this.DataContext = new Customers(); #region code tb_custCode.Text = ""; #endregion #region mobile-Phone-fax-email-country //cb_areaMobile.SelectedValue = MainWindow.Region.countryId; //cb_areaPhone.SelectedValue = MainWindow.Region.countryId; //cb_areaFax.SelectedValue = MainWindow.Region.countryId; cb_country.SelectedIndex = -1; cb_areaMobile.SelectedIndex = -1; cb_areaPhone.SelectedIndex = -1; cb_areaFax.SelectedIndex = -1; cb_areaPhoneLocal.SelectedIndex = -1; cb_areaFaxLocal.SelectedIndex = -1; tb_mobile.Clear(); tb_phone.Clear(); tb_fax.Clear(); tb_email.Clear(); #endregion #region image HelpClass.clearImg(btn_image); #endregion // last HelpClass.clearValidate(requiredControlList, this); p_error_email.Visibility = Visibility.Collapsed; }
void Clear() { this.DataContext = new Users(); #region password-code pb_password.Clear(); tb_passwordMirror.Clear(); tb_code.Text = ""; #endregion #region mobile-Phone-fax-country //cb_areaMobile.SelectedValue = MainWindow.Region.countryId; //cb_areaPhone.SelectedValue = MainWindow.Region.countryId; //cb_areaFax.SelectedValue = MainWindow.Region.countryId; cb_country.SelectedIndex = -1; cb_areaMobile.SelectedIndex = -1; cb_areaPhone.SelectedIndex = -1; cb_areaFax.SelectedIndex = -1; cb_areaPhoneLocal.SelectedIndex = -1; cb_areaFaxLocal.SelectedIndex = -1; tb_mobile.Clear(); tb_phone.Clear(); tb_fax.Clear(); tb_email.Clear(); #endregion #region image HelpClass.clearImg(btn_image); #endregion // last HelpClass.clearValidate(requiredControlList, this); p_error_email.Visibility = Visibility.Collapsed; btn_packages.IsEnabled = false; }
void Clear() { sysEmail = new SysEmails(); this.DataContext = sysEmail; pb_password.Clear(); // last HelpClass.clearValidate(requiredControlList, this); p_error_email.Visibility = Visibility.Collapsed; }
private void clearValidate(Path p) { try { HelpClass.clearValidate(p); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private async void Dg_user_SelectionChanged(object sender, SelectionChangedEventArgs e) {//selection try { HelpClass.StartAwait(grid_main); if (dg_user.SelectedIndex != -1) { user = dg_user.SelectedItem as Users; this.DataContext = user; if (user != null) { btn_packages.IsEnabled = true; btn_customers.IsEnabled = true; tb_code.Text = user.code; cb_country.SelectedValue = user.countryId; this.DataContext = user; await getImg(); #region delete if (user.canDelete) { btn_delete.Content = MainWindow.resourcemanager.GetString("trDelete"); } else { if (user.isActive == 0) { btn_delete.Content = MainWindow.resourcemanager.GetString("trActive"); } else { btn_delete.Content = MainWindow.resourcemanager.GetString("trInActive"); } } #endregion HelpClass.getMobile(user.mobile, cb_areaMobile, tb_mobile); HelpClass.getPhone(user.phone, cb_areaPhone, cb_areaPhoneLocal, tb_phone); HelpClass.getPhone(user.fax, cb_areaFax, cb_areaFaxLocal, tb_fax); } } HelpClass.clearValidate(requiredControlList, this); p_error_email.Visibility = Visibility.Collapsed; HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
void Clear() { this.DataContext = new Packages(); tgl_branch.IsChecked = false; tgl_user.IsChecked = false; tgl_customer.IsChecked = false; tgl_saleInv.IsChecked = false; tgl_store.IsChecked = false; tgl_pos.IsChecked = false; tgl_vendor.IsChecked = false; tgl_item.IsChecked = false; btn_packagePriceDate.IsEnabled = false; HelpClass.clearValidate(requiredControlList, this); }
void Clear() { dg_setValues.SelectedIndex = -1; tb_title.Text = tb_text1.Text = tb_text2.Text = tb_link1text.Text = tb_link2text.Text = tb_link3text.Text = tb_link1url.Text = tb_link2url.Text = tb_link3url.Text = ""; this.DataContext = new SetValues(); HelpClass.clearValidate(requiredControlList, this); }
void clearValidate() { try { foreach (var control in requiredControlList) { System.Windows.Shapes.Path path = FindControls.FindVisualChildren <System.Windows.Shapes.Path>(this).Where(x => x.Name == "p_error_" + control) .FirstOrDefault(); if (path != null) { HelpClass.clearValidate(path); } } } catch { } }
private async void Dg_book_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { //HelpClass.StartAwait(grid_main); BookSts book = dg_book.SelectedItem as BookSts; if (book.packageUserId > 0) { PackageUser puModel = new PackageUser(); PackageUser packageUser = await puModel.GetByID(book.packageUserId); Packages pModel = new Packages(); Packages package = await pModel.GetByID(book.packageId.Value); if (packageUser.packageId > 0) { MainWindow.mainWindow.Btn_sales_Click(MainWindow.mainWindow.btn_sales, null); uc_sales.Instance.Window_Loaded(null, null); uc_sales.Instance.Btn_sale_Click(uc_sales.Instance.btn_sale, null); uc_sale.Instance.UserControl_Loaded(null, null); uc_sale.Instance.package = package; uc_sale.Instance.oldCustomerId = packageUser.customerId.Value; uc_sale.Instance.oldAgentId = packageUser.userId.Value; uc_sale.Instance.oldPackageId = packageUser.packageId.Value; uc_sale.Instance.oldCountryPackageId = packageUser.countryPackageId.Value; uc_sale.Instance.packuser = packageUser; uc_sale.Instance.btn_serials.IsEnabled = true; uc_sale.Instance.tb_activationCode.Text = packageUser.packageSaleCode; uc_sale.Instance.isOnline = packageUser.isOnlineServer.Value; HelpClass.clearValidate(uc_sale.requiredControlList, this); } } //Clear(); //ClearPackageUser(); //HelpClass.EndAwait(grid_main); } catch (Exception ex) { //HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
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); } }
//async Task<IEnumerable<Packages>> RefreshPackagesList() //{ // packages = await package.GetAll(); // return packages; //} #endregion #region validate - clearValidate - textChange - lostFocus - . . . . void Clear() { try { this.DataContext = new Packages(); } catch { } packuser = new PackageUser(); cb_customer.SelectedIndex = -1; cb_isOnline.SelectedIndex = -1; cb_package.ItemsSource = null; cb_period.ItemsSource = null; tgl_device.IsChecked = false; tgl_isActive.IsChecked = true; oldPackageId = 0; oldCountryPackageId = 0; cb_package.IsEnabled = false; cb_period.IsEnabled = false; btn_serials.IsEnabled = false; tb_activationCode.Text = ""; txt_date.Text = ""; btn_add.Content = MainWindow.resourcemanager.GetString("trBook"); HelpClass.clearValidate(requiredControlList, this); }
private async void btnLogIn_Click(object sender, RoutedEventArgs e) {//log in try { if (!logInProcessing) { logInProcessing = true; HelpClass.StartAwait(grid_main); HelpClass.clearValidate(p_errorUserName); HelpClass.clearValidate(p_errorPassword); string password = Md5Encription.MD5Hash("Inc-m" + txtPassword.Password); string userName = txtUserName.Text; user = await userModel.Getloginuser(userName, password); if (user.accountName == null) { //user does not exist HelpClass.SetValidate(p_errorUserName, "trUserNotFound"); } else { if (user.userId == 0) { //wrong password HelpClass.SetValidate(p_errorPassword, "trWrongPassword"); } else { //correct //send user info to main window MainWindow.userID = user.userId; MainWindow.userLogin = user; #region check if menu is open //try //{ // string m = await SectionData.getUserMenuIsOpen(user.userId); // if (!m.Equals("-1")) // MainWindow.menuIsOpen = m; // else // MainWindow.menuIsOpen = "close"; // menuIsOpen = MainWindow.menuIsOpen; //} //catch //{ // MainWindow.menuIsOpen = "close"; // menuIsOpen = MainWindow.menuIsOpen; //} #endregion //make user online user.isOnline = 1; int s = await userModel.Save(user); #region remember me if (cbxRemmemberMe.IsChecked.Value) { Properties.Settings.Default.userName = txtUserName.Text; Properties.Settings.Default.password = txtPassword.Password; Properties.Settings.Default.Lang = MainWindow.lang; //Properties.Settings.Default.menuIsOpen = menuIsOpen; } else { Properties.Settings.Default.userName = ""; Properties.Settings.Default.password = ""; Properties.Settings.Default.Lang = ""; //Properties.Settings.Default.menuIsOpen = ""; } Properties.Settings.Default.Save(); #endregion MainWindow.Region.countryId = 1; MainWindow main = new MainWindow(); main.Show(); this.Close(); } } HelpClass.EndAwait(grid_main); logInProcessing = false; } } catch (Exception ex) { HelpClass.EndAwait(grid_main); logInProcessing = false; HelpClass.ExceptionMessage(ex, this); } }
private void Dg_package_SelectionChanged(object sender, SelectionChangedEventArgs e) {//selection try { HelpClass.StartAwait(grid_main); if (dg_package.SelectedIndex != -1) { package = dg_package.SelectedItem as Packages; this.DataContext = package; if (package != null) { btn_packagePriceDate.IsEnabled = true; #region toggels if (package.branchCount == -1) { tgl_branch.IsChecked = true; } else { tgl_branch.IsChecked = false; } if (package.userCount == -1) { tgl_user.IsChecked = true; } else { tgl_user.IsChecked = false; } if (package.customerCount == -1) { tgl_customer.IsChecked = true; } else { tgl_customer.IsChecked = false; } if (package.salesInvCount == -1) { tgl_saleInv.IsChecked = true; } else { tgl_saleInv.IsChecked = false; } if (package.storeCount == -1) { tgl_store.IsChecked = true; } else { tgl_store.IsChecked = false; } if (package.posCount == -1) { tgl_pos.IsChecked = true; } else { tgl_pos.IsChecked = false; } if (package.vendorCount == -1) { tgl_vendor.IsChecked = true; } else { tgl_vendor.IsChecked = false; } if (package.itemCount == -1) { tgl_item.IsChecked = true; } else { tgl_item.IsChecked = false; } #endregion #region delete if (package.canDelete) { btn_delete.Content = MainWindow.resourcemanager.GetString("trDelete"); } else { if (package.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); } }