示例#1
0
        /*
        public OtherTypes TransactionDate
        {
        set {_TransactionDate = value; }
        get { return _TransactionDate; }
        }
        */
        #endregion

        #region Class Methods
        public DataTable tblTransaction(BALtblTransaction objBALtblTransaction)
        {
            DataTable dt = new DataTable();
            try
            {
                dt = objDALtblTransaction.tblTransaction(objBALtblTransaction);
            }
            catch (Exception ex)
            { }
            return dt;
        }
示例#2
0
        private void tb_RFID_TextChanged(object sender, EventArgs e)
        {
            if (tb_RFID.Text.Length < 8) return;
            BALCust_Registration objCustomer = new BALCust_Registration();
            objCustomer.CRUD = "Search";
            objCustomer.RFID = Convert.ToInt64(tb_RFID.Text);
            DataTable dt = new DataTable();
            dt = objCustomer.Cust_Registration(objCustomer);
            lbl_CurrAmount.Text = dt.Rows[0]["CurrentBalance"].ToString();
            if (dt != null && dt.Rows.Count > 0)
            {
                lbl_PrvsAmount.Text = dt.Rows[0]["CurrentBalance"].ToString();
                BALCust_Registration oBALCust_Registration = new BALCust_Registration();
                oBALCust_Registration.CRUD = "Update";
                oBALCust_Registration.RFID = Convert.ToInt64(tb_RFID.Text);
                oBALCust_Registration.CurrentBalance = Convert.ToInt32(dt.Rows[0]["CurrentBalance"]) - 20;
                lbl_CurrAmount.Text = Convert.ToString(Convert.ToInt32(dt.Rows[0]["CurrentBalance"]) - 20);
                DataTable dtUpdate = new DataTable();
                oBALCust_Registration.Cust_Registration(oBALCust_Registration);


                BALtblTransaction oBALtblTransaction = new BALtblTransaction();
                oBALtblTransaction.CRUD = "Insert";
                oBALtblTransaction.RefID = Convert.ToInt64(tb_RFID.Text);
                DataTable dtInsert = new DataTable();
                dtInsert = oBALtblTransaction.tblTransaction(oBALtblTransaction);
                if (dtInsert != null && dtInsert.Rows.Count > 0)
                {
                    MessageBox.Show("Verified");
                    tb_RFID.Text = "";
                }




               
            }

        }
示例#3
0
        public DataTable tblTransaction(BALtblTransaction objBALtblTransaction)
        {
            DataTable dt = new DataTable();
            //TYPE YOUR STORE PROCEDURE NAME HERE
            string spName = "spro_tblTransaction";
            SqlParameter[] objSqlParameter = new SqlParameter[3];
            string where = "";
            try
            {
                #region Search

                if (objBALtblTransaction.WHERE != "")
                {
                    where += where == "" ? " WHERE " : " AND ";
                    where += objBALtblTransaction.WHERE;
                }
                //if (objBALtblTransaction.TransactionDate != 0)
                //{
                //    where += where == "" ? " WHERE " : " AND ";
                //    where += "TransactionDate='" + objBALtblTransaction.TransactionDate + "'";
                //}
                if (objBALtblTransaction.RefID != 0)
                {
                    where += where == "" ? " WHERE " : " AND ";
                    where += "RefID=" + objBALtblTransaction.RefID;
                }
                objBALtblTransaction.WHERE = where;
                #endregion

                #region Add

                objSqlParameter[0] = new SqlParameter("@CRUD", objBALtblTransaction.CRUD);
                objSqlParameter[1] = new SqlParameter("@WHERE", objBALtblTransaction.WHERE);

                //objSqlParameter[2] = new SqlParameter("@TransactionDate", objBALtblTransaction.TransactionDate);

                objSqlParameter[2] = new SqlParameter("@RefID", objBALtblTransaction.RefID);
                #endregion

                if (objBALtblTransaction.CRUD == "Insert" || objBALtblTransaction.CRUD == "Update" || objBALtblTransaction.CRUD == "Delete")
                {
                    dt.Columns.Add("pk", typeof(Int32));
                    DataRow dr = dt.NewRow();
                    dt.Rows.Add(dr);
                    int pk = 0;
                    pk = SqlHelper.ExecuteNonQuery(SqlHelper.SqlCon, CommandType.StoredProcedure, spName, objSqlParameter);
                    if (pk == 0)
                        dt.Rows[0][0] = 0;
                    else
                        dt.Rows[0][0] = 1;
                }
                else
                {
                    dt = SqlHelper.ExecuteDataset(SqlHelper.SqlCon, CommandType.StoredProcedure, spName, objSqlParameter).Tables[0];
                }
            }
            catch (Exception ex)
            {
                DataRow dr = dt.NewRow();
                dt.Rows.Add(dr);
                dt.Rows[0][0] = 0;
            }
            return dt;
        }