private void mnuInsert_Click(object sender, EventArgs e)
 {
     if (Flag == 1)
     {
         frmProduct f = new frmProduct();
         f.op   = "Add";
         f.Flag = 0;
         f.Form_Load();
         try
         {
             f.cmbType.Text = trvProduct.SelectedNode.Text;
         }
         catch
         {
         }
         f.ShowDialog();
     }
     else
     {
         frmProduct f = new frmProduct();
         f.op   = "Add";
         f.Flag = 0;
         f.Form_Load();
         f.ShowDialog();
     }
 }
 private void mnuInsert_Click(object sender, EventArgs e)
 {
     try
     {
         frmProduct f = new frmProduct();
         f.op   = "Add";
         f.Flag = 0;
         f.Form_Load();
         f.ShowDialog();
     }
     catch
     {
     }
 }
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == Keys.Enter)
     {
         try
         {
             if (dgvStore.CurrentCell.ColumnIndex == 0)
             {
                 Get_Product();
                 Calculate_INC();
                 Calculate_DEC();
             }
             if (dgvStore.CurrentCell.ColumnIndex == 2 || dgvStore.CurrentCell.ColumnIndex == 3)
             {
                 Inc_OR_Dec();
                 Calculate_INC();
                 Calculate_DEC();
             }
             SendKeys.Send("{tab}");
             return(true);
         }
         catch
         {
         }
     }
     if (keyData == Keys.Delete)
     {
         mnuDelete_Click(null, null);
         Calculate_INC();
         Calculate_DEC();
     }
     if (this.ActiveControl.GetType() != typeof(DevComponents.DotNetBar.Controls.ComboBoxEx))
     {
         if (keyData == Keys.F12)
         {
             try
             {
                 frmProduct f = new frmProduct();
                 f.op   = "Add";
                 f.Flag = 0;
                 f.Form_Load();
                 f.ShowDialog();
             }
             catch
             {
             }
         }
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }
 private void mnuView_Click(object sender, EventArgs e)
 {
     if (Flag == 0)
     {
         try
         {
             frmProduct f = new frmProduct();
             f.FillData(dgvProduct.CurrentRow.Cells["P_Name"].Value.ToString());
             f.grpBaseInfo.Enabled       = false;
             f.grpFull_Info.Enabled      = false;
             f.grpInventory_Info.Enabled = false;
             f.grpTax_Info.Enabled       = false;
             f.btnFinish.Enabled         = false;
             f.rbtnProduct.Enabled       = false;
             f.rbtnService.Enabled       = false;
             f.ShowDialog();
         }
         catch
         {
             frmMessage f = new frmMessage();
             f.flag            = 0;
             f.lblMessage.Text = "کالای انتخابی معتبر نمی باشد";
             f.ShowDialog();
         }
     }
     else if (Flag == 1)
     {
         try
         {
             frmProduct f = new frmProduct();
             f.FillData(trvProduct.SelectedNode.Text);
             f.grpBaseInfo.Enabled       = false;
             f.grpFull_Info.Enabled      = false;
             f.grpInventory_Info.Enabled = false;
             f.grpTax_Info.Enabled       = false;
             f.btnFinish.Enabled         = false;
             f.rbtnProduct.Enabled       = false;
             f.rbtnService.Enabled       = false;
             f.ShowDialog();
         }
         catch
         {
             frmMessage f = new frmMessage();
             f.flag            = 0;
             f.lblMessage.Text = "کالای انتخابی معتبر نمی باشد";
             f.ShowDialog();
         }
     }
 }
Пример #5
0
 private void cmbProduct_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 13)
     {
         dgvStore.Focus();
     }
     else if (e.KeyData == Keys.F12)
     {
         try
         {
             frmProduct f = new frmProduct();
             f.op   = "Add";
             f.Flag = 0;
             f.Form_Load();
             f.ShowDialog();
             Fill_Product();
         }
         catch
         {
         }
     }
 }
 private void mnuEdit_Click(object sender, EventArgs e)
 {
     if (Flag == 0)
     {
         try
         {
             frmProduct f = new frmProduct();
             f.op = "Edit";
             f.FillData(dgvProduct.CurrentRow.Cells["P_Name"].Value.ToString());
             f.ShowDialog();
         }
         catch
         {
             frmMessage f = new frmMessage();
             f.flag            = 0;
             f.lblMessage.Text = "کالای انتخابی معتبر نمی باشد";
             f.ShowDialog();
         }
     }
     else if (Flag == 1)
     {
         try
         {
             frmProduct f = new frmProduct();
             f.op = "Edit";
             f.FillData(trvProduct.SelectedNode.Text);
             f.ShowDialog();
         }
         catch
         {
             frmMessage f = new frmMessage();
             f.flag            = 0;
             f.lblMessage.Text = "کالای انتخابی معتبر نمی باشد";
             f.ShowDialog();
         }
     }
 }