Exemplo n.º 1
0
        public ActionResult Avtar(AvtarViewModel model)
        {
            ViewBag.MenuItem = "avtar";
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    MemberService.SaveMemberAvtar(CookieHelper.MemberID, model);
                    result.Message = "头像保存成功!";

                }
                catch (Exception ex)
                {
                    result.Message = "头像保存失败!";
                    result.AddServiceError(Utilities.GetInnerMostException(ex));
                    LogHelper.WriteLog("用户:" + model.MemberID + "头像保存失败!", ex);
                    return View(model);
                }
            }
            else
            {
                result.Message = "表单输入有误,请仔细填写表单!";
                result.AddServiceError("表单输入有误,请仔细填写表单!");
            }
            return View(model);
        }
Exemplo n.º 2
0
 public ActionResult AddFavorite(int id)
 {
     ServiceResult result = new ServiceResult();
     var MemberID = CookieHelper.MemberID;
     if (!FavoriteService.GetALL().Any(x => x.MemberID == MemberID && x.MediaID == id))
     {
         try
         {
             Favorite entity = new Favorite()
             {
                 MediaID = id,
                 MemberID = MemberID,
                 AddTime = DateTime.Now
             };
             FavoriteService.Create(entity);
         }
         catch (Exception ex)
         {
             result.Message = "添加收藏失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "添加收藏失败!", ex);
         }
     }
     else
     {
         result.Message = "已经收藏了该媒体";
         result.AddServiceError("已经收藏了该媒体");
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 3
0
 public ActionResult Create(CityCateViewModel model)
 {
     ViewBag.Data_PID = GetSelectList();
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             CityCate entity = new CityCate();
             entity.CateName = model.CateName;
             entity.PID = model.PID == 0 ? null : model.PID;
             entity.Level = model.Level;
             entity.OrderIndex = model.OrderIndex;
             entity.Code = model.Code;
             cityService.Create(entity);
             result.Message = "添加城市信息成功!";
             LogHelper.WriteLog("添加城市信息成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加城市信息错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Exemplo n.º 4
0
        public ActionResult Create(AreaCateViewModel model)
        {
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    AreaCate entity = new AreaCate();
                    entity.CateName = model.CateName;

                    AreaCateService.Create(entity);
                    result.Message = "添加商业区分类成功!";
                    LogHelper.WriteLog("添加商业区分类成功");
                    return RedirectToAction("index");
                }
                catch (DbEntityValidationException ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加商业区分类错误", ex);
                    return View(model);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");
                return View(model);
            }
        }
Exemplo n.º 5
0
 public ActionResult Create(DepartmentViewModel model)
 {
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             Department entity = new Department();
             entity.Name = model.Name;
             entity.Description = model.Description;
             entity.Leader = model.Leader;
             DepartmentService.Create(entity);
             result.Message = "添加部门成功!";
             LogHelper.WriteLog("添加部门成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加部门错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Exemplo n.º 6
0
        public ActionResult Create(ArticleViewModel model)
        {
            ViewBag.Data_ArticleCode = GetForeignData();
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    Article article = new Article()
                    {
                        AddTime = DateTime.Now,
                        ArticleCodeValue = model.ArticleCode,
                        Content = model.Content,
                        Name = model.Name,
                        LastTime = DateTime.Now,
                        ArticleCode = Convert.ToInt32(model.ArticleCode.Split(',').Last())
                    };

                    ArticleService.Create(article);
                    result.Message = "添加文章信息成功!";
                    LogHelper.WriteLog("添加文章信息成功");
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加文章信息错误", ex);
                    return View(model);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");
                return View(model);
            }
        }
Exemplo n.º 7
0
 public ActionResult Delete(string ids)
 {
     ServiceResult result = new ServiceResult();
     var IdArr = ids.Split(',').Select(x => Convert.ToInt32(x)).ToList();
     try
     {
         for (var i = 0; i < IdArr.Count; i++)
         {
             var model = AreaCateService.Find(IdArr[i]);
             AreaCateService.Delete(model);
         }
         LogHelper.WriteLog("删除商业区分类成功");
         result.Message = "删除商业区分类成功!";
     }
     catch (DbEntityValidationException ex)
     {
         result.Message = "删除商业区分类错误!";
         result.AddServiceError("删除商业区分类错误!");
         LogHelper.WriteLog("删除商业区分类错误", ex);
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 8
0
 public ActionResult Details(MessageViewModel model)
 {
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             var entity = new Message()
             {
                 SenderID = CookieHelper.MemberID,
                 RecipientID = model.SenderID,
                 Title = model.Name,
                 Content = model.Replay,
                 AddTime = DateTime.Now,
                 MessageType = (int)MessageType.Reply,
                 RecipienterStatus = (int)MessageStatus.Show,
                 SenderStatus = (int)MessageStatus.Show
             };
             MessageService.Create(entity);
             result.Message = "回复留言成功!";
             return Content("<script>window.top.location.reload();</script>");
         }
         catch (Exception ex)
         {
             result.Message = "回复留言失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "回复留言失败!", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     return View(model);
 }
Exemplo n.º 9
0
 public ActionResult Create(PermissionsViewModel model)
 {
     ViewBag.Data_DepartmentID = GetSelectList();
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             Permissions entity = new Permissions();
             entity.Name = model.Name;
             entity.Description = model.Description;
             entity.Controller = model.Controller;
             entity.Action = model.Action;
             entity.Namespace = model.Namespace;
             entity.DepartmentID = model.DepartmentID;
             PermissionsService.Create(entity);
             result.Message = "添加权限成功!";
             LogHelper.WriteLog("添加权限成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加权限错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Exemplo n.º 10
0
 public ActionResult Create(RolesViewModel model)
 {
     var permissions = GetGroupForeignData();
     ViewBag.Data_Permissions = permissions;
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             Roles entity = new Roles();
             entity.Name = model.Name;
             entity.Description = model.Description;
             var permissionsArray = model.Permissions.Split(',').Select(x => Convert.ToInt32(x)).ToList();
             var PermissionList = PermissionsService.GetALL().Where(x => permissionsArray.Contains(x.ID));
             entity.Permissions.AddRange(PermissionList);
             RolesService.Create(entity);
             result.Message = "添加角色成功!";
             LogHelper.WriteLog("添加角色成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加角色错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Exemplo n.º 11
0
 public ActionResult Edit(ArticleViewModel model)
 {
     List<int> ids = model.ArticleCode.Split(',').Select(x => Convert.ToInt32(x)).ToList();
     ViewBag.Data_ArticleCode = GetForeignData(ids);
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             Article entity = new Article()
             {
                 ID = model.ID,
                 Name = model.Name,
                 Content = model.Content,
                 ArticleCodeValue = model.ArticleCode,
                 ArticleCode = Convert.ToInt32(model.ArticleCode.Split(',').Last()),
                 LastTime = DateTime.Now
             };
             ArticleService.Update(entity);
             result.Message = "编辑文章信息成功!";
             LogHelper.WriteLog("编辑文章信息成功");
             return RedirectToAction("index");
         }
         catch (Exception ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("编辑文章信息错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Exemplo n.º 12
0
 public ActionResult SchemeMedia_Delete(int id)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var model = SchemeItemService.Find(id);
         SchemeItemService.Delete(model);
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "媒体方案修改失败!", ex);
     }
     result.Message = "删除媒体方案" + (result.Success ? "成功!" : "失败!");
     return Json(result);
 }
Exemplo n.º 13
0
 public ActionResult Edit(SchemeAddViewModel model)
 {
     ViewBag.MenuItem = "scheme-media";
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             var entity = new Scheme();
             entity.ID = model.ID;
             entity.Name = model.Name;
             entity.Description = model.Description;
             SchemeService.Update(entity);
             result.Message = "媒体方案修改成功!";
             return Redirect(Url.Action("index"));
         }
         catch (Exception ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "媒体方案修改失败!", ex);
         }
     }
     else
     {
         result.Message = "表单输入有误!";
         result.AddServiceError("表单输入有误!");
     }
     return View(model);
 }
Exemplo n.º 14
0
        public ActionResult AddCredentials(CompanyCredentialsViewModel model)
        {
            ViewBag.MenuItem = "company-credentials";
            var member = MemberService.Find(CookieHelper.MemberID);
            if (member.Status < (int)MemberStatus.CompanyAuth)
            {
                return Redirect(Url.Action("openbiz", "reg"));
            }
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    var entity = new CompanyCredentialsImg()
                    {
                        ImgUrl = model.ImgUrl,
                        Title = model.Name,
                        MemberID = CookieHelper.MemberID
                    };

                    CompanyCredentialsImgService.Create(entity);
                    result.Message = "添加证书成功!";

                    return RedirectToAction("Credentials");
                }
                catch (Exception ex)
                {
                    result.Message = "添加证书失败!";
                    result.AddServiceError(Utilities.GetInnerMostException(ex));
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "添加证书失败!", ex);
                    return View(model);
                }
            }
            else
            {
                result.Message = "表单输入有误,请仔细填写表单!";
                result.AddServiceError("表单输入有误,请仔细填写表单!");
            }
            return View(model);
        }
Exemplo n.º 15
0
 public ActionResult NoticeDelete(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var ListIds = Utilities.GetIdList(ids);
         foreach (var id in ListIds)
         {
             var model = CompanyNoticeService.Find(id);
             CompanyNoticeService.Delete(model);
         }
         result.Message = "删除公告成功!";
     }
     catch (Exception ex)
     {
         result.Message = "删除公告失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "删除公告失败!", ex);
     }
     return Json(result);
 }
Exemplo n.º 16
0
 public ActionResult EditNotice(CompanyNoticeViewModel model)
 {
     ViewBag.MenuItem = "shop-notice";
     var member = MemberService.Find(CookieHelper.MemberID);
     if (member.Status < (int)MemberStatus.CompanyAuth)
     {
         return Redirect(Url.Action("openbiz", "reg"));
     }
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             var entity = new CompanyNotice()
             {
                 MemberID = CookieHelper.MemberID,
                 Title = model.Name,
                 Content = model.Content,
                 ID = model.ID
             };
             CompanyNoticeService.Update(entity);
             result.Message = "编辑企业公告成功!";
             return RedirectToAction("Notice");
         }
         catch (Exception ex)
         {
             result.Message = "编辑企业公告失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "编辑企业公告失败!", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     return View(model);
 }
Exemplo n.º 17
0
 public ActionResult Banner(CompanyBannerViewModel model)
 {
     ViewBag.MenuItem = "shop-banner";
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     var member = MemberService.Find(CookieHelper.MemberID);
     if (member.Status < (int)MemberStatus.CompanyAuth)
     {
         return Redirect(Url.Action("openbiz", "reg"));
     }
     if (ModelState.IsValid)
     {
         try
         {
             var filepath = Server.MapPath("~" + model.BannerImg);
             FileHelper.deleteImg(filepath, 120);
             FileHelper.deleteImg(filepath, 430);
             FileHelper.deleteImg(filepath, 800);
             FileHelper.deleteImg(FileHelper.GetImgCutpath(filepath));
             model.BannerImg = FileHelper.GetImgCutpath(model.BannerImg, 960);
             CompanyService.SaveBanner(CookieHelper.MemberID, model);
             result.Message = "企业横幅保存成功!";
             return RedirectToAction("Banner");
         }
         catch (Exception ex)
         {
             result.Message = "企业横幅保存失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "企业横幅保存失败!", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     return View(model);
 }
Exemplo n.º 18
0
 public ActionResult SenderMessageDelete(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var ListIds = Utilities.GetIdList(ids);
         foreach (var id in ListIds)
         {
             MessageService.DeleteSenderMessage(id);
         }
         result.Message = "删除留言成功!";
     }
     catch (Exception ex)
     {
         result.Message = "删除留言失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "删除留言失败!", ex);
     }
     return Json(result);
 }
Exemplo n.º 19
0
 public ActionResult SetShow(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         OutDoorService.ChangeStatus(ids, OutDoorStatus.ShowOnline);
         result.Message = "设置媒体信息显示成功!";
     }
     catch (Exception ex)
     {
         result.Message = "设置媒体信息显示失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "设置媒体信息显示失败!", ex);
     }
     return Json(result);
 }
Exemplo n.º 20
0
        public ActionResult RegAuth(BizAuthViewModel model)
        {
            Member member = MemberService.Find(CookieHelper.MemberID);
            if (member.Status >= (int)MemberStatus.CompanyAuth)
            {
                return Content("<script>alert('您的企业已经认证通过了!');window.top.location='" + Url.Action("index", "personal") + "';</script>");
            }
            else
            {
                if (member.Status >= (int)MemberStatus.EmailActived)
                {
                    return Redirect(Url.Action("OpenBiz"));
                }
                Company cpy = CompanyService.Find(CookieHelper.MemberID);
                if (cpy == null)
                {
                    return Content("<script>alert('请先填写企业基本信息然后再填写认证信息!');window.top.location='" + Url.Action("openbiz") + "';</script>");
                }
                else
                {
                    ServiceResult result = new ServiceResult();

                    if (ModelState.IsValid)
                    {
                        try
                        {
                            CompanyService.UpdateAuthInfo(CookieHelper.MemberID, model);
                            return Redirect(Url.Action("BizActiveEmail"));
                        }
                        catch (Exception ex)
                        {
                            LogHelper.WriteLog("用户:" + member.MemberID + "填写认证信息失败!", ex);
                            TempData["FormError"] = true;
                            return View(model);
                        }
                    }
                    else
                    {
                        TempData["FormError"] = true;
                        return View(model);
                    }
                }
            }
        }
Exemplo n.º 21
0
 public ActionResult DeleteCredentials(int ID)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var model = CompanyCredentialsImgService.Find(ID);
         CompanyCredentialsImgService.Delete(model);
         result.Message = "删除证书成功!";
     }
     catch (Exception ex)
     {
         result.Message = "删除证书失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "删除证书失败!", ex);
     }
     return Json(result);
 }
