public static int RemoveAll(string customerID) { dbcon obj = new dbcon(); SqlParameter[] objParams = new SqlParameter[1]; objParams[0] = new SqlParameter("@CustomerID", customerID); return(obj.ExecuteNonQuery("EmptyCart", objParams)); }
public static int UpdateItem(ShoppingCartItem item) { dbcon obj = new dbcon(); SqlParameter[] objParams = new SqlParameter[3]; objParams[0] = new SqlParameter("@Quantity", item.Quantity); objParams[1] = new SqlParameter("@CustomerID", item.CustomerID); objParams[2] = new SqlParameter("@ProductID", item.ProductID); return(obj.ExecuteNonQuery("UpdateCart", objParams)); }
public int insertUser(registerUser reg) { dbcon obj = new dbcon(); SqlParameter[] objParams = new SqlParameter[6]; objParams[0] = new SqlParameter("@UserName", reg.UserName); objParams[1] = new SqlParameter("@Password", reg.Password); objParams[2] = new SqlParameter("@FirstName", reg.FirstName); objParams[3] = new SqlParameter("@LastName", reg.LastName); objParams[4] = new SqlParameter("@Email", reg.Email); objParams[5] = new SqlParameter("@Mobile", reg.MobileNo); //objParams[6] = new SqlParameter("@Result", reg.result); int b = obj.ExecuteNonQuery("insertUser", objParams); return(b); }
public static int PlaceOrder(Order o, List <OrderItem> listOI) { dbcon obj = new dbcon(); SqlParameter[] objParams = new SqlParameter[14]; objParams[0] = new SqlParameter("@CustomerID", o.CustomerID); objParams[1] = new SqlParameter("@OrderDate", o.OrderDate); objParams[2] = new SqlParameter("@FirstName", o.FirstName); objParams[3] = new SqlParameter("@LastName", o.LastName); objParams[4] = new SqlParameter("@Company", o.Company); objParams[5] = new SqlParameter("@Address", o.Address); objParams[6] = new SqlParameter("@Country", o.Country); objParams[7] = new SqlParameter("@City", o.City); objParams[8] = new SqlParameter("@Province", o.Province); objParams[9] = new SqlParameter("@ZipCode", o.ZipCode); objParams[10] = new SqlParameter("@Telephone", o.Telephone); objParams[11] = new SqlParameter("@Fax", o.Fax); objParams[12] = new SqlParameter("@totalAmount", o.TotaAmount); objParams[13] = new SqlParameter("@Status", o.status); o.OrderID = int.Parse(obj.ExecuteScalar("InsertOrder", objParams).ToString()); foreach (OrderItem item in listOI) { SqlParameter[] objParams2 = new SqlParameter[7]; objParams2[0] = new SqlParameter("@OrderID", o.OrderID); objParams2[1] = new SqlParameter("@ProductID", item.ProductID); objParams2[2] = new SqlParameter("@Quantity", item.Quantity); objParams2[3] = new SqlParameter("@UnitCost", item.UnitCost); objParams2[4] = new SqlParameter("@PurchaseDate", DateTime.Now); objParams2[5] = new SqlParameter("@ProductName", item.ProductName); objParams2[6] = new SqlParameter("@buyprice", item.buyPrice); obj.ExecuteNonQuery("InsertOrderItem", objParams2); } return(o.OrderID); }