コード例 #1
0
        /// <summary>
        /// 添加团队Logo地址   已改
        /// </summary>
        /// <returns></returns>
        public ActionResult AddTeamLogoAddress()
        {
            string     jsonTxt         = null;
            HttpCookie loginUserCookie = Request.Cookies["loginUserInfo"];
            int        teamId          = Common.GetID.GetTeamID(loginUserCookie, TeamapplicantService);

            if (teamId == 0)
            {
                status = "no";
                result = "添加失败";
            }
            else if (teamId == -1)
            {
                status = "no";
                result = "添加失败";
            }
            else
            {
                string teamLogoAddress = Request["teamLogoAddress"] != null ? Request["teamLogoAddress"] : "Image/SliderPhoto/slider.jpg"; //获取团队头像的base64编码
                string getPath         = ConfigurationManager.AppSettings["teamLogo"];
                string savePath        = EditPhotos.Base64StringToImage(teamLogoAddress, getPath);                                         //Base64转图片
                string sliderLogo      = ".." + getPath + "/" + Path.GetFileName(savePath);
                try
                {
                    var team = TeamService.LoadEntities(t => t.ID == teamId && t.IsDel == false).FirstOrDefault();
                    team.vcTeamLogoAddress = sliderLogo;
                    if (TeamService.EditEntity(team))   //保存的时候出现对一个或多个实体
                    {
                        status = "ok";
                        result = "添加成功";
                    }
                    else
                    {
                        status = "no";
                        result = "添加失败";
                    }
                }
                catch (Exception ex)
                {
                    status = "no";
                    result = "网络异常";
                }
            }
            jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "," + "\"" + "result" + "\"" + ":" + "\"" + result + "\"" + "}";
            return(Content(jsonTxt));
        }
コード例 #2
0
        /// <summary>
        /// 添加荣耀表的Logo地址
        /// </summary>
        /// <returns></returns>
        public ActionResult AddHonorLogoAddress()
        {
            string jsonTxt = "";
            int    honorId = Convert.ToInt32(Request["honorId"]);

            if (honorId == 0)
            {
                status = "no";
                result = "添加失败";
            }
            else if (honorId == -1)
            {
                status = "no";
                result = "添加失败";
            }
            else
            {
                string honorLogoAddress = Request["honorLogoAddress"] != null ? Request["honorLogoAddress"] : "Image/SliderPhoto/slider.jpg"; //获取团队头像的base64编码
                string getPath          = ConfigurationManager.AppSettings["honorLogo"];
                string savePath         = EditPhotos.Base64StringToImage(honorLogoAddress, getPath);                                          //Base64转图片
                string sliderLogo       = ".." + getPath + "/" + Path.GetFileName(savePath);
                try
                {
                    var honor = HonorService.LoadEntities(h => h.ID == honorId && h.IsDel == false).FirstOrDefault();
                    honor.vcPreviewAddress = sliderLogo;
                    if (HonorService.EditEntity(honor))
                    {
                        status = "ok";
                        result = "添加成功";
                    }
                    else
                    {
                        status = "no";
                        result = "添加失败";
                    }
                }
                catch (Exception)
                {
                    status = "no";
                    result = "网络异常";
                }
            }
            jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "," + "\"" + "result" + "\"" + ":" + "\"" + result + "\"" + "}";
            return(Content(jsonTxt));
        }