示例#1
0
        private void Save()
        {
            try
            {
                if (IsExistBarcode(txtBarcode.Text.Trim()))
                {
                    MessageBox.Show("This Barcode already used!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtBarcode.Focus();
                }
                else
                {
                    Database.ConnStr obj = new Database.ConnStr();

                    string sql = "Insert into tbl_customers(Barcode, Cust_name, Place, Mobile, email) values('"
                                 + txtBarcode.Text.Trim() + "','" + txtname.Text.Trim() + "','" + txtplace.Text.Trim() + "','"
                                 + txtmobile.Text.Trim() + "','" + txtemail.Text.Trim() + "')";

                    obj.RunQuery(sql);
                    MessageBox.Show("Record Saved!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefreshGrid();
                    ClearText();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, ":: User Account ::", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void Edit()
        {
            try
            {
                Database.ConnStr obj = new Database.ConnStr();

                string sql = "UPDATE tbl_customers SET "
                             + " Barcode = '" + txtBarcode.Text
                             + "', Cust_name = '" + txtname.Text
                             + "', Place = '" + txtplace.Text
                             + "', Mobile = '" + txtmobile.Text
                             + "', email = '" + txtmobile.Text
                             + "' WHERE ID = '" + CurrID + "'";

                obj.RunQuery(sql);
                MessageBox.Show("Record Updated!", "Smart Loyalty", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RefreshGrid();
                ClearText();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, ":: User Account ::", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }