Ejemplo n.º 1
0
        public void DeleteMarket(MarketVM value)
        {
            var data = ObjectMapper.Mapper.Map <Market>(value);

            _stockMarketUow.MarketRepo.Delete(data);
            _stockMarketUow.Save();
        }
Ejemplo n.º 2
0
        public void AddMarket(MarketVM value)
        {
            var data = ObjectMapper.Mapper.Map <Market>(value);

            _stockMarketUow.MarketRepo.Add <Market>(data);
            _stockMarketUow.Save();
        }
Ejemplo n.º 3
0
        public void UpdateMarket(MarketVM value)
        {
            var data = ObjectMapper.Mapper.Map <Market>(value);

            _stockMarketUow.MarketRepo.Edit <Market>(data);
            _stockMarketUow.Save();
        }
Ejemplo n.º 4
0
        public string UpdateMarket(MarketVM market)
        {
            string marketId = string.Empty;

            SqlParameter[] parameters =
            {
                new SqlParameter {
                    ParameterName = "@Id", Value = market.Id
                },
                new SqlParameter {
                    ParameterName = "@Name", Value = market.Name
                },
                new SqlParameter {
                    ParameterName = "@Description", Value = market.Description
                },
                new SqlParameter {
                    ParameterName = "@IsActive", Value = market.IsActive
                },
                new SqlParameter {
                    ParameterName = "@UpdatedBy", Value = market.UpdatedBy
                }
            };

            marketId = Convert.ToString(DALHelper.ExecuteScalar("UpdateMarket", parameters));

            return(marketId);
        }
Ejemplo n.º 5
0
        public IResponseDTO EditMarket(MarketVM model)
        {
            try
            {
                var DbMarket    = _mapper.Map <Market>(model);
                var entityEntry = _MarketRepositroy.Update(DbMarket);


                int save = _unitOfWork.Commit();

                if (save == 200)
                {
                    _response.Data     = model;
                    _response.IsPassed = true;
                    _response.Message  = "Ok";
                }
                else
                {
                    _response.Data     = null;
                    _response.IsPassed = false;
                    _response.Message  = "Not saved";
                }
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }

            return(_response);
        }
Ejemplo n.º 6
0
        public ActionResult Edit(Guid id)
        {
            var market = marketRepository.GetMarketById(id);

            MarketVM model = new MarketVM();

            if (market != null && market.Count > 0)
            {
                model = market[0];

                return(View(model));
            }

            return(RedirectToAction("List"));
        }
Ejemplo n.º 7
0
        public ActionResult UpdateMarket([FromBody] MarketVM value)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                _stockMarketBusinessSevice.UpdateMarket(value);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex));
            }
        }
