Esempio n. 1
0
        public void DeleteCart(string id)
        {
            int prdId = Convert.ToInt32(id);

            if (HttpContext.Current.Session["UserKey"] != null)
            {
                int       custId    = Convert.ToInt32(HttpContext.Current.Session["UserKey"].ToString());
                Customers _customer = bCustomer.List().Where(m => m.Customer_Id == custId).FirstOrDefault();
                Carts     _cart     = bCarts.List().ToList().Where(m => m.Product_Id == prdId && (m.Cart_Status == eCartStatus.Open.ToString() || m.Cart_Status == eCartStatus.Temp.ToString())).FirstOrDefault();
                if (_cart != null)
                {
                    using (var context = new RachnaDBContext())
                    {
                        context.Entry(_cart).State = EntityState.Deleted;
                        context.SaveChanges();
                    }
                }
            }
            else
            {
                Carts _cart = bCarts.List().ToList().Where(m => m.Product_Id == prdId && (m.Cart_Status == eCartStatus.Open.ToString() || m.Cart_Status == eCartStatus.Temp.ToString()) && m.Ip_Address == IpAddress.GetLocalIPAddress()).FirstOrDefault();
                if (_cart != null)
                {
                    using (var context = new RachnaDBContext())
                    {
                        context.Entry(_cart).State = EntityState.Deleted;
                        context.SaveChanges();
                    }
                }
            }
        }
Esempio n. 2
0
        private void AddVisitedProducts(int productId)
        {
            string ipAddress = IpAddress.GetLocalIPAddress();

            using (var ctx = new RachnaDBContext())
            {
                Product         _prd  = ctx.Product.Where(m => m.Product_Id == productId).FirstOrDefault();
                VisitedProducts vpdts = ctx.VisitedProducts.Where(m => m.Product_Id == productId && m.IpAddress == ipAddress).FirstOrDefault();
                if (_prd != null)
                {
                    _prd.ProductBanner = ctx.ProductBanner.Where(m => m.Product_Id == _prd.Product_Id).ToList();
                    VisitedProducts _customerVisitedProducts = new VisitedProducts()
                    {
                        IpAddress     = IpAddress.GetLocalIPAddress(),
                        Product_Id    = productId,
                        Store_Id      = _prd.Store_Id,
                        ProductTitle  = _prd.Product_Title,
                        ProductBanner = _prd.ProductBanner.Where(m => m.Product_Banner_Default == 1).FirstOrDefault().Product_Banner_Photo,
                        DateCreated   = DateTime.Now,
                        VisitedCount  = 1
                    };
                    if (vpdts == null)
                    {
                        ctx.VisitedProducts.Add(_customerVisitedProducts);
                        ctx.SaveChanges();
                    }
                    else
                    {
                        vpdts.VisitedCount     = vpdts.VisitedCount + 1;
                        ctx.Entry(vpdts).State = System.Data.Entity.EntityState.Modified;
                        ctx.SaveChanges();
                    }
                }
            };
        }
        public ActionResult Subscribe(string emailid)
        {
            string result = string.Empty;

            using (var ctx = new RachnaDBContext())
            {
                Subscription _subscribeUser = ctx.Subscribe.Where(m => m.Subscription_EmailId == emailid).FirstOrDefault();
                if (_subscribeUser == null)
                {
                    Subscription _subscr = new Subscription()
                    {
                        Subscription_EmailId     = emailid,
                        Subscription_Status      = eStatus.Active.ToString(),
                        Subscription_CreatedDate = DateTime.Now,
                        Subscription_UpdatedDate = DateTime.Now
                    };

                    ctx.Subscribe.Add(_subscr);
                    ctx.SaveChanges();
                    result = "Thank you for sbscribing our news letter! we have triggered a email to you. Please activate the subscription by clicking on the link.";
                }
                else
                {
                    result = "Oops!! Entered Email Id already exists with us.";
                }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                using (var ctx = new RachnaDBContext())
                {
                    ProdComments ProdComments = new ProdComments();
                    int          commentId    = Convert.ToInt32(hdnProductCommentId.Value);
                    ProdComments = ctx.ProdComments.ToList().Where(m => m.Comment_Id == commentId).FirstOrDefault();
                    if (ProdComments != null)
                    {
                        ProdComments.Comment_Status   = ddlSorderStatus.Text;
                        ProdComments.DateUpdated      = DateTime.Now;
                        ctx.Entry(ProdComments).State = System.Data.Entity.EntityState.Modified;
                        ctx.SaveChanges();

                        pnlErrorMessage.Attributes.Remove("class");
                        pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                        pnlErrorMessage.Visible             = true;
                        lblMessage.Text = "Comment Detail Updated Successfully and status set to " + ddlSorderStatus.Text;
                    }
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = ex.Message;
            }
        }
 public ActionResult AddToCart(string id, string qty, string size)
 {
     if (qty.ToLower() == "select...")
     {
         qty = "1";
     }
     if (size == "" || size == "0")
     {
         using (var context = new RachnaDBContext())
         {
             int     prdId   = Convert.ToInt32(id);
             Product Product = context.Product.Where(m => m.Product_Id == prdId).FirstOrDefault();
             if (Product.Product_Has_Size)
             {
                 string[] sizes = Product.Product_Size.Split(',');
                 size = sizes[0].ToString();
             }
             else
             {
                 size = "No Size";
             }
         }
     }
     _mcartmdl.AddToCart(id, qty, size);
     return(Redirect(HttpContext.Request.UrlReferrer.AbsoluteUri));
 }
Esempio n. 6
0
 public void DeleteCartByCartId(Carts _cart)
 {
     using (var context = new RachnaDBContext())
     {
         context.Entry(_cart).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
        public static List <ProductFlow> ListProductFlow(int product_id)
        {
            List <ProductFlow> _productflow = new List <ProductFlow>();

            using (var ctx = new RachnaDBContext())
            {
                _productflow = ctx.ProductFlow.Where(m => m.Product_Id == product_id).ToList();
            }
            return(_productflow);
        }
        public ProductPageModel GetProductPageDataOffline(int product_id)
        {
            ProductPageModel prdModel = new ProductPageModel();

            using (var ctx = new RachnaDBContext())
            {
                CartModel _cartMdl = new CartModel();
                prdModel.Carts   = _cartMdl.GetCarts();
                prdModel.Product = bProduct.List().Where(m => m.Product_Id == product_id).FirstOrDefault();
                prdModel.Product.ProductBanner = bProduct.ListProductBanner().Where(m => m.Product_Id == prdModel.Product.Product_Id).ToList();
                prdModel.Product.SubCategory   = bSubCategory.List().Where(m => m.SubCategory_Id == prdModel.Product.SubCategory_Id).FirstOrDefault();

                prdModel.RelatedProducts = bProduct.List().Where(m => m.Product_Id != prdModel.Product.Product_Id).Take(4).ToList();
                foreach (var item in prdModel.RelatedProducts)
                {
                    item.ProductBanner = bProduct.ListProductBanner().Where(m => m.Product_Id == item.Product_Id).ToList();
                }

                prdModel.ProductFeatures = ctx.ProductFeature.Where(m => m.Product_Feature_Type == eProductFeature.Best.ToString()).ToList();
                foreach (var item in prdModel.ProductFeatures)
                {
                    item.Product = bProduct.List().Where(m => m.Product_Id == item.Product_Id).FirstOrDefault();
                    item.Product.ProductBanner = bProduct.ListProductBanner().Where(m => m.Product_Id == item.Product_Id).ToList();
                }

                prdModel.ProductFeatures2 = ctx.ProductFeature.Where(m => m.Product_Feature_Type == eProductFeature.OurChoice.ToString()).ToList();
                foreach (var item in prdModel.ProductFeatures2)
                {
                    item.Product = bProduct.List().Where(m => m.Product_Id == item.Product_Id).FirstOrDefault();
                    item.Product.ProductBanner = bProduct.ListProductBanner().Where(m => m.Product_Id == item.Product_Id).ToList();
                }

                prdModel.Categories = bCategory.List().Where(m => m.Category_Status == eStatus.Active.ToString()).ToList();
                foreach (var item in prdModel.Categories)
                {
                    item.SubCategory = bSubCategory.List().Where(m => m.Category_Id == item.Category_Id && item.Category_Status == eStatus.Active.ToString()).ToList();
                }

                prdModel.ProdComments = ctx.ProdComments.Where(m => m.Product_Id == prdModel.Product.Product_Id).ToList();
                if (HttpContext.Current.Session["UserKey"] != null)
                {
                    int CustomerId = Convert.ToInt32(HttpContext.Current.Session["UserKey"].ToString());
                    List <ProdComments> _commentsTemp = new List <ProdComments>();
                    _commentsTemp = ctx.ProdComments.Where(m => m.Customer_Id == CustomerId).ToList();
                    if (_commentsTemp != null)
                    {
                        prdModel.AlreadyCommentsDone = 1;
                        prdModel.ProdComments.AddRange(_commentsTemp);
                    }
                }
                return(prdModel);
            }
        }
Esempio n. 9
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         using (var ctx = new RachnaDBContext())
         {
             Order _productOrder = new Order();
             _productOrder = ctx.Orders.ToList().Where(m => m.Order_Id == Convert.ToInt32(hdnOrderId.Value)).FirstOrDefault();
             if (_productOrder != null)
             {
                 if (_productOrder.Order_Status != eOrderStatus.Cancelled.ToString() ||
                     _productOrder.Order_Status != eOrderStatus.Packed.ToString() ||
                     _productOrder.Order_Status != eOrderStatus.Shipped.ToString())
                 {
                     string[] listSize = hdnAvailableSize.Value.Split(',');
                     bool     sizeSame = false;
                     foreach (var item in listSize)
                     {
                         if (txtSize.Text == item)
                         {
                             sizeSame = true;
                         }
                     }
                     if (sizeSame == true)
                     {
                         _productOrder.Order_Size       = txtSize.Text;
                         ctx.Entry(_productOrder).State = System.Data.Entity.EntityState.Modified;
                         ctx.SaveChanges();
                         Page.ClientScript.RegisterStartupScript(this.GetType(), "Order", "new Messi('Size Added Successfully.', { title: 'Success!! ' });", true);
                     }
                     else
                     {
                         Page.ClientScript.RegisterStartupScript(this.GetType(), "Order", "new Messi('Selected size not in the available list', { title: 'Failed!! ' });", true);
                     }
                 }
                 else
                 {
                     Page.ClientScript.RegisterStartupScript(this.GetType(), "Order", "new Messi('update failed because, order status is not valid.', { title: 'Failed!! ' });", true);
                 }
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "Order", "new Messi('You cannot update the product because no Size available, for this product', { title: 'Failed!! ' });", true);
             }
         }
     }
     catch (Exception ex)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "Order", "new Messi('" + ex.Message + "', { title: 'Error!! ' });", true);
     }
 }
 private void AddSearchKey(string searchKey)
 {
     using (var ctx = new RachnaDBContext())
     {
         CustomerSearchKey _customerSearchKey = new CustomerSearchKey()
         {
             IpAddress   = IpAddress.GetLocalIPAddress(),
             SearchKey   = searchKey,
             DateCreated = DateTime.Now
         };
         ctx.CustomerSearchKey.Add(_customerSearchKey);
         ctx.SaveChanges();
     };
 }
Esempio n. 11
0
        public SliderModel Get()
        {
            SliderModel _sliderModel = new SliderModel();

            using (var context = new RachnaDBContext())
            {
                _sliderModel._sliders    = context.Slider.ToList();
                _sliderModel._categories = context.Category.Include("Admin").Where(m => m.Category_Status == eStatus.Active.ToString()).ToList();
                foreach (var item in _sliderModel._categories)
                {
                    item.SubCategory = context.SubCategory.Include("Admin").Where(m => m.Category_Id == item.Category_Id && m.SubCategory_Status == eStatus.Active.ToString()).ToList();
                }
                _sliderModel._ads = context.Advertisement.ToList();
            }
            return(_sliderModel);
        }
Esempio n. 12
0
        public void SaveCartAfterLogin()
        {
            if (HttpContext.Current.Session["UserKey"] != null)
            {
                int          custId    = Convert.ToInt32(HttpContext.Current.Session["UserKey"].ToString());
                Customers    Customers = bCustomer.List().Where(m => m.Customer_Id == custId).FirstOrDefault();
                List <Carts> Carts     = bCarts.List().ToList().Where(x => x.Cart_Status == eCartStatus.Temp.ToString() && x.Ip_Address == IpAddress.GetLocalIPAddress()).ToList();
                List <Carts> matching  = null;
                foreach (var item in Carts)
                {
                    matching = Customers.Cart.Where(m => m.Product_Id == item.Product_Id && m.Cart_Status == eCartStatus.Open.ToString()).ToList();
                    if (matching != null && matching.Count > 0)
                    {
                        using (var context = new RachnaDBContext())
                        {
                            context.Entry(matching).State = EntityState.Deleted;
                            context.SaveChanges();
                        }
                    }
                }

                foreach (var item in Carts)
                {
                    DeleteCart(item.Product_Id.ToString());
                    Carts ncarts = new Carts()
                    {
                        Cart_Price       = item.Cart_Price,
                        Cart_Qty         = item.Cart_Qty,
                        Cart_Size        = item.Cart_Size,
                        Cart_Status      = eCartStatus.Open.ToString(),
                        Cart_Total_Price = item.Cart_Total_Price,
                        Customer_Id      = Customers.Customer_Id,
                        Customer_Name    = Customers.Customers_FullName,
                        Store_Id         = item.Store_Id,
                        Shipping_Charge  = item.Shipping_Charge,
                        DateCreated      = item.DateCreated,
                        DateUpdated      = DateTime.Now,
                        Ip_Address       = item.Ip_Address,
                        Product_Title    = item.Product_Title,
                        Product_Price    = item.Product_Price,
                        Product_Id       = item.Product_Id,
                        Product_Banner   = item.Product_Banner
                    };
                    SaveCartToDB(ncarts);
                }
            }
        }
        public ActionResult GetProductsSearchKey(string s, int loadItems)
        {
            List <Product> _product = null;
            List <HomePageProductModel> _prdModel = new List <HomePageProductModel>();

            using (var ctx = new RachnaDBContext())
            {
                CustomerSearchKey _seracKeys = ctx.CustomerSearchKey.Where(m => m.SearchKey == s).FirstOrDefault();
                if (_seracKeys == null)
                {
                    AddSearchKey(s);
                }
                _product = ctx.Product
                           .Where(p => (p.Product_Title.Contains(s) || p.Product_Description.Contains(s)) && p.Product_Status == eProductStatus.Published.ToString())
                           .Take(loadItems).ToList();
                //_product = ctx.Product.Where(m => (m.Product_Title == s || m.Product_Description== s) && m.Product_Status.ToLower() == "published").Take(loadItems).ToList();
                foreach (var item in _product)
                {
                    item.ProductBanner = ctx.ProductBanner.Where(m => m.Product_Id == item.Product_Id).ToList();
                }
            }

            foreach (var item in _product.Take(8).ToList())
            {
                if (item.ProductBanner.Count > 0)
                {
                    _prdModel.Add(new HomePageProductModel
                    {
                        Id          = item.Product_Id,
                        Title       = item.Product_Title,
                        Description = (item.Product_Description.Length > 500) ? item.Product_Description.Substring(0, 500) + "..." : item.Product_Description,
                        Banner1     = item.ProductBanner.Where(x => x.Product_Banner_Default == 1).FirstOrDefault().Product_Banner_Photo.ToString(),
                        Banner2     = (item.ProductBanner.Count > 1) ?
                                      item.ProductBanner.Where(x => x.Product_Banner_Default != 1).FirstOrDefault().Product_Banner_Photo.ToString() :
                                      item.ProductBanner.Where(x => x.Product_Banner_Default == 1).FirstOrDefault().Product_Banner_Photo.ToString(),
                        OldPrice      = item.Product_Mkt_Price,
                        TotalPrice    = item.Product_Our_Price,
                        DiscountPrice = item.Product_Discount,
                        Rating        = item.Store_Rating
                    });
                }
            }
            return(Json(_prdModel, JsonRequestBehavior.AllowGet));
        }
        public static void CreateProductFlow(int product_id, string product_title, int Administrators_Id, string admin_name, string flow_detail, string status)
        {
            using (var ctx = new RachnaDBContext())
            {
                ProductFlow _product = new ProductFlow()
                {
                    Product_Id               = product_id,
                    Product_Title            = product_title,
                    Administrators_Id        = Administrators_Id,
                    Product_Flow_CreatedBy   = admin_name,
                    Product_Flow_Detail      = flow_detail,
                    Product_Flow_CreatedDate = DateTime.Now,
                    Product_Status           = status
                };

                ctx.ProductFlow.Add(_product);
                ctx.SaveChanges();
            }
        }
