Exemple #1
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditVoteObjectInfo(HttpContext context)
        {
            string voteObjectName = context.Request["VoteObjectName"];
            string area           = context.Request["Area"];
            string introduction   = context.Request["Introduction"];
            string number         = (bllVote.GetVoteObjectMaxNumber(currVote.AutoID) + 1).ToString();
            string phone          = context.Request["Phone"];
            string height         = context.Request["height"];

            string showImage1 = context.Request["ShowImage1"];
            string showImage2 = context.Request["ShowImage2"];
            string showImage3 = context.Request["ShowImage3"];
            string showImage4 = context.Request["ShowImage4"];
            string showImage5 = context.Request["ShowImage5"];

            string schoolName          = context.Request["SchoolName"];
            string conatact            = context.Request["Conatact"];
            string ex1                 = context.Request["Ex1"];
            string ex2                 = context.Request["Ex2"];
            string ex3                 = context.Request["Ex3"];
            string voteObjectHeadImage = context.Request["VoteObjectHeadImage"];

            VoteObjectInfo model = bllVote.GetVoteObjectInfo(currVote.AutoID, currentUserInfo.UserID);

            if (model == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "您还没有报名";
                goto outoff;
            }
            if (model.Status.Equals(1))
            {
                resp.errcode = 1;
                resp.errmsg  = "您已通过审核,不能修改个人资料";
                goto outoff;
            }
            //if (string.IsNullOrEmpty(introduction))
            //{
            //    resp.errcode = 1;
            //    resp.errmsg = "请输入参赛口号";
            //    goto outoff;
            //}
            //if (string.IsNullOrEmpty(voteObjectName))
            //{
            //    resp.errcode = 1;
            //    resp.errmsg = "请输入姓名";
            //    goto outoff;
            //}

            //if (string.IsNullOrEmpty(area))
            //{
            //    resp.errcode = 1;
            //    resp.errmsg = "请输入城市";
            //    goto outoff;
            //}


            //if (string.IsNullOrEmpty(phone))
            //{
            //    resp.errcode = 1;
            //    resp.errmsg = "请输入联系人电话";
            //    goto outoff;
            //}
            CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();
            if (!string.IsNullOrWhiteSpace(showImage1))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle1 = Convert.ToInt32(context.Request["imgAngle1"]);
                //imgAngle = 90;
                if (imgAngle1 != 0)
                {
                    imgAngle1 = RevertAngle(imgAngle1);
                    if (showImage1.StartsWith("http"))//远程图片
                    {
                        showImage1 = bllJuactivity.DownLoadRemoteImage(showImage1);
                    }
                    //获取源图片地址
                    string imgPath1 = context.Server.MapPath(showImage1);


                    var imgResult = imgHelper.RotateImg(imgPath1, imgAngle1, imgPath1);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage2))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle2 = Convert.ToInt32(context.Request["imgAngle2"]);

                if (imgAngle2 != 0)
                {
                    imgAngle2 = RevertAngle(imgAngle2);
                    if (showImage2.StartsWith("http"))//远程图片
                    {
                        showImage2 = bllJuactivity.DownLoadRemoteImage(showImage2);
                    }
                    //获取源图片地址
                    string imgPath2  = context.Server.MapPath(showImage2);
                    var    imgResult = imgHelper.RotateImg(imgPath2, imgAngle2, imgPath2);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage3))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle3 = Convert.ToInt32(context.Request["imgAngle3"]);

                if (imgAngle3 != 0)
                {
                    imgAngle3 = RevertAngle(imgAngle3);
                    if (showImage3.StartsWith("http"))//远程图片
                    {
                        showImage3 = bllJuactivity.DownLoadRemoteImage(showImage3);
                    }
                    //获取源图片地址
                    string imgPath3  = context.Server.MapPath(showImage3);
                    var    imgResult = imgHelper.RotateImg(imgPath3, imgAngle3, imgPath3);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage4))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle4 = Convert.ToInt32(context.Request["imgAngle4"]);

                if (imgAngle4 != 0)
                {
                    imgAngle4 = RevertAngle(imgAngle4);
                    if (showImage4.StartsWith("http"))//远程图片
                    {
                        showImage4 = bllJuactivity.DownLoadRemoteImage(showImage4);
                    }
                    //获取源图片地址
                    string imgPath4  = context.Server.MapPath(showImage4);
                    var    imgResult = imgHelper.RotateImg(imgPath4, imgAngle4, imgPath4);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage5))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle5 = Convert.ToInt32(context.Request["imgAngle5"]);

                if (imgAngle5 != 0)
                {
                    imgAngle5 = RevertAngle(imgAngle5);
                    if (showImage5.StartsWith("http"))//远程图片
                    {
                        showImage5 = bllJuactivity.DownLoadRemoteImage(showImage5);
                    }
                    //获取源图片地址
                    string imgPath5  = context.Server.MapPath(showImage5);
                    var    imgResult = imgHelper.RotateImg(imgPath5, imgAngle5, imgPath5);
                }
            }

            model.VoteObjectName      = voteObjectName;
            model.VoteObjectHeadImage = showImage1;
            model.Area         = area;
            model.Introduction = introduction;
            model.Phone        = phone;
            model.Height       = height;
            model.ShowImage1   = showImage1;
            model.ShowImage2   = showImage2;
            model.ShowImage3   = showImage3;
            model.ShowImage4   = showImage4;
            model.ShowImage5   = showImage5;
            model.SchoolName   = schoolName;
            model.Contact      = conatact;
            model.Ex1          = ex1;
            model.Ex2          = ex2;
            model.Ex3          = ex3;
            if (!string.IsNullOrEmpty(voteObjectHeadImage))
            {
                model.VoteObjectHeadImage = voteObjectHeadImage;
            }
            if (bllVote.UpdateVoteObjectInfo(model))
            {
                resp.errmsg = "修改成功";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "修改失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }