Example #1
0
        private bool AddItemUsingBarcode(string aBarcode)
        {
            try
            {
                if (!ItemsMgmt.IsItemTouchScreen(aBarcode))
                {
                    DataTable aItemTable = ItemsMgmt.SelectItemByBarCode(aBarcode);
                    if (aItemTable.Rows.Count == 1)
                    {
                        TeldgView.ClearSelection();
                        int RowNum = TeldgView.Rows.Add();
                        TeldgView.Rows[RowNum].Cells["Barcode"].Value      = aItemTable.Rows[0]["Barcode"].ToString();
                        TeldgView.Rows[RowNum].Cells["Description"].Value  = aItemTable.Rows[0]["Description"].ToString();
                        TeldgView.Rows[RowNum].Cells["PricePerUnit"].Value = aItemTable.Rows[0]["SellPrice"].ToString();
                        TeldgView.Rows[RowNum].Cells["AvalQty"].Value      = aItemTable.Rows[0]["Qty"].ToString();
                        TeldgView.Rows[RowNum].Selected = true;
                        BarcodeTxtBox.Text = string.Empty;
                        ItemsMgmt.MakeItemTouchScreen(aBarcode, true);
                        // MessageBox.Show(MsgTxt.UpdateSuccessfully, MsgTxt.UpdateSuccessfully, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return(true);
                    }
                    else
                    {
                        MessageBox.Show(MsgTxt.ItemNotFoundTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        BarcodeTxtBox.Text = string.Empty;
                        return(false);
                    }
                }
                else
                {
                    MessageBox.Show(MsgTxt.AlreadyUsedTxt, MsgTxt.InformationCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [AddItemUsingBarcode] \n Exception: \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return(false);

                throw;
            }
        }
Example #2
0
 private void DeleteItemsBtn_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (DataGridViewRow row in TeldgView.SelectedRows)
         {
             if (!row.IsNewRow)
             {
                 ItemsMgmt.MakeItemTouchScreen(row.Cells["Barcode"].Value.ToString(), false);
                 TeldgView.Rows.Remove(row);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [DeleteItemsBtn_Click] \n Exception: \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         throw;
     }
 }