Ejemplo n.º 8
0
        public ActionResult ekleMarket(MarketVM market)
        {
            if (ModelState.IsValid)
            {
                Market m = new Market()
                {
                    ComissionPrice = market.ComissionPrice,
                    MarketName     = market.MarketName,
                    UserID         = market.UserID
                };

                service.MarketService.Insert(m);


                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 9
0
        public ActionResult Create(MarketVM model)
        {
            try
            {
                string marketId = string.Empty;
                model.CreatedBy = LogInManager.LoggedInUserId;

                marketId = marketRepository.AddMarket(model);

                if (!string.IsNullOrWhiteSpace(marketId))
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            MarketId = marketId
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Market details not saved successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Create");
                return(Json(new
                {
                    IsSuccess = false,
                    errorMessage = e.Message
                }));
            }
        }
Ejemplo n.º 10
0
        public IResponseDTO PostMarket(MarketVM model)
        {
            try
            {
                var res = _MarketRepositroy.Get(x => x.MarketEmail == model.MarketEmail);
                if (res != null)
                {
                    _response.Data     = null;
                    _response.IsPassed = false;
                    _response.Message  = "This email already exists";
                }
                var DbMarket = _mapper.Map <Market>(model);

                var Market = _mapper.Map <MarketVM>(_MarketRepositroy.Add(DbMarket));

                int save = _unitOfWork.Commit();

                if (save == 200)
                {
                    _response.Data     = model;
                    _response.IsPassed = true;
                    _response.Message  = "Ok";
                }
                else
                {
                    _response.Data     = null;
                    _response.IsPassed = false;
                    _response.Message  = "Not saved";
                }
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }
            return(_response);
        }
Ejemplo n.º 11
0
 public void AddMarket(MarketVM value)
 {
     _stockMarketDataSevice.AddMarket(value);
 }
Ejemplo n.º 12
0
        public IResponseDTO UpdateMarket(MarketVM MarketVM)
        {
            var depart = _MarketServices.EditMarket(MarketVM);

            return(depart);
        }
Ejemplo n.º 13
0
        public IResponseDTO postMarket(MarketVM MarketVM)
        {
            var depart = _MarketServices.PostMarket(MarketVM);

            return(depart);
        }
Ejemplo n.º 14
0
 public void DeleteMarket(MarketVM value)
 {
     _stockMarketDataSevice.DeleteMarket(value);
 }
Ejemplo n.º 15
0
 public void UpdateMarket(MarketVM value)
 {
     _stockMarketDataSevice.UpdateMarket(value);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// type: 1行情,5评论
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private List <MarketVM> GetMyOrderMarkets(string mobile, int type, Dictionary <int, IEnumerable <Weixin_Pinglun> > threePl)
        {
            var        list        = new List <MarketVM>();
            List <int> xhmarketIds = new List <int>();
            var        xhMarkets   = new Dictionary <int, string>();

            using (var ctx = new ShtxSms2008Entities())
            {
                //change://
                //var groups = ctx.XHMarketGroups.Where(o => (o.Flag == type) && o.IsForApp).ToList();
                var          groups = CacheService.GetMarketGroupForApp(type);
                CustomerBase cb     = ctx.CustomerBases.FirstOrDefault(o => o.Tel.Contains(mobile) && o.SendInterFace == 102);
                if (cb != null)
                {
                    mobile = cb.Tel;

                    foreach (var group in groups)
                    {
                        //change://
                        //var markets = ctx.Markets.Where(o => o.GroupID == group.GroupID).ToList();
                        var markets = CacheService.GetMarketByGroupId(group.GroupID);
                        foreach (var m in markets)
                        {
                            xhmarketIds.Add(m.MarketId);
                            xhMarkets.Add(m.MarketId, group.GroupName + " - " + m.MarketName);
                        }
                    }


                    var marketIds = ctx.Gps.Where(o => o.Tel == mobile && xhmarketIds.Contains(o.MarketID.Value)).Select(o => o.MarketID.Value).Distinct().ToList();

                    //评论,显示三条,价格不显示
                    if (type == (int)EnumMarketFlag.WXMarket)
                    {
                        var orderProducts = ctx.Gps.Where(o => o.Tel == mobile).Select(o => o.ProductID).Distinct().ToList();
                        foreach (var marketId in marketIds)
                        {
                            MarketVM order = new MarketVM();
                            order.Id   = marketId;
                            order.Name = xhMarkets[marketId];
                            //change://
                            //var hasProducts = ctx.SmsProducts.Where(o => o.MarketId == marketId && orderProducts.Contains(o.ProductId)).Select(o => o.ProductId).ToList();
                            //var pls = ctx.Weixin_Pinglun.OrderByDescending(o => o.create).Where(o => hasProducts.Contains(o.productId)).Take(3).ToList();
                            var hasProducts           = CacheService.GetProductByMarketId(marketId).Where(o => orderProducts.Contains(o.ProductId)).Select(o => o.ProductId).ToList();
                            var pls                   = threePl.Where(o => hasProducts.Contains(o.Key)).SelectMany(o => o.Value).OrderByDescending(o => o.create).Take(3).ToList();
                            List <OrderPLVM> orderPls = new List <OrderPLVM>();
                            foreach (var pl in pls)
                            {
                                OrderPLVM vm = new OrderPLVM();
                                vm.Id    = pl.id;
                                vm.Title = pl.title;
                                vm.Date  = pl.date.ToString("yyyy-MM-dd");
                                vm.Url   = "http://app.shtx.com.cn/StaticHtml/WeixinPingLun.html?mobile=" + mobile + "&id=" + pl.id;
                                orderPls.Add(vm);
                            }
                            order.OrderPL = orderPls;
                            list.Add(order);
                        }
                    }
                    else
                    {
                        foreach (var marketId in marketIds)
                        {
                            MarketVM order = new MarketVM();
                            order.Id   = marketId;
                            order.Name = xhMarkets[marketId];
                            list.Add(order);
                        }
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 17
0
        public IResponseDTO RemoveMarket(MarketVM MarketVM)
        {
            var depart = _MarketServices.DeleteMarket(MarketVM);

            return(depart);
        }