private async void Btn_saveReportlang_Click(object sender, RoutedEventArgs e) { // string msg = ""; int msg = 0; if (cb_reportlang.SelectedIndex != -1) { replangrow = replangList.Where(r => r.valId == (int)cb_reportlang.SelectedValue).FirstOrDefault(); replangrow.isDefault = 1; msg = await setvalueModel.Save(replangrow); // replangrow.valId= await MainWindow.GetReportlang(); await fillRepLang(); if (msg > 0) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } } }
private async Task saveDateform() { if (!cb_dateForm.Text.Equals("")) { var setDate = set.Where(t => t.name == "dateForm").FirstOrDefault(); SetValues dateForm = new SetValues(); dateForm.value = cb_dateForm.SelectedValue.ToString(); dateForm.isSystem = 1; dateForm.settingId = setDate.settingId; int s = await valueModel.Save(dateForm); if (!s.Equals("0")) { //update dateForm in main window MainWindow.dateFormat = dateForm.value; } } else { MainWindow.dateFormat = "ShortDatePattern"; } }
private async void Btn_save_Click(object sender, RoutedEventArgs e) { int msg; sale_copy_countrow.value = (string)tb_saleCopyCount.Text; pur_copy_countrow.value = (string)tb_purCopyCount.Text; rep_copy_countrow.value = (string)tb_repPrintCount.Text; directentry_copy_countrow.value = (string)tb_directEntry.Text; if (int.Parse(sale_copy_countrow.value) <= 0 || int.Parse(pur_copy_countrow.value) <= 0 || int.Parse(rep_copy_countrow.value) <= 0 || int.Parse(directentry_copy_countrow.value) <= 0) { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trMustBeMoreThanZero"), animation: ToasterAnimation.FadeIn); } else { msg = await setvalueModel.Save(sale_copy_countrow); msg = await setvalueModel.Save(pur_copy_countrow); msg = await setvalueModel.Save(rep_copy_countrow); msg = await setvalueModel.Save(directentry_copy_countrow); await refreshWindow(); await MainWindow.Getprintparameter(); if (msg > 0) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); await Task.Delay(1500); this.Close(); } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } } }
private async void Btn_printCount_Click(object sender, RoutedEventArgs e) {//save print count try { if (sender != null) { SectionData.StartAwait(grid_main); } SectionData.validateEmptyTextBox(tb_printCount, p_errorPrintCount, tt_errorPrintCount, "trEmptyPrintCount"); if (!tb_printCount.Text.Equals("")) { if (printCount == null) { printCount = new SetValues(); } printCount.value = tb_printCount.Text; printCount.isSystem = 1; printCount.isDefault = 1; printCount.settingId = printCountId; int s = await valueModel.Save(printCount); if (!s.Equals(0)) { //update tax in main window MainWindow.Allow_print_inv_count = printCount.value; Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }
private async void Btn_save_Click(object sender, RoutedEventArgs e) { try { setVNote.value = tb_notes.Text.Trim(); int res = await valueModel.Save(setVNote); if (res > 0) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); await Task.Delay(1500); } else { Toaster.ShowWarning(Window.GetWindow(this), message: "Not saved", animation: ToasterAnimation.FadeIn); await Task.Delay(1500); } this.Close(); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private async void Btn_save_Click(object sender, RoutedEventArgs e) { // string msg = ""; int msg = 0; if ((bool)tgl_printOnSavePur.IsChecked) { print_on_save_purrow.value = "1"; } else { print_on_save_purrow.value = "0"; } if ((bool)tgl_printOnSaveSale.IsChecked) { print_on_save_salerow.value = "1"; } else { print_on_save_salerow.value = "0"; } if ((bool)tgl_emailOnSavePur.IsChecked) { email_on_save_purrow.value = "1"; } else { email_on_save_purrow.value = "0"; } if ((bool)tgl_emailOnSaveSale.IsChecked) { email_on_save_salerow.value = "1"; } else { email_on_save_salerow.value = "0"; } if ((bool)tgl_showHeader.IsChecked) { show_header_row.value = "1"; } else { show_header_row.value = "0"; } if ((bool)tgl_directEntry.IsChecked) { print_on_save_directentryrow.value = "1"; } else { print_on_save_directentryrow.value = "0"; } // tgl_showHeader msg = await setvalueModel.Save(print_on_save_purrow); msg = await setvalueModel.Save(print_on_save_salerow); msg = await setvalueModel.Save(email_on_save_purrow); msg = await setvalueModel.Save(email_on_save_salerow); msg = await setvalueModel.Save(print_on_save_directentryrow); // msg = await setvalueModel.Save(show_header_row); await Getprintparameter(); await MainWindow.Getprintparameter(); if (msg > 0) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); await Task.Delay(1500); this.Close(); } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } }
private async void Btn_save_Click(object sender, RoutedEventArgs e) {//save try { if (sender != null) { HelpClass.StartAwait(grid_main); } #region validate if (HelpClass.validate(requiredControlList, this) && HelpClass.IsValidEmail(this)) { //save name if (!tb_name.Text.Equals("")) { setVName.value = tb_name.Text; setVName.isSystem = 1; setVName.isDefault = 1; setVName.settingId = nameId; // string sName = await valueModel.Save(setVName); int sName = await valueModel.Save(setVName); if (!sName.Equals(0)) { FillCombo.companyName = tb_name.Text; } } //save address if (!tb_address.Text.Equals("")) { setVAddress.value = tb_address.Text; setVAddress.isSystem = 1; setVAddress.isDefault = 1; setVAddress.settingId = addressId; int sAddress = await valueModel.Save(setVAddress); // string sAddress = await valueModel.Save(setVAddress); if (!sAddress.Equals(0)) { FillCombo.Address = tb_address.Text; } } //save email if ((!tb_email.Text.Equals(""))) { setVEmail.value = tb_email.Text; setVEmail.isSystem = 1; setVEmail.settingId = emailId; setVEmail.isDefault = 1; // string sEmail = await valueModel.Save(setVEmail); int sEmail = await valueModel.Save(setVEmail); if (!sEmail.Equals(0)) { FillCombo.Email = tb_email.Text; } } //save mobile if (!tb_mobile.Text.Equals("")) { setVMobile.value = cb_areaMobile.Text + "-" + tb_mobile.Text; setVMobile.isSystem = 1; setVMobile.isDefault = 1; setVMobile.settingId = mobileId; int sMobile = await valueModel.Save(setVMobile); if (!sMobile.Equals(0)) { FillCombo.Mobile = cb_areaMobile.Text + tb_mobile.Text; } } //save phone //if (!tb_phone.Text.Equals("")) //{ setVPhone.value = cb_areaPhone.Text + "-" + cb_areaPhoneLocal.Text + "-" + tb_phone.Text; setVPhone.isSystem = 1; setVPhone.isDefault = 1; setVPhone.settingId = phoneId; int sPhone = await valueModel.Save(setVPhone); if (!sPhone.Equals(0)) { FillCombo.Phone = cb_areaPhone.Text + cb_areaPhoneLocal.Text + tb_phone.Text; } //} //save fax setVFax.value = cb_areaFax.Text + "-" + cb_areaFaxLocal.Text + "-" + tb_fax.Text; setVFax.isSystem = 1; setVFax.isDefault = 1; setVFax.settingId = faxId; int sFax = await valueModel.Save(setVFax); if (!sFax.Equals(0)) { FillCombo.Fax = cb_areaFax.Text + cb_areaFaxLocal.Text + tb_fax.Text; } // save logo // image // string sLogo = ""; int sLogo = 0; if (isImgPressed) { isImgPressed = false; setVLogo.value = sLogo.ToString(); setVLogo.isSystem = 1; setVLogo.isDefault = 1; setVLogo.settingId = logoId; sLogo = await valueModel.Save(setVLogo); if (!sLogo.Equals(0)) { FillCombo.logoImage = setVLogo.value; string b = await setVLogo.uploadImage(imgFileName, Md5Encription.MD5Hash("Inc-m" + sLogo), sLogo); setVLogo.value = b; FillCombo.logoImage = b; sLogo = await valueModel.Save(setVLogo); await valueModel.getImg(setVLogo.value); } } #endregion if (!isFirstTime) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); await Task.Delay(1500); } await FillCombo.loading_getDefaultSystemInfo(); this.Close(); } if (sender != null) { HelpClass.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { HelpClass.EndAwait(grid_main); } HelpClass.ExceptionMessage(ex, this); } }
private async void Btn_save_Click(object sender, RoutedEventArgs e) {//save try { if (sender != null) { SectionData.StartAwait(grid_main); } #region validate if (tgl_invoiceTax.IsChecked == true) { SectionData.validateEmptyTextBox(tb_invoiceTax, p_errorInvoiceTax, tt_errorInvoiceTax, "trEmptyTax"); } else { SectionData.clearValidate(tb_invoiceTax, p_errorInvoiceTax); } if (tgl_itemsTax.IsChecked == true) { SectionData.validateEmptyTextBox(tb_itemsTax, p_errorItemsTax, tt_errorItemsTax, "trEmptyTax"); } else { SectionData.clearValidate(tb_itemsTax, p_errorItemsTax); } #endregion if ((!tb_invoiceTax.Text.Equals(""))) { if (setVInvoiceBool == null) { setVInvoiceBool = new SetValues(); } //save bool invoice tax setVInvoiceBool.value = tgl_invoiceTax.IsChecked.ToString(); setVInvoiceBool.isSystem = 1; setVInvoiceBool.settingId = setInvoiceBool.settingId; int invoiceBoolRes = await setValuesModel.Save(setVInvoiceBool); if (setVInvoice == null) { setVInvoice = new SetValues(); } //save invoice tax string invTax = "0.000"; if (tgl_invoiceTax.IsChecked == true) { decimal d = decimal.Parse(tb_invoiceTax.Text); invTax = String.Format("{0:0.000}", d); } else { invTax = "0.000"; } setVInvoice.value = invTax; setVInvoice.isSystem = 1; setVInvoice.settingId = setInvoice.settingId; int invoiceRes = await setValuesModel.Save(setVInvoice); if (setVItemBool == null) { setVItemBool = new SetValues(); } //save bool item tax setVItemBool.value = tgl_itemsTax.IsChecked.ToString(); setVItemBool.isSystem = 1; setVItemBool.settingId = setItemBool.settingId; int itemBoolRes = await setValuesModel.Save(setVItemBool); if (setVItem == null) { setVItem = new SetValues(); } //save item tax string itemTax = "0.000"; if (tgl_itemsTax.IsChecked == true) { decimal d = decimal.Parse(tb_itemsTax.Text); itemTax = String.Format("{0:0.000}", d); } else { itemTax = "0.000"; } setVItem.value = itemTax; setVItem.isSystem = 1; setVItem.settingId = setItem.settingId; int itemRes = await setValuesModel.Save(setVItem); if ((invoiceBoolRes > 0) && (invoiceRes > 0) && (itemBoolRes > 0) && (itemRes > 0)) { //update tax in main window MainWindow.invoiceTax_bool = bool.Parse(setVInvoiceBool.value); MainWindow.invoiceTax_decimal = decimal.Parse(setVInvoice.value); MainWindow.itemsTax_bool = bool.Parse(setVItemBool.value); MainWindow.itemsTax_decimal = decimal.Parse(setVItem.value); Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); this.Close(); } else { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }
private async void Btn_save_Click(object sender, RoutedEventArgs e) {//save try { if (sender != null) { SectionData.StartAwait(grid_main); } #region validate bool emailError = false; if (!isFirstTime) { //chk empty name SectionData.validateEmptyTextBox(tb_name, p_errorName, tt_errorName, "trEmptyNameToolTip"); //validate email SectionData.validateEmail(tb_email, p_errorEmail, tt_errorEmail); if (!tb_email.Text.Equals("")) { if (!ValidatorExtensions.IsValid(tb_email.Text)) { emailError = true; } } //chk empty mobile SectionData.validateEmptyTextBox(tb_mobile, p_errorMobile, tt_errorMobile, "trEmptyMobileToolTip"); } else { //chk empty name validateEmptyTextBox(tb_name, p_errorName, tt_errorName, "Name cann't be empty"); //validate email validateEmail(tb_email, p_errorEmail, tt_errorEmail); if (!tb_email.Text.Equals("")) { if (!ValidatorExtensions.IsValid(tb_email.Text)) { emailError = true; } } //chk empty mobile validateEmptyTextBox(tb_mobile, p_errorMobile, tt_errorMobile, "Mobile number cann't be empty"); } #endregion #region save if ((!tb_name.Text.Equals("")) && (!tb_mobile.Text.Equals("")) && !emailError) { //save name if (!tb_name.Text.Equals("")) { setVName.value = tb_name.Text; setVName.isSystem = 1; setVName.isDefault = 1; setVName.settingId = nameId; // string sName = await valueModel.Save(setVName); int sName = await valueModel.Save(setVName); if (!sName.Equals(0)) { MainWindow.companyName = tb_name.Text; } } //save address if (!tb_address.Text.Equals("")) { setVAddress.value = tb_address.Text; setVAddress.isSystem = 1; setVAddress.isDefault = 1; setVAddress.settingId = addressId; int sAddress = await valueModel.Save(setVAddress); // string sAddress = await valueModel.Save(setVAddress); if (!sAddress.Equals(0)) { MainWindow.Address = tb_address.Text; } } //save email if ((!tb_email.Text.Equals("")) && (!emailError)) { setVEmail.value = tb_email.Text; setVEmail.isSystem = 1; setVEmail.settingId = emailId; setVEmail.isDefault = 1; // string sEmail = await valueModel.Save(setVEmail); int sEmail = await valueModel.Save(setVEmail); if (!sEmail.Equals(0)) { MainWindow.Email = tb_email.Text; } } //save mobile if (!tb_mobile.Text.Equals("")) { setVMobile.value = cb_areaMobile.Text + "-" + tb_mobile.Text; setVMobile.isSystem = 1; setVMobile.isDefault = 1; setVMobile.settingId = mobileId; int sMobile = await valueModel.Save(setVMobile); if (!sMobile.Equals(0)) { MainWindow.Mobile = cb_areaMobile.Text + tb_mobile.Text; } } //save phone if (!tb_phone.Text.Equals("")) { setVPhone.value = cb_areaPhone.Text + "-" + cb_areaPhoneLocal.Text + "-" + tb_phone.Text; setVPhone.isSystem = 1; setVPhone.isDefault = 1; setVPhone.settingId = phoneId; int sPhone = await valueModel.Save(setVPhone); if (!sPhone.Equals(0)) { MainWindow.Phone = cb_areaPhone.Text + cb_areaPhoneLocal.Text + tb_phone.Text; } } //save fax if (!tb_fax.Text.Equals("")) { setVFax.value = cb_areaFax.Text + "-" + cb_areaFaxLocal.Text + "-" + tb_fax.Text; setVFax.isSystem = 1; setVFax.isDefault = 1; setVFax.settingId = faxId; int sFax = await valueModel.Save(setVFax); if (!sFax.Equals(0)) { MainWindow.Fax = cb_areaFax.Text + cb_areaFaxLocal.Text + tb_fax.Text; } } // save logo // image // string sLogo = ""; int sLogo = 0; if (isImgPressed) { isImgPressed = false; setVLogo.value = sLogo.ToString(); setVLogo.isSystem = 1; setVLogo.isDefault = 1; setVLogo.settingId = logoId; sLogo = await valueModel.Save(setVLogo); if (!sLogo.Equals(0)) { MainWindow.logoImage = setVLogo.value; string b = await setVLogo.uploadImage(imgFileName, Md5Encription.MD5Hash("Inc-m" + sLogo), sLogo); setVLogo.value = b; MainWindow.logoImage = b; sLogo = await valueModel.Save(setVLogo); await valueModel.getImg(setVLogo.value); } } #endregion if (!isFirstTime) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn); await Task.Delay(1500); } this.Close(); } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }