Ejemplo n.º 1
0
        public static List <clsBilling> selectAll()
        {
            List <clsBilling> x = new List <clsBilling>();

            using (SqlConnection conn = new SqlConnection(sqlconnstring))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("shop.spSelectAllBilling", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    clsBilling y = new clsBilling();
                    y.ID            = Convert.ToInt32(rdr["ID"]);
                    y.InvoiceNo     = Convert.ToString(rdr["InvoiceNo"]);
                    y.InvoiceDate   = Convert.ToDateTime(rdr["InvoiceDate"]);
                    y.Product       = Convert.ToString(rdr["PartName"]);
                    y.FullName      = Convert.ToString(rdr["FullName"]);
                    y.Amount        = Convert.ToInt32(rdr[@"Amount\Qty"]);
                    y.PaymentMethod = Convert.ToString(rdr["PaymentMethod"]);
                    y.IsInCart      = Convert.ToBoolean(rdr["IsInCart"]);
                    y.Remarks       = Convert.ToString(rdr["Remarks"]);

                    x.Add(y);
                }
            }
            return(x);
        }
Ejemplo n.º 2
0
 public static int insert(clsBilling x)
 {
     using (SqlConnection conn = new SqlConnection(sqlconnstring))
     {
         conn.Open();
         SqlCommand cmd = new SqlCommand("shop.spInsertBilling", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@ivno", x.InvoiceNo);
         cmd.Parameters.AddWithValue("@ivdate", x.InvoiceDate);
         cmd.Parameters.AddWithValue("@pid", x.PID);
         cmd.Parameters.AddWithValue("@cid", x.CID);
         cmd.Parameters.AddWithValue("@qty", x.Amount);
         cmd.Parameters.AddWithValue("@pm", x.PaymentMethod);
         cmd.Parameters.AddWithValue("@is", x.IsInCart);
         cmd.Parameters.AddWithValue("@rem", x.Remarks);
         int r = cmd.ExecuteNonQuery();
         return(r);
     }
 }