public static IActionResult GetStartUpData()
            {
                productData productData = new productData();

                using (SqlConnection conn = new SqlConnection(con))
                {
                    conn.Open();
                    productData.productsCateNames = GetProductsCate(conn);
                    productData.productsNames     = GetProductsNames(conn);
                    productData.topProducts       = getTopProducts(conn, productData.productsCateNames);
                }
                return(new OkObjectResult(productData));
            }
示例#2
0
        public int Exists(string name, string description)
        {
            productData data = new productData();

            try
            {
                return(data.Exists(name, description));
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "Exists");
                throw (ex);
            }
            finally
            {
                data = null;
            }
        }
示例#3
0
        public ProductCollection GetProductsCollection(string whereExpression, string orderByExpression)
        {
            productData       data = new productData();
            ProductCollection col  = new ProductCollection();

            try
            {
                col = data.GetProductDynamicCollection(whereExpression, orderByExpression);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetProductsCollection");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(col);
        }
示例#4
0
        public DataSet GetProductsDataSet(string whereExpression, string orderByExpression)
        {
            productData data = new productData();
            DataSet     ds   = new DataSet();

            try
            {
                ds = data.GetProductDynamicDataSet(whereExpression, orderByExpression);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetProductsDataSet");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(ds);
        }
示例#5
0
        public ProductCollection GetAllProductsCollection()
        {
            productData       data = new productData();
            ProductCollection col  = new ProductCollection();

            try
            {
                col = data.GetAllProductsCollection();
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProductsCollection");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(col);
        }
示例#6
0
        public bool UpdateProduct(Product product)
        {
            productData data = new productData();
            bool        ret  = false;

            try
            {
                ret = data.UpdateProduct(product);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "UpdateProduct");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(ret);
        }
示例#7
0
        public bool RemoveProduct(int productID)
        {
            productData data = new productData();
            bool        ret  = false;

            try
            {
                ret = data.DeleteProduct(productID);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "RemoveProduct");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(ret);
        }
示例#8
0
        public int AddProduct(Product product)
        {
            productData data      = new productData();
            int         productID = 0;

            try
            {
                productID = data.AddProduct(product);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "AddProduct");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(productID);
        }
示例#9
0
        public DataSet GetAllProductsDataSet()
        {
            productData data = new productData();
            DataSet     ds   = new DataSet();

            try
            {
                //ds = data.GetAllProductsDataSet();
                ds = data.GetProductsWithVendorsDataSet();
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetAllProducts");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(ds);
        }
示例#10
0
        public ActionResult ProductData(ProductModel product)
        {
            if (product != null)
            {
                //Use Namespace called :  System.IO
                string FileName = Path.GetFileNameWithoutExtension(product.ImageFile.FileName);

                //To Get File Extension
                string FileExtension = Path.GetExtension(product.ImageFile.FileName);

                //Add Current Date To Attached File Name
                FileName = DateTime.Now.ToString("yyyyMMdd") + "-" + FileName.Trim() + FileExtension;

                //Get Upload path from Web.Config file AppSettings.
                string UploadPath = ConfigurationManager.AppSettings["UserImagePath"].ToString();

                //Its Create complete path to store in server.
                product.ImagePath = UploadPath + FileName;

                //To copy and save file into server.
                product.ImageFile.SaveAs(product.ImagePath);


                //To save Club Member Contact Form Detail to database table.
                var db = new RatnoTechEntities1();

                productData _member = new productData();

                _member.productImage   = product.ImagePath;
                _member.productName    = product.ProductName;
                _member.productDetails = product.ProductDetails;

                db.productDatas.Add(_member);
                db.SaveChanges();

                return(RedirectToAction("AdminDashBoard", "Login"));
            }

            return(View());
        }
示例#11
0
        public Product GetProduct(int productid)
        {
            productData data    = new productData();
            Product     product = new Product();

            if (data == null)
            {
                data = new productData();
            }
            try
            {
                product = data.GetProduct(productid);
            }
            catch (Exception ex)
            {
                log.Write(ex.Message, "GetProduct");
                throw (ex);
            }
            finally
            {
                data = null;
            }
            return(product);
        }
 public JsonResult product(string MyChecked)
 {
     product n = new product();
     productData nd = new productData();
     var array = MyChecked.Split(',');
     if (MyChecked != "" && MyChecked != null)
     {
         for (var i = 0; i < array.Length; i++)
         {
             //var Original = nd.Get().ToList().Where(a => a.num.ToString() == array[i]).SingleOrDefault();
             //if (Original.filePath != "")
             //{
             //    var DelPath = System.IO.Path.Combine(Server.MapPath("~/upload/catalog/"), Original.filePath);
             //    System.IO.File.Delete(DelPath);
             //}
             //if (Original.jsonimg != "no_img.jpg")
             //{
             //    var jsonstr = JsonConvert.DeserializeObject<List<jsonSer>>(Original.jsonimg);
             //    var DelJsonPath = Server.MapPath("~/upload/photograhy/");
             //    foreach (var j in jsonstr)
             //    {
             //        var DelJsonPathing = System.IO.Path.Combine(DelJsonPath, j.content);
             //        System.IO.File.Delete(DelJsonPathing);
             //    }
             //}
             n.num = Convert.ToInt32(array[i]);
             n.isdel = 1;
             n.udate = DateTime.Now;
             nd.Delete(n);
         }
     }
     return Json("");
 }