Exemplo n.º 22
0
 public ActionResult ChangePwd(ChangePasswordViewModel model)
 {
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     ViewBag.MenuItem = "changepwd";
     if (ModelState.IsValid)
     {
         try
         {
             var memberID = Convert.ToInt32(CookieHelper.UID);
             if (!MemberService.ChangePassword(memberID, model.OldPassword, model.NewPassword))
             {
                 result.Message = "旧密码错误!";
                 result.AddServiceError("旧密码错误");
                 return View(model);
             }
             result.Message = "密码修改成功!";
             return RedirectToAction("changepwd");
         }
         catch (Exception ex)
         {
             result.Message = "密码修改失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + model.MemberID + "密码修改失败!", ex);
         }
     }
     return View(model);
 }
Exemplo n.º 23
0
 public ActionResult Logo(CompanyLogoViewModel model)
 {
     ViewBag.MenuItem = "shop-logo";
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     var member = MemberService.Find(CookieHelper.MemberID);
     if (member.Status < (int)MemberStatus.CompanyAuth)
     {
         return Redirect(Url.Action("openbiz", "reg"));
     }
     if (ModelState.IsValid)
     {
         try
         {
             CompanyService.SaveLogo(CookieHelper.MemberID, model);
             result.Message = "企业标志保存成功!";
             return RedirectToAction("Logo");
         }
         catch (Exception ex)
         {
             result.Message = "企业标志保存失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "企业标志保存失败!", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     return View(model);
 }
Exemplo n.º 24
0
 public ActionResult VerifyPass(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         OutDoorService.ChangeStatus(ids, OutDoorStatus.Verified);
         result.Message = "媒体信息审核通过成功!";
     }
     catch (Exception ex)
     {
         result.Message = "媒体信息审核通过失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "媒体信息审核通过失败!", ex);
     }
     return Json(result);
 }
Exemplo n.º 25
0
 public ActionResult NoticeShow(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var status = (int)CompanyNoticeStatus.ShowOnLine;
         CompanyNoticeService.ChangeStatus(ids, status);
         result.Message = "设置显示成功!";
     }
     catch (Exception ex)
     {
         result.Message = "设置显示失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "设置显示失败!", ex);
     }
     return Json(result);
 }
