public Boolean getServiceCart(int id) { SqlConnection scon = new SqlConnection(conn); ServiceCart objServiceCartMaster = new ServiceCart(); using (SqlCommand scmd = new SqlCommand()) { scmd.Connection = scon; scmd.CommandType = CommandType.Text; scmd.CommandText = "SELECT * FROM ServiceCart where subServiceId=" + id + ""; scon.Open(); SqlDataReader sdr = scmd.ExecuteReader(); if (sdr.Read()) { return(true); } if (sdr != null) { sdr.Dispose(); sdr.Close(); } scon.Close(); return(false); } }
public List <ServiceCart> getServiceCartList(int cid) { SqlConnection scon = new SqlConnection(conn); List <ServiceCart> objServiceCartList = new List <ServiceCart>(); using (SqlCommand scmd = new SqlCommand()) { scmd.Connection = scon; scmd.CommandType = CommandType.Text; scmd.CommandText = "SELECT * FROM ServiceCart"; scon.Open(); SqlDataReader sdr = scmd.ExecuteReader(); while (sdr.Read()) { ServiceCart objServicecartMaster = new ServiceCart(); objServicecartMaster.CartID = Convert.ToInt32(sdr["cartid"]); objServicecartMaster.subServiceId = Convert.ToInt32(sdr["subServiceId"]); objServicecartMaster.SubServiceName = sdr["Name"].ToString(); objServicecartMaster.Cost = float.Parse(sdr["Cost"].ToString()); objServicecartMaster.duration = float.Parse(sdr["duration"].ToString()); objServicecartMaster.customerId = Convert.ToInt32(sdr["customerid"]); objServiceCartList.Add(objServicecartMaster); } if (sdr != null) { sdr.Dispose(); sdr.Close(); } scon.Close(); return(objServiceCartList.ToList());; } }
public void AddCart() { mock.Setup(x => x.Carts); ServiceCart serviceCart = new ServiceCart(mock.Object); serviceCart.GetAddToCart(null); }
public void GetMigrateCart() { mock.Setup(x => x.Carts); ServiceCart serviceCart = new ServiceCart(mock.Object); serviceCart.GetMigrateCart(null); }
public ActionResult Index(OrderViewModel model) { OrderDTO orderDTO = new OrderDTO(); TryUpdateModel(orderDTO); if (ModelState.IsValid) { ServiceCart cart = serviceCart.GetCart(this.HttpContext); orderDTO.OrderDate = DateTime.Now; orderDTO.Total = cart.GetTotalFromCart(); orderDTO.Username = User.Identity.Name; serviceOrder.CreateOrder(orderDTO); cart.GetCreateOrder(orderDTO); return(RedirectToAction("index", "home")); } else { ViewBag.Error = "Error"; ModelState.AddModelError("", "Not correct datas!"); return(View(model)); } }
public ActionResult Index() { ServiceCart cart = serviceCart.GetCart(this.HttpContext); ViewBag.Total = cart.GetTotalFromCart(); return(View()); }
public RedirectToRouteResult AddToCart(int itemId, string returnUrl) { ItemDTO getItem = serviceItem.GetItem(itemId); ServiceCart cart = serviceCart.GetCart(this.HttpContext); cart.GetAddToCart(getItem); return(RedirectToAction("DisplayCart", new { returnUrl })); }
public ActionResult DisplayCart(string returnUrl) { ServiceCart cart = serviceCart.GetCart(this.HttpContext); ShoppingCartViewModel model = new ShoppingCartViewModel { CartItems = cart.GetItemsCart(), CartTotal = cart.GetTotalFromCart(), returnUrl = returnUrl }; return(View(model)); }
public OrderController(IAllOrders orderRep, ShopCartRepository shopCartRep, ServiceCart servicesCart, ServiceUser servicesUser, IAllUser userRep) { this.orderRep = orderRep; this.shopCartRep = shopCartRep; this.servicesCart = servicesCart; this.servicesUser = servicesUser; this.userRep = userRep; }
public ShopCartController(ShopCartRepository shopCartRep, ServiceCart servicesCart) { this.shopCartRep = shopCartRep; this.servicesCart = servicesCart; }
public void GetItemName() { mock.Setup(x => x.Carts); ServiceCart serviceCart = new ServiceCart(mock.Object); string res = serviceCart.GetItemName(null); }
public void CreateOrder() { mock.Setup(x => x.Carts); ServiceCart serviceCart = new ServiceCart(mock.Object); int res = serviceCart.GetCreateOrder(null); }