コード例 #1
0
 public void FillData(CustomersBussines _cus)
 {
     try
     {
         txtPhone1.Text     = _cus.Phone1;
         txtPhone2.Text     = _cus.Phone2;
         txtMobile1.Text    = _cus.Mobile1;
         txtMobile2.Text    = _cus.Mobile2;
         txtEmail.Text      = _cus.Email;
         txtPostalCode.Text = _cus.PostalCode;
         txtFax.Text        = _cus.Fax;
         txtAddress.Text    = _cus.Address;
         if (_cus.Pic == null)
         {
             return;
         }
         var path = Path.Combine(Application.StartupPath + "\\pictures\\Customer", _cus.Pic);
         picPerssonel.ImageLocation = path;
     }
     catch (Exception ex)
     {
         frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, ex.Message);
         f.ShowDialog();
     }
 }
コード例 #2
0
 public void FillData(CustomersBussines _cus)
 {
     try
     {
         txtHadeEtebar.Text   = _cus.HadeEtebar.ToString();
         txtJob.Text          = _cus.Job;
         txtCompanyName.Text  = _cus.CompanyName;
         txtShomareSabt.Text  = _cus.ShomareSabt;
         txtEconomyCode.Text  = _cus.EconomyNumber;
         txtCusClubPoint.Text = _cus.ClubPoint.ToString();
         txtNahveAshnaei.Text = _cus.NahveAshnaei;
         txtHesabNumber1.Text = _cus.HesabNumber1;
         txtHesabNumber2.Text = _cus.HesabNumber2;
         txtCardNumber1.Text  = _cus.CardNumber1;
         txtCardNumber2.Text  = _cus.CardNumber2;
         txtSubCode.Text      = _cus.SubCode;
         if (_cus.PayType == PayType.Naqdi)
         {
             rbtnNaqdi.Checked = true;
         }
         else
         {
             rbtnEtebari.Checked = true;
         }
     }
     catch (Exception ex)
     {
         var f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, ex.Message);
         f.ShowDialog();
     }
 }
コード例 #3
0
        private CustomersBussines GetCustomer(CustomersBussines _p)
        {
            try
            {
                switch (top)
                {
                case 0:
                    _p = frmCustomer_PublicInfo.PublicInfo.SetData(_cus);
                    break;

                case 1:
                    _p = frmCustomer_CallInfo.CallInfo.SetData(_cus);
                    break;

                case 2:
                    _p = frmCustomer_AouthInfo.AouthInfo.SetData(_cus);
                    break;
                }

                return(_p);
            }
            catch (Exception ex)
            {
                frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, ex.Message);
                f.ShowDialog();
                return(null);
            }
        }
コード例 #4
0
 public CustomersBussines SetData(CustomersBussines _cus)
 {
     try
     {
         _cus.HadeEtebar    = txtHadeEtebar.Text.ParseToDecimal();
         _cus.Job           = txtJob.Text;
         _cus.CompanyName   = txtCompanyName.Text;
         _cus.ShomareSabt   = txtShomareSabt.Text;
         _cus.EconomyNumber = txtEconomyCode.Text;
         _cus.ClubPoint     = txtCusClubPoint.Text.ParseToInt();
         _cus.NahveAshnaei  = txtNahveAshnaei.Text;
         _cus.HesabNumber1  = txtHesabNumber1.Text;
         _cus.HesabNumber2  = txtHesabNumber2.Text;
         _cus.CardNumber1   = txtCardNumber1.Text;
         _cus.CardNumber2   = txtCardNumber2.Text;
         _cus.PayType       = rbtnNaqdi.Checked ? PayType.Naqdi : PayType.Etebari;
         _cus.SubCode       = txtSubCode.Text;
         return(_cus);
     }
     catch (Exception ex)
     {
         var f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, ex.Message);
         f.ShowDialog();
         return(null);
     }
 }
