Example #1
0
        public ActionResult Index()
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            try
            {
                if (ModelState.IsValid)
                {
                    MS_Product_Request         param   = new MS_Product_Request();
                    List <MS_Product_Response> Product = GetProduct(param);
                    ViewBag.VProducts = Product;
                }
            }
            catch (Exception ex)
            {
                int UserID = Convert.ToInt32(HttpContext.Session["UserID"].ToString());

                MS_ActivityLog param = new MS_ActivityLog
                {
                    ActionName     = ControllerContext.RouteData.Values["action"].ToString(),
                    UserID_FK      = UserID,
                    ControllerName = ControllerContext.RouteData.Values["controller"].ToString(),
                    Description    = ex.Message.ToString(),
                    ActivityDate   = DateTime.Now
                };
                bool RetVal = Act.ActivityLog(param);
            }

            return(View());
        }
Example #2
0
        public List <MS_Product_Response> GetProduct(MS_Product_Request req)
        {
            List <MS_Product_Response> RetVal = new List <MS_Product_Response>();

            try
            {
                RetVal = BL.GetProduct(req);
            }
            catch (Exception ex)
            {
            }
            return(RetVal);
        }
        public MS_Product_Response GetProduct(MS_Product_Request req)
        {
            MS_Product_Response RetVal = new MS_Product_Response();

            try
            {
                List <MS_Product_Response> AllProduct = BL.GetProduct(req);
                RetVal = AllProduct.FirstOrDefault();
            }
            catch (Exception ex)
            {
            }
            return(RetVal);
        }
        public ActionResult Product(MS_Product_Request req)
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            try
            {
                MS_Product_Response ProductBy_ID = GetProduct(req);
                ViewBag.VProduct = ProductBy_ID;
            }
            catch (Exception ex)
            {
            }

            return(View());
        }
Example #5
0
        public List <MS_Product_Response> GetProduct(MS_Product_Request req)
        {
            List <MS_Product_Response> RetVal = new List <MS_Product_Response>();

            try
            {
                RetVal = DAL.GetProduct(req);
            }
            catch (Exception ex)
            {
                RetVal = null;
                throw ex;
            }
            finally
            {
            }
            return(RetVal);
        }
Example #6
0
        public List <MS_Product_Response> GetProduct(MS_Product_Request req)
        {
            List <MS_Product_Response> RetVal = new List <MS_Product_Response>();

            try
            {
                DataTable dt = DBtran.DbToDataTable("[dbo].[USP_GET_PRODUCT]", new
                {
                    pProductID  = req.ProductID_PK == null ? 0 : req.ProductID_PK,
                    pSellerID   = req.SellerID_FK == null ? 0 : req.SellerID_FK,
                    pCategoryID = req.CategoryID_FK == null ? 0 : req.CategoryID_FK,
                    pIsActive   = req.IsActive == null ? true : req.IsActive
                }, true);

                foreach (DataRow row in dt.Rows)
                {
                    RetVal.Add(new MS_Product_Response
                    {
                        ProductID_PK  = string.IsNullOrEmpty(row["ProductID_PK"].ToString()) ? 0 : Convert.ToInt32(row["ProductID_PK"]),
                        SellerID_FK   = string.IsNullOrEmpty(row["SellerID_FK"].ToString()) ? 0 : Convert.ToInt32(row["SellerID_FK"]),
                        CategoryID_FK = string.IsNullOrEmpty(row["CategoryID_FK"].ToString()) ? 0 : Convert.ToInt32(row["CategoryID_FK"]),
                        ProductName   = string.IsNullOrEmpty(row["ProductName"].ToString()) ? "" : row["ProductName"].ToString(),
                        Description   = string.IsNullOrEmpty(row["Description"].ToString()) ? "" : row["Description"].ToString(),
                        Stock         = string.IsNullOrEmpty(row["Stock"].ToString()) ? 0 : Convert.ToInt32(row["Stock"]),
                        Price         = string.IsNullOrEmpty(row["Price"].ToString()) ? 0 : Convert.ToInt32(row["Price"]),
                        ProductSeen   = string.IsNullOrEmpty(row["ProductSeen"].ToString()) ? 0 : Convert.ToInt32(row["ProductSeen"]),
                        ProductImage  = string.IsNullOrEmpty(row["ProductImage"].ToString()) ? "" : row["ProductImage"].ToString(),
                        IsActive      = string.IsNullOrEmpty(row["IsActive"].ToString()) ? true : Convert.ToBoolean(row["IsActive"]),
                        IsDelete      = string.IsNullOrEmpty(row["IsDelete"].ToString()) ? true : Convert.ToBoolean(row["IsDelete"]),
                        CreatedBy     = string.IsNullOrEmpty(row["CreatedBy"].ToString()) ? "" : row["CreatedBy"].ToString(),
                        CreatedDate   = string.IsNullOrEmpty(row["CreatedDate"].ToString()) ? DateTime.Now : Convert.ToDateTime(row["CreatedDate"]),
                        ModifiedBy    = string.IsNullOrEmpty(row["ModifiedBy"].ToString()) ? "" : row["ModifiedBy"].ToString(),
                        ModifiedDate  = string.IsNullOrEmpty(row["ModifiedDate"].ToString()) ? DateTime.Now : Convert.ToDateTime(row["ModifiedDate"]),
                        RecordTotal   = string.IsNullOrEmpty(row["RecordTotal"].ToString()) ? 0 : Convert.ToInt32(row["RecordTotal"])
                    });
                }
            }
            catch (Exception ex)
            {
                RetVal = null;
                throw ex;
            }
            return(RetVal);
        }
Example #7
0
 public ActionResult btnOpenDetail(MS_Product_Request req)
 {
     return(RedirectToAction("Product", "ProductDetail", req));
 }