当前位置: 首页>>代码示例>>C#>>正文


C# ServiceResult.AddServiceError方法代码示例

本文整理汇总了C#中ServiceResult.AddServiceError方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceResult.AddServiceError方法的具体用法?C# ServiceResult.AddServiceError怎么用?C# ServiceResult.AddServiceError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceResult的用法示例。


在下文中一共展示了ServiceResult.AddServiceError方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

 public ActionResult Create(DetailsViewModel model)
 {
     var groups = GetForeignData();
     ViewBag.Data_GroupID = groups;
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             MemberService.Create(model);
             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);
     }
 }
开发者ID:navy235,项目名称:7980Site,代码行数:30,代码来源:MemberController.cs

示例2: FavoriteDelete

 public ActionResult FavoriteDelete(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var idsList = Utilities.GetIdList(ids);
         foreach (var id in idsList)
         {
             var model = FavoriteService.Find(id);
             FavoriteService.Delete(model);
         }
         result.Message = "删除收藏成功!";
     }
     catch (Exception ex)
     {
         result.Message = "删除收藏失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "删除收藏失败!", ex);
     }
     return Json(result);
 }
开发者ID:navy235,项目名称:7980Site,代码行数:21,代码来源:FavoriteController.cs

示例3: Add

        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);

                    Member_Scheme ms = new Member_Scheme()
                    {
                        Name = model.Name,
                        Description = model.Description,
                        MemberID = memberID,
                        AddTime = DateTime.Now,
                        LastTime = DateTime.Now,
                    };
                    member_SchemeService.Create(ms);
                    result.Message = "媒体方案保存成功!";
                    return Redirect(Url.Action("index"));
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                }
            }
            else
            {
                result.Message = "表单输入有误!";
                result.AddServiceError("表单输入有误!");
            }
            return View(model);
        }
开发者ID:navy235,项目名称:WebSite,代码行数:36,代码来源:SchemeController.cs

示例4: SchemeMedia_Delete

 public ActionResult SchemeMedia_Delete(int id)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var model = scheme_MediaService.Find(id);
         scheme_MediaService.Delete(model);
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     result.Message = "删除收藏" + (result.Success ? "成功!" : "失败!");
     return Json(result);
 }
开发者ID:navy235,项目名称:WebSite,代码行数:15,代码来源:SchemeController.cs

示例5: Edit

 public ActionResult Edit(SchemeAddViewModel model)
 {
     ViewBag.MenuItem = "scheme-index";
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             var scheme = new Member_Scheme();
             scheme.ID = model.ID;
             scheme.Name = model.Name;
             scheme.Description = model.Description;
             member_SchemeService.Update(scheme);
             result.Message = "媒体方案保存成功!";
             return Redirect(Url.Action("index"));
         }
         catch (Exception ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
         }
     }
     else
     {
         result.Message = "表单输入有误!";
         result.AddServiceError("表单输入有误!");
     }
     return View(model);
 }
开发者ID:navy235,项目名称:WebSite,代码行数:30,代码来源:SchemeController.cs

