Example #1
0
 private void btnAddItem_Click(object sender, EventArgs e)
 {
     clsUtility.ExecuteSQLQuery(" SELECT  * FROM   Users  WHERE   USER_ID = '" + clsUtility.UserID + "' AND   Can_Add = 'Y' ");
     if (clsUtility.sqlDT.Rows.Count > 0)
     {
         ///////////////////////////////////////////
         if (rbItem.Checked)
         {
             if (cmbItemName.SelectedValue == null | cmbItemName.SelectedIndex == -1 | string.IsNullOrWhiteSpace(this.txtQty.Text))
             {
                 errorProvider.SetError(cmbItemName, "Required"); errorProvider.SetError(txtQty, "Required");
             }
             else
             {
                 InsertSalesItem(cmbItemName.SelectedValue.ToString(), Convert.ToDouble(txtQty.Text));
                 errorProvider.Clear();
                 LoadSalesItem();
                 txtQty.Text = "";
             }
         }
         else
         {
             if (string.IsNullOrWhiteSpace(txtBarcode.Text) | string.IsNullOrWhiteSpace(this.txtQty.Text))
             {
                 errorProvider.SetError(txtBarcode, "Required"); errorProvider.SetError(txtQty, "Required");
             }
             else
             {
                 double ITEM_ID;
                 clsUtility.ExecuteSQLQuery("SELECT * FROM ItemInformation WHERE  Barcode = '" + txtBarcode.Text + "'");
                 if (clsUtility.sqlDT.Rows.Count > 0)
                 {
                     ITEM_ID = Convert.ToDouble(clsUtility.sqlDT.Rows[0]["ITEM_ID"]);
                     InsertSalesItem(ITEM_ID.ToString(), Convert.ToDouble(txtQty.Text));
                     errorProvider.Clear();
                     LoadSalesItem();
                     txtQty.Text     = "";
                     txtBarcode.Text = "";
                 }
                 else
                 {
                     clsUtility.MesgBoxShow("msgNotFound", "info");
                 }
             }
         }
         ///////////////////////////////////////////
     }
     else
     {
         clsUtility.MesgBoxShow("msgPermission", "err");
     }
 }
Example #2
0
 private void txtBarcode_KeyPress(object sender, KeyPressEventArgs e)
 {
     clsUtility.ExecuteSQLQuery(" SELECT  * FROM   Users  WHERE   USER_ID = '" + clsUtility.UserID + "' AND   Can_Add = 'Y' ");
     if (clsUtility.sqlDT.Rows.Count > 0)
     {
         ///////////////////////////////////////////
         if (e.KeyChar == Convert.ToChar(Keys.Return))
         {
             if (string.IsNullOrWhiteSpace(txtBarcode.Text))
             {
                 errorProvider.SetError(txtBarcode, "Required");
             }
             else
             {
                 errorProvider.Clear();
                 double ITEM_ID;
                 clsUtility.ExecuteSQLQuery("SELECT * FROM ItemInformation WHERE  (Barcode LIKE '%" + txtBarcode.Text + "%')   ");
                 if (clsUtility.sqlDT.Rows.Count > 0)
                 {
                     errorProvider.Clear();
                     ITEM_ID = Convert.ToDouble(clsUtility.sqlDT.Rows[0]["ITEM_ID"]);
                     InsertSalesItem(ITEM_ID.ToString(), 1);
                     LoadSalesItem();
                     txtBarcode.Text = "";
                     txtBarcode.Focus();
                 }
                 else
                 {
                     clsUtility.MesgBoxShow("msgNotFound", "info");
                 }
             }
         }
         ///////////////////////////////////////////
     }
     else
     {
         clsUtility.MesgBoxShow("msgPermission", "err");
     }
 }