Example #1
0
        public List <Amt_Withdraw> WithdrawTransaction(int User_ID)
        {
            List <Amt_Withdraw> Items = new List <Amt_Withdraw>();

            using (SqlConnection con = new SqlConnection(ConnectionString.GetCon()))
            {
                SqlCommand cmd = new SqlCommand("SP_WithdrawTransaction", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("User_ID", User_ID);
                con.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        Amt_Withdraw temp = new Amt_Withdraw();
                        temp.W_ID    = Convert.ToInt32(dr["W_ID"]);
                        temp.User_ID = Convert.ToInt32(dr["User_ID"]);
                        temp.Date    = dr["Date"].ToString();
                        temp.Amount  = Convert.ToInt32(dr["Amount"]);


                        Items.Add(temp);
                    }
                }
            }
            return(Items);
        }
Example #2
0
        public int Withdraw(Amt_Withdraw data)
        {
            using (SqlConnection con = new SqlConnection(ConnectionString.GetCon()))
            {
                SqlCommand cmd = new SqlCommand("SP_Withdraw", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("User_ID", data.User_ID);
                cmd.Parameters.AddWithValue("Amount", data.Amount);

                con.Open();
                int Data = cmd.ExecuteNonQuery();
                return(Data);
            }
        }