public string DeleteOrder(clsOrders prOrder) { try { int lcRecCount = ClsDBConnection.Execute( "DELETE FROM tbl_orders WHERE id = @Id", prepareOrderParameters(prOrder)); if (lcRecCount == 1) { return("Order is deleted"); } else { return("Error Unexpected order confirm count: " + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }
public string PutConfirmOrder(clsOrders prOrder) { try { int lcRecCount = ClsDBConnection.Execute( "UPDATE tbl_orders SET status = 1 WHERE id = @Id and updated_at = @UpdatedAt", prepareOrderParameters(prOrder)); if (lcRecCount == 1) { return("Order is confirmed"); } else { return("Error Unexpected order confirm count: " + lcRecCount); } } catch (Exception ex) { return(ex.GetBaseException().Message); } }
public string DeletePhone(clsPhone prPhone) { try { int lcRecCount = ClsDBConnection.Execute( "DELETE FROM tbl_all_products WHERE id = @Id", preparePhoneParameters(prPhone)); if (lcRecCount == 1) { return("One product deleted"); } else { return("Error Unexpected product update count: " + lcRecCount); } } catch (Exception ex) { return("Error: " + ex.GetBaseException().Message); } }
public string PostPhone(clsPhone prPhone) { try { int lcRecCount = ClsDBConnection.Execute("INSERT INTO tbl_all_products " + "(IMEI, name, item_price, description, color, type, availability, phone_condition, category_id, warrenty) " + "VALUES (@IMEI, @Name, @ItemPrice, @Description, @Color, @Type, @Availability, @Condition, @CategoryID, @Warrenty)", preparePhoneParameters(prPhone)); if (lcRecCount == 1) { return("One Product inserted"); } else { return("Error Unexpected Product insert count: " + lcRecCount); } } catch (Exception ex) { return("Error: " + ex.GetBaseException().Message); } }
public string PostOrder(clsOrders prOrder) { var validString = ValidateNewOrder(prOrder); if (validString == "true") { try { int lcRecCount = ClsDBConnection.Execute("INSERT INTO `tbl_orders` (`name`, `status`, `email`, " + "`amount`, `product_id`) VALUES (@Name, 0, @Email, @Amount, @ProductId)", prepareOrderParameters(prOrder)); if (lcRecCount == 1) { int lcRecUpdateCount = ClsDBConnection.Execute( "UPDATE tbl_all_products SET availability = 'Not Available' WHERE id = " + prOrder.ProductId + "", null); if (lcRecUpdateCount == 1) { return("Your order is completed."); } else { return("Error Unexpected order confirm count: " + lcRecCount); } } else { return("Error Unexpected Product insert count: " + lcRecCount); } } catch (Exception ex) { return("Error: " + ex.GetBaseException().Message); } } else { return(validString); } }
public string PutPhone(clsPhone prPhone) { try { int lcRecCount = ClsDBConnection.Execute( "UPDATE tbl_all_products SET IMEI = @IMEI, name = @Name, item_price = @ItemPrice, description = @Description, color = @Color, type = @Type, availability = @Availability, " + "phone_condition = @Condition, category_id = @CategoryID, warrenty = @Warrenty WHERE id = @Id", preparePhoneParameters(prPhone)); if (lcRecCount == 1) { return("One product updated"); } else { return("Error Unexpected product update count: " + lcRecCount); } } catch (Exception ex) { return("Error: " + ex.GetBaseException().Message); } }