static void AddSalesInfo()
        {
            GoodsInfoDal GoodsInfoDal = new GoodsInfoDal();
            ProfitsInfo  salesInfo    = new ProfitsInfo();
            //salesInfo.GoodsId = 2;
            //salesInfo.Count = 3;
            //salesInfo.DisCount = 50;
            //salesInfo.GoodsInfo = GoodsInfoDal.GetEntityById(salesInfo.GoodsId);
            //salesInfo.Prices = salesInfo.GoodsInfo.PayPrice * (decimal)salesInfo.Count - salesInfo.DisCount;
            //salesInfo.CreateTime = DateTime.Now;
            //salesInfo.IsPay = true;


            ProfitsInfoDal salesInfoDal = new ProfitsInfoDal();

            bool d = salesInfoDal.Add(salesInfo);

            if (d)
            {
                Console.WriteLine("成功");
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
Exemplo n.º 2
0
 public JsonResult SearchGoodsList(string userId, string entId, string searchValue, string letter, string tags, string isKc, string CategoryId, string Login_Id, int pageIndex, int pageSize)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         ///获取商品分类列表
         ///
         ////获取当前商品分类
         List <Category> clist = new List <Category>();
         if (CategoryId != "")
         {
             ImgInfoDal idal = new ImgInfoDal();
             clist = idal.GetCategory(CategoryId, entId);
         }
         ///商品信息
         GoodsInfoDal     dal  = new GoodsInfoDal();
         List <GoodsList> list = dal.GetGoodsList(userId, Server.UrlDecode(searchValue.Trim()), letter, tags, isKc, CategoryId, Login_Id, pageIndex, pageSize, entId);
         ///商品分类信息
         return(Json(new { success = true, list, clist }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Search/SearchGoodsList", ex.Message.ToString());
         return(Json(new { success = false, message = "商品列表加载失败!" }));
     }
 }
        static void EditGoodsInfo()
        {
            GoodsInfo goodsInfo = new GoodsInfo();

            goodsInfo.UnitId       = 1;
            goodsInfo.SortId       = 1;
            goodsInfo.WholeSalerId = 1;
            goodsInfo.GoodsName    = "品";
            goodsInfo.PurPrice     = (decimal)455.343;
            goodsInfo.PayPrice     = (decimal)455.343;
            goodsInfo.Total        = 500;
            goodsInfo.SalesCount   = 0;
            goodsInfo.SurplusCount = 500;
            goodsInfo.GoodsType    = " gfg ";
            goodsInfo.CreateTime   = DateTime.Now;
            goodsInfo.LastTime     = DateTime.Now + new TimeSpan(50, 5, 5, 1);
            goodsInfo.Id           = 2;
            GoodsInfoDal GoodsInfoDal = new GoodsInfoDal();

            bool d = GoodsInfoDal.Edit(goodsInfo);

            if (d)
            {
                Console.WriteLine("成功");
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
Exemplo n.º 4
0
        public JsonResult GoodsDetails(string entId, string userId, string articleId)
        {
            try
            {
                if (string.IsNullOrEmpty(entId))
                {
                    entId = BaseConfiguration.EntId;
                }
                if (string.IsNullOrEmpty(articleId))
                {
                    return(Json(new { success = false, message = "参数获取失败!" }));
                }
                ///商品信息
                GoodsInfoDal dal = new GoodsInfoDal();
                ///商品当月销量排行
                List <GoodsStatistical> slist = dal.GetGoodsRanking(userId, entId, "GoodsSale", 10);
                ///商品当月点击量量排行
                List <GoodsStatistical> clist = dal.GetGoodsRanking(userId, entId, "GoodsClick", 3);
                ///商品详情
                List <GoodsList> list = dal.GetGoodDetail(userId, articleId, entId);

                return(Json(new { success = true, list, slist, clist }));
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "Goods/GoodsDetails", ex.Message.ToString());

                return(Json(new { success = false, message = "商品详情加载失败!" }));
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更多回复
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="entId"></param>
 /// <param name="criticismsId"></param>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <returns></returns>
 public JsonResult MoreRepaly(string userId, string entId, int criticismsId, int pageIndex = 1, int pageSize = 30)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (criticismsId == 0)
         {
             return(Json(new { success = false, message = "参数获取异常!" }));
         }
         else if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "请先登录!" }));
         }
         ///商品信息
         GoodsInfoDal dal = new GoodsInfoDal();
         ///商品评价回复
         List <StairCriticisms> list = dal.GetReplay(userId, entId, criticismsId, pageIndex, pageSize, out int pageCount, out int recordCount);
         return(Json(new { success = true, list, pageCount, recordCount }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/MoreRepaly", ex.Message.ToString());
         return(Json(new { success = false, message = "商品评价回复获取失败!" }));
     }
 }
Exemplo n.º 6
0
 public JsonResult LikeCriticism(string userId, string entId, int criticismsId)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (criticismsId == 0)
         {
             return(Json(new { success = false, message = "参数获取异常!" }));
         }
         else if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "请先登录!" }));
         }
         ///商品信息
         GoodsInfoDal dal  = new GoodsInfoDal();
         int          flag = dal.LikeCriticism(userId, entId, criticismsId, out string message);
         return(Json(new { success = flag == 1 ? true : false, message }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/RedactCriticism", ex.Message.ToString());
         return(Json(new { success = false, message = "商品评价点赞失败!" }));
     }
 }
