private void SaveAdjustments()
        {
            try
            {
                if (!string.IsNullOrEmpty(searchLookUpEdit1.Text) && !string.IsNullOrEmpty(textBox24.Text))
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        DataClasses1DataContext db = new DataClasses1DataContext();



                        Edison_StockAdjustment AddNew = new Edison_StockAdjustment();

                        AddNew.Date = dateTimePicker5.Value;

                        AddNew.PID       = Convert.ToInt32(searchLookUpEdit1.EditValue);
                        AddNew.TotalQty  = Convert.ToInt32(textBox24.Text == "" ? "0" : textBox24.Text);
                        AddNew.Remarks   = textBox25.Text.Trim();
                        AddNew.StockType = comboBoxEdit1.Text.Trim();

                        db.Edison_StockAdjustments.InsertOnSubmit(AddNew);
                        db.SubmitChanges();

                        db.Dispose();
                        scope.Complete();


                        //MessageBox.Show("Confirmation Message! Stock Has been Added/Removed");
                    }
                }

                AdjustmentRevertState();
                AdjusmentDisableState();


                this.stockAdjustmentGridTableAdapter.Fill(this.dataSet1.StockAdjustmentGrid);
                this.edison_ProductListTableAdapter.Fill(this.dataSet11.Edison_ProductList);


                INV_btnAdd.Focus();
            }
            catch (Exception err)
            {
                MessageBox.Show("Error " + err);
            }
        }
Exemplo n.º 2
0
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            try
            {
                if (keyData == (Keys.Tab))
                {
                    return(true);
                }

                if (keyData == (Keys.Alt | Keys.A))
                {
                    INV_btnAdd.PerformClick();
                    return(true);
                }

                if (keyData == (Keys.Alt | Keys.R))
                {
                    INV_btnRevert.PerformClick();
                    return(true);
                }


                if (keyData == (Keys.Alt | Keys.S) && INV_btnSave.Visible == true)
                {
                    INV_btnSave.PerformClick();
                    return(true);
                }

                if (keyData == (Keys.Alt | Keys.S) && INV_btnEditSave.Visible == true)
                {
                    INV_btnEditSave.PerformClick();
                    return(true);
                }


                if (keyData == (Keys.Alt | Keys.E))
                {
                    INV_btnEdit.PerformClick();
                    return(true);
                }



                //if (keyData == (Keys.Alt | Keys.R) && CustomersTab.SelectedTab.Name.Equals("OrdersTab"))
                //{
                //    if (RevertOrder.Visible == true)
                //    {
                //        RevertOrder.PerformClick();
                //        return true;
                //    }

                //}

                return(base.ProcessCmdKey(ref msg, keyData));
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message + "ProcessCmdKey");
                return(base.ProcessCmdKey(ref msg, keyData));
            }
        }