protected override List <CDMAS> RetrieveOrderInfoByCIDDAL() { var list = new List <CDMAS>(); try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("RetrieveOrderInfoByCID", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var orderinfo = new CDMAS(); orderinfo.oID = int.Parse(reader["oID"].ToString()); orderinfo.iID = int.Parse(reader["iID"].ToString()); orderinfo.iName = reader["iName"].ToString(); orderinfo.Qty = int.Parse(reader["Qty"].ToString()); orderinfo.Subtotal = float.Parse(reader["Subtotal"].ToString()); orderinfo.Total = decimal.Parse(reader["Total"].ToString()); list.Add(orderinfo); } con.Close(); } } } } catch { } return(list); }
protected override bool CreateCustomerInfoDAL(CDMAS cdmas) { var result = 0; try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("CreateCustomerInfo", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); cmd.Parameters.AddWithValue("@FIRSTNAME", cdmas.FirstName); cmd.Parameters.AddWithValue("@LASTNAME", cdmas.LastName); cmd.Parameters.AddWithValue("@ADDRESS", cdmas.Address); cmd.Parameters.AddWithValue("@CONTACTNO", cdmas.ContactNo); cmd.Parameters.AddWithValue("@EMAIL", cdmas.Email); cmd.Parameters.AddWithValue("@DELIVOPTION", cdmas.DelivOption); result = cmd.ExecuteNonQuery(); cmd.Dispose(); } } } catch (Exception) { throw new ApplicationException("CREATE CUSTOMER INFORMATION FAILED"); } return(result == 1 ? true : false); }
protected override bool UpdateOrderInfoDAL(CDMAS cdmas) { var result = 0; try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("UpdateOrderInfo", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); cmd.Parameters.AddWithValue("@oID", cdmas.oID); cmd.Parameters.AddWithValue("@Qty", cdmas.Qty); result = cmd.ExecuteNonQuery(); cmd.Dispose(); } } } catch (Exception) { throw new ApplicationException("UPDATE ORDER INFORMATION FAILED"); } return(result == 1 ? true : false); }
protected override CDMAS ShowSalesDAL() { var Sales = new CDMAS(); try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("ShowSales", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Sales.GrossSales = decimal.Parse(reader["GrossSales"].ToString()); Sales.NetSales = decimal.Parse(reader["NetSales"].ToString()); } con.Close(); } } } } catch { } return(Sales); }
protected override bool UpdateItemDAL(CDMAS cdmas) { var result = 0; try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("UpdateItem", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); cmd.Parameters.AddWithValue("@IID", cdmas.iID); cmd.Parameters.AddWithValue("@NAME", cdmas.iName); cmd.Parameters.AddWithValue("@DESCRIPTION", cdmas.iDescription); cmd.Parameters.AddWithValue("@SRP", cdmas.iSRP); cmd.Parameters.AddWithValue("@NETPRICE", cdmas.iNetPrice); cmd.Parameters.AddWithValue("@AQty", cdmas.iAQty); cmd.Parameters.AddWithValue("@CATEGORY", cdmas.iCategory); result = cmd.ExecuteNonQuery(); cmd.Dispose(); } } } catch (Exception) { throw new ApplicationException("UPDATE ITEM FAILED"); } return(result == 1 ? true : false); }
protected override bool UpdateStatusDAL(CDMAS cdmas) { var result = 0; try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("UpdateStatus", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); cmd.Parameters.AddWithValue("@CID", cdmas.cID); cmd.Parameters.AddWithValue("@STATUS", cdmas.Status); result = cmd.ExecuteNonQuery(); cmd.Dispose(); } } } catch (Exception) { throw new ApplicationException("UPDATE STATUS FAILED"); } return(result == 1 ? true : false); }
internal bool UpdateStatus(CDMAS cdmas) { try { return(UpdateStatusDAL(cdmas)); } catch (Exception ex) { throw new ApplicationException(ex.Message); } }
internal bool CreateCustomerInfo(CDMAS cdmas) { try { return(CreateCustomerInfoDAL(cdmas)); } catch (Exception ex) { throw new ApplicationException(ex.Message); } }
public bool CreateOrderInfo(CDMAS cdmas) { try { return(orderinfobll.CreateOrderInfo(cdmas)); } catch (Exception ex) { throw new ApplicationException(ex.Message); } }
public bool UpdateItem(CDMAS cdmas) { try { return(itembll.UpdateItem(cdmas)); } catch (Exception ex) { throw new ApplicationException(ex.Message); } }
public bool UpdateStatus(CDMAS cdmas) { try { return(customerinfobll.UpdateStatus(cdmas)); } catch (Exception ex) { throw new ApplicationException(ex.Message); } }
public ActionResult Edit(int iID, CDMAS cdmas) { try { if (ModelState.IsValid) { cdmasm.UpdateItem(cdmas); ModelState.Clear(); return(RedirectToAction("Index")); } } catch { } return(View()); }
public ActionResult Index(CDMAS cdmas) { try { if (ModelState.IsValid) { cdmasm.CreateOrderInfo(cdmas); ModelState.Clear(); } } catch { } return(View()); }
public ActionResult Edit(int oID, CDMAS cdmas) { try { if (ModelState.IsValid) { cdmasm.UpdateOrderInfo(cdmas); ModelState.Clear(); return(RedirectToAction("Cart")); } } catch { } return(View()); }
public ActionResult Create(CDMAS cdmas) { try { if (ModelState.IsValid) { cdmasm.CreateOrderInfo(cdmas); ModelState.Clear(); return(RedirectToAction("Cart", "OrderInfo")); } } catch { } return(View()); }
public ActionResult Delete(int oID, CDMAS cdmas) { try { if (ModelState.IsValid) { cdmasm.DeleteOrderInfo(oID); ModelState.Clear(); return(RedirectToAction("Cart", "OrderInfo")); } } catch { } return(View()); }
public ActionResult Customer(CDMAS cdmas) { try { if (ModelState.IsValid) { cdmasm.CreateCustomerInfo(cdmas); ModelState.Clear(); return(RedirectToAction("CheckOutMsg")); } } catch { } return(View()); }
public ActionResult Edit(int cID, CDMAS cdmas) { try { if (ModelState.IsValid) { cdmasm.UpdateStatus(cdmas); ModelState.Clear(); } return(RedirectToAction("Customers")); } catch { return(View()); } }
public ActionResult Delete(int cID, CDMAS cdmas) { try { if (ModelState.IsValid) { cdmasm.DeleteCustomerInfo(cID); ModelState.Clear(); //return RedirectToAction("Category"); } return(RedirectToAction("Customers")); } catch { return(View()); } }
protected override CDMAS ShowCustomerInfoByCIDDAL(int cID) { var customerinfo = new CDMAS(); try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("ShowCustomerInfoByCID", con)) { cmd.Parameters.Add("@cID", SqlDbType.Int).Value = cID; cmd.CommandType = CommandType.StoredProcedure; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { customerinfo.cID = int.Parse(reader["cID"].ToString()); customerinfo.FirstName = reader["FirstName"].ToString(); customerinfo.LastName = reader["LastName"].ToString(); customerinfo.Address = reader["Address"].ToString(); customerinfo.ContactNo = reader["ContactNo"].ToString(); customerinfo.Email = reader["Email"].ToString(); customerinfo.DelivOption = reader["DelivOption"].ToString(); customerinfo.Status = reader["Status"].ToString(); customerinfo.tTotal = decimal.Parse(reader["tTotal"].ToString()); } con.Close(); } } } } catch (Exception) { throw new ApplicationException("SHOW CUSTOMER INFORMATION FAILED"); } return(customerinfo); }
protected override CDMAS ShowOrderInfoByOIDDAL(int oID) { var orderinfo = new CDMAS(); try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("ShowOrderInfoByOID", con)) { cmd.Parameters.Add("@oID", SqlDbType.Int).Value = oID; cmd.CommandType = CommandType.StoredProcedure; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { orderinfo.oID = int.Parse(reader["oID"].ToString()); orderinfo.DatePurchased = DateTime.Parse(reader["DatePurchased"].ToString()); orderinfo.Qty = int.Parse(reader["Qty"].ToString()); orderinfo.Subtotal = float.Parse(reader["Subtotal"].ToString()); orderinfo.NetTotal = float.Parse(reader["NetTotal"].ToString()); orderinfo.iName = reader["iName"].ToString(); orderinfo.iID = int.Parse(reader["iID"].ToString()); orderinfo.FirstName = reader["FirstName"].ToString(); orderinfo.LastName = reader["LastName"].ToString(); } con.Close(); } } } } catch { } return(orderinfo); }
protected override List <CDMAS> RetrieveAllOrderInfoDAL() { var list = new List <CDMAS>(); try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("RetrieveAllOrderInfo", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var orderinfo = new CDMAS(); orderinfo.oID = int.Parse(reader["oID"].ToString()); orderinfo.DatePurchased = DateTime.Parse(reader["DatePurchased"].ToString()); orderinfo.Qty = int.Parse(reader["Qty"].ToString()); orderinfo.Subtotal = float.Parse(reader["Subtotal"].ToString()); orderinfo.NetTotal = float.Parse(reader["NetTotal"].ToString()); orderinfo.iName = reader["iName"].ToString(); orderinfo.iID = int.Parse(reader["iID"].ToString()); orderinfo.FirstName = reader["FirstName"].ToString(); orderinfo.LastName = reader["LastName"].ToString(); orderinfo.iCategory = reader["iCategory"].ToString(); list.Add(orderinfo); } con.Close(); } } } } catch { } return(list); }
protected override List <CDMAS> CreateSalesforthedayDAL() { var list = new List <CDMAS>(); try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("CreateSalesfortheday", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var sales = new CDMAS(); sales.iName = reader["iName"].ToString(); sales.Qty = int.Parse(reader["Qty"].ToString()); sales.iSRP = float.Parse(reader["iSRP"].ToString()); sales.Subtotal = float.Parse(reader["Subtotal"].ToString()); sales.iNetPrice = float.Parse(reader["iNetPrice"].ToString()); sales.NetTotal = float.Parse(reader["NetTotal"].ToString()); sales.DatePurchased = DateTime.Parse(reader["DatePurchased"].ToString()); sales.GrossSales = decimal.Parse(reader["GrossSales"].ToString()); sales.NetSales = decimal.Parse(reader["NetSales"].ToString()); list.Add(sales); } con.Close(); } } } } catch { } return(list); }
protected override List <CDMAS> RetrieveAllCustomerInfoDAL() { var list = new List <CDMAS>(); try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("RetrieveAllCustomerInfo", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var customerinfo = new CDMAS(); customerinfo.cID = int.Parse(reader["cID"].ToString()); customerinfo.FirstName = reader["FirstName"].ToString(); customerinfo.LastName = reader["LastName"].ToString(); customerinfo.Address = reader["Address"].ToString(); customerinfo.ContactNo = reader["ContactNo"].ToString(); customerinfo.Email = reader["Email"].ToString(); customerinfo.DelivOption = reader["DelivOption"].ToString(); customerinfo.Status = reader["Status"].ToString(); customerinfo.tTotal = decimal.Parse(reader["tTotal"].ToString()); list.Add(customerinfo); } con.Close(); } } } } catch { } return(list); }
protected override List <CDMAS> RetrieveAllItemDAL() { var list = new List <CDMAS>(); try { using (var con = new SqlConnection(_conStr)) { using (var cmd = new SqlCommand("RetrieveAllItem", con)) { cmd.CommandType = CommandType.StoredProcedure; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var item = new CDMAS(); item.iID = int.Parse(reader["iID"].ToString()); item.iName = reader["iName"].ToString(); item.iDescription = reader["iDescription"].ToString(); item.iSRP = float.Parse(reader["iSRP"].ToString()); item.iNetPrice = float.Parse(reader["iNetPrice"].ToString()); item.iAQty = int.Parse(reader["iAQty"].ToString()); item.iSQty = int.Parse(reader["iSQty"].ToString()); item.iCategory = reader["iCategory"].ToString(); list.Add(item); } con.Close(); } } } } catch { } return(list); }
protected abstract bool UpdateOrderInfoDAL(CDMAS cdmas);
protected abstract bool UpdateItemDAL(CDMAS cdmas);
protected abstract bool CreateCustomerInfoDAL(CDMAS cdmas);
protected abstract bool UpdateStatusDAL(CDMAS cdmas);