コード例 #5
0
 private void mnuDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (DGrid.RowCount == 0)
         {
             return;
         }
         var        accGuid = (Guid)DGrid[dgGuid.Index, DGrid.CurrentRow.Index].Value;
         var        Acc     = CustomersBussines.Get(accGuid);
         string     message = "آیا از حذف " + Acc.Name + " " + "اطمینان دارید؟";
         frmMessage frm     = new frmMessage(EnumMessageFlag.DeleteFlag, Color.PapayaWhip, message);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             Acc = CustomersBussines.Change_Status(accGuid, false);
             if (Acc.Save())
             {
                 frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Green, "عملیات با موفقیت انجام شد");
                 f.ShowDialog();
                 LoadData();
             }
         }
     }
     catch (Exception exception)
     {
         frmMessage frm = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message);
         frm.ShowDialog();
     }
 }
コード例 #6
0
 public frmCustomer(Guid guid, bool Is_Show)
 {
     InitializeComponent();
     Count = listForms.Count();
     _cus  = CustomersBussines.Get(guid);
     pnlContent.Enabled = Is_Show;
     btnFinish.Enabled  = Is_Show;
 }
コード例 #7
0
        public void FillData(CustomersBussines _cus)
        {
            try
            {
                cmbType.Items.Clear();
                cmbType.Items.Add(SellerType.A_Haqiqi.GetDisplay());
                cmbType.Items.Add(SellerType.A_Hoqouqi.GetDisplay());
                cmbType.SelectedIndex = 0;
                lblCode.Text          = AccountGroupBussines.Get((int)HesabType.A_Haqiqi).Aouth_Code;
                LoadGroups();
                LoadMahiat();
                txtCode.Text   = _cus.Half_Code;
                txtName.Text   = _cus.Name;
                txtAmount.Text = (Math.Abs(_cus.Amount_AvalDore)).ToString();
                txtDateBirth.Value.FarsiSelectedDate = _cus.DateBirth;
                txtDescription.Text = _cus.Description;
                moein                 = MoeinBussines.Get(_cus.MoeinAmountAvalDore);
                txtMoeinName.Text     = moein?.Name ?? "";
                txtMoeinCode.Text     = moein?.Code ?? "";
                cmbType.SelectedIndex = _cus.Type == SellerType.A_Haqiqi ? 0 : 1;
                if (_cus.GroupGuid != Guid.Empty)
                {
                    cmbGroup.SelectedValue = _cus.GroupGuid;
                }
                else
                {
                    if (cusGroupBindingSource.Count > 0)
                    {
                        cmbGroup.SelectedIndex = 0;
                    }
                }

                if (_cus.Guid == Guid.Empty)
                {
                    NewCode();
                }

                if (_cus.Amount_AvalDore < 0)
                {
                    cmbAmountMahiat.SelectedIndex = 1;
                }
                if (_cus.Amount_AvalDore == 0)
                {
                    cmbAmountMahiat.SelectedIndex = 0;
                }
                if (_cus.Amount_AvalDore > 0)
                {
                    cmbAmountMahiat.SelectedIndex = 2;
                }
            }
            catch (Exception ex)
            {
                frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, ex.Message);
                f.ShowDialog();
            }
        }
コード例 #8
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     _cus = GetCustomer(_cus);
     if (btnBack.Text == "خروج")
     {
         btnCancel.PerformClick();
         return;
     }
     Back();
 }
コード例 #9
0
 private void btnNext_Click(object sender, EventArgs e)
 {
     _cus = GetCustomer(_cus);
     if (btnNext.Text == "ثبت اطلاعات")
     {
         btnFinish.PerformClick();
         return;
     }
     Next();
 }
コード例 #10
0
 public CustomersBussines SetData(CustomersBussines _cus)
 {
     try
     {
         _cus.Phone1        = txtPhone1.Text;
         _cus.Phone2        = txtPhone2.Text;
         _cus.Mobile1       = txtMobile1.Text;
         _cus.Mobile2       = txtMobile2.Text;
         _cus.Email         = txtEmail.Text;
         _cus.PostalCode    = txtPostalCode.Text;
         _cus.Fax           = txtFax.Text;
         _cus.Address       = txtAddress.Text;
         _cus.Pic           = Pic;
         picPerssonel.Image = null;
         return(_cus);
     }
     catch (Exception ex)
     {
         frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, ex.Message);
         f.ShowDialog();
         return(null);
     }
 }
