Esempio n. 1
0
        public string LoadProductsCategory()
        {
            PLog.Info("BEGIN::Controller > Home, Method > LoadProductsCategory()");

            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();

            try
            {
                IProductsCategoryImple oProducts = new ProductsCategoryImple();

                DataTable dt = oProducts.GetGridData(0); //0 will gets all the products data


                Dictionary <string, object> row;
                foreach (DataRow dr in dt.Rows)
                {
                    row = new Dictionary <string, object>();
                    foreach (DataColumn col in dt.Columns)
                    {
                        row.Add(col.ColumnName, dr[col]);
                    }
                    rows.Add(row);
                }
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > Home, Method > LoadProductsCategory()", ex);
            }
            PLog.Info("END::Controller > Home, Method > LoadProductsCategory()");
            return(serializer.Serialize(rows));
        }
Esempio n. 2
0
        public ActionResult SaveProductsCategory(string Data)
        {
            PLog.Info("BEGIN::Controller > Home, Method > SaveProductsCategory(string Data)");
            long flg = 0;

            try
            {
                ProductsCategoryModel  obj       = JsonConvert.DeserializeObject <ProductsCategoryModel>(Data);
                IProductsCategoryImple oProducts = new ProductsCategoryImple();
                flg = oProducts.SaveProductCategory(obj);
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > Home, Method > SaveProductsCategory(string Data)", ex);
            }
            PLog.Info("END::Controller > Home, Method > SaveProductsCategory(string Data)");
            return(Content(flg.ToString()));
        }
Esempio n. 3
0
        public long DeleteProductsCategory(string ID)
        {
            PLog.Info("BEGIN::Controller > Home, Method > DeleteProductsCategory(string ID)");
            long ret = 0;

            if (!string.IsNullOrEmpty(ID))
            {
                try
                {
                    IProductsCategoryImple oProducts = new ProductsCategoryImple();
                    ret = oProducts.DeleteProductsCategory(Convert.ToInt32(ID));
                }
                catch (Exception ex)
                {
                    PLog.Error("Error::Controller > Home, Method > DeleteProductsCategory(string ID)", ex);
                }
            }
            PLog.Info("END::Controller > Home, Method > DeleteProductsCategory(string ID)");
            return(ret);
        }
Esempio n. 4
0
        public ActionResult UpdateProductsCategory(string ID)
        {
            PLog.Info("BEGIN::Controller > Home, Method > UpdateProductsCategory(string ID");
            ProductsCategoryModel  objModel  = null;
            IProductsCategoryImple oProducts = new ProductsCategoryImple();

            try
            {
                if (!string.IsNullOrEmpty(ID))
                {
                    objModel = oProducts.EditProdcutCategory(Convert.ToInt32(ID));
                }
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > Home, Method > UpdateProductsCategory(string ID)", ex);
            }
            PLog.Info("END::Controller > Home, Method > UpdateProductsCategory(string ID)");
            return(View($"ProductsCategory", objModel));
        }