Esempio n. 15
0
        public HeaderModel Get()
        {
            HeaderModel _header   = new HeaderModel();
            CartModel   CartModel = new CartModel();

            using (var context = new RachnaDBContext())
            {
                _header._logo  = context.Logo.Where(m => m.Logo_Status == eStatus.Active.ToString()).FirstOrDefault();
                _header._carts = CartModel.GetCarts();
                _header._menu  = context.RMenu.ToList();
                if (HttpContext.Current.Session["UserKey"] != null)
                {
                    int cusId = Convert.ToInt32(HttpContext.Current.Session["UserKey"].ToString());
                    _header._customer = context.Customer.ToList().Where(m => m.Customer_Id == cusId).FirstOrDefault();
                }
                _header._contact = context.ContactOwner.Where(m => m.Contact_Status == eStatus.Active.ToString()).FirstOrDefault();
            }
            return(_header);
        }
        public ActionResult GetProductsByStoreId(int id, int max_price, int min_price, int storeId)
        {
            List <Product> _product = null;
            List <HomePageProductModel> _prdModel = new List <HomePageProductModel>();

            using (var ctx = new RachnaDBContext())
            {
                if (id != 0)
                {
                    _product = ctx.Product.Where(m => m.SubCategory_Id == id && m.Product_Our_Price <= max_price && m.Product_Our_Price >= min_price && m.Product_Status == eProductStatus.Published.ToString() && m.Store_Id == storeId).ToList();
                }
                else
                {
                    _product = ctx.Product.Where(m => m.Product_Our_Price <= max_price && m.Product_Our_Price >= min_price && m.Product_Status == eProductStatus.Published.ToString() && m.Store_Id == storeId).ToList();
                }
                foreach (var item in _product)
                {
                    item.ProductBanner = ctx.ProductBanner.Where(m => m.Product_Id == item.Product_Id).ToList();
                }
            }

            foreach (var item in _product.Take(8).ToList())
            {
                if (item.ProductBanner.Count > 0)
                {
                    _prdModel.Add(new HomePageProductModel
                    {
                        Id          = item.Product_Id,
                        Title       = item.Product_Title,
                        Description = (item.Product_Description.Length > 500) ? item.Product_Description.Substring(0, 500) + "..." : item.Product_Description,
                        Banner1     = item.ProductBanner.Where(x => x.Product_Banner_Default == 1).FirstOrDefault().Product_Banner_Photo.ToString(),
                        Banner2     = (item.ProductBanner.Count > 1) ?
                                      item.ProductBanner.Where(x => x.Product_Banner_Default != 1).FirstOrDefault().Product_Banner_Photo.ToString() :
                                      item.ProductBanner.Where(x => x.Product_Banner_Default == 1).FirstOrDefault().Product_Banner_Photo.ToString(),
                        OldPrice      = item.Product_Mkt_Price,
                        TotalPrice    = item.Product_Our_Price,
                        DiscountPrice = item.Product_Discount,
                        Rating        = item.Store_Rating
                    });
                }
            }
            return(Json(_prdModel, JsonRequestBehavior.AllowGet));
        }
