Пример #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(bllVote.BeachHoneyVoteID) + 1).ToString();
            string phone          = context.Request["Phone"];
            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"];

            VoteObjectInfo model = bllVote.GetVoteObjectInfo(bllVote.BeachHoneyVoteID, 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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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.ShowImage1   = showImage1;
            model.ShowImage2   = showImage2;
            model.ShowImage3   = showImage3;
            model.ShowImage4   = showImage4;
            model.ShowImage5   = showImage5;
            if (bllVote.UpdateVoteObjectInfo(model))
            {
                resp.errmsg = "修改成功";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "修改失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Пример #2
0
        /// <summary>
        /// 报名
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddVoteObjectInfo(HttpContext context)
        {
            string voteObjectName = context.Request["VoteObjectName"];
            string area           = context.Request["Area"];
            string introduction   = context.Request["Introduction"];
            string number         = (bllVote.GetVoteObjectMaxNumber(bllVote.BeachHoneyVoteID) + 1).ToString();
            string phone          = context.Request["Phone"];


            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"];

            if (!context.Request.Url.Host.Equals("beachhoney.comeoncloud.net"))
            {
                resp.errcode = 1;
                resp.errmsg  = "请通过沙滩宝贝公众号进行报名";
                goto outoff;
            }
            if (bllVote.GetVoteObjectInfo(bllVote.BeachHoneyVoteID, CurrentUserInfo.UserID) != null)
            {
                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;
            }
            if (bllVote.IsExitsVoteObjectNumber(bllVote.BeachHoneyVoteID, number))
            {
                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"]);
                if (imgAngle1 != 0)
                {
                    imgAngle1 = RevertAngle(imgAngle1);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    string imgPath5  = context.Server.MapPath(showImage5);
                    var    imgResult = imgHelper.RotateImg(imgPath5, imgAngle5, imgPath5);
                }
            }



            VoteObjectInfo model = new VoteObjectInfo();

            model.VoteID              = bllVote.BeachHoneyVoteID;
            model.Number              = number;
            model.VoteObjectName      = voteObjectName;
            model.VoteObjectHeadImage = showImage1;
            model.Area         = area;
            model.Introduction = introduction;
            model.Phone        = phone;
            model.Status       = 0;
            model.CreateUserId = CurrentUserInfo.UserID;
            model.Rank         = 0;
            model.ShowImage1   = showImage1;
            model.ShowImage2   = showImage2;
            model.ShowImage3   = showImage3;
            model.ShowImage4   = showImage4;
            model.ShowImage5   = showImage5;
            if (bllVote.AddVoteObjectInfo(model))
            {
                resp.errmsg = "报名成功";
                bllVote.UpdateVoteObjectRank(bllVote.BeachHoneyVoteID);
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "报名失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Пример #3
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));
        }
Пример #4
0
        /// <summary>
        /// 报名
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddVoteObjectInfo(HttpContext context)
        {
            try
            {
                string voteObjectName = context.Request["VoteObjectName"];
                string area           = context.Request["Area"];
                string introduction   = context.Request["Introduction"];
                string number         = (bllVote.GetVoteObjectMaxNumber(currVote.AutoID) + 1).ToString();//TODO:生成 number的算法可能会并发产生重复
                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"];


                if (bllVote.GetVoteObjectInfo(currVote.AutoID, currentUserInfo.UserID) != null)
                {
                    resp.errcode = 1;
                    resp.errmsg  = "你已经报过名了";
                    goto outoff;
                }
                //if (string.IsNullOrEmpty(introduction))
                //{
                //    resp.errcode = 1;
                //    resp.errmsg = "请输入" + (string.IsNullOrWhiteSpace(currVote.SignUpDeclarationRename)? "参赛宣言": currVote.SignUpDeclarationRename);
                //    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;
                }
                if (bllVote.IsExitsVoteObjectNumber(currVote.AutoID, number))
                {
                    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"]);
                    if (imgAngle1 != 0)
                    {
                        imgAngle1 = RevertAngle(imgAngle1);

                        //获取源图片地址
                        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);
                        //获取源图片地址
                        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);
                        //获取源图片地址
                        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);
                        //获取源图片地址
                        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);
                        //获取源图片地址
                        string imgPath5  = context.Server.MapPath(showImage5);
                        var    imgResult = imgHelper.RotateImg(imgPath5, imgAngle5, imgPath5);
                    }
                }



                VoteObjectInfo model = new VoteObjectInfo();
                model.VoteID              = currVote.AutoID;
                model.Number              = number;
                model.VoteObjectName      = voteObjectName;
                model.VoteObjectHeadImage = showImage1;
                model.Area         = area;
                model.Introduction = introduction;
                model.Phone        = phone;
                model.Status       = 0;
                model.CreateUserId = currentUserInfo.UserID;
                model.Rank         = 0;
                model.ShowImage1   = showImage1;
                model.ShowImage2   = showImage2;
                model.ShowImage3   = showImage3;
                model.ShowImage4   = showImage4;
                model.ShowImage5   = showImage5;
                model.Height       = height;
                model.SchoolName   = schoolName;
                model.Contact      = conatact;
                model.Ex1          = ex1;
                model.Ex2          = ex2;
                model.Ex3          = ex3;
                if (!string.IsNullOrEmpty(voteObjectHeadImage))
                {
                    model.VoteObjectHeadImage = voteObjectHeadImage;
                }
                if (bllVote.AddVoteObjectInfo(model))
                {
                    resp.errmsg = "报名成功";
                    bllVote.UpdateVoteObjectRank(currVote.AutoID);
                }
                else
                {
                    resp.errcode = 1;
                    resp.errmsg  = "报名失败";
                }
            }
            catch (Exception ex)
            {
                bllVote.ToLog("投票报名异常" + ex.ToString());
                resp.errcode = 1;
                resp.errmsg  = "报名失败,请重试";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Пример #5
0
        /// <summary>
        /// 我爱我班报名
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddVoteObjectInfo(HttpContext context)
        {
            string voteObjectName      = context.Request["VoteObjectName"];
            string voteObjectHeadImage = context.Request["VoteObjectHeadImage"];
            string area          = context.Request["Area"];
            string introduction  = context.Request["Introduction"];
            string number        = (bllVote.GetVoteObjectMaxNumber(bllVote.TotemaVoteID) + 1).ToString();
            string schoolName    = context.Request["SchoolName"];
            string address       = context.Request["Address"];//Totema
            string contact       = context.Request["Contact"];
            string phone         = context.Request["Phone"];
            string comeonShareId = context.Request["ComeonShareId"];

            if (bllVote.GetVoteObjectInfo(bllVote.TotemaVoteID, CurrentUserInfo.UserID) != null)
            {
                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(schoolName))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入学校全称";
                goto outoff;
            }
            if (string.IsNullOrEmpty(area))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入所在区域";
                goto outoff;
            }
            if (string.IsNullOrEmpty(address))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入学校地址";
                goto outoff;
            }
            if (string.IsNullOrEmpty(contact))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人姓名";
                goto outoff;
            }
            if (string.IsNullOrEmpty(phone))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人电话";
                goto outoff;
            }
            if (bllVote.IsExitsVoteObjectNumber(bllVote.TotemaVoteID, number))
            {
                resp.errcode = 1;
                resp.errmsg  = "班级编号已经存在";
                goto outoff;
            }

            if (!string.IsNullOrWhiteSpace(voteObjectHeadImage))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle = Convert.ToInt32(context.Request["imgAngle"]);
                //imgAngle = 90;
                if (imgAngle != 0)
                {
                    //获取源图片地址
                    string imgPath = context.Server.MapPath(voteObjectHeadImage);

                    CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();

                    var imgResult = imgHelper.RotateImg(imgPath, imgAngle, imgPath);
                }
            }



            VoteObjectInfo model = new VoteObjectInfo();

            model.VoteID              = bllVote.TotemaVoteID;
            model.Number              = number;
            model.VoteObjectName      = voteObjectName;
            model.VoteObjectHeadImage = voteObjectHeadImage;
            model.Area          = area;
            model.Introduction  = introduction;
            model.SchoolName    = schoolName;
            model.Address       = address;
            model.Contact       = contact;
            model.Phone         = phone;
            model.Status        = 1;
            model.CreateUserId  = CurrentUserInfo.UserID;
            model.Rank          = 0;
            model.ComeonShareId = comeonShareId;
            if (bllVote.AddVoteObjectInfo(model))
            {
                resp.errmsg = "报名成功";
                bllVote.UpdateVoteObjectRank(bllVote.TotemaVoteID);
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "报名失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Пример #6
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 schoolName          = context.Request["SchoolName"];     //学校名称
            string address             = context.Request["Address"];        //Totema
            string contact             = context.Request["Contact"];        //联系人
            string phone               = context.Request["Phone"];          //联系人电话
            string voteObjectHeadImage = context.Request["VoteObjectHeadImage"];

            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(schoolName))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入学校全称";
                goto outoff;
            }
            if (string.IsNullOrEmpty(area))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入所在区域";
                goto outoff;
            }
            if (string.IsNullOrEmpty(address))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入学校地址";
                goto outoff;
            }
            if (string.IsNullOrEmpty(contact))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人姓名";
                goto outoff;
            }
            if (string.IsNullOrEmpty(phone))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人电话";
                goto outoff;
            }
            VoteObjectInfo model = bllVote.GetVoteObjectInfo(bllVote.TotemaVoteID, CurrentUserInfo.UserID);

            if (model == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "您还没有报名";
                goto outoff;
            }
            if (!string.IsNullOrWhiteSpace(voteObjectHeadImage))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle = Convert.ToInt32(context.Request["imgAngle"]);
                //imgAngle = 90;
                if (imgAngle != 0)
                {
                    //获取源图片地址
                    string imgPath = context.Server.MapPath(voteObjectHeadImage);

                    CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();

                    var imgResult = imgHelper.RotateImg(imgPath, imgAngle, imgPath);
                }
            }
            model.VoteObjectName      = voteObjectName;
            model.Area                = area;
            model.Introduction        = introduction;
            model.SchoolName          = schoolName;
            model.Address             = address;
            model.Contact             = contact;
            model.Phone               = phone;
            model.VoteObjectHeadImage = voteObjectHeadImage;
            if (bllVote.Update(model))
            {
                resp.errmsg = "保存成功";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "保存失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Пример #7
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditVoteObjectInfo(HttpContext context)
        {
            string voteObjectName = context.Request["VoteObjectName"];
            string introduction   = context.Request["Introduction"];
            string showImage1     = context.Request["ShowImage1"];
            string showImage2     = context.Request["ShowImage2"];
            string showImage3     = context.Request["ShowImage3"];
            string showImage4     = context.Request["ShowImage4"];

            VoteObjectInfo model = bllVote.GetVoteObjectInfo(haiMaVoteIDSale, CurrentUserInfo.UserID);

            if (model == null)
            {
                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;
            }



            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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    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);
                    //获取源图片地址
                    string imgPath4  = context.Server.MapPath(showImage4);
                    var    imgResult = imgHelper.RotateImg(imgPath4, imgAngle4, imgPath4);
                }
            }


            model.VoteObjectName      = voteObjectName;
            model.VoteObjectHeadImage = showImage1;
            model.Introduction        = introduction;
            model.ShowImage1          = showImage1;
            model.ShowImage2          = showImage2;
            model.ShowImage3          = showImage3;
            model.ShowImage4          = showImage4;

            if (bllVote.UpdateVoteObjectInfo(model))
            {
                resp.errmsg = "修改成功";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "修改失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }