示例#1
0
        public ActionResult Index(int?id)
        {
            string mine = string.IsNullOrEmpty(Request.QueryString["mine"])
               ? "false" : Request.QueryString["mine"];

            string categoryCode = string.IsNullOrEmpty(Request.QueryString["CategoryCode"])
               ? SystemConst.CategoryCode.Blog : Request.QueryString["CategoryCode"];
            string order = string.IsNullOrEmpty(Request.QueryString["order"])
                ? "default" : Request.QueryString["order"];

            int memberID = 0;

            if (mine == "true")
            {
                memberID = WebCookieHelper.GetUserId(0);
                if (memberID == 0)
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            string     categoryName = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == categoryCode).FirstOrDefault().Name;
            Pagination pagination   = new Pagination();
            int        page         = 1;

            if (id != null)
            {
                page = int.Parse(id.ToString());
            }

            int totalCount = 0;

            pagination.ActionUrl = "blog/index";

            pagination.CurrentPageIndex = page;
            var myblogs = BlogServices.GetBlogs(memberID, categoryCode, order, page, pagination.Size, out totalCount);

            pagination.TotalCount   = totalCount;
            pagination.Order        = order;
            pagination.CategoryCode = categoryCode;
            pagination.CategoryName = categoryName;
            ViewBag.mine            = mine;
            ViewBag.myblogs         = myblogs;
            ViewBag.Pagination      = pagination;
            return(View());
        }
示例#2
0
        public ActionResult ExamPlace()
        {
            string Tel  = WebCookieHelper.GetUserInfo(2);
            string Name = WebCookieHelper.GetUserInfo(1);

            //未缓存手机号
            if (string.IsNullOrEmpty(Tel))
            {
                return(Redirect("/sui/account/telephone"));
            }
            var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();

            if (result == null)
            {
                return(Redirect("/sui/account/userinfo"));
            }
            return(View(result));
        }
示例#3
0
        public ActionResult PersonalInfo()
        {
            int id     = WebCookieHelper.GetUserId(0);
            var member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            if (member == null)
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var oAuthUser      = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.MemberID == id).FirstOrDefault();
            int blogsum        = EnterRepository.GetRepositoryEnter().BlogRepository.LoadEntities(m => m.MemberID == id).Count();
            int blogvideosum   = 0;
            int blogpicturesum = 0;

            EnterRepository.GetRepositoryEnter().BlogRepository.GetBlogs(null, id, SystemConst.CategoryCode.BlogVideo, null, 0, 0, out blogvideosum);
            EnterRepository.GetRepositoryEnter().BlogRepository.GetBlogs(null, id, SystemConst.CategoryCode.BlogPicture, null, 0, 0, out blogvideosum);

            if (oAuthUser != null)
            {
                ViewBag.FigureUrl = oAuthUser.Headimgurl;
            }
            string tel      = WebCookieHelper.GetUserInfo(2);
            var    employee = EnterRepository.GetRepositoryEnter().EmployeeRepository.LoadEntities(m => m.Tel == tel).FirstOrDefault();

            if (employee != null)
            {
                WebCookieHelper.SetEmployeeCookie(employee.ID, employee.Name, employee.EmpNo, employee.Tel, 15);
            }
            ViewBag.employee       = employee;
            ViewBag.blogsum        = blogsum;
            ViewBag.blogvideosum   = blogvideosum;
            ViewBag.blogpicturesum = blogpicturesum;
            GlobalMethod.log.Info(string.Format("{0}进入个人主页", member.UserName));
            return(View(member));
        }
示例#4
0
        public ActionResult Order()
        {
            if (!WebCookieHelper.EmployeeCheckLogin())
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var users = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.EmployeeID == 0).OrderByDescending(m => m.ID).ToList();

            ViewBag.users = users;
            return(View());
        }
示例#5
0
        public ActionResult QueryEmployeeIDs()
        {
            try
            {
                if (!WebCookieHelper.EmployeeCheckLogin())
                {
                    return(RedirectToAction("Admin/Account/Login"));
                }
                JsonHelper json    = new JsonHelper();
                string     strJson = string.Empty;
                json.AddItem("id", "");
                json.AddItem("text", "所有");
                json.ItemOk();

                int    empid = WebCookieHelper.GetEmployeeId();
                string Name  = WebCookieHelper.GetEmployeeInfo((int)WebCookieHelper.EmployeeInfo.Name);
                if (!RightServices.CheckAuthority(SystemContext.RightPoint.ViewAllUsers, empid))
                {
                    json.AddItem("id", empid.ToString());
                    json.AddItem("text", Name);
                    json.ItemOk();
                }
                else
                {
                    var result = UsersServices.GetStaffEmployee(empid);
                    foreach (Employee item in result)
                    {
                        json.AddItem("id", item.ID.ToString());
                        json.AddItem("text", item.Name);
                        json.ItemOk();
                    }
                }
                strJson = json.ToEasyuiListJsonString();
                return(Content(strJson));
            }
            catch (Exception ex)
            {
                GlobalMethod.log.Error(ex);
                throw;
            }
        }
示例#6
0
        public ActionResult updatePassword()
        {
            string oldpwd = Request.Form["oldpwd"];
            string pwd    = Request.Form["pwd"];
            int    id     = WebCookieHelper.GetUserId(0);
            var    result = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            //if (result == null)
            //    return Content("用户不存在,请重新登录");
            //if (result.Password != Utility.MD5Helper.MD5(oldpwd))
            //    return Content("原始密码不对");
            result.Password = string.IsNullOrEmpty(pwd)?Utility.MD5Helper.MD5(SystemContext.Instance.DefaultPwd): Utility.MD5Helper.MD5(pwd);
            EnterRepository.GetRepositoryEnter().MemberRepository.Get(m => m.ID == id);
            EnterRepository.GetRepositoryEnter().MemberRepository.EditEntity(result, new string[] { "Password" });
            if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
            {
                return(Content("系统错误,修改密码失败"));
            }

            return(Content(""));
        }
示例#7
0
        public ActionResult GetHtmlToutiao()
        {
            string url         = Request.Form["url"];
            string htmlstr     = HtmlContentHelper.WebPageContentGet(url);
            string title       = HtmlContentHelper.WebPageTitleGet(htmlstr).Replace("- 今日头条(TouTiao.com)", "").Replace("- 今日头条(TouTiao.org)", "");
            string description = HtmlContentHelper.WebPageDescriptionGet(htmlstr);
            string keywords    = HtmlContentHelper.WebPageKeywordsGet(htmlstr);
            string article     = HtmlContentHelper.WebPageArticleGet(url, htmlstr);



            var item = EnterRepository.GetRepositoryEnter().ToutiaoRepository.LoadEntities(m => m.ReprintUrl == url).FirstOrDefault();

            if (item == null)
            {
                item            = new Models.Toutiao();
                item.ReprintUrl = url;
                item.MemberID   = WebCookieHelper.GetUserId(0);
                item.CategoryID = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == "toutiao").FirstOrDefault().ID;
                item.ImagePath  = HtmlContentHelper.GetFirstImgUrl(article);
                item.IsPublic   = 1;
                item.Keywords   = keywords;
                item.Summary    = description;
                item.Zhuanzai   = 1;
                item.ModifyTime = DateTime.Now;
                item.CreateTime = DateTime.Now;
                item.Content    = article;
                item.Title      = title;
                EnterRepository.GetRepositoryEnter().ToutiaoRepository.AddEntity(item);
                if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                {
                    return(Redirect("/toutiao/view/" + item.ID + ".htm"));
                }
                return(Content(""));
            }
            else
            {
                return(Redirect("/toutiao/view/" + item.ID + ".htm"));
            }
        }
示例#8
0
 public ActionResult ExamPlace(FormCollection fc)
 {
     try
     {
         string Tel = WebCookieHelper.GetUserInfo(2);
         if (string.IsNullOrEmpty(Tel))
         {
             return(Redirect("/weixin/account/telephone"));
         }
         var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();
         if (result == null)
         {
             return(Redirect("/weixin/account/userinfo"));
         }
         string ddlSchool = fc["ddlSchool"];
         string Place     = fc["Place"];
         if (!string.IsNullOrEmpty(ddlSchool))
         {
             result.ExamPlace = ddlSchool;
         }
         else
         {
             result.ExamPlace = Place;
         }
         EnterRepository.GetRepositoryEnter().UsersRepository.EditEntity(result, new string[] { "ExamPlace" });
         if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
         {
             return(Json(new { validate = "true", message = "考点提交成功" }));
         }
         else
         {
             return(Json(new { validate = "false", message = "考点提交失败" }));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(Json(new { validate = "false", message = "考点提交失败" }));
     }
 }
示例#9
0
        public ActionResult LuckyRoller()
        {
            int id     = WebCookieHelper.GetUserId(0);
            var member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == id).FirstOrDefault();

            if (member == null)
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var invites = EnterRepository.GetRepositoryEnter().InviteRepository.LoadEntities(m => m.InviteTel == member.Tel).ToList();

            if (invites != null && invites.Count > 0)
            {
                List <string> lstBeinvite = new List <string>();
                foreach (var item in invites)
                {
                    lstBeinvite.Add(item.BeInviteTel);
                }
                //获取邀请名额
                var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => lstBeinvite.Contains(m.Tel) && m.EmployeeID != 0).ToList();
                ViewBag.users = result;
            }
            var lottery = EnterRepository.GetRepositoryEnter().LotteryRepository.LoadEntities(m => m.Tel == member.Tel).FirstOrDefault();

            ViewBag.lottery = lottery;
            string szName = WebCookieHelper.GetUserInfo(1);

            GlobalMethod.log.Info(string.Format("{0}进入幸运大转盘抽奖", szName));
            return(View());
        }
示例#10
0
        public ActionResult UserInfo(Models.Users user)
        {
            string Tel = WebCookieHelper.GetUserInfo(2);

            if (user.ID == 0)
            {
                user.Pwd = SystemContext.Instance.GetPwd(Tel);
                EnterRepository.GetRepositoryEnter().UsersRepository.AddEntity(user);
            }
            else
            {
                EnterRepository.GetRepositoryEnter().UsersRepository.EditEntity(user, new string[] { "Name", "Gender", "School", "ExamSchool", "ExamPlace", "ExceptRoomie", "Baks" });
            }
            if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
            {
                return(Content(""));
            }
            else
            {
                return(Content("提交成功"));
            }
        }
示例#11
0
        public ActionResult Write(FormCollection form)
        {
            var blog = new Models.Blog();

            blog.ID         = int.Parse(form["ID"]);
            blog.CategoryID = int.Parse(form["CategoryID"]);
            blog.Content    = form["Content"];
            blog.IsPublic   = int.Parse(form["IsPublic"]);
            blog.Keywords   = form["Keywords"];
            blog.ReprintUrl = form["ReprintUrl"];
            blog.Title      = form["Title"];

            blog.Zhuanzai = int.Parse(form["Zhuanzai"]);

            blog.MemberID  = WebCookieHelper.GetUserId(0);
            blog.Summary   = HtmlContentHelper.GetSummary(blog.Content);
            blog.ImagePath = HtmlContentHelper.GetFirstImgUrl(blog.Content);
            //创建会员信息
            if (blog.ID == 0)
            {
                blog.CreateTime = DateTime.Now;
                blog.ModifyTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().BlogRepository.AddEntity(blog);
            }
            else
            {
                blog.ModifyTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().BlogRepository.Get(m => m.ID == blog.ID);
                EnterRepository.GetRepositoryEnter().BlogRepository.EditEntity(blog
                                                                               , new string[] { "Content", "IsPublic", "ReprintUrl", "Keywords"
                                                                                                , "ModifyTime", "Summary", "ImagePath", "CategoryID", "Title", "Zhuanzai" });
            }
            if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
            {
                return(Content("error"));
            }
            return(Content(blog.ID.ToString()));
        }
示例#12
0
 public ActionResult Detail()
 {
     if (!WebCookieHelper.UserCheckLogin())
     {
         return(Redirect("/weixin/account/"));
     }
     try
     {
         int nid = WebCookieHelper.GetUserId(0);
         //查找用户信息
         var result = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.ID == nid).FirstOrDefault();
         if (result == null)
         {
             return(Redirect("/weixin/account/"));
         }
         return(View(result));
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(Redirect("/weixin/account/"));
     }
 }
示例#13
0
 public ActionResult SaveAdvice(Models.Advice advice)
 {
     try
     {
         advice.Name       = WebCookieHelper.GetUserInfo(1);
         advice.Contact    = WebCookieHelper.GetUserInfo(2);
         advice.CreateTime = DateTime.Now;
         EnterRepository.GetRepositoryEnter().AdviceRepository.AddEntity(advice);
         if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
         {
             return(Json(new { validate = "true", message = "提交成功" }));
         }
         else
         {
             return(Json(new { validate = "false", message = "提交失败" }));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(Json(new { validate = "false", message = "提交失败" }));
     }
 }
示例#14
0
        /// <summary>
        /// 酒店安排房间信息
        /// </summary>
        /// <returns></returns>
        public ActionResult RoomInfo()
        {
            string Tel = WebCookieHelper.GetUserInfo(2);

            if (string.IsNullOrEmpty(Tel))
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Utility.CookieHelper.SetCookie("returnurl", Request.Url.ToString(), "", 1);
                    return(Redirect("/weixin/account"));
                }
                else
                {
                    return(Redirect("/member/login?returnurl=" + Request.Url));
                }
            }
            var result = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();

            if (result == null)
            {
                return(Redirect("/users/userinfo"));
            }
            if (!string.IsNullOrEmpty(result.Hotel) &&
                !string.IsNullOrEmpty(result.Room))
            {
                var roomies = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => m.Hotel == result.Hotel && m.Room == result.Room).ToList();
                if (roomies != null)
                {
                    ViewData["roomies"] = roomies;
                }
            }
            var lottery = EnterRepository.GetRepositoryEnter().LotteryRepository.LoadEntities(m => m.Tel == Tel).FirstOrDefault();

            ViewBag.lottery = lottery;
            return(View(result));
        }
示例#15
0
        public ActionResult WeixinRegister(Member member)
        {
            var result = EnterRepository.GetRepositoryEnter().MemberRepository
                         .LoadEntities(m => m.Tel == member.Tel).FirstOrDefault();
            int oauthuserID = int.Parse(Request.Form["OAuthUserID"]);
            var oauthuser   = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.ID == oauthuserID).FirstOrDefault();

            if (result == null)
            {
                //member不存在,创建member
                member.UserName   = oauthuser.NickName;
                member.CreateTime = DateTime.Now;
                member.Password   = Utility.MD5Helper.MD5(SystemContext.Instance.DefaultPwd);
                EnterRepository.GetRepositoryEnter().MemberRepository.AddEntity(member);
                if (EnterRepository.GetRepositoryEnter().SaveChange() < 0)
                {
                    return(Content("绑定失败"));
                }
                oauthuser.MemberID = member.ID;
            }
            else
            {
                oauthuser.MemberID = result.ID;
                member.UserName    = result.UserName;
            }

            //更新qquser的memberID
            EnterRepository.GetRepositoryEnter().OAuthUserRepository.Get(m => m.ID == oauthuserID);
            EnterRepository.GetRepositoryEnter().OAuthUserRepository.EditEntity(oauthuser, new string[] { "MemberID" });
            if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
            {
                return(Content("绑定失败"));
            }
            WebCookieHelper.SetUserCookie(oauthuser.MemberID, member.UserName, member.Tel, "", "", 15);
            return(Content(""));
        }
示例#16
0
        //
        // GET: /Advise/

        public ActionResult Write(int?id)
        {
            int memberID = WebCookieHelper.GetUserId(0);

            if (memberID == 0)
            {
                return(Redirect("/member/login?returnurl=" + Request.Url));
            }

            var item = new Models.Toutiao();

            if (id != null)
            {
                item = EnterRepository.GetRepositoryEnter().ToutiaoRepository.LoadEntities(m => m.ID == id).FirstOrDefault();
            }
            else
            {
                item.IsPublic = 1;
            }
            var categorylist = EnterRepository.GetRepositoryEnter().CategoryRepository.GetCategorys("toutiao").ToList();

            ViewBag.categorylist = categorylist;
            return(View(item));
        }
示例#17
0
        //
        // GET: /sui/Account/

        public ActionResult Index()
        {
            if (!WebCookieHelper.UserCheckLogin())
            {
                return(Redirect("/weixin/account/"));
            }
            try
            {
                int nid = WebCookieHelper.GetUserId(0);
                //查找用户信息
                var result = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.ID == nid).FirstOrDefault();
                if (result == null)
                {
                    return(Redirect("/weixin/account/"));
                }
                log.Info(string.Format("用户:{0}登录个人中心", result.NickName));
                return(View(result));
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return(Redirect("/weixin/account/"));
            }
        }
示例#18
0
        public ActionResult Export()
        {
            string     jsons        = "";
            JsonHelper jsonHelper   = new JsonHelper();
            var        Template     = Request.Form["Template"];
            var        Name         = Request.Form["Name"];
            var        szEmployeeID = Request.Form["EmployeeID"];

            string filePath = string.Format("{0}{1}"
                                            , Server.MapPath(SystemContext.FilePath.Excel)
                                            , "test.xls");

            if (!WebCookieHelper.EmployeeCheckLogin())
            {
                return(Content(""));
            }
            int empid = WebCookieHelper.GetEmployeeId();

            if (string.IsNullOrEmpty(szEmployeeID) || szEmployeeID == "所有")
            {
                szEmployeeID = "0";
            }

            if (!RightServices.CheckAuthority(SystemContext.RightPoint.ViewAllUsers, empid))
            {
                szEmployeeID = empid.ToString();
            }
            try
            {
                var lstUser = EnterRepository.GetRepositoryEnter().UsersRepository.GetUsersList(int.Parse(szEmployeeID), empid, null, null);

                string           templateValue = SystemContext.Template.GetTemplate(Template);
                ExcelHelper      excelOpr      = new ExcelHelper();
                string[]         columnName    = templateValue.Split(',');
                List <ArrayList> values        = new List <ArrayList>();
                foreach (var user in lstUser)
                {
                    ArrayList value = new ArrayList();
                    for (int j = 0; j < columnName.Length; j++)
                    {
                        value.Add(GetColumnValue(user, columnName[j]));
                    }
                    value.Add("");
                    values.Add(value);
                }

                excelOpr.ToExcel(filePath, columnName, values);
                jsons = "[{\"success\":true,msg:\"导出成功\",filePath:\""
                        + string.Format("{0}/{1}"
                                        , SystemContext.FilePath.Excel
                                        , "test.xls")
                        + "\"}]";
            }
            catch (Exception ex)
            {
                GlobalMethod.log.Error(ex);

                jsons = "[{\"success\":true,msg:\"导出失败\"}]";
            }
            return(Content(jsons));
        }
示例#19
0
 public ActionResult RemoveCookie()
 {
     WebCookieHelper.UserLoginOut();
     return(Redirect("/sui/account"));
 }
示例#20
0
        /// <summary>
        /// 查询数据
        /// </summary>
        public ActionResult QueryData()
        {
            try
            {
                int    page          = Request.Form["page"] != "" ? Convert.ToInt32(Request.Form["page"]) : 0;
                int    size          = Request.Form["rows"] != "" ? Convert.ToInt32(Request.Form["rows"]) : 0;
                string sort          = Request.Form["sort"] != "" ? Request.Form["sort"] : "";
                string order         = Request.Form["order"] != "" ? Request.Form["order"] : "";
                string Template      = Request.Form["Template"] != "" ? Request.Form["Template"] : "";
                string szEmployeeIDs = !string.IsNullOrEmpty(Request.Form["EmployeeID"]) ? Request.Form["EmployeeID"] : "0";
                string Name          = Request.Form["Name"] != "" ? Request.Form["Name"] : "";
                string Tel           = Request.Form["Tel"] != "" ? Request.Form["Tel"] : "";
                if (page < 1)
                {
                    return(Content(""));
                }
                if (Name == "所有")
                {
                    Name = string.Empty;
                }
                if (szEmployeeIDs == "所有")
                {
                    szEmployeeIDs = "0";
                }

                if (!WebCookieHelper.EmployeeCheckLogin())
                {
                    return(Content(""));
                }
                int empid = WebCookieHelper.GetEmployeeId();
                if (!RightServices.CheckAuthority(SystemContext.RightPoint.ViewAllUsers, empid))
                {
                    szEmployeeIDs = empid.ToString();
                }
                int        rowCount = 0;
                var        lstUsers = EnterRepository.GetRepositoryEnter().UsersRepository.LoadPageList(int.Parse(szEmployeeIDs), empid, Tel, Name, (page - 1) * size, size, out rowCount).ToList();
                JsonHelper json     = new JsonHelper();
                string     strJson  = string.Empty;
                try
                {
                    foreach (Users item in lstUsers)
                    {
                        item.Hotel = item.Hotel == null?"":item.Hotel.Replace("\t", "");
                        item.Tel   = item.Tel == null ? "" : item.Tel.Replace("\n", "");
                        item.Baks  = item.Baks == null ? "" : item.Baks.Replace("\n", "");
                        json.AddItem("ID", item.ID.ToString());
                        json.AddItem("Name", item.Name);
                        json.AddItem("School", item.School);
                        json.AddItem("ExamSchool", item.ExamSchool);
                        json.AddItem("Sequences", item.Sequences.ToString());
                        json.AddItem("Tel", item.Tel);
                        json.AddItem("Baks", item.Baks);
                        json.AddItem("Pwd", item.Pwd);
                        json.AddItem("PayMoney", item.PayMoney);
                        json.AddItem("ExamPlace", item.ExamPlace);
                        json.AddItem("Hotel", item.Hotel);
                        json.AddItem("PassWord", item.Pwd);
                        json.AddItem("PayMoney", item.PayMoney);
                        json.AddItem("ExamPlace", item.ExamPlace);
                        json.AddItem("Room", item.Room);
                        json.AddItem("Hotel", item.Hotel);
                        json.AddItem("HotelExpense", item.HotelExpense);
                        json.AddItem("MoneyBack", item.MoneyBack);
                        json.AddItem("EmployeeID", item.EmployeeID.ToString());
                        json.AddItem("EmployeeName", item.EmployeeName);
                        json.AddItem("Gender", item.Gender);
                        json.AddItem("Template", item.Template);
                        json.AddItem("PayPlace", item.PayPlace);
                        json.AddItem("CreateTime", item.CreateTime == null?DateTime.Now.ToString():item.CreateTime.ToString());
                        json.AddItem("ExceptRoomie", item.ExceptRoomie);
                        json.AddItem("Status", item.Status);
                        json.AddItem("Prize", item.Prize);
                        json.ItemOk();
                    }
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                }
                json.totlalCount = rowCount;
                if (json.totlalCount > 0)
                {
                    strJson = json.ToEasyuiGridJsonString();
                }
                else
                {
                    strJson = @"[]";
                }
                // json = "{ \"rows\":[ { \"ID\":\"48\",\"NewsTitle\":\"mr\",\"NewsContent\":\"mrsoft\",\"CreateTime\":\"2013-12-23\",\"CreateUser\":\"ceshi\",\"ModifyTime\":\"2013-12-23\",\"ModifyUser\":\"ceshi\"} ],\"total\":3}";
                return(Content(strJson));
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw;
            }
        }