示例6: TopSet

        public ActionResult TopSet(PayTopViewModel model)
        {
            ViewBag.MenuItem = "gztvip-paytop";

            ServiceResult result = new ServiceResult();

            var server = serverItemService.Find(model.TopID);

            var money = member_MoneyService.GetMemberMoney(CookieHelper.MemberID);

            var dayCount = model.TopTime.Split(',').Length;

            var totalPrice = Convert.ToInt32((server.Price * dayCount * model.Discount / 10));

            if (money < totalPrice)
            {
                result.AddServiceError("您当前剩余广知币不足已支付。当前" + money + "个,支付需要" + totalPrice + "个");
            }

            ViewBag.Money = money;

            List<TopLimitModel> topLimit = sliderImgService.GetTopSourceLimit(30);

            for (var i = 0; i < model.TopTime.Split(',').Length; i++)
            {
                var topitem = model.TopTime.Split(',')[i];

                if (topLimit.Any(x => x.Time.Equals(topLimit)))
                {
                    var limit = topLimit.Single(x => x.Time.Equals(topLimit));

                    if (limit.Count >= 8)
                    {
                        result.AddServiceError(topitem + "的置顶已达到最大数,请选择其他日期。");
                    }
                }
            }

            if (result.Success)
            {

                List<SliderImg> payModel = new List<SliderImg>();
                for (var i = 0; i < model.TopTime.Split(',').Length; i++)
                {
                    var topTime = Convert.ToDateTime(model.TopTime.Split(',')[i]);

                    SliderImg payItem = new SliderImg()
                    {
                        MemberID = CookieHelper.MemberID,
                        AddTime = DateTime.Now,
                        TopTime = topTime,
                        ImgUrl = model.ImgUrl,
                        LinkUrl = model.LinkUrl,
                        ProvinceCode = (int)ProvinceName.quanguo,
                        Status = (int)SliderImgStatus.User,
                        Title = model.Name
                    };

                    payModel.Add(payItem);
                }

                var excuteresult = sliderImgService.PayTopSliderImg(payModel, totalPrice);

                if (!excuteresult.Success)
                {
                    result.AddServiceError("置顶失败!");
                }

            }
            else
            {
                #region  GetTopMediaSource

                List<CustomSelectListItem> select = new List<CustomSelectListItem>();

                var startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(1);

                for (var i = 0; i < 30; i++)
                {

                    var day = startTime.AddDays(i);

                    var dayString = day.ToString("yyyy-MM-dd");

                    if (topLimit.Any(x => x.Time.Equals(dayString)))
                    {
                        var limit = topLimit.Single(x => x.Time.Equals(dayString));

                        var limitStr = Convert.ToDateTime(limit.Time).ToString("MM-dd");

                        if (limit.Count >= 8)
                        {
                            select.Add(new CustomSelectListItem()
                            {
                                Disabled = true,
                                Text = limitStr + " (已售)",
                                Value = limit.Time
                            });
                        }
                        else
//.........这里部分代码省略.........
开发者ID:navy235,项目名称:WebSite,代码行数:101,代码来源:GztvipController.cs

示例7: TopMedia

        public ActionResult TopMedia(PayTopMeidaViewModel model)
        {
            ViewBag.MenuItem = "gztvip-paytop";

            ServiceResult result = new ServiceResult();

            var server = serverItemService.Find(model.TopID);

            var money = member_MoneyService.GetMemberMoney(CookieHelper.MemberID);

            var dayCount = model.TopTime.Split(',').Length;

            var totalPrice = Convert.ToInt32((server.Price * dayCount * model.Discount / 10));

            if (money < totalPrice)
            {
                result.AddServiceError("您当前剩余广知币不足已支付。当前" + money + "个,支付需要" + totalPrice + "个");
            }
            ViewBag.Money = money;

            List<TopLimitModel> topLimit = topMediaService.GetTopSourceLimit(30);

            for (var i = 0; i < model.TopTime.Split(',').Length; i++)
            {
                var topitem = model.TopTime.Split(',')[i];

                if (topLimit.Any(x => x.Time.Equals(topLimit)))
                {
                    var limit = topLimit.Single(x => x.Time.Equals(topLimit));

                    if (limit.Count >= 8)
                    {
                        result.AddServiceError(topitem + "的置顶已达到最大数,请选择其他日期。");
                    }
                }
            }

            if (result.Success)
            {

                List<TopMedia> payModel = new List<TopMedia>();

                var media = outDoorService.IncludeCategoryFind(model.MediaID.Value);

                for (var i = 0; i < model.TopTime.Split(',').Length; i++)
                {
                    var topTime = Convert.ToDateTime(model.TopTime.Split(',')[i]);

                    TopMedia payItem = new TopMedia()
                    {
                        MediaID = model.MediaID.Value,
                        TopTime = topTime,
                        MemberID = CookieHelper.MemberID
                    };

                    payItem.IsQuanGuo = server.IsQuanGuo;

                    payItem.IsByCategory = server.IsByCategory;

                    payItem.IsByChildCategory = server.IsByChildCategory;

                    payItem.ProvinceCode = media.Area.PCategory.ID;

                    payItem.CategoryCode = media.MeidaCode;

                    payItem.PCategoryCode = media.OutDoorMediaCate.PCategory.ID;

                    payModel.Add(payItem);
                }

                var excuteresult = topMediaService.PayTopMedia(payModel, totalPrice);

                if (!excuteresult.Success)
                {
                    result.AddServiceError("置顶失败!");
                }

            }
            else
            {
                ViewBag.CheckErr = result;
            }
            result.Message = "置顶" + (result.Success ? "成功!" : "失败!");

            TempData["Service_Result"] = result;

            if (result.Success)
            {
                return RedirectToAction("OpenOK");
            }
            var vip = member_VIPService.GetMemberVIP(CookieHelper.MemberID, true);

            ViewBag.VIP = vip;

            ViewBag.Server = server;

            return View(model);
        }
开发者ID:navy235,项目名称:WebSite,代码行数:98,代码来源:GztvipController.cs

示例8: PayCz

        public ActionResult PayCz(int ApplyMoney, string txtMoney)
        {
            ViewBag.MenuItem = "gztvip-paycz";
            ServiceResult result = new ServiceResult();
            if (string.IsNullOrEmpty(txtMoney))
            {
                txtMoney = "0";
            }
            var intMoney = Convert.ToInt32(txtMoney);
            var vip = member_VIPService.GetMemberVIP(CookieHelper.MemberID, true);
            ViewBag.VIP = vip;
            try
            {
                PayList orderItem = new PayList();
                switch (ApplyMoney)
                {
                    case 200:
                    case 500:
                    case 1000:
                        if (vip != null && vip.EndTime.CompareTo(DateTime.Now) > 0)
                        {
                            if (vip.VipLevel == (int)ServerType.NomarlVIPServer)
                            {
                                orderItem.VMoney = ApplyMoney / 10;
                            }
                            else if (vip.VipLevel == (int)ServerType.SuperVIPServer)
                            {
                                orderItem.VMoney = ApplyMoney / 5;
                            }
                        }
                        else
                        {
                            orderItem.VMoney = 0;
                        }
                        orderItem.Money = ApplyMoney;
                        break;
                    case 600:
                        orderItem.Money = intMoney;
                        if (vip != null && vip.EndTime.CompareTo(DateTime.Now) > 0)
                        {
                            if (vip.VipLevel == (int)ServerType.NomarlVIPServer)
                            {
                                orderItem.VMoney = intMoney / 10;
                            }
                            else if (vip.VipLevel == (int)ServerType.SuperVIPServer)
                            {
                                orderItem.VMoney = intMoney / 5;
                            }
                        }
                        else
                        {
                            orderItem.VMoney = 0;
                        }
                        break;
                    default:
                        return Content("<script>alert('您提交的表单有误!');window.top.location='" + Url.Action("paycz") + "';</script>");

                }
                orderItem.Pay_No = Guid.NewGuid();
                orderItem.MemberID = CookieHelper.MemberID;
                orderItem.Mode = "GZBCZ";
                orderItem.ProductType = "GZBCZ";
                orderItem.Status = Pay_State.Applying.ToString();
                orderItem.AddTime = DateTime.Now;
                orderItem.AddIP = HttpHelper.IP;
                payListService.CreateOrder(orderItem);
                result = member_VIPService.PayMoney(CookieHelper.MemberID, orderItem);
            }
            catch (Exception ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }

            var money = member_MoneyService.GetMemberMoney(CookieHelper.MemberID);

            ViewBag.Money = money;

            result.Message = "充值" + (result.Success ? "成功!" : "失败!");

            TempData["Service_Result"] = result;

            if (result.Success)
            {
                return RedirectToAction("OpenOK");
            }

            return View(vip);
        }
开发者ID:navy235,项目名称:WebSite,代码行数:88,代码来源:GztvipController.cs

示例9: Open

        public ActionResult Open(int ID, int Price)
        {
            ViewBag.MenuItem = "gztvip-index";
            ServiceResult result = new ServiceResult();

            var server = serverItemService.Find(ID);
            try
            {
                if (server == null)
                {
                    return Content("<script>alert('您提交的表单有误!');window.top.location='" + Url.Action("Index") + "';</script>");
                }

                PayList orderItem = new PayList();
                orderItem.Pay_No = Guid.NewGuid();
                orderItem.MemberID = CookieHelper.MemberID;
                orderItem.Money = server.Price;
                orderItem.ServerID = ID;
                orderItem.Mode = "VIPTest";
                orderItem.ProductType = UIHelper.ServerTypeList.Single(x => x.Value == server.ServerType.ToString()).Text;
                orderItem.Status = Pay_State.Applying.ToString();
                orderItem.AddTime = DateTime.Now;
                orderItem.AddIP = HttpHelper.IP;
                payListService.CreateOrder(orderItem);

                result = member_VIPService.PayVIP(CookieHelper.MemberID, server, orderItem);

            }
            catch (Exception ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }

            var vip = member_VIPService.GetMemberVIP(CookieHelper.MemberID, true);

            var money = member_MoneyService.GetMemberMoney(CookieHelper.MemberID);
            ViewBag.Money = money;

            result.Message = "VIP开通" + (result.Success ? "成功!" : "失败!");

            TempData["Service_Result"] = result;

            ViewBag.Server = server;
            if (result.Success)
            {
                return RedirectToAction("openok");
            }
            return View(vip);
        }
开发者ID:navy235,项目名称:WebSite,代码行数:49,代码来源:GztvipController.cs


注:本文中的ServiceResult.AddServiceError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。