Esempio n. 17
0
        public FooterModel Get()
        {
            FooterModel _footer = new FooterModel();

            using (var context = new RachnaDBContext())
            {
                _footer._social = context.SocialNetworking.Where(m => m.Scl_Ntk_Status == eStatus.Active.ToString()).ToList();
                _footer._menu   = context.RMenu.ToList();
                if (HttpContext.Current.Session["UserKey"] != null)
                {
                    int cusId = Convert.ToInt32(HttpContext.Current.Session["UserKey"].ToString());
                    _footer._customer = context.Customer.ToList().Where(m => m.Customer_Id == cusId).FirstOrDefault();
                }
                _footer._categories = context.Category.Where(m => m.Category_Status == eStatus.Active.ToString()).ToList();
                _footer._contact    = context.ContactOwner.Where(m => m.Contact_Status == eStatus.Active.ToString()).FirstOrDefault();
                _footer._stores     = context.Store.ToList().Where(m => m.Store_Status == eStatus.Active.ToString()).ToList();
            }
            return(_footer);
        }
Esempio n. 18
0
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                using (var ctx = new RachnaDBContext())
                {
                    ProductBanners _banner  = ctx.ProductBanner.ToList().Where(m => m.Product_Banner_Id == Convert.ToInt32(e.Values[0].ToString())).FirstOrDefault();
                    string         filePath = Server.MapPath("~/" + _banner.Product_Banner_Photo);
                    if (!filePath.Contains("noimage.png"))
                    {
                        FileInfo file = new FileInfo(filePath);
                        if (file.Exists)
                        {
                            file.Delete();
                        }
                    }
                    ctx.Entry(_banner).State = EntityState.Deleted;
                    ctx.SaveChanges();

                    ProductBanners currentBanner = ctx.ProductBanner.ToList().Where(m => m.Product_Id == Convert.ToInt32(hdnProductId.Value)).FirstOrDefault();
                    if (currentBanner != null)
                    {
                        currentBanner.Product_Banner_Default = 1;
                        ctx.Entry(currentBanner).State       = System.Data.Entity.EntityState.Modified;
                        ctx.SaveChanges();
                    }
                    pnlErrorMessage.Attributes.Remove("class");
                    pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                    pnlErrorMessage.Visible             = true;
                    lblMessage.Text = "Product Slider Deleted Successfully.";
                    LoadGrid();
                }
            }
            catch (Exception ex)
            {
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-danger alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = "Oops!! Server error occured, please contact administrator.";
            }
        }
Esempio n. 19
0
        public void LoadDetail()
        {
            using (var ctx = new RachnaDBContext())
            {
                Administrators _Administrator = null;
                _Administrator = bAdministrator.List().Where(m => m.Administrators_Id == Convert.ToInt32(Session[ConfigurationSettings.AppSettings["VendorSession"].ToString()].ToString())).FirstOrDefault();
                int storeId = _Administrator.Store_Id;

                if (txtEndDate.Text != "" && txtStartDate.Text != "" && ddlStatus.Text != "Select..")
                {
                    _RequestList = ctx.Orders.ToList().Where(m => m.Store_Id == storeId && m.Order_Status == ddlStatus.Text && (m.Order_Date >= Convert.ToDateTime(txtStartDate.Text) && m.Order_Date <= Convert.ToDateTime(txtEndDate.Text))).ToList();
                }
                else if (txtEndDate.Text != "" && txtStartDate.Text != "")
                {
                    _RequestList = ctx.Orders.ToList().Where(m => m.Store_Id == storeId && (m.Order_Date >= Convert.ToDateTime(txtStartDate.Text) && m.Order_Date <= Convert.ToDateTime(txtEndDate.Text))).ToList();
                }
                else if (ddlStatus.Text != "Select..")
                {
                    _RequestList = ctx.Orders.ToList().Where(m => m.Store_Id == storeId && m.Order_Status == ddlStatus.Text).ToList();
                }
                else
                {
                    _RequestList = ctx.Orders.ToList().Where(m => m.Store_Id == storeId).ToList();
                }
                foreach (var item in _RequestList)
                {
                    item.OrderHistory    = ctx.OrderHistories.ToList().Where(m => m.Order_Id == item.Order_Id).ToList();
                    item.CustomerAddress = ctx.CustomerAddres.ToList().Where(m => m.CustomerAddress_Id == item.CustomerAddress_Id).FirstOrDefault();
                }
            }
            if (_RequestList != null)
            {
                grdStoreOrders.DataSource = _RequestList;
                grdStoreOrders.DataBind();
            }
            else
            {
                btnExport.Visible = false;
            }
        }
Esempio n. 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Array status = Enum.GetValues(typeof(eOrderStatus));
                foreach (eOrderStatus sts in status)
                {
                    ddlStatus.Items.Add(new ListItem(sts.ToString()));
                }

                using (var ctx = new RachnaDBContext())
                {
                    _RequestList = ctx.Orders.ToList();
                    if (_RequestList == null)
                    {
                        btnExport.Visible = false;
                    }
                    grdStoreOrders.DataSource = _RequestList;
                    grdStoreOrders.DataBind();
                }
            }
        }
        public ActionResult CustomerRequest(CustomerRequest customerRequest)
        {
            string result = string.Empty;

            using (var ctx = new RachnaDBContext())
            {
                CustomerRequest _customerRequest = new CustomerRequest()
                {
                    FullName    = customerRequest.FullName,
                    EmailId     = customerRequest.EmailId,
                    Subject     = customerRequest.Subject,
                    Description = customerRequest.Description,
                    IpAddress   = IpAddress.GetLocalIPAddress(),
                    DateCreated = DateTime.Now,
                    DateUpdated = DateTime.Now
                };

                ctx.CustomerRequest.Add(_customerRequest);
                ctx.SaveChanges();
                result = "Thank you for submitting your request we will work on your request.";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
 public void LoadDetail()
 {
     using (var ctx = new RachnaDBContext())
     {
         if (txtEndDate.Text != "" && txtStartDate.Text != "" && ddlStatus.Text != "Select..")
         {
             _RequestList = ctx.Orders.ToList().Where(m => m.Store_Id == Convert.ToInt32(ddlStore.Text) && m.Order_Status == ddlStatus.Text && (m.Order_Date >= Convert.ToDateTime(txtStartDate.Text) && m.Order_Date <= Convert.ToDateTime(txtEndDate.Text))).ToList();
         }
         else if (txtEndDate.Text != "" && txtStartDate.Text != "")
         {
             _RequestList = ctx.Orders.ToList().Where(m => m.Store_Id == Convert.ToInt32(ddlStore.Text) && (m.Order_Date >= Convert.ToDateTime(txtStartDate.Text) && m.Order_Date <= Convert.ToDateTime(txtEndDate.Text))).ToList();
         }
         else if (ddlStatus.Text != "Select..")
         {
             _RequestList = ctx.Orders.ToList().Where(m => m.Store_Id == Convert.ToInt32(ddlStore.Text) && m.Order_Status == ddlStatus.Text).ToList();
         }
         else
         {
             _RequestList = ctx.Orders.ToList().Where(m => m.Store_Id == Convert.ToInt32(ddlStore.Text)).ToList();
         }
         foreach (var item in _RequestList)
         {
             item.OrderHistory    = ctx.OrderHistories.ToList().Where(m => m.Order_Id == item.Order_Id).ToList();
             item.CustomerAddress = ctx.CustomerAddres.ToList().Where(m => m.CustomerAddress_Id == item.CustomerAddress_Id).FirstOrDefault();
         }
     }
     if (_RequestList != null)
     {
         grdStoreOrders.DataSource = _RequestList;
         grdStoreOrders.DataBind();
     }
     else
     {
         btnExport.Visible = false;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List <Stores> Stores = context.Store.Where(m => m.Store_Status == eStatus.Active.ToString()).ToList();
                foreach (var item in Stores)
                {
                    ddlStore.Items.Add(new ListItem {
                        Text = item.Store_Name, Value = item.Store_Id.ToString()
                    });
                }

                Array status = Enum.GetValues(typeof(eOrderStatus));
                foreach (eOrderStatus sts in status)
                {
                    ddlStatus.Items.Add(new ListItem(sts.ToString()));
                }

                Array dstatus = Enum.GetValues(typeof(eOrderDeliveryStatus));
                foreach (eOrderDeliveryStatus dsts in dstatus)
                {
                    ddlStatus.Items.Add(new ListItem(dsts.ToString()));
                }

                using (var ctx = new RachnaDBContext())
                {
                    _RequestList = ctx.Orders.ToList();
                    if (_RequestList == null)
                    {
                        btnExport.Visible = false;
                    }
                    grdStoreOrders.DataSource = _RequestList;
                    grdStoreOrders.DataBind();
                }
            }
        }
Esempio n. 24
0
        public string SetDefaultImage(string id)
        {
            using (var ctx = new RachnaDBContext())
            {
                List <ProductBanners> Productbnrs = ctx.ProductBanner.ToList().Where(f => f.Product_Id == Convert.ToInt32(hdnProductId.Value)).ToList();
                foreach (var item in Productbnrs)
                {
                    item.Product_Banner_Default = 0;
                    ctx.Entry(item).State       = System.Data.Entity.EntityState.Modified;
                    ctx.SaveChanges();
                }

                ProductBanners _banner = ctx.ProductBanner.ToList().Where(m => m.Product_Banner_Id == Convert.ToInt32(id)).FirstOrDefault();
                _banner.Product_Banner_Default = 1;
                ctx.Entry(_banner).State       = System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
                pnlErrorMessage.Attributes.Remove("class");
                pnlErrorMessage.Attributes["class"] = "alert alert-success alert-dismissable";
                pnlErrorMessage.Visible             = true;
                lblMessage.Text = "Banner Updated Successfully.";
            }
            LoadGrid();
            return("");
        }
 public newoffers()
 {
     context = new RachnaDBContext();
 }
 public AdministratorDetail()
 {
     context = new RachnaDBContext();
 }
Esempio n. 27
0
        public void LoadDetail(int id)
        {
            Order           _RequestList = null;
            Customers       _customer    = null;
            CustomerAddress _custAdress  = null;
            Product         _product     = null;

            using (var ctx = new RachnaDBContext())
            {
                _RequestList              = ctx.Orders.Include("OrderHistory").Include("PaymentMethod").ToList().Where(m => m.Order_Id == id).FirstOrDefault();
                _custAdress               = ctx.CustomerAddres.ToList().Where(m => m.CustomerAddress_Id == _RequestList.CustomerAddress_Id).FirstOrDefault();
                _customer                 = ctx.Customer.ToList().Where(m => m.Customer_Id == _RequestList.Customer_Id).FirstOrDefault();
                _product                  = ctx.Product.ToList().Where(m => m.Product_Id == _RequestList.Product_Id).FirstOrDefault();
                lblProduct_Title.Text     = _RequestList.Product_Title + "( Product Id : " + _RequestList.Product_Id + " )";
                imgProductBanner.ImageUrl = "../../" + _RequestList.Product_Banner;
                lblProduct_Price.Text     = _RequestList.Product_Price.ToString();

                if (_RequestList.Order_Status != eOrderStatus.Rejected.ToString() && _RequestList.Order_Status != eOrderStatus.Cancelled.ToString())
                {
                    lblOrder_Status.Font.Bold = true;
                    lblOrder_Status.ForeColor = System.Drawing.Color.Green;
                    lblOrder_Status.Text      = _RequestList.Order_Status.ToUpper();
                    if (_RequestList.Order_Status == eOrderStatus.Delevery.ToString())
                    {
                        btnEdit.Enabled = false;
                    }
                }
                else
                {
                    lblOrder_Status.Font.Bold = true;
                    lblOrder_Status.ForeColor = System.Drawing.Color.Red;
                    lblOrder_Status.Text      = _RequestList.Order_Status.ToUpper();
                    btnEdit.Enabled           = false;
                }
                if (_RequestList.Order_Size != "0")
                {
                    lblOrder_Size.Font.Bold = true;
                    lblOrder_Size.ForeColor = System.Drawing.Color.Green;
                    lblOrder_Size.Text      = "Selected Size is " + _RequestList.Order_Size;
                }
                else if (_RequestList.Order_Size == "0" && _product.Product_Size != "0")
                {
                    lblOrder_Size.Font.Bold = true;
                    lblOrder_Size.ForeColor = System.Drawing.Color.Red;
                    lblOrder_Size.Text      = " No Size Selected, Please Confirm From the Customer";
                }
                else
                {
                    lblOrder_Size.Font.Bold = true;
                    lblOrder_Size.ForeColor = System.Drawing.Color.Blue;
                    lblOrder_Size.Text      = "This Product has Free Size, No Need to select product size";
                }
                lblOrder_Qty.Text   = _RequestList.Order_Qty.ToString();
                lblOrder_Price.Text = _RequestList.Order_Price.ToString();

                lblCustomerName.Text   = _customer.Customers_FullName;
                lblAddress1.Text       = _custAdress.Customer_AddressLine1;
                lblAddress2.Text       = _custAdress.Customer_AddressLine2;
                lblCity.Text           = _custAdress.CustomerAddress_City;
                lblState.Text          = _custAdress.CustomerAddress_State;
                lblCountry.Text        = _custAdress.CustomerAddress_Country;
                lblZipCode.Text        = "ZipCode - " + _custAdress.CustomerAddress_ZipCode;
                lblEmailId.Text        = _customer.Customers_EmailId;
                lblPhoneNumber.Text    = _customer.Customers_Phone;
                hdnAvailableSize.Value = _product.Product_Size;
                hdnOrderId.Value       = _RequestList.Order_Id.ToString();
                hdnProductId.Value     = _RequestList.Product_Id.ToString();
                hdnCustId.Value        = _RequestList.Customer_Id.ToString();
                lblOrder_Delivery.Text = "Delivery expected by " + _RequestList.Order_Delievery_Date.ToString("D");
                lblOrderStatus.Text    = _RequestList.Order_Status;
                lblPaymentMode.Text    = _RequestList.PaymentMethod.Title.ToString();
                lblOrderDetail.Text    = _RequestList.OrderHistory.OrderByDescending(m => m.OrderHistory_Id).FirstOrDefault().OrderHistory_Description.ToString();
            }
        }
 internal dFunctionality()
 {
     context = new RachnaDBContext();
 }
Esempio n. 29
0
 public _default()
 {
     context = new RachnaDBContext();
 }
 public productsdetailstatic()
 {
     context = new RachnaDBContext();
 }