示例#21
0
        /// <summary>
        /// OAuthScope.snsapi_userinfo方式回调
        /// </summary>
        /// <param name="code"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public ActionResult UserInfoCallback(string code, string state)
        {
            if (string.IsNullOrEmpty(code))
            {
                return(Content("您拒绝了授权!"));
            }

            if (state != SystemContext.Instance.WeiXinAppInfo.Token)
            {
                //这里的state其实是会暴露给客户端的,验证能力很弱,这里只是演示一下
                //实际上可以存任何想传递的数据,比如用户ID,并且需要结合例如下面的Session["OAuthAccessToken"]进行验证
                return(Content("验证失败!请从正规途径进入!"));
            }

            OAuthAccessTokenResult result = null;

            //通过,用code换取access_token
            try
            {
                ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
                result = OAuthApi.GetAccessToken(SystemContext.Instance.WeiXinAppInfo.AppID, SystemContext.Instance.WeiXinAppInfo.AppSecret, code);
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
            if (result.errcode != ReturnCode.请求成功)
            {
                return(Content("错误:" + result.errmsg));
            }
            //下面2个数据也可以自己封装成一个类,储存在数据库中(建议结合缓存)
            //如果可以确保安全,可以将access_token存入用户的cookie中,每一个人的access_token是不一样的
            //Session["OAuthAccessTokenStartTime"] = DateTime.Now;
            //Session["OAuthAccessToken"] = result;

            //因为第一步选择的是OAuthScope.snsapi_userinfo,这里可以进一步获取用户详细信息
            try
            {
                ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
                OAuthUserInfo userInfo = OAuthApi.GetUserInfo(result.access_token, result.openid);
                //将用户资料保存进自己的库
                var oauthuser = EnterRepository.GetRepositoryEnter().OAuthUserRepository.LoadEntities(m => m.OpenID == userInfo.openid).FirstOrDefault();
                //微信公开信息记录数据库
                if (oauthuser == null)
                {
                    DateTime createTime = DateTime.Now;
                    string   pwd        = Utility.MD5Helper.MD5(SystemContext.Instance.DefaultPwd);
                    oauthuser = new Models.OAuthUser()
                    {
                        City = userInfo.city, Country = userInfo.country, Headimgurl = userInfo.headimgurl, NickName = userInfo.nickname, OpenID = userInfo.openid, Province = userInfo.province, Sex = userInfo.sex, CreateTime = createTime, Pwd = pwd
                    };

                    EnterRepository.GetRepositoryEnter().OAuthUserRepository.AddEntity(oauthuser);
                    if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                    {
                        logger.Info("新增关注用户" + userInfo.nickname);
                    }
                }
                if (oauthuser.MemberID == 0)
                {
                    //绑定手机号,查找是否有相同号码的member,如果没有则创建member账号
                    return(Redirect("/member/weixinregister?ID=" + oauthuser.ID.ToString()));
                }
                var member = EnterRepository.GetRepositoryEnter().MemberRepository.LoadEntities(m => m.ID == oauthuser.MemberID).FirstOrDefault();
                if (member == null)
                {
                    GlobalMethod.log.Error("微信绑定的用户不存在了,重新绑定手机号");

                    //重新绑定手机号
                    return(Redirect("/member/weixinregister?ID=" + oauthuser.ID.ToString()));
                }
                WebCookieHelper.SetUserCookie(member.ID, member.UserName, member.Tel, string.Empty, string.Empty, 7);
                if (Utility.CookieHelper.ExistCookie("returnurl"))
                {
                    return(Redirect(Utility.CookieHelper.GetCookie("returnurl")));
                }
                else
                {
                    return(Redirect("/member/personalinfo"));
                }
            }
            catch (ErrorJsonResultException ex)
            {
                logger.Error(ex);
                return(Content(ex.Message));
            }
        }
示例#22
0
        public ActionResult Save()
        {
            var    prize = Request.Form["prize"];
            string tel   = WebCookieHelper.GetUserInfo(2);
            string name  = WebCookieHelper.GetUserInfo(1);

            var    lottery = EnterRepository.GetRepositoryEnter().LotteryRepository.LoadEntities(m => m.Tel == tel).FirstOrDefault();
            string result  = string.Empty;
            var    invites = EnterRepository.GetRepositoryEnter().InviteRepository.LoadEntities(m => m.InviteTel == tel).ToList();

            if (invites == null || invites.Count <= 0)
            {
                result = "您未成功邀请任何人,无法参与抽奖!";
                return(Content(result));
            }
            if (invites != null && invites.Count > 0)
            {
                List <string> lstBeinvite = new List <string>();
                foreach (var item in invites)
                {
                    lstBeinvite.Add(item.BeInviteTel);
                }
                //获取邀请名额
                var users = EnterRepository.GetRepositoryEnter().UsersRepository.LoadEntities(m => lstBeinvite.Contains(m.Tel) && m.EmployeeID != 0).ToList();
                if (users == null || users.Count <= 0)
                {
                    result = "您未成功邀请任何人,无法参与抽奖!";
                    return(Content(result));
                }
                if (lottery != null)
                {
                    var prizes = lottery.Prize.Split('、');
                    if (users.Count <= prizes.Length)
                    {
                        result = "抽奖次数限制,本次抽奖无效!";
                        return(Content(result));
                    }
                }
            }
            if (lottery == null)
            {
                lottery            = new Models.Lottery();
                lottery.Tel        = tel;
                lottery.Prize      = prize;
                lottery.CreateTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().LotteryRepository.AddEntity(lottery);
                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                {
                    result = "抽奖结果保存失败";
                    return(Content(result));
                }
            }
            else
            {
                lottery.Prize      = string.IsNullOrEmpty(lottery.Prize)?prize: lottery.Prize + "、" + prize;
                lottery.CreateTime = DateTime.Now;
                EnterRepository.GetRepositoryEnter().LotteryRepository.EditEntity(lottery, new string[] { "Prize", "CreateTime" });
                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                {
                    result = "抽奖结果保存失败";
                    return(Content(result));
                }
            }
            return(Content(result));
        }
示例#23
0
 public ActionResult LoginOut()
 {
     WebCookieHelper.UserLoginOut();
     return(Redirect("/member/login?returnurl=/member/personalinfo"));
 }
示例#24
0
        public JsonResult Login(Models.LoginModel model)
        {
            if (ModelState.IsValid)
            {
                string validateImgCode = CookieHelper.GetCookie("ValidateImgCode");
                //首先判断下验证码是否正确
                if (!string.IsNullOrEmpty(validateImgCode) && string.Equals(validateImgCode,
                                                                            model.ValidateCode, StringComparison.OrdinalIgnoreCase))
                {
                    Employee adminModel = new Employee();
                    if (new Regex("1[3|5|7|8|][0-9]{9}").IsMatch(model.UserName))
                    {//匹配手机号码
                        adminModel = EnterRepository.GetRepositoryEnter().EmployeeRepository.LoadEntities(m => m.Tel == model.UserName).FirstOrDefault();
                    }
                    else  //匹配用户名
                    {
                        adminModel = EnterRepository.GetRepositoryEnter().EmployeeRepository.LoadEntities(m => m.EmpNo == model.UserName).FirstOrDefault();
                    }
                    if (adminModel == null)
                    {
                        return(Json(new
                        {
                            state = "error",
                            message = "用户名不存在"
                        }));
                    }
                    else
                    {
                        //判断密码是否正确
                        if (adminModel.Pwd == model.Password)
                        {
                            string ip            = IpHelper.GetRealIP();
                            string address       = IpHelper.GetAdrByIp(ip);
                            string brower        = IpHelper.GetBrowerVersion();
                            string adminloginlog = string.Join("|", new string[] { DateTime.Now.ToString(), adminModel.Name, ip, address, brower });
                            log.Info("用户登录后台管理:" + adminloginlog);
                            //添加登录日志并修改上次登录信息

                            //先清除原来的cookie
                            WebCookieHelper.EmployeeLoginOut();
                            //登录成功,保存cookie
                            WebCookieHelper.SetEmployeeCookie(adminModel.ID, adminModel.Name, adminModel.EmpNo, adminModel.Tel, (model.IsRemind != null && model.IsRemind) ? 15 : 0);
                            return(Json(new
                            {
                                state = "success",
                                message = "登录成功"
                            }));
                        }
                        else
                        {
                            return(Json(new
                            {
                                state = "error",
                                message = "密码错误"
                            }));
                        }
                    }
                }
                else
                {
                    return(Json(new
                    {
                        state = "error",
                        message = "验证码错误"
                    }));
                }
            }
            else
            {
                return(Json(new
                {
                    state = "error",
                    message = "输入信息不完整"
                }));
            }
        }
示例#25
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //用MVC系统自带的功能 获取当前方法上的特性名称
            bool skipAuthorization = filterContext.ActionDescriptor.IsDefined(typeof(NoNeedAdminAuthory), inherit: true) ||
                                     filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(NoNeedAdminAuthory), inherit: true);

            if (skipAuthorization)
            {
                return;
            }
            //检查是否登录
            if (!WebCookieHelper.AdminCheckLogin())
            {
                filterContext.Result = new RedirectResult("~/Admin/Account/Login", true);
                return;
            }
            //如果是超级管理就免去验证
            if (WebCookieHelper.GetAdminId(5) == 1)
            {
                return;
            }
            //页面权限验证开始
            var customAttributes = filterContext.ActionDescriptor.GetCustomAttributes(true);

            if (customAttributes != null && customAttributes.Length > 0)
            {
                for (int i = 0; i < customAttributes.Count(); i++)
                {
                    if (customAttributes.GetValue(i).GetType().Name == "AdminActionMethod")                    //判断anction特性名称
                    {
                        string actionCode       = (customAttributes[i] as AdminActionMethod).RoleCode;         //获取特性功能按钮代码
                        string actionUrl        = (customAttributes[i] as AdminActionMethod).ActionUrl;        //获取特性功能地址
                        int    actionResultType = (customAttributes[i] as AdminActionMethod).ActionResultType; //获取返回视图类型
                        if (actionCode == "NoNeedAuthory")                                                     //不需要权限认证
                        {
                            return;
                        }
                        else   //判断权限是否符合
                        {
                            List <AuthorDesign.Model.AdminPageAction> pageActionList = AdminMenuHelper.GetNowAdminMenu();
                            var pageSelect = pageActionList.Where(m => m.PageUrl == actionUrl);
                            if (pageSelect != null && pageSelect.Count() > 0)   //判断有无执行该页面的权利
                            //判断有误执行该动作权利
                            {
                                var codeList = AdminMenuHelper.LoadActionCodeList();
                                //先根据动作按钮代码查找到代码所在按钮Id
                                var codeSelect = codeList.Where(m => m.ActionCode == actionCode);
                                if (codeSelect != null && codeSelect.Count() > 0)
                                {
                                    int codeId = codeSelect.First().Id;
                                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                                    //判断codeId在角色动作列表中是否为选择状态
                                    string roleActionList = pageSelect.First().RoleActionList;

                                    List <AuthorDesign.Web.Areas.Admin.Models.RolePageActionModel> roleActionListModel = serializer.Deserialize <List <AuthorDesign.Web.Areas.Admin.Models.RolePageActionModel> >(roleActionList);
                                    if (roleActionListModel != null && roleActionListModel.Where(m => m.ActionId == codeId && m.actionChecked == 1).Count() > 0)
                                    {
                                        //判断CodeId在管理员动作列表中是否为选择状态
                                        List <AuthorDesign.Web.Areas.Admin.Models.RolePageActionModel> adminActionListModel = serializer.Deserialize <List <AuthorDesign.Web.Areas.Admin.Models.RolePageActionModel> >(pageSelect.First().AdminActionList);
                                        if (adminActionListModel != null && adminActionListModel.Where(m => m.ActionId == codeId && m.actionChecked == 1).Count() > 0)
                                        {
                                            StringBuilder sb = new StringBuilder();
                                            sb.Append("[");
                                            //传递在该页面可执行的按钮
                                            foreach (var item in roleActionListModel)
                                            {
                                                if (item.actionChecked == 1)
                                                {
                                                    var needChangeAction = adminActionListModel.Where(m => m.ActionId == item.ActionId).FirstOrDefault();
                                                    if (needChangeAction == null)
                                                    {
                                                        item.actionChecked = 0;
                                                    }
                                                    else if (needChangeAction.actionChecked == 0)
                                                    {
                                                        item.actionChecked = 0;
                                                    }
                                                }
                                                AuthorDesign.Model.PageAction OneAction = codeList.Where(m => m.Id == item.ActionId).FirstOrDefault();
                                                sb.Append("{").Append("\"").Append("ActionName").Append("\"").Append(":").Append("\"").Append(OneAction == null ? "" : OneAction.ActionCode).Append("\"").Append(",").Append("\"").Append("IsChecked").Append("\"").Append(":").Append(item.actionChecked).Append("}").Append(",");
                                            }
                                            sb.Remove(sb.Length - 1, 1);
                                            sb.Append("]");
                                            filterContext.Controller.ViewBag.CanOperationActionList = sb.ToString();
                                        }
                                        else
                                        {
                                            if (actionResultType == 0)
                                            {
                                                filterContext.Result = new RedirectResult("~/Admin/Home/NoAuthory", true);
                                            }
                                            else if (actionResultType == 1)
                                            {
                                                filterContext.Result = new JsonResult()
                                                {
                                                    Data = new { state = "error", message = "您暂无权限操作" }
                                                };
                                            }
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        if (actionResultType == 0)
                                        {
                                            filterContext.Result = new RedirectResult("~/Admin/Home/NoAuthory", true);
                                        }
                                        else if (actionResultType == 1)
                                        {
                                            filterContext.Result = new JsonResult()
                                            {
                                                Data = new { state = "error", message = "您暂无权限操作" }
                                            };
                                        }
                                        return;
                                    }
                                }
                                else
                                {
                                    if (actionResultType == 0)
                                    {
                                        filterContext.Result = new RedirectResult("~/Admin/Home/NoAuthory", true);
                                    }
                                    else if (actionResultType == 1)
                                    {
                                        filterContext.Result = new JsonResult()
                                        {
                                            Data = new { state = "error", message = "您暂无权限操作" }
                                        };
                                    }
                                    return;
                                }
                            }
                            else
                            {
                                if (actionResultType == 0)
                                {
                                    filterContext.Result = new RedirectResult("~/Admin/Home/NoAuthory", true);
                                }
                                else if (actionResultType == 1)
                                {
                                    filterContext.Result = new JsonResult()
                                    {
                                        Data = new { state = "error", message = "您暂无权限操作" }
                                    };
                                }
                                return;
                            }
                        }
                    }
                }
            }

            base.OnActionExecuting(filterContext);
        }
 public JsonResult Login(Models.LoginModel model)
 {
     if (ModelState.IsValid)
     {
         //首先判断下验证码是否正确
         if (Session["ValidateImgCode"] != null && string.Equals(Session["ValidateImgCode"].ToString(),
                                                                 model.ValidateCode, StringComparison.OrdinalIgnoreCase))
         {
             Model.Admin adminModel = new Model.Admin();
             if (new Regex("1[3|5|7|8|][0-9]{9}").IsMatch(model.UserName))  //匹配手机号码
             {
                 adminModel = EnterRepository.GetRepositoryEnter().GetAdminRepository.LoadEntities(m => m.Mobile == model.UserName && m.IsLogin == 1).FirstOrDefault();
             }
             else if (new Regex(@"[A-Za-z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}").IsMatch(model.UserName))  //匹配邮箱
             {
                 adminModel = EnterRepository.GetRepositoryEnter().GetAdminRepository.LoadEntities(m => m.Email == model.UserName && m.IsLogin == 1).FirstOrDefault();
             }
             else  //匹配用户名
             {
                 adminModel = EnterRepository.GetRepositoryEnter().GetAdminRepository.LoadEntities(m => m.AdminName == model.UserName && m.IsLogin == 1).FirstOrDefault();
             }
             if (adminModel == null)
             {
                 return(Json(new {
                     state = "error",
                     message = "用户名不存在"
                 }));
             }
             else
             {
                 //判断密码是否正确
                 if (adminModel.Password == MD5Helper.CreatePasswordMd5(model.Password, adminModel.Salt))
                 {
                     adminModel.LastLoginTime    = DateTime.Now;
                     adminModel.LastLoginIp      = IpHelper.GetRealIP();
                     adminModel.LastLoginAddress = IpHelper.GetAdrByIp(adminModel.LastLoginIp);
                     adminModel.LastLoginInfo    = IpHelper.GetBrowerVersion();
                     //添加登录日志并修改上次登录信息
                     EnterRepository.GetRepositoryEnter().GetAdminLoginLogRepository.AddEntity(new Model.AdminLoginLog()
                     {
                         AdminId           = adminModel.Id,
                         AdminLoginAddress = adminModel.LastLoginAddress,
                         AdminLoginIP      = adminModel.LastLoginIp,
                         AdminLoginTime    = adminModel.LastLoginTime,
                         AdminLoginInfo    = adminModel.LastLoginInfo
                     });
                     if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                     {
                         //先清除原来的cookie
                         WebCookieHelper.AdminLoginOut();
                         //登录成功,保存cookie
                         WebCookieHelper.SetCookie(adminModel.Id, model.UserName, adminModel.LastLoginTime, adminModel.LastLoginIp, adminModel.LastLoginAddress, adminModel.IsSuperAdmin, adminModel.AuthoryId, (model.IsRemind != null && model.IsRemind)? 15 : 0);
                         return(Json(new {
                             state = "success",
                             message = "登录成功"
                         }));
                     }
                     else
                     {
                         return(Json(new {
                             state = "success",
                             message = "服务器泡妞去了"
                         }));
                     }
                 }
                 else
                 {
                     return(Json(new {
                         state = "error",
                         message = "密码错误"
                     }));
                 }
             }
         }
         else
         {
             return(Json(new {
                 state = "error",
                 message = "验证码错误"
             }));
         }
     }
     else
     {
         return(Json(new {
             state = "error",
             message = "输入信息不完整"
         }));
     }
 }