Exemplo n.º 7
0
 public JsonResult RedactCriticism(string userId, string entId, string orderNo, int id, string articleId, string content, decimal starLevel, int superiorId = 0, int replayId = 0)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (string.IsNullOrEmpty(articleId) && string.IsNullOrEmpty(orderNo))
         {
             return(Json(new { success = false, message = "商品和订单编号不能为空" }));
         }
         else if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "请先登录!" }));
         }
         ///商品信息
         GoodsInfoDal dal  = new GoodsInfoDal();
         int          flag = dal.RedactCriticism(userId, entId, orderNo, id, articleId, content, starLevel, superiorId, replayId, out string message);
         return(Json(new { success = flag == 1 ? true : false, message }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/RedactCriticism", ex.Message.ToString());
         return(Json(new { success = false, message = "商品评价编辑失败!" }));
     }
 }
Exemplo n.º 8
0
 public JsonResult GoodsCriticisms(string userId, string entId, string articleId, string orderBy = "desc", int pageIndex = 1, int pageSize = 30)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (string.IsNullOrEmpty(articleId))
         {
             return(Json(new { success = false, message = "参数获取失败!" }));
         }
         else if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "请先登录!" }));
         }
         ///商品信息
         GoodsInfoDal dal = new GoodsInfoDal();
         ///商品评价
         List <StairCriticisms> list = dal.GetCriticisms(userId, entId, articleId, pageIndex, pageSize, orderBy, out int pageCount, out int recordCount, out int passSum, out decimal raveReviews);
         return(Json(new { success = true, list, pageCount, recordCount, passSum, raveReviews }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/GoodsEvaluate", ex.Message.ToString());
         return(Json(new { success = false, message = "商品评价失败!" }));
     }
 }
Exemplo n.º 9
0
        public ActionResult SearchFastGoods(string entid, string userId, string searchValue)
        {
            try
            {
                if (string.IsNullOrEmpty(entid) || string.IsNullOrEmpty(userId))
                {
                    return(Json(new { flag = 0, message = "请先登录!" }));
                }
                //获取用户信息
                UserInfoDal     dal  = new UserInfoDal();
                List <UserInfo> user = new List <UserInfo>();
                if (!string.IsNullOrEmpty(userId))
                {
                    user = dal.GetUserInfo(userId, entid);
                }
                string jgjb = "", clientlimit = "", KhType = "";
                bool   landing    = false;
                bool   staleDated = false;
                if (user.Count > 0)
                {
                    entid       = user[0].EntId;
                    jgjb        = user[0].Pricelevel;
                    clientlimit = user[0].ClientLimit;
                    KhType      = user[0].KhType;
                    staleDated  = user[0].StaleDated;
                    landing     = true;
                }

                GoodsInfoDal infoDal = new GoodsInfoDal();
                if (searchValue.Trim().Contains(" "))
                {
                    int    length = searchValue.Length;
                    int    index = searchValue.IndexOf(" ");
                    string goodsValue, factoryValue;
                    goodsValue   = searchValue.Substring(0, index).Trim();
                    factoryValue = searchValue.Substring(index, length - index).ToString().Trim();
                    searchValue  = goodsValue + ',' + factoryValue;
                }
                List <GoodsList> lists = new List <GoodsList>();
                lists = infoDal.SearchFastGoods(entid, searchValue, jgjb, KhType, landing, staleDated);
                if (lists == null)
                {
                    return(Json(new { flag = 2, message = "无符合商品!" }));
                }
                else
                {
                    return(Json(new { flag = 2, message = "商品查询成功!", lists }));
                }
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "Search/SearchFastGoods", ex.Message.ToString());
                return(Json(new { flag = 99, message = "商品获取失败!" }));
            }
        }
Exemplo n.º 10
0
        static void DeleteGoodsInfo()
        {
            int          id          = 1;
            GoodsInfoDal sortInfoDal = new GoodsInfoDal();
            var          d           = sortInfoDal.Delete(id);

            if (d)
            {
                Console.WriteLine("成功");
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
Exemplo n.º 11
0
        public JsonResult OftenBuy(string userId, string entId, string searchValue, int pageIndex = 1, int pageSize = 15)
        {
            try
            {
                if (string.IsNullOrEmpty(entId) || string.IsNullOrEmpty(userId))
                {
                    return(Json(new { success = false, message = "请先登录" }));
                }
                //获取用户信息
                UserInfoDal     dal  = new UserInfoDal();
                List <UserInfo> user = new List <UserInfo>();
                if (!string.IsNullOrEmpty(userId))
                {
                    user = dal.GetUserInfo(userId, entId);
                }
                string jgjb = "", clientlimit = "", KhType = "";
                bool   landing    = false;
                bool   staleDated = false;
                if (user.Count > 0)
                {
                    entId       = user[0].EntId;
                    jgjb        = user[0].Pricelevel;
                    clientlimit = user[0].ClientLimit;
                    KhType      = user[0].KhType;
                    staleDated  = user[0].StaleDated;
                    landing     = true;
                }

                GoodsInfoDal infoDal = new GoodsInfoDal();
                if (searchValue.Trim().Contains(" "))
                {
                    int    length = searchValue.Length;
                    int    index = searchValue.IndexOf(" ");
                    string goodsValue, factoryValue;
                    goodsValue   = searchValue.Substring(0, index).Trim();
                    factoryValue = searchValue.Substring(index, length - index).ToString().Trim();
                    searchValue  = goodsValue + ',' + factoryValue;
                }
                List <GoodsList> lists = new List <GoodsList>();
                lists = infoDal.OftenBuy(userId, entId, searchValue, jgjb, KhType, landing, staleDated, pageIndex, pageSize, out int pageCount, out int recordCount);
                return(Json(new { success = true, message = "常购商品获取成功", lists, pageCount, recordCount }));
            }
            catch (Exception ex)
            {
                LogQueue.Write(LogType.Error, "Search/OftenBuy", $"{ex.Message}");
                return(Json(new { success = false, message = "常购商品获取失败!" }));
            }
        }
Exemplo n.º 12
0
 /// <summary>
 /// 请求求购信息
 /// </summary>
 /// <param name="userId">用户</param>
 /// <param name="entId">机构</param>
 /// <param name="pageIndex">页码</param>
 /// <param name="pageSize">容量</param>
 /// <returns></returns>
 public ActionResult QueryReply(string userId, string entId, int pageIndex, int pageSize)
 {
     try
     {
         GoodsInfoDal   goodsInfoDal   = new GoodsInfoDal();
         RequrementList requrementList = new RequrementList();
         requrementList = goodsInfoDal.QueryReply(userId, entId, pageIndex, pageSize);
         return(Json(new { success = true, message = "求购信息获取成功", requrementList }));
     }
     catch (Exception ex)
     {
         string msg = ex.Message.ToString().Trim();
         LogQueue.Write(LogType.Error, "GoodsInfoDal/QueryReply", msg);
         return(Json(new { success = false, message = msg }));
     }
 }
Exemplo n.º 13
0
 /// <summary>
 /// 同类商品推荐
 /// </summary>
 /// <param name="entId">企业</param>
 /// <param name="userId">用户</param>
 /// <param name="articleId">商品ID</param>
 /// <param name="num">条目数</param>
 /// <returns></returns>
 public ActionResult Commendation(string entId, string userId, string articleId, int num)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (string.IsNullOrEmpty(articleId))
         {
             return(Json(new { success = false, message = "参数异常" }));
         }
         ///获取用户信息
         UserInfoDal     dal  = new UserInfoDal();
         List <UserInfo> user = new List <UserInfo>();
         if (!string.IsNullOrEmpty(userId))
         {
             user = dal.GetUserInfo(userId, entId);
         }
         string jgjb = "", clientlimit = "", KhType = "";
         bool   landing    = false;
         bool   staleDated = false;
         //获取客户价格级别
         if (user.Count > 0)
         {
             entId       = user[0].EntId;
             jgjb        = user[0].Pricelevel;
             clientlimit = user[0].ClientLimit;
             KhType      = user[0].KhType;
             staleDated  = user[0].StaleDated;
             landing     = true;
         }
         GoodsInfoDal infoDal = new GoodsInfoDal();
         ///商品详情
         List <GoodsList> list = infoDal.GetGoodDetail(userId, articleId, entId);
         var category          = list[0].GoodsInfo[0].Category;
         //同类商品推荐
         List <Models.GoodsInfo> klist = infoDal.Commendation(entId, category, num, jgjb, KhType, landing, staleDated);
         return(Json(new { success = true, message = "商品推荐获取成功", klist }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Goods/Commendation", ex.Message.ToString());
         return(Json(new { success = false, message = "商品推荐加载失败!" }));
     }
 }
Exemplo n.º 14
0
 public JsonResult SearchIndex(string entid, string parameter)
 {
     try
     {
         if (string.IsNullOrEmpty(entid))
         {
             entid = BaseConfiguration.EntId;
         }
         GoodsInfoDal       infoDal = new GoodsInfoDal();
         List <SearchIndex> indices = new List <SearchIndex>();
         indices = infoDal.SearchIndex(entid, parameter);
         return(Json(new { success = true, list = indices }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Search/SearchIndex", ex.Message.ToString());
         return(Json(new { success = false, message = "搜索栏索引获取失败!" }));
     }
 }
Exemplo n.º 15
0
 public JsonResult GetActivity(string userId, string entId, string articleId, string fabh = "")
 {
     try
     {
         if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(entId))
         {
             return(Json(new { success = false, message = "用户未登录,请先登录" }));
         }
         GoodsInfoDal     dal  = new GoodsInfoDal();
         List <Promotion> list = new List <Promotion>();
         list = dal.GetActivity(userId, entId, articleId, fabh);
         return(Json(new { success = true, message = list }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Search/GetActivity", ex.Message.ToString());
         return(Json(new { success = false, message = "商品活动信息获取失败!" }));
     }
 }
Exemplo n.º 16
0
        static void EditSalesInfo()
        {
            GoodsInfoDal GoodsInfoDal = new GoodsInfoDal();


            ProfitsInfoDal salesInfoDal = new ProfitsInfoDal();
            ProfitsInfo    salesInfo    = salesInfoDal.GetEntityById(2);

            salesInfo.Remark = "测试修改";
            salesInfo.IsPay  = false;

            var d = salesInfoDal.Edit(salesInfo);//仅能修改 备注和是否支付

            if (d)
            {
                Console.WriteLine("成功");
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
Exemplo n.º 17
0
        public ActionResult GetArticleRecommend(string entId, string userId, int count, int type)
        {
            if (string.IsNullOrEmpty(entId))
            {
                entId = BaseConfiguration.EntId;
            }
            ///获取用户信息
            UserInfoDal     dal  = new UserInfoDal();
            List <UserInfo> user = new List <UserInfo>();

            if (!string.IsNullOrEmpty(userId))
            {
                user = dal.GetUserInfo(userId, entId);
            }
            string jgjb = "", clientlimit = "", KhType = "";
            bool   staleDated = false;

            //获取客户价格级别
            if (user.Count > 0)
            {
                entId       = user[0].EntId;
                jgjb        = user[0].Pricelevel;
                clientlimit = user[0].ClientLimit;
                KhType      = user[0].KhType;
                staleDated  = user[0].StaleDated;
            }
            GoodsInfoDal goodsInfoDal = new GoodsInfoDal();
            DataTable    dt           = goodsInfoDal.GetGetArticleRecommend(entId, jgjb, KhType, count, type);

            JsonSerializerSettings setting = new JsonSerializerSettings()
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            };

            var data = JsonConvert.SerializeObject(dt, setting);

            return(Json(data));
        }
Exemplo n.º 18
0
 /// <summary>
 /// 发起求购专区
 /// </summary>
 /// <param name="userId">用户</param>
 /// <param name="entId">机构</param>
 /// <param name="buyName">求购人</param>
 /// <param name="buyTel">求购人联系方式</param>
 /// <param name="buyGoods">求购药品名称</param>
 /// <param name="productName">求购药品厂家</param>
 /// <param name="buySpec">求购药品规格</param>
 /// <param name="buyNumber">求购药品数量</param>
 /// <param name="buyPrice">求购药品价格</param>
 /// <param name="message">求购备注</param>
 /// <returns></returns>
 public ActionResult InsertReply(string userId, string entId, string buyName, string buyTel, string buyGoods, string productName, string buySpec, decimal buyNumber, decimal buyPrice, string message)
 {
     try
     {
         GoodsInfoDal goodsInfoDal = new GoodsInfoDal();
         if (string.IsNullOrEmpty(buyName) || string.IsNullOrEmpty(buyGoods) || string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(entId) || string.IsNullOrEmpty(productName) || string.IsNullOrEmpty(buyTel) || string.IsNullOrEmpty(buySpec))
         {
             LogQueue.Write(LogType.Debug, "", $"求购人:{buyName},求购人联系方式:{buyTel},求购药品名称:{buyGoods},用户:{userId},机构:{entId},求购药品厂家:{productName},求购药品规格:{buySpec}");
             return(Json(new { success = false, message = "参数异常" }));
         }
         else
         {
             bool flag = goodsInfoDal.InsertReply(buyName, buyTel, buyGoods, productName, buySpec, buyNumber, buyPrice, userId, entId, message, out string msg);
             return(Json(new { success = flag, message = msg }));
         }
     }
     catch (Exception ex)
     {
         string msg = ex.Message.ToString().Trim();
         LogQueue.Write(LogType.Error, "GoodsInfoDal/InsertReply", msg);
         return(Json(new { success = false, message = msg }));
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// 专区商品
 /// </summary>
 /// <param name="entId">机构Id</param>
 /// <param name="userId">会员Id</param>
 /// <param name="zqType">专区类型</param>
 /// <param name="pageIndex">页码</param>
 /// <param name="pageSize">页容</param>
 /// <returns></returns>
 public JsonResult GetZqGoodsList(string entId, string userId, string zqType, int pageIndex, int pageSize)
 {
     try
     {
         if (string.IsNullOrEmpty(entId))
         {
             entId = BaseConfiguration.EntId;
         }
         if (string.IsNullOrEmpty(zqType))
         {
             return(Json(new { success = false, msgCode = "E002", message = "专区类型获取失败" }));
         }
         ///获取商品分类列表
         GoodsInfoDal     dal  = new GoodsInfoDal();
         List <GoodsList> list = dal.GetGoodsList(userId, "", "", "cxbs", "", "", "", pageIndex, pageSize, entId, zqType);
         ///商品分类信息
         return(Json(new { success = true, list }));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Search/SearchGoodsList", ex.Message.ToString());
         return(Json(new { success = false, message = "商品列表加载失败!" }));
     }
 }