Пример #1
0
        public JsonResult BatchAddRecommendInfo(string json)
        {
            List <RecommendInfo> modelList     = new List <RecommendInfo>();
            RecommendInfo        recommendInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <RecommendInfo>(json);

            if (recommendInfo._RecommendInfos != null)
            {
                foreach (RecommendInfo list in recommendInfo._RecommendInfos.ToList())
                {
                    list.Status     = 2;
                    list.CreateDate = DateTime.Now;
                    list.ActiveTime = DateTime.Now;
                    list.UserId     = base.CurrentManager.Id;
                }
                modelList = recommendInfo._RecommendInfos;
                bool flag = ServiceHelper.Create <IRecommendInfoService>().BatchAddRecommendInfo(modelList);
                if (flag)
                {
                    return(Json(new { success = true }));
                }
                else
                {
                    return(Json(new { success = false }));
                }
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Пример #2
0
        public JsonResult AddRecommendInfo(string platcode, string casno, string productName, string structure_2D, decimal price, string uname)
        {
            RecommendInfo recommendInfo = new RecommendInfo()
            {
                Plat_Code    = platcode,
                CID          = int.Parse(structure_2D),
                CASNO        = casno,
                ProductName  = productName,
                Structure_2D = "",
                Price        = price,
                Status       = 2,
                CreateDate   = DateTime.Now,
                ActiveTime   = DateTime.Now,
                UserId       = base.CurrentManager.Id,
                UserName     = uname
            };
            bool flag = ServiceHelper.Create <IRecommendInfoService>().AddRecommendInfo(recommendInfo);

            if (flag)
            {
                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Пример #3
0
 public bool UpdateRecommendInfo(long id, decimal price)
 {
     try
     {
         RecommendInfo model = context.RecommendInfo.FindById(id);
         if (model != null)
         {
             model.Price = price;
             int i = context.SaveChanges();
             if (i > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Пример #4
0
 public bool UpdateRecommendInfoStatus(long Id, int status, long userId)
 {
     try
     {
         RecommendInfo model = context.RecommendInfo.FindById(Id);
         if (model != null)
         {
             model.Status = status;
             model.UserId = userId;
             int i = context.SaveChanges();
             if (i > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Пример #5
0
 public bool DeleteRecommendInfo(long id)
 {
     try
     {
         RecommendInfo model = context.RecommendInfo.FindById(id);
         if (model != null)
         {
             context.RecommendInfo.Remove(model);
             int i = context.SaveChanges();
             if (i > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Пример #6
0
 /// <summary>
 /// 同步通过好友认证
 /// </summary>
 /// <param name="info">sync中获得的申请信息</param>
 /// <returns></returns>
 public SimpleResponse VerifyUser(RecommendInfo info)
 {
     string verifyUserUrl = host + "/cgi-bin/mmwebwx-bin/webwxverifyuser?r=" + Utils.GetJavaTimeStamp();
     VerifyUserRequest request = new VerifyUserRequest();
     request.BaseRequest = baseRequest;
     request.Opcode = VERIFYUSER_OPCODE.VERIFYUSER_OPCODE_VERIFYOK;
     request.SceneList = new List<int>() { (int)ADDSCENE_PF.ADDSCENE_PF_WEB };
     request.VerifyUserList = new List<Modal.Request.VerifyUser>() { new Modal.Request.VerifyUser { Value = info.UserName, VerifyUserTicket = info.Ticket } };
     request.skey = baseRequest.Skey;
     //反馈结果可以不理
     return httpClient.PostJson<SimpleResponse>(verifyUserUrl, request);
 }
Пример #7
0
        public bool UpdateRecommendInfo(RecommendInfo newrinfo, RecommendInfo oldRecommendInfo)
        {
            string path = Path.Combine(EntityElement.UserPath, "Files");

            if (!(newrinfo.RAttachmentInfo.UploadName == oldRecommendInfo.RAttachmentInfo.UploadName) || !(newrinfo.RAttachmentInfo.UploadFullPath == string.Empty))
            {
                if (File.Exists(Path.Combine(path, oldRecommendInfo.RAttachmentInfo.StoreName)))
                {
                    File.Delete(Path.Combine(path, oldRecommendInfo.RAttachmentInfo.StoreName));
                }
                if (File.Exists(newrinfo.RAttachmentInfo.UploadFullPath))
                {
                    File.Copy(newrinfo.RAttachmentInfo.UploadFullPath, Path.Combine(path, newrinfo.RAttachmentInfo.StoreName), true);
                }
            }
            if (!(newrinfo.ExperInfoList[0].EAttachmentInfo.UploadName == oldRecommendInfo.ExperInfoList[0].EAttachmentInfo.UploadName) || !(newrinfo.ExperInfoList[0].EAttachmentInfo.UploadFullPath == string.Empty))
            {
                if (File.Exists(Path.Combine(path, oldRecommendInfo.ExperInfoList[0].EAttachmentInfo.StoreName)))
                {
                    File.Delete(Path.Combine(path, oldRecommendInfo.ExperInfoList[0].EAttachmentInfo.StoreName));
                }
                if (File.Exists(newrinfo.ExperInfoList[0].EAttachmentInfo.UploadFullPath))
                {
                    File.Copy(newrinfo.ExperInfoList[0].EAttachmentInfo.UploadFullPath, Path.Combine(path, newrinfo.ExperInfoList[0].EAttachmentInfo.StoreName), true);
                }
            }
            if (!(newrinfo.ExperInfoList[1].EAttachmentInfo.UploadName == oldRecommendInfo.ExperInfoList[1].EAttachmentInfo.UploadName) || !(newrinfo.ExperInfoList[1].EAttachmentInfo.UploadFullPath == string.Empty))
            {
                if (File.Exists(Path.Combine(path, oldRecommendInfo.ExperInfoList[1].EAttachmentInfo.StoreName)))
                {
                    File.Delete(Path.Combine(path, oldRecommendInfo.ExperInfoList[1].EAttachmentInfo.StoreName));
                }
                if (File.Exists(newrinfo.ExperInfoList[1].EAttachmentInfo.UploadFullPath))
                {
                    File.Copy(newrinfo.ExperInfoList[1].EAttachmentInfo.UploadFullPath, Path.Combine(path, newrinfo.ExperInfoList[1].EAttachmentInfo.StoreName), true);
                }
            }
            if (!(newrinfo.ExperInfoList[2].EAttachmentInfo.UploadName == oldRecommendInfo.ExperInfoList[2].EAttachmentInfo.UploadName) || !(newrinfo.ExperInfoList[2].EAttachmentInfo.UploadFullPath == string.Empty))
            {
                if (File.Exists(Path.Combine(path, oldRecommendInfo.ExperInfoList[2].EAttachmentInfo.StoreName)))
                {
                    File.Delete(Path.Combine(path, oldRecommendInfo.ExperInfoList[2].EAttachmentInfo.StoreName));
                }
                if (File.Exists(newrinfo.ExperInfoList[2].EAttachmentInfo.UploadFullPath))
                {
                    File.Copy(newrinfo.ExperInfoList[2].EAttachmentInfo.UploadFullPath, Path.Combine(path, newrinfo.ExperInfoList[2].EAttachmentInfo.StoreName), true);
                }
            }
            return(this._recommendInfoDao.UpdateRecommendInfo(newrinfo));
        }
Пример #8
0
        protected void btnAddBanner_Click(object sender, System.EventArgs e)
        {
            if (this.id == 0)
            {
                TplCfgInfo tplCfgInfo = new RecommendInfo();
                tplCfgInfo.IsDisable    = false;
                tplCfgInfo.ImageUrl     = this.fmSrc.Value;
                tplCfgInfo.ShortDesc    = this.txtBannerDesc.Text;
                tplCfgInfo.Client       = 3;
                tplCfgInfo.LocationType = (LocationType)System.Enum.Parse(typeof(LocationType), this.ddlType.SelectedValue);
                tplCfgInfo.Url          = this.locationUrl.Value;
                tplCfgInfo.SupplierId   = CheckSupplierRole();
                if (string.IsNullOrWhiteSpace(tplCfgInfo.ImageUrl))
                {
                    this.ShowMsg("请上传图片!", false);
                    return;
                }
                if (VShopHelper.SaveTplCfg(tplCfgInfo))
                {
                    this.CloseWindow();
                    return;
                }
                this.ShowMsg("添加错误!", false);
            }

            else
            {
                TplCfgInfo tplCfgById = VShopHelper.GetTplCfgById(this.id);
                tplCfgById.IsDisable    = false;
                tplCfgById.ImageUrl     = this.fmSrc.Value;
                tplCfgById.ShortDesc    = this.txtBannerDesc.Text;
                tplCfgById.Client       = 3;
                tplCfgById.LocationType = (LocationType)System.Enum.Parse(typeof(LocationType), this.ddlType.SelectedValue);
                tplCfgById.Url          = this.locationUrl.Value;
                tplCfgById.SupplierId   = CheckSupplierRole();
                if (VShopHelper.UpdateTplCfg(tplCfgById))
                {
                    this.CloseWindow();
                    return;
                }
                this.ShowMsg("修改失败!", false);
            }
        }
Пример #9
0
        public RecommendInfo GetRecommendInfo()
        {
            string        querystring   = "select ApplicationType,UnitRecommend,UnitRecommendOName,ExpertName1,ExpertArea1,ExpertWorkType1,ExpertUnitPosition1,\r\n           ExpertUnit1,ExpertRecommend1, ExpertRecommend1OName,ExpertName2,ExpertArea2,ExpertWorkType2,ExpertUnitPosition2,ExpertUnit2,\r\n            ExpertRecommend2,ExpertRecommend2OName,ExpertName3,ExpertArea3,ExpertWorkType3,ExpertUnitPosition3,ExpertUnit3,ExpertRecommend3,ExpertRecommend3OName from BaseInfor";
            string        text          = "";
            DataTable     data          = base.GetData(querystring, out text);
            RecommendInfo recommendInfo = null;

            if (data != null && data.Rows.Count > 0)
            {
                recommendInfo = new RecommendInfo();
                recommendInfo.ApplicationType            = ((data.Rows[0]["ApplicationType"] == DBNull.Value) ? "单位推荐" : data.Rows[0]["ApplicationType"].ToString());
                recommendInfo.RAttachmentInfo.StoreName  = ((data.Rows[0]["UnitRecommend"] == DBNull.Value) ? "" : data.Rows[0]["UnitRecommend"].ToString());
                recommendInfo.RAttachmentInfo.UploadName = ((data.Rows[0]["UnitRecommendOName"] == DBNull.Value) ? "" : data.Rows[0]["UnitRecommendOName"].ToString());
                ExpertInfo expertInfo = new ExpertInfo();
                expertInfo.ExpertName                 = ((data.Rows[0]["ExpertName1"] == DBNull.Value) ? "" : data.Rows[0]["ExpertName1"].ToString());
                expertInfo.ExpertArea                 = ((data.Rows[0]["ExpertArea1"] == DBNull.Value) ? "" : data.Rows[0]["ExpertArea1"].ToString());
                expertInfo.ExpertWorkType             = ((data.Rows[0]["ExpertWorkType1"] == DBNull.Value) ? "" : data.Rows[0]["ExpertWorkType1"].ToString());
                expertInfo.ExpertUnitPosition         = ((data.Rows[0]["ExpertUnitPosition1"] == DBNull.Value) ? "" : data.Rows[0]["ExpertUnitPosition1"].ToString());
                expertInfo.ExpertUnit                 = ((data.Rows[0]["ExpertUnit1"] == DBNull.Value) ? "" : data.Rows[0]["ExpertUnit1"].ToString());
                expertInfo.EAttachmentInfo.StoreName  = ((data.Rows[0]["ExpertRecommend1"] == DBNull.Value) ? "" : data.Rows[0]["ExpertRecommend1"].ToString());
                expertInfo.EAttachmentInfo.UploadName = ((data.Rows[0]["ExpertRecommend1OName"] == DBNull.Value) ? "" : data.Rows[0]["ExpertRecommend1OName"].ToString());
                recommendInfo.ExperInfoList.Add(expertInfo);
                expertInfo                            = new ExpertInfo();
                expertInfo.ExpertName                 = ((data.Rows[0]["ExpertName2"] == DBNull.Value) ? "" : data.Rows[0]["ExpertName2"].ToString());
                expertInfo.ExpertArea                 = ((data.Rows[0]["ExpertArea2"] == DBNull.Value) ? "" : data.Rows[0]["ExpertArea2"].ToString());
                expertInfo.ExpertWorkType             = ((data.Rows[0]["ExpertWorkType2"] == DBNull.Value) ? "" : data.Rows[0]["ExpertWorkType2"].ToString());
                expertInfo.ExpertUnitPosition         = ((data.Rows[0]["ExpertUnitPosition2"] == DBNull.Value) ? "" : data.Rows[0]["ExpertUnitPosition2"].ToString());
                expertInfo.ExpertUnit                 = ((data.Rows[0]["ExpertUnit2"] == DBNull.Value) ? "" : data.Rows[0]["ExpertUnit2"].ToString());
                expertInfo.EAttachmentInfo.StoreName  = ((data.Rows[0]["ExpertRecommend2"] == DBNull.Value) ? "" : data.Rows[0]["ExpertRecommend2"].ToString());
                expertInfo.EAttachmentInfo.UploadName = ((data.Rows[0]["ExpertRecommend2OName"] == DBNull.Value) ? "" : data.Rows[0]["ExpertRecommend2OName"].ToString());
                recommendInfo.ExperInfoList.Add(expertInfo);
                expertInfo                            = new ExpertInfo();
                expertInfo.ExpertName                 = ((data.Rows[0]["ExpertName3"] == DBNull.Value) ? "" : data.Rows[0]["ExpertName3"].ToString());
                expertInfo.ExpertArea                 = ((data.Rows[0]["ExpertArea3"] == DBNull.Value) ? "" : data.Rows[0]["ExpertArea3"].ToString());
                expertInfo.ExpertWorkType             = ((data.Rows[0]["ExpertWorkType3"] == DBNull.Value) ? "" : data.Rows[0]["ExpertWorkType3"].ToString());
                expertInfo.ExpertUnitPosition         = ((data.Rows[0]["ExpertUnitPosition3"] == DBNull.Value) ? "" : data.Rows[0]["ExpertUnitPosition3"].ToString());
                expertInfo.ExpertUnit                 = ((data.Rows[0]["ExpertUnit3"] == DBNull.Value) ? "" : data.Rows[0]["ExpertUnit3"].ToString());
                expertInfo.EAttachmentInfo.StoreName  = ((data.Rows[0]["ExpertRecommend3"] == DBNull.Value) ? "" : data.Rows[0]["ExpertRecommend3"].ToString());
                expertInfo.EAttachmentInfo.UploadName = ((data.Rows[0]["ExpertRecommend3OName"] == DBNull.Value) ? "" : data.Rows[0]["ExpertRecommend3OName"].ToString());
                recommendInfo.ExperInfoList.Add(expertInfo);
            }
            return(recommendInfo);
        }
Пример #10
0
 public bool AddRecommendInfo(RecommendInfo model)
 {
     try
     {
         context.RecommendInfo.Add(model);
         int i = context.SaveChanges();
         if (i > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException ex)
     {
         return(false);
     }
 }
Пример #11
0
        public JsonResult GetRecommendInfosData(string platCode)
        {
            List <ProductInfo>   productInfos   = ServiceHelper.Create <IRecommendInfoService>().GetRecommendInfosLikePlatCode(platCode);
            List <RecommendInfo> recommendInfos = new List <RecommendInfo>();

            foreach (ProductInfo list in productInfos)
            {
                RecommendInfo recommendInfo = new RecommendInfo();
                recommendInfo.Plat_Code   = list.Plat_Code;
                recommendInfo.CID         = list.Pub_CID;
                recommendInfo.CASNO       = list.CASNo;
                recommendInfo.ProductName = list.ProductName;
                recommendInfo.Price       = list.Price;
                recommendInfo.UserName    = ServiceHelper.Create <IManagerService>().GetManagerInfoByShopId(list.ShopId).UserName;
                recommendInfos.Add(recommendInfo);
            }
            int count = recommendInfos.Count();

            if (count <= 0)
            {
                return(Json(new { success = false, msg = "没有找到数据" }));
            }
            return(Json(new { success = true, rows = recommendInfos, total = count }));
        }
Пример #12
0
        public bool UpdateRecommendInfo(RecommendInfo rinfo)
        {
            string sql = "update BaseInfor set  ApplicationType=@ApplicationType,UnitRecommend=@UnitRecommend,UnitRecommendOName=@UnitRecommendOName,\r\nExpertName1=@ExpertName1,ExpertArea1=@ExpertArea1,ExpertWorkType1=@ExpertWorkType1,ExpertUnitPosition1=@ExpertUnitPosition1,ExpertUnit1=@ExpertUnit1,ExpertRecommend1=@ExpertRecommend1,\r\nExpertRecommend1OName=@ExpertRecommend1OName,ExpertName2=@ExpertName2,ExpertArea2=@ExpertArea2,ExpertWorkType2=@ExpertWorkType2,ExpertUnitPosition2=@ExpertUnitPosition2,ExpertUnit2=@ExpertUnit2,\r\n            ExpertRecommend2=@ExpertRecommend2,ExpertRecommend2OName=@ExpertRecommend2OName,ExpertName3=@ExpertName3,ExpertArea3=@ExpertArea3,ExpertWorkType3=@ExpertWorkType3,ExpertUnitPosition3=@ExpertUnitPosition3,\r\nExpertUnit3=@ExpertUnit3,ExpertRecommend3=@ExpertRecommend3,ExpertRecommend3OName=@ExpertRecommend3OName";

            SQLiteParameter[] parameters = new SQLiteParameter[]
            {
                new SQLiteParameter("@ApplicationType", rinfo.ApplicationType),
                new SQLiteParameter("@UnitRecommend", rinfo.RAttachmentInfo.StoreName),
                new SQLiteParameter("@UnitRecommendOName", rinfo.RAttachmentInfo.UploadName),
                new SQLiteParameter("@ExpertName1", rinfo.ExperInfoList[0].ExpertName),
                new SQLiteParameter("@ExpertArea1", rinfo.ExperInfoList[0].ExpertArea),
                new SQLiteParameter("@ExpertWorkType1", rinfo.ExperInfoList[0].ExpertWorkType),
                new SQLiteParameter("@ExpertUnitPosition1", rinfo.ExperInfoList[0].ExpertUnitPosition),
                new SQLiteParameter("@ExpertUnit1", rinfo.ExperInfoList[0].ExpertUnit),
                new SQLiteParameter("@ExpertRecommend1", rinfo.ExperInfoList[0].EAttachmentInfo.StoreName),
                new SQLiteParameter("@ExpertRecommend1OName", rinfo.ExperInfoList[0].EAttachmentInfo.UploadName),
                new SQLiteParameter("@ExpertName2", rinfo.ExperInfoList[1].ExpertName),
                new SQLiteParameter("@ExpertArea2", rinfo.ExperInfoList[1].ExpertArea),
                new SQLiteParameter("@ExpertWorkType2", rinfo.ExperInfoList[1].ExpertWorkType),
                new SQLiteParameter("@ExpertUnitPosition2", rinfo.ExperInfoList[1].ExpertUnitPosition),
                new SQLiteParameter("@ExpertUnit2", rinfo.ExperInfoList[1].ExpertUnit),
                new SQLiteParameter("@ExpertRecommend2", rinfo.ExperInfoList[1].EAttachmentInfo.StoreName),
                new SQLiteParameter("@ExpertRecommend2OName", rinfo.ExperInfoList[1].EAttachmentInfo.UploadName),
                new SQLiteParameter("@ExpertName3", rinfo.ExperInfoList[2].ExpertName),
                new SQLiteParameter("@ExpertArea3", rinfo.ExperInfoList[2].ExpertArea),
                new SQLiteParameter("@ExpertWorkType3", rinfo.ExperInfoList[2].ExpertWorkType),
                new SQLiteParameter("@ExpertUnitPosition3", rinfo.ExperInfoList[2].ExpertUnitPosition),
                new SQLiteParameter("@ExpertUnit3", rinfo.ExperInfoList[2].ExpertUnit),
                new SQLiteParameter("@ExpertRecommend3", rinfo.ExperInfoList[2].EAttachmentInfo.StoreName),
                new SQLiteParameter("@ExpertRecommend3OName", rinfo.ExperInfoList[2].EAttachmentInfo.UploadName)
            };
            string text = "";

            base.ExecuteNonQuery(sql, parameters, out text);
            return(true);
        }
Пример #13
0
        public ActionResult Edit(long id)
        {
            RecommendInfo recommendInfo = ServiceHelper.Create <IRecommendInfoService>().GetRecommendInfo(id);

            return(View(recommendInfo));
        }
Пример #14
0
        public RecommendInfo GetRecommendInfoByCID(long cid)
        {
            RecommendInfo model = context.RecommendInfo.FirstOrDefault((RecommendInfo m) => m.CID == cid);

            return(model);
        }
Пример #15
0
        public RecommendInfo GetRecommendInfo(long id)
        {
            RecommendInfo model = context.RecommendInfo.FirstOrDefault((RecommendInfo m) => m.Id == id);

            return(model);
        }