示例#27
0
 /// <summary>
 /// 移除单个客户端Cookie
 /// </summary>
 public void Remove(CookieNames key)
 {
     WebCookieHelper.Save(GetCookieName(key), string.Empty, -1);
 }
示例#28
0
 public ActionResult LoginOut()
 {
     WebCookieHelper.UserLoginOut();
     return(Redirect("/"));
 }
示例#29
0
        public ActionResult ArticleBack()
        {
            int    employeeID = WebCookieHelper.GetEmployeeId();
            string writeMsg   = "同步成功!";

            try
            {
                string selectID = Request.Form["cbx_select"] != "" ? Request.Form["cbx_select"] : "";
                if (selectID != string.Empty && selectID != "0")
                {
                    string[] ids = selectID.Split(',');
                    foreach (var item in ids)
                    {
                        int id   = int.Parse(item);
                        var blog = EnterRepository.GetRepositoryEnter().BlogRepository.LoadEntities(m => m.ID == id).FirstOrDefault();
                        if (blog.ArticleID == 0)
                        {
                            var article = new Article();
                            article.CategoryID = blog.CategoryID;
                            article.Content    = blog.Content;
                            article.Title      = blog.Title;
                            article.ViewCount  = blog.ViewCount;
                            article.Summary    = blog.Summary;
                            article.ModifyTime = blog.ModifyTime;
                            article.ModifyID   = employeeID;
                            article.Keywords   = blog.Keywords;
                            article.ImagePath  = blog.ImagePath;
                            article.CreateID   = employeeID;
                            article.CreateTime = blog.CreateTime;
                            EnterRepository.GetRepositoryEnter().ArticleRepository.AddEntity(article);
                            if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                            {
                                writeMsg = string.Format("同步失败");
                                break;
                            }
                            blog.ArticleID = article.ID;
                            EnterRepository.GetRepositoryEnter().BlogRepository.Get(m => m.ID == id);
                            EnterRepository.GetRepositoryEnter().BlogRepository.EditEntity(blog, new string[] { "ArticleID" });
                            if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                            {
                                writeMsg = string.Format("同步失败");
                                break;
                            }
                        }
                        else
                        {
                            var article = EnterRepository.GetRepositoryEnter().ArticleRepository.LoadEntities(m => m.ID == blog.ArticleID).FirstOrDefault();
                            if (article != null)
                            {
                                article.CategoryID = blog.CategoryID;
                                article.Content    = blog.Content;
                                article.Title      = blog.Title;
                                article.ViewCount  = blog.ViewCount;
                                article.Summary    = blog.Summary;
                                article.Keywords   = blog.Keywords;
                                article.ModifyTime = blog.ModifyTime;
                                article.ModifyID   = employeeID;
                                article.ImagePath  = blog.ImagePath;
                                article.CreateID   = employeeID;
                                article.CreateTime = blog.CreateTime;
                                EnterRepository.GetRepositoryEnter().ArticleRepository.Get(m => m.ID == article.ID);
                                EnterRepository.GetRepositoryEnter().ArticleRepository.EditEntity(article, new string[] {
                                    "CategoryID"
                                    , "Content"
                                    , "Title"
                                    , "ViewCount"
                                    , "Summary"
                                    , "Keywords"
                                    , "ModifyTime"
                                    , "ModifyID"
                                    , "CreateID"
                                    , "CreateTime"
                                    , "ImagePath"
                                });
                                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                                {
                                    writeMsg = string.Format("同步失败");
                                    break;
                                }
                            }
                            else
                            {
                                article            = new Article();
                                article.CategoryID = blog.CategoryID;
                                article.Content    = blog.Content;
                                article.Title      = blog.Title;
                                article.ViewCount  = blog.ViewCount;
                                article.Summary    = blog.Summary;
                                article.Keywords   = blog.Keywords;
                                article.ModifyTime = blog.ModifyTime;
                                article.ModifyID   = employeeID;
                                article.ImagePath  = blog.ImagePath;
                                article.CreateID   = employeeID;
                                article.CreateTime = blog.CreateTime;
                                EnterRepository.GetRepositoryEnter().ArticleRepository.AddEntity(article);
                                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                                {
                                    writeMsg = string.Format("同步失败");
                                    break;
                                }
                                blog.ArticleID = article.ID;
                                EnterRepository.GetRepositoryEnter().BlogRepository.Get(m => m.ID == id);
                                EnterRepository.GetRepositoryEnter().BlogRepository.EditEntity(blog, new string[] { "ArticleID" });
                                if (EnterRepository.GetRepositoryEnter().SaveChange() <= 0)
                                {
                                    writeMsg = string.Format("同步失败");
                                    break;
                                }
                            }
                        }
                    }
                }
                return(Content(writeMsg));
            }
            catch (Exception ex)
            {
                GlobalMethod.log.Error(ex);
                writeMsg = "同步失败";
                return(Content(writeMsg));
            }
        }