Ejemplo n.º 1
0
 public frmStores(Guid anbarGuid, bool Is_Show)
 {
     InitializeComponent();
     anbar = AnbarBussines.Get(anbarGuid);
     grpAccount.Enabled = Is_Show;
     btnFinish.Enabled  = Is_Show;
 }
Ejemplo n.º 2
0
        private void BtnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                btnFinish.Enabled = false;
                if (anbar.Guid == Guid.Empty)
                {
                    anbar.DateSabt = DateConvertor.M2SH(DateTime.Now);
                    anbar.Guid     = Guid.NewGuid();
                }

                if (cmbGroup.SelectedValue == null)
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, "گروه انبار را وارد نمایید");
                    f.ShowDialog();
                    cmbGroup.Focus();
                    return;
                }

                if (string.IsNullOrWhiteSpace(txtName.Text))
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, "عنوان انبار را وارد نمایید");
                    f.ShowDialog();
                    txtName.Focus();
                    return;
                }

                if (!AnbarBussines.Check_Name(txtName.Text.Trim(), anbar.Guid))
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red,
                                                  "عنوان انبار وارد شده تکراری است");
                    f.ShowDialog();
                    txtName.Focus();
                    return;
                }

                anbar.AnbarGroup  = (Guid)cmbGroup.SelectedValue;
                anbar.Description = txtDescription.Text;
                anbar.Name        = txtName.Text;
                anbar.Status      = true;
                anbar.Manfi       = chbManfi.Checked;
                if (anbar.Save())
                {
                    frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Green, "عملیات با موفقیت انجام شد");
                    f.ShowDialog();
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception exception)
            {
                frmMessage frm = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message);
                frm.ShowDialog();
            }
            finally
            {
                btnFinish.Enabled = true;
            }
        }
Ejemplo n.º 3
0
        private void FrmStores_Load(object sender, EventArgs e)
        {
            Set_Data();
            var accounts = AnbarBussines.GetAll().ToList();
            AutoCompleteStringCollection _source = new AutoCompleteStringCollection();

            foreach (var item in accounts)
            {
                _source.Add(item.Name);
            }

            txtName.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            txtName.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            txtName.AutoCompleteCustomSource = _source;
        }
Ejemplo n.º 4
0
 public frmStores()
 {
     InitializeComponent();
     anbar = new AnbarBussines();
 }