コード例 #1
0
            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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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
ファイル: Product.cs プロジェクト: aymanmirghani/SynTech
        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);
        }
コード例 #12
0
 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("");
 }