public frmCustomer(Guid guid, bool isShowMode) { InitializeComponent(); cls = CustomerBussines.Get(guid); grpAccount.Enabled = !isShowMode; btnFinish.Enabled = !isShowMode; }
private async Task LoadDataAsync(bool status, string search = "") { try { lblAccount.Text = lblAccount_.Text = ""; if (InvokeRequired) { Invoke(new MethodInvoker(() => { if (cmbUsers.SelectedValue == null) { return; } })); } else if (cmbUsers.SelectedValue == null) { return; } list = await CustomerBussines.GetAllAsync(); Search(search, status); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.OrderMainLayout); FindElements(); SetSupportActionBar(myToolbar); BindList(); SetFonts(); order = new OrderBussines(); lblOrderCode.Text = OrderBussines.NextCode(); lblDateSh.Text = order?.DateSh; txtOrderMainLearningCount.Text = "1"; txtOrderMainDiscount.Text = order?.DetList?.Sum(q => q.Discount).ToString("N0"); SetLables(); var names = CustomerBussines.GetAll().Select(q => q.Name).ToList(); ArrayAdapter adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, names); txtOrderMainCustomerName.Adapter = adapter; OrderBussines.OnDetailsChanged += OrderBussines_OnDetailsChanged; txtOrderMainDiscount.TextChanged += TxtOrderMainDiscount_TextChanged; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.PardakhtMainLayout); myToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.PardakhtMainToolbar); SetSupportActionBar(myToolbar); FindElements(); SetCmbData(); SetFonts(); var names = CustomerBussines.GetAll().Select(q => q.Name).ToList(); ArrayAdapter adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, names); txtPardakhtMainCustomerName.Adapter = adapter; var names_ = PardakhtBussines.GetAll().Select(q => q.BankName).ToList(); ArrayAdapter adapter_ = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, names_); txtPardakhtMainBankName.Adapter = adapter_; cls = new PardakhtBussines(); txtPardakhtMainYear.Text = Calendar.GetYearOfDateSh(cls.DateSh).ToString(); txtPardakhtMainMounth.Text = Calendar.GetMonthOfDateSh(cls.DateSh).ToString(); txtPardakhtMainDay.Text = Calendar.GetDayOfDateSh(cls.DateSh).ToString(); lblPardakhtMainDateSh.Text = cls.DateSh; cmbSandouq.ItemSelected += CmbSandouq_ItemSelected; cmbBank.ItemSelected += CmbBank_ItemSelected; }
private async void btnFinish_Click(object sender, EventArgs e) { try { if (cls.Guid == Guid.Empty) { cls.Guid = Guid.NewGuid(); } if (string.IsNullOrEmpty(txtName.Text)) { frmNotification.PublicInfo.ShowMessage("عنوان نمی تواند خالی باشد"); txtName.Focus(); return; } if (!await CustomerBussines.CheckName(cls.Guid, txtName.Text.Trim())) { frmNotification.PublicInfo.ShowMessage("عنوان وارد شده تکراری است"); txtName.Focus(); return; } if (cmbGroup.SelectedValue == null) { frmNotification.PublicInfo.ShowMessage("گروه نمی تواند خالی باشد"); cmbGroup.Focus(); return; } cls.Name = txtName.Text.Trim(); cls.Description = txtDesc.Text; cls.GroupGuid = (Guid)cmbGroup.SelectedValue; cls.Address = txtAddress.Text; cls.NahveAshnaei = (EnNahveAshnaei)(cmbNahveAshnaei.SelectedIndex + 1); cls.NationalCode = txtPostalCode.Text; cls.NationalCode = txtNationalCode.Text; cls.Phone1 = txtTell1.Text; cls.Phone2 = txtTell2.Text; var res = await cls.SaveAsync(); if (res.HasError) { frmNotification.PublicInfo.ShowMessage(res.ErrorMessage); return; } DialogResult = DialogResult.OK; frmLoading.PublicInfo.ShowForm(); Close(); } catch (Exception exception) { WebErrorLog.ErrorInstence.StartErrorLog(exception); } }
private async Task LoadDataAsync(string search = "") { try { list = await CustomerBussines.GetAllAsync(); Search(search, true); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private void BindList() { try { list = CustomerBussines.GetAll(); lstCustomers.Adapter = new CustomerAccountAdapter(this, list.OrderBy(q => q.Name).ToList()); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private void SetCustomer(Guid guid) { try { _customer = CustomerBussines.Get(guid); txtCustName.Text = _customer?.Name; lblCompanyName.Text = _customer?.CompanyName; } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private async void btnFinish_Click(object sender, EventArgs e) { try { if (cls.Guid == Guid.Empty) { cls.Guid = Guid.NewGuid(); cls.CreateDate = DateTime.Now; cls.UserGuid = CurentUser.CurrentUser.Guid; } if (string.IsNullOrWhiteSpace(txtName.Text)) { frmNotification.PublicInfo.ShowMessage("عنوان نمی تواند خالی باشد"); txtName.Focus(); return; } cls.Name = txtName.Text.Trim(); cls.CompanyName = txtCompanyName.Text; cls.NationalCode = txtNationalCode.Text; cls.AppSerial = txtAppSerial.Text; cls.Address = txtAddress.Text; cls.PostalCode = txtPostalCode.Text; cls.Tell1 = txtTell1.Text; cls.Tell2 = txtTell2.Text; cls.Tell3 = txtTell3.Text; cls.Tell4 = txtTell4.Text; cls.Email = txtEmail.Text; cls.Description = txtDesc.Text; cls.Status = true; cls.LkSerial = txtLkSeral.Text; var res = await CustomerBussines.SaveAsync(cls); if (res.HasError) { frmNotification.PublicInfo.ShowMessage(res.ErrorMessage); return; } DialogResult = DialogResult.OK; Close(); } catch (Exception exception) { WebErrorLog.ErrorInstence.StartErrorLog(exception); } }
private void BindList() { try { list = CustomerBussines.GetAll(); if (CurrentUser.User.Type != EnUserType.Manager) { list = list.Where(q => q.UserGuid == CurrentUser.User.Guid).ToList(); } lstCustomers.Adapter = new CustomerAdapter(this, list.OrderBy(q => q.Name).ToList()); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private ReturnedSaveFuncInfo CheckValidation() { var res = new ReturnedSaveFuncInfo(); try { if (string.IsNullOrEmpty(txtPardakhtMainCustomerName.Text)) { res.AddReturnedValue(ReturnedState.Error, "مشتری انتخاب شده معتبر نمی باشد"); return(res); } var cust = CustomerBussines.Get(txtPardakhtMainCustomerName.Text); if (cust == null || cust.Guid == Guid.Empty) { res.AddReturnedValue(ReturnedState.Error, "مشتری انتخاب شده معتبر نمی باشد"); return(res); } customerGuid = cust.Guid; if (txtPardakhtMainNaqdPrice.Text.ParseToDecimal() <= 0 && txtPardakhtMainBankPrice.Text.ParseToDecimal() <= 0 && txtPardakhtMainCheckPrice.Text.ParseToDecimal() <= 0) { res.AddReturnedValue(ReturnedState.Error, "حتما باید یکی از قیلدهای مبلغ را وارد نمایید"); return(res); } if (txtPardakhtMainDay.Text.ParseToInt() > 0 && txtPardakhtMainDay.Text.ParseToInt() > 31) { res.AddReturnedValue(ReturnedState.Error, "تاریخ سررسید چک با فرمت ناصحیح پرشده است"); return(res); } if (txtPardakhtMainMounth.Text.ParseToInt() > 0 && txtPardakhtMainMounth.Text.ParseToInt() > 12) { res.AddReturnedValue(ReturnedState.Error, "تاریخ سررسید چک با فرمت ناصحیح پرشده است"); return(res); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } return(res); }
private async Task SetLabelsAsync() { try { var cust = await CustomerBussines.GetAllAsync(); var order = await OrderBussines.GetAllAsync(); var rece = await ReceptionBussines.GetAllAsync(); var pardakht = await PardakhtBussines.GetAllAsync(); var currentUser = CurentUser.CurrentUser; Invoke(new MethodInvoker(() => { lblAllCustomers.Text = lblMyCustomers.Text = ""; lblAllOrders.Text = lblMyOrders.Text = ""; lblAllPardakht.Text = lblMyPardakht.Text = lblSumPardakht.Text = ""; lblAllReceptions.Text = lblMyReceptions.Text = lblSumReception.Text = ""; lblAllCustomers.Text = (cust?.Count ?? 0).ToString(); lblMyCustomers.Text = (cust?.Where(q => q.UserGuid == currentUser.Guid)?.Count() ?? 0).ToString(); lblAllOrders.Text = (order?.Count ?? 0).ToString(); lblMyOrders.Text = (order?.Where(q => q.UserGuid == currentUser.Guid)?.Count() ?? 0).ToString(); lblAllPardakht.Text = (pardakht?.Count ?? 0).ToString(); lblMyPardakht.Text = (pardakht?.Where(q => q.UserGuid == currentUser.Guid)?.Count() ?? 0).ToString(); lblSumPardakht.Text = (pardakht?.Where(q => q.UserGuid == currentUser.Guid)?.Sum(q => q.TotalPrice) ?? 0) .ToString("N0"); lblAllReceptions.Text = (rece?.Count ?? 0).ToString(); lblMyReceptions.Text = (rece?.Where(q => q.UserGuid == currentUser.Guid)?.Count() ?? 0).ToString(); lblSumReception.Text = (rece?.Where(q => q.UserGuid == currentUser.Guid)?.Sum(q => q.TotalPrice) ?? 0).ToString("N0"); })); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
public override bool OnOptionsItemSelected(IMenuItem item) { var res = new ReturnedSaveFuncInfo(); res.AddReturnedValue(CheckValidation()); if (res.HasError) { Toast.MakeText(this, res.ErrorMessage, ToastLength.Short).Show(); return(base.OnOptionsItemSelected(item)); } if (cus == null) { cus = new CustomerBussines() { Guid = Guid.NewGuid(), Account = 0, HardSerial = "", AppSerial = "", Description = "", ExpireDate = DateTime.Now.AddYears(1), Modified = DateTime.Now, Password = "", SiteUrl = "", Status = true, Tell3 = "", Tell4 = "", UserGuid = CurrentUser.User.Guid, CreateDate = DateTime.Now, UserName = "" }; } cus.Tell1 = txtTell1.Text; cus.Tell2 = txtTell2.Text; cus.Name = txtName.Text; cus.CompanyName = txtCompany.Text; cus.Address = txtAddress.Text; cus.Email = txtEmail.Text; cus.NationalCode = txtNatCode.Text; cus.PostalCode = txtZip.Text; CustomerBussines.Save(cus); Finish(); return(base.OnOptionsItemSelected(item)); }
private void btnFinish_Click(object sender, EventArgs e) { try { if (DGrid.RowCount <= 0 || DGrid.CurrentRow == null) { return; } var guid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value; Customer = CustomerBussines.Get(guid); DialogResult = DialogResult.OK; Close(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
private ReturnedSaveFuncInfo CheckValidation() { var res = new ReturnedSaveFuncInfo(); try { if (string.IsNullOrEmpty(txtOrderMainCustomerName.Text)) { res.AddReturnedValue(ReturnedState.Error, "مشتری انتخاب شده معتبر نمی باشد"); return(res); } var cust = CustomerBussines.Get(txtOrderMainCustomerName.Text); if (cust == null || cust.Guid == Guid.Empty) { res.AddReturnedValue(ReturnedState.Error, "مشتری انتخاب شده معتبر نمی باشد"); return(res); } customerGuid = cust.Guid; if (order?.DetList == null || order.DetList.Count <= 0) { res.AddReturnedValue(ReturnedState.Error, "لیست اقلام نمی تواند خالی باشد"); return(res); } if (txtOrderMainDiscount.Text.ParseToDecimal() > order?.DetList?.Sum(q => q.Total)) { res.AddReturnedValue(ReturnedState.Error, "تخفیف از جمع کل فاکتور نمی تواند بیشتر باشد"); return(res); } } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); res.AddReturnedValue(ex); } return(res); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CustomerMainLayout); myToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.mainCustToolbar); SetSupportActionBar(myToolbar); var guid = Intent.GetStringExtra("CusGuid"); var cusGuid = Guid.Empty; if (!string.IsNullOrEmpty(guid)) { cusGuid = Guid.Parse(guid); } cus = CustomerBussines.Get(cusGuid); txtName = FindViewById <EditText>(Resource.Id.txtName); txtCompany = FindViewById <EditText>(Resource.Id.txtCompany); txtNatCode = FindViewById <EditText>(Resource.Id.txtNatCode); txtZip = FindViewById <EditText>(Resource.Id.txtZipCode); txtTell1 = FindViewById <EditText>(Resource.Id.txtTell1); txtTell2 = FindViewById <EditText>(Resource.Id.txtTell2); txtEmail = FindViewById <EditText>(Resource.Id.txtEmail); txtAddress = FindViewById <EditText>(Resource.Id.txtAddress); SetFonts(); txtName.Text = cus?.Name; txtCompany.Text = cus?.CompanyName; txtNatCode.Text = cus?.NationalCode; txtZip.Text = cus?.PostalCode; txtTell1.Text = cus?.Tell1; txtTell2.Text = cus?.Tell2; txtEmail.Text = cus?.Email; txtAddress.Text = cus?.Address; }
public frmCustomer() { InitializeComponent(); cls = new CustomerBussines(); }
public frmCustomerLogMain(CustomerBussines cus) { InitializeComponent(); cls = cus; }