public ActionResult AddFavProduct(List <int> ProId)
        {
            var           svFavProduct = new FavProductService();
            b2bFavProduct model        = new b2bFavProduct();

            try
            {
                #region Set FavProduct Model
                foreach (var Pro in ProId)
                {
                    var IsResult = svFavProduct.InsertFavProduct(Pro, LogonCompID);
                    if (ProId.Count() == 1)
                    {
                        return(Json(IsResult));
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                CreateLogFiles(ex);
            }


            return(Json(new { IsResult = svFavProduct.IsResult, MsgError = GenerateMsgError(svFavProduct.MsgError), ID = model.FavProductID }));
        }
        public bool InsertFavProduct(int Pro, int CompID)
        {
            var           svFavProduct = new FavProductService();
            b2bFavProduct model        = new b2bFavProduct();
            bool          ChkProduct   = ValidateInsert(Pro, CompID);

            if (ChkProduct == true)
            {
                model.ProductID         = Pro;
                model.CompID            = CompID;
                model.FavGroupProductID = 0;
                model.RowFlag           = 1;
                model.IsShow            = true;
                model.IsDelete          = false;
                model.CreatedDate       = DateTimeNow;
                model.ModifiedDate      = DateTimeNow;
                model.CreatedBy         = "sa";
                model.ModifiedBy        = "sa";
                svFavProduct.SaveData(model, "FavProductID");
                IsResult = true;
            }
            else
            {
                IsResult = false;
                MsgError.Add(new Exception("product exist"));
            }
            return(IsResult);
        }
Beispiel #3
0
        public ActionResult addfav(int compid, int productid)
        {
            var svFav = new FavProductService();
            var fav   = new b2bFavProduct();

            svFav.InsertFavProduct(productid, compid);

            return(Json(new { status = svFav.IsResult }, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public ActionResult delfav(int productid, int compid)
        {
            var svFav        = new FavProductService();
            var fav          = new b2bFavProduct();
            var lstProductID = new List <int>();

            if (productid > 0)
            {
                lstProductID.Add(productid);
                svFav.Delete(lstProductID, compid);
            }

            return(Json(new { status = svFav.IsResult }, JsonRequestBehavior.AllowGet));
        }