Exemplo n.º 26
0
 public ActionResult Edit(GroupViewModel model)
 {
     var RolesArray = model.Roles.Split(',').Select(x => Convert.ToInt32(x)).ToList();
     var Roles = GetForeignData(RolesArray);
     ViewBag.Data_Roles = Roles;
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             Group entity = new Group();
             entity.ID = model.ID;
             entity.Name = model.Name;
             entity.Description = model.Description;
             var RoleList = RolesService.GetALL().Where(x => RolesArray.Contains(x.ID)).ToList();
             entity.Roles = RoleList;
             GroupService.Update(entity);
             result.Message = "编辑群组成功!";
             LogHelper.WriteLog("编辑群组成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加群组错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Exemplo n.º 27
0
 public ActionResult SetSuggest(string ids, int reason)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         OutDoorService.ChangeSuggestStatus(ids, reason);
         result.Message = "设置媒体信息推荐状态操作成功!";
     }
     catch (Exception ex)
     {
         result.Message = "设置媒体信息推荐状态操作失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "设置媒体信息推荐状态操作失败!", ex);
     }
     return Json(result);
 }
Exemplo n.º 28
0
 public ActionResult Edit(ArticleCateViewModel model)
 {
     ViewBag.Data_PID = GetSelectList(model.PID.HasValue ? model.PID.Value : 0);
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             ArticleCate entity = new ArticleCate();
             entity.ID = model.ID;
             entity.CateName = model.CateName;
             entity.PID = model.PID == 0 ? null : model.PID;
             entity.Level = model.Level;
             entity.OrderIndex = model.OrderIndex;
             entity.IsSingle = model.IsSingle;
             entity.Code = model.Code;
             articleCateService.Update(entity);
             result.Message = "编辑文章分类成功!";
             LogHelper.WriteLog("编辑文章分类成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加文章分类错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Exemplo n.º 29
0
        public ActionResult Add(OutDoorAdminViewModel model)
        {
            ServiceResult result = new ServiceResult();

            var AreaCateArray = new List<int>();
            var CrowdCateArray = new List<int>();
            var IndustryCateArray = new List<int>();
            var PurposeCateArray = new List<int>();
            //if (!string.IsNullOrEmpty(model.AreaCate))
            //{
            //    AreaCateArray = model.AreaCate.Split(',').Select(x => Convert.ToInt32(x)).ToList();
            //}
            //if (!string.IsNullOrEmpty(model.CrowdCate))
            //{
            //    CrowdCateArray = model.CrowdCate.Split(',').Select(x => Convert.ToInt32(x)).ToList();
            //}
            //if (!string.IsNullOrEmpty(model.IndustryCate))
            //{
            //    IndustryCateArray = model.IndustryCate.Split(',').Select(x => Convert.ToInt32(x)).ToList();
            //}

            //if (!string.IsNullOrEmpty(model.PurposeCate))
            //{
            //    PurposeCateArray = model.PurposeCate.Split(',').Select(x => Convert.ToInt32(x)).ToList();
            //}

            TempData["Service_Result"] = result;

            if (!ModelState.IsValid)
            {
                result.Message = "表单输入有误,请仔细填写表单!";
                result.AddServiceError("表单输入有误,请仔细填写表单!");
            }
            else
            {
                try
                {
                    OutDoorService.Create(model);
                    result.Message = "后台添加户外成功!";
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = "后台添加户外失败!";
                    result.AddServiceError(Utilities.GetInnerMostException(ex));
                    LogHelper.WriteLog("后台用户:" + CookieHelper.MemberID + "添加户外失败!", ex);
                }

            }

            //ViewBag.Data_CrowdCate = Utilities.GetSelectListData(CrowdCateService.GetALL(), x => x.ID, x => x.CateName, CrowdCateArray, false);
            //ViewBag.Data_IndustryCate = Utilities.GetSelectListData(IndustryCateService.GetALL(), x => x.ID, x => x.CateName, IndustryCateArray, false);
            //ViewBag.Data_PurposeCate = Utilities.GetSelectListData(PurposeCateService.GetALL(), x => x.ID, x => x.CateName, PurposeCateArray, false);
            //ViewBag.Data_AreaCate = Utilities.GetSelectListData(AreaCateService.GetALL(), x => x.ID, x => x.CateName, AreaCateArray, false);
            ViewBag.Data_FormatCode = Utilities.GetSelectListData(FormatCateService.GetALL(), x => x.ID, x => x.CateName, true);
            ViewBag.Data_PeriodCode = Utilities.GetSelectListData(PeriodCateService.GetALL(), x => x.ID, x => x.CateName, true);
            //ViewBag.Data_OwnerCode = Utilities.GetSelectListData(OwnerCateService.GetALL(), x => x.ID, x => x.CateName, false);

            return View(model);
        }
Exemplo n.º 30
0
        public ActionResult Add(SchemeAddViewModel model)
        {
            ViewBag.MenuItem = "scheme-add";
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    var memberID = Convert.ToInt32(CookieHelper.UID);

                    Scheme entity = new Scheme()
                    {
                        Name = model.Name,
                        Description = model.Description,
                        MemberID = memberID,
                        AddTime = DateTime.Now,
                        LastTime = DateTime.Now,
                    };
                    SchemeService.Create(entity);
                    result.Message = "媒体方案保存成功!";
                    return Redirect(Url.Action("index"));
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "媒体方案保存失败!", ex);
                }
            }
            else
            {
                result.Message = "表单输入有误!";
                result.AddServiceError("表单输入有误!");
            }
            return View(model);
        }