예제 #1
0
        // GET: WishList
        public ActionResult Index()
        {
            try
            {
                if (Session["idUser"] != null)
                {
                    var wishListData = CustmorWishlistCRUD.GetWishlistByCustomerId(Convert.ToInt32(Session["idUser"]));
                    return(View(wishListData));
                }
                else
                {
                    return(RedirectToAction("Login", "Customer"));
                }
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "Index";
                obj.ControllerName = "WishList";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #2
0
        // GET: Cart
        public ActionResult Index()
        {
            try
            {
                if (Session["idUser"] != null)
                {
                    var cartData = CustomerCartCRUD.GetCartByCustomerId(Convert.ToInt32(Session["idUser"]));
                    cartData            = cartData.Where(x => x.IsPlace == false).ToList();
                    ViewBag.totalAmount = cartData.Sum(x => x.Amount).ToString();

                    return(View(cartData));
                }
                else
                {
                    return(RedirectToAction("Login", "Customer"));
                }
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "Index";
                obj.ControllerName = "Cart";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #3
0
        public ActionResult AddToWishList(string prodId, string price)
        {
            try
            {
                if (Session["idUser"] != null)
                {
                    CustomerWishlistDomain mCustomerWishlist = new CustomerWishlistDomain();

                    mCustomerWishlist.Amount          = Convert.ToDecimal(price);
                    mCustomerWishlist.CreatedDateTime = DateTime.Now;
                    mCustomerWishlist.CustomerId      = Convert.ToInt32(Session["idUser"]);
                    mCustomerWishlist.ProductId       = prodId;

                    CustmorWishlistCRUD.AddToWishlist(mCustomerWishlist);

                    return(Json(true));
                }
                else
                {
                    return(RedirectToAction("Login", "Customer"));
                }
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "AddToWishList";
                obj.ControllerName = "Product";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #4
0
        public ActionResult TopSearchBar()
        {
            try
            {
                //"1" is customerid
                if (Session["idUser"] != null)
                {
                    ViewBag.totalItemsInCart     = CustomerCartCRUD.GetCartByCustomerId(Convert.ToInt32(Session["idUser"])).Where(x => x.IsPlace == false).Count();
                    ViewBag.totalItemsInWishList = CustmorWishlistCRUD.GetWishlistByCustomerId(Convert.ToInt32(Session["idUser"])).Count();
                }
                else
                {
                    ViewBag.totalItemsInCart     = 0;
                    ViewBag.totalItemsInWishList = 0;
                }
                return(PartialView("_TopSearchMenu"));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "TopSearchBar";
                obj.ControllerName = "Menu";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
        public ActionResult Login(CustomerModel model)
        {
            try
            {
                var result = CustomerCRUD.CustomerLogin(model.Email, model.Password);

                if (result.Count() > 0)
                {
                    Session["FullName"] = result[0].FirstName + " " + result[0].LastName;
                    Session["idUser"]   = result[0].Id;

                    return(RedirectToAction("Index", "Menu"));
                }
                else
                {
                    ViewBag.error = "Login failed";
                    return(View());
                }
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "Login";
                obj.ControllerName = "Customer";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
        public ActionResult Register(CustomerDomain model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    // TO DO
                    CustomerCRUD.AddToCustomer(model);
                    return(View());
                }
                return(View("Registered"));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "Register";
                obj.ControllerName = "Customer";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #7
0
        public ActionResult DeleteWishListItem(int wishListId)
        {
            //var wishListData = CustmorWishlistCRUD.GetWishlistByWishlistId(wishListId);
            try
            {
                var result = CustmorWishlistCRUD.DeleteWhishListItem(wishListId);
                if (result == true)
                {
                    return(Json(result));
                }
                else
                {
                    return(RedirectToAction("Index", "Error"));
                }
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "DeleteWishListItem";
                obj.ControllerName = "WishList";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #8
0
        // GET: checkout
        public ActionResult Index()
        {
            try
            {
                if (Session["idUser"] != null)
                {
                    CheckoutDomain            mCheckoutDomain  = new CheckoutDomain();
                    List <CustomerCartDomain> customercartList = new List <CustomerCartDomain>();

                    var customerCartOrders = CustomerCartCRUD.GetCartByALLCustomerId(Convert.ToInt32(Session["idUser"]));


                    mCheckoutDomain.Id              = customerCartOrders[0].Id;
                    mCheckoutDomain.FirstName       = customerCartOrders[0].FirstName;
                    mCheckoutDomain.LastName        = customerCartOrders[0].LastName;
                    mCheckoutDomain.Email           = customerCartOrders[0].Email;
                    mCheckoutDomain.Phone           = customerCartOrders[0].Phone;
                    mCheckoutDomain.Country         = customerCartOrders[0].Country;
                    mCheckoutDomain.State           = customerCartOrders[0].State;
                    mCheckoutDomain.City            = customerCartOrders[0].City;
                    mCheckoutDomain.Pincode         = customerCartOrders[0].Pincode;
                    mCheckoutDomain.ShippingAddress = customerCartOrders[0].ShippingAddress;
                    mCheckoutDomain.BillingAddress  = customerCartOrders[0].BillingAddress;

                    for (int i = 0; i < customerCartOrders.Count(); i++)
                    {
                        CustomerCartDomain mObj = new CustomerCartDomain();
                        mObj.Amount    = customerCartOrders[i].Amount;
                        mObj.Quantity  = customerCartOrders[i].Quantity;
                        mObj.ITEM_DESC = customerCartOrders[i].ProductName;
                        mObj.Id        = customerCartOrders[i].cartId;
                        mObj.IsPlace   = customerCartOrders[i].IsPlaced;

                        customercartList.Add(mObj);
                    }
                    ViewBag.CustomerscartList     = customercartList.Where(x => x.IsPlace == false).ToList();
                    Session["customerCartOrders"] = customercartList;

                    ViewBag.Subtotal = customercartList.Where(x => x.IsPlace == false).Sum(x => x.Amount);
                    return(View(mCheckoutDomain));
                }
                else
                {
                    return(RedirectToAction("Login", "Customer"));
                }
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "Index";
                obj.ControllerName = "Checkout";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #9
0
        public ActionResult GetProductList(string catId, int?page, string record1, string ShortBy, string[] checkedValues)
        {
            try
            {
                int pageSize = 0;
                if (string.IsNullOrEmpty(record1))
                {
                    pageSize = Convert.ToInt32(record1);
                }
                else
                {
                    pageSize = Convert.ToInt32(record1);
                }
                var Products = ITMMASTCRUD.GetProductByCatId(catId.Trim());

                ViewBag.RecordPerPage = pageSize;
                ViewBag.TotalRecord   = Products.Count();

                if (ShortBy == "Low to High")
                {
                    Products = Products.OrderBy(x => x.Sale_Price).ToList();
                }
                else
                {
                    Products = Products.OrderByDescending(x => x.Sale_Price).ToList();
                }

                if (checkedValues != null)
                {
                    Products = Products.Where(x => checkedValues.Any(a => a.ToString() == x.BrandId)).ToList();
                }

                var pager = new Pager(Products.Count(), page, pageSize);
                pager.catId = catId;

                var viewModel = new IndexViewModel
                {
                    Items = Products.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize).ToList(),

                    Pager = pager
                };
                return(PartialView("_ProductListing", viewModel));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "GetProductList";
                obj.ControllerName = "Product";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #10
0
        public ActionResult GetCategoryList(string brandId, int?page, string record1, string ShortBy, string[] checkedValues)
        {
            try
            {
                int pageSize = 0;
                List <GRP_MASTERDomain> categories = new List <GRP_MASTERDomain>();
                if (string.IsNullOrEmpty(record1))
                {
                    pageSize = Convert.ToInt32(record1);
                }
                else
                {
                    pageSize = Convert.ToInt32(record1);
                }
                if (checkedValues == null)
                {
                    categories            = GRP_MASTERCRUD.GetCategoryByBrandId(Convert.ToInt32(brandId));
                    ViewBag.RecordPerPage = pageSize;
                    ViewBag.TotalRecord   = categories.Count();
                }

                else
                {
                    categories = GRP_MASTERCRUD.GetAllCategory().Where(x => checkedValues.Any(a => a.ToString() == x.BrandId)).ToList();
                }

                var pager = new Pager(categories.Count(), page, pageSize);
                pager.catId = brandId;

                var viewModel = new IndexViewModel
                {
                    Categories = categories.Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize).ToList(),
                    Pager      = pager
                };
                return(PartialView("_categoryListing", viewModel));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "GetProductList";
                obj.ControllerName = "Product";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #11
0
        public ActionResult PlaceOrder(CustomerOrderDomain model)
        {
            try
            {
                var orders = CustomerOrderCRUD.GetCustomerOrderByCustomerId(0);

                int lastOrder = 0;
                if (orders.Count > 1)
                {
                    lastOrder = orders[0].Id;
                }

                model.OrderDate     = DateTime.Now;
                model.PaymentType   = "COD";
                model.TransactionId = "Trans00" + lastOrder + 1;

                CustomerOrderCRUD.AddToCustomerOrder(model);

                List <CustomerCartDomain> sessionCustomerCartOrders = (List <CustomerCartDomain>)Session["customerCartOrders"];
                if (sessionCustomerCartOrders != null)
                {
                    foreach (var item in sessionCustomerCartOrders)
                    {
                        bool res = CustomerCartCRUD.UpdateDetails(item.Id, true);
                    }
                }
                else
                {
                    var customerCartOrders = CustomerCartCRUD.GetCartByALLCustomerId(Convert.ToInt32(Session["idUser"]));
                    foreach (var item in customerCartOrders)
                    {
                        bool res = CustomerCartCRUD.UpdateDetails(item.Id, true);
                    }
                }
                return(Json("True", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "PlaceOrder";
                obj.ControllerName = "Checkout";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;
                ExceptionLogCRUD.AddToExceptionLog(obj);

                return(Json("False", JsonRequestBehavior.AllowGet));
            }
        }
예제 #12
0
        public ActionResult MyAccount()
        {
            try
            {
                return(PartialView("_MyAccount"));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "MyAccount";
                obj.ControllerName = "Menu";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #13
0
        // GET: Order
        public ActionResult Index()
        {
            try
            {
                if (Session["idUser"] != null)
                {
                    int customerID = Convert.ToInt32(Session["idUser"]);
                    var orders     = CustomerOrderCRUD.GetCustomerOrderByCustomerId(customerID);

                    List <Domain.CustomerCartDomain> customercartList = new List <Domain.CustomerCartDomain>();
                    var customerOrders = CustomerCartCRUD.GetCartByALLCustomerId(Convert.ToInt32(Session["idUser"]));
                    for (int i = 0; i < customerOrders.Count(); i++)
                    {
                        Domain.CustomerCartDomain mObj = new Domain.CustomerCartDomain();
                        mObj.Amount    = customerOrders[i].Amount;
                        mObj.Quantity  = customerOrders[i].Quantity;
                        mObj.ITEM_DESC = customerOrders[i].ProductName;
                        mObj.Id        = customerOrders[i].cartId;
                        customercartList.Add(mObj);
                    }
                    ViewBag.CustomerscartList = customercartList;

                    return(View(orders));
                }
                else
                {
                    return(RedirectToAction("Login", "Customer"));
                }
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "Index";
                obj.ControllerName = "Order";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #14
0
        public ActionResult ProductDetail(string ProdId, string catId)
        {
            try
            {
                var           data           = ITMMASTCRUD.GetProductById(ProdId);
                ITMMASTDomain mITMMASTDomain = new ITMMASTDomain();

                mITMMASTDomain.DetailDesc  = data[0].DetailDesc;
                mITMMASTDomain.GRP_CD      = data[0].GRP_CD;
                mITMMASTDomain.Item_CD     = data[0].Item_CD;
                mITMMASTDomain.Item_Desc   = data[0].Item_Desc;
                mITMMASTDomain.Offer_Price = data[0].Offer_Price;
                mITMMASTDomain.Sale_Price  = data[0].Sale_Price;
                if (Session["QTY"] != null)
                {
                    mITMMASTDomain.Qty = Session["QTY"].ToString();
                }
                else
                {
                    mITMMASTDomain.Qty = "1";
                }


                var relatedProduct = ITMMASTCRUD.GetProductByCatId(catId.Trim());

                ViewBag.relatedProducts = relatedProduct.SkipWhile(a => a.Item_CD != ProdId).ToList();

                return(View(mITMMASTDomain));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "GetProductList";
                obj.ControllerName = "Product";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #15
0
        public ActionResult GetMenuSubMenuList()
        {
            try
            {
                var data = GRP_MASTERCRUD.GetAllMenu();
                return(PartialView("Menu_Submenu", data));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "GetMenuSubMenuList";
                obj.ControllerName = "Menu";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
        public JsonResult ChkEmailExistsOrNot(string emailId)
        {
            try
            {
                var result = CustomerCRUD.ChkEmailExistsOrNot(emailId);
                return(Json(result));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "ChkEmailExistsOrNot";
                obj.ControllerName = "Customer";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(Json(false));
            }
        }
예제 #17
0
        public ActionResult GetBrandList()
        {
            try
            {
                var data = BrandmasterCRUD.GetBrandMaster().Where(x => x.IsOnHomePage == true).ToList();
                return(PartialView("_BrandList", data));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "GetMenuList";
                obj.ControllerName = "Menu";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #18
0
        public ActionResult DeleteCartItem(int cartId)
        {
            try
            {
                var result = CustomerCartCRUD.DeleteCartItem(cartId);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "Index";
                obj.ControllerName = "Cart";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #19
0
        public ActionResult AddToCart(string prodId, string price, string qty)
        {
            try
            {
                if (Session["idUser"] != null)
                {
                    Session["QTY"] = qty;

                    CustomerCartDomain mcustomerCart = new CustomerCartDomain();

                    mcustomerCart.Amount          = Convert.ToDecimal(price) * Convert.ToInt32(qty);
                    mcustomerCart.CreatedDatetime = DateTime.Now;
                    mcustomerCart.CustomerId      = Session["idUser"].ToString();
                    mcustomerCart.IsDeleted       = "False";
                    mcustomerCart.Quantity        = Convert.ToInt32(qty);
                    mcustomerCart.ProductId       = prodId;
                    mcustomerCart.IsPlace         = false;
                    CustomerCartCRUD.AddToCart(mcustomerCart);

                    return(Json(true));
                }
                else
                {
                    return(Json(false));
                }
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "AddToCart";
                obj.ControllerName = "Product";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }
예제 #20
0
        public ActionResult GetMenuList()
        {
            try
            {
                var data = GRP_MASTERCRUD.GetAllMenu();
                ViewBag.totalItemsInWishList = CustmorWishlistCRUD.GetWishlistByCustomerId(Convert.ToInt32(Session["idUser"])).Count();

                return(PartialView("Menu", data));
            }
            catch (Exception ex)
            {
                ExceptionLogDomain obj = new ExceptionLogDomain();
                obj.MethodName     = "GetMenuList";
                obj.ControllerName = "Menu";
                obj.ErrorText      = ex.Message;
                obj.StackTrace     = ex.StackTrace;
                obj.Datetime       = DateTime.Now;

                ExceptionLogCRUD.AddToExceptionLog(obj);
                return(RedirectToAction("Index", "Error"));
            }
        }