コード例 #11
0
        public void LoadData(string search = "")
        {
            try
            {
                if (search == "")
                {
                    var lst = CustomersBussines.GetAll().Where(q => q.Status).OrderBy(q => q.Name).ToList();
                    CustomerBindingSource.DataSource = lst.ToList();
                }
                else
                {
                    var list = CustomersBussines.Search(search).Where(q => q.Status).OrderBy(q => q.Name).ToList();
                    CustomerBindingSource.DataSource = list;
                }

                lblCounter.Text = CustomerBindingSource.Count.ToString();
            }
            catch (Exception exception)
            {
                var frm = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message);
                frm.ShowDialog();
            }
        }
コード例 #12
0
        public CustomersBussines SetData(CustomersBussines _cus)
        {
            try
            {
                _cus.Code                = lblCode.Text + txtCode.Text;
                _cus.Half_Code           = txtCode.Text;
                _cus.GroupGuid           = (Guid)cmbGroup.SelectedValue;
                _cus.DateBirth           = txtDateBirth.Value.FarsiSelectedDate;
                _cus.Name                = txtName.Text.Trim();
                _cus.Description         = txtDescription.Text;
                _cus.MoeinAmountAvalDore = moein?.Guid ?? Guid.Empty;
                _cus.Type                = cmbType.SelectedIndex == 0 ? SellerType.A_Haqiqi : SellerType.A_Hoqouqi;
                var amount = txtAmount.Text.Replace(",", "").ParseToDecimal();
                switch (cmbAmountMahiat.SelectedIndex)
                {
                case 0:
                    _cus.Amount_AvalDore = 0;
                    break;

                case 1:
                    _cus.Amount_AvalDore = -amount;
                    break;

                case 2:
                    _cus.Amount_AvalDore = +amount;
                    break;
                }
                return(_cus);
            }
            catch (Exception ex)
            {
                frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, ex.Message);
                f.ShowDialog();
                return(null);
            }
        }
コード例 #13
0
 public frmCustomer()
 {
     InitializeComponent();
     Count = listForms.Count();
     _cus  = new CustomersBussines();
 }
コード例 #14
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                _cus        = GetCustomer(_cus);
                _cus.Status = true;
                if (_cus.Guid == Guid.Empty)
                {
                    _cus.Guid     = Guid.NewGuid();
                    _cus.DateSabt = DateConvertor.M2SH(DateTime.Now);
                }

                if (string.IsNullOrEmpty(_cus.Code) || !CustomersBussines.Check_Code(_cus.Code, _cus.Guid))
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                                  "کد شناسایی مشتری مورد نظر، معتبر نمی باشد");
                    f.ShowDialog();
                    return;
                }
                if (string.IsNullOrEmpty(_cus.Name) || !CustomersBussines.Check_Name(_cus.Name, _cus.Guid))
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                                  "نام مشتری مورد نظر، معتبر نمی باشد");
                    f.ShowDialog();
                    return;
                }

                if (_cus.GroupGuid == Guid.Empty)
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                                  "گروه مشتری مورد نظر، معتبر نمی باشد");
                    f.ShowDialog();
                    return;
                }

                if (_cus.Amount_AvalDore != 0 && _cus.MoeinAmountAvalDore == Guid.Empty)
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                                  "معین حساب مانده اول دوره مشتری مورد نظر، معتبر نمی باشد");
                    f.ShowDialog();
                    return;
                }
                if (!CheckPerssonValidation.Check_Mobile(_cus.Mobile1) || !CheckPerssonValidation.Check_Mobile(_cus.Mobile2))
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                                  "تلفن همراه مشتری مورد نظر، معتبر نمی باشد");
                    f.ShowDialog();
                    return;
                }

                if (!CheckPerssonValidation.Check_Email(_cus.Email))
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                                  "پست الکترونیک مشتری مورد نظر، معتبر نمی باشد");
                    f.ShowDialog();
                    return;
                }

                if (_cus.Save())
                {
                    var f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Green, "عملیات با موفقیت انجام شد");
                    f.ShowDialog();
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, ex.Message);
                f.ShowDialog();
            }
        }