示例#1
0
        public ServiceResult Create(Member_VIP model)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                DB_Service.Add<Member_VIP>(model);
                DB_Service.Commit();
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {

                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }
示例#2
0
 public ServiceResult DeleteAll(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var IdsArray = ids.Split(',').Select(x => Convert.ToInt32(x));
         DB_Service.Set<Member_Scheme>().Include(x => x.Scheme_Media).Where(x => IdsArray.Contains(x.ID))
             .ToList().ForEach(x => Delete(x));
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#3
0
 public ServiceResult ChangeMessageStatus(string Ids, Sys_MessageStatus MessageStatus)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var IdsArray = Ids.Split(',').Select(x => Convert.ToInt32(x));
         var StatusValue = (int)MessageStatus;
         DB_Service.Set<Sys_Message>().Where(x => IdsArray.Contains(x.ID)).ToList().ForEach(x => x.Status = StatusValue);
         DB_Service.Commit();
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#4
0
 public ServiceResult Update(Member_Favorite model)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var target = Find(model.ID);
         DB_Service.Attach<Member_Favorite>(target);
         target.Status = model.Status;
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#5
0
 public ServiceResult DeleteMessage(int MessageID)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var Message = DB_Service.Set<Sys_Message>().Single(x => x.ID == MessageID);
         DB_Service.Attach<Sys_Message>(Message);
         Message.Status = (int)Sys_MessageStatus.Delete;
         DB_Service.Commit();
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
 public ServiceResult Update(OutDoorMediaCate model)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var target = Find(model.ID);
         DB_Service.Attach<OutDoorMediaCate>(target);
         target.CateName = model.CateName;
         target.PID = model.PID;
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#7
0
 public ServiceResult UpdateOrder(PayStatusViewModel PayStatus)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         Guid Pay_No = new Guid(PayStatus.Pay_No);
         PayList orderItem = Find(Pay_No);
         DB_Service.Attach<PayList>(orderItem);
         orderItem.Status = PayStatus.Status;
         orderItem.Trade_No = PayStatus.Trade_No;
         orderItem.Buy_Email = PayStatus.Buy_Email;
         orderItem.Buy_ID = PayStatus.Buy_ID;
         orderItem.EndTime = DateTime.Now;
         DB_Service.Commit();
     }
     catch (DbEntityValidationException ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#8
0
 public ServiceResult DeleteMessage(int MessageID, bool IsSender)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var Message = DB_Service.Set<Member_Message>().Single(x => x.ID == MessageID);
         DB_Service.Attach<Member_Message>(Message);
         if (IsSender)
         {
             Message.SenderStatus = (int)Member_MessageStatus.Delete;
         }
         else
         {
             Message.RecipienterStatus = (int)Member_MessageStatus.Delete;
         }
         DB_Service.Commit();
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#9
0
 public ServiceResult AddCompanyNotice(int MemberID, AddCompanyNoticeViewModel model)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var company = DB_Service.Set<Company>().Include(x => x.CompanyNotice).Single(x => x.MemberID == MemberID);
         DB_Service.Attach<Company>(company);
         CompanyNotice cn = new CompanyNotice()
         {
             MemberID = MemberID,
             AddTime = DateTime.Now,
             Content = model.Content,
             Title = model.Name,
             Status = (int)CompanyNoticeStatus.ShowOnLine
         };
         company.CompanyNotice.Add(cn);
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#10
0
        public ServiceResult Update(Member_VIP model)
        {
            ServiceResult result = new ServiceResult();

            try
            {
                var target = DB_Service.Set<Member_VIP>().Single(x => x.MemberID == model.MemberID);
                DB_Service.Attach<Member_VIP>(target);
                target.EndTime = model.EndTime;
                target.VipLevel = model.VipLevel;
                target.PayTime = target.PayTime + 1;
                DB_Service.Commit();
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {

                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }
示例#11
0
        public ServiceResult PayVIP(int MemberID, ServerItem Server, PayList PayOrder)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    Member_VIP model = new Member_VIP();
                    var vip = GetMemberVIP(MemberID, true);

                    PayStatusViewModel PayStatus = new PayStatusViewModel();
                    PayStatus.Pay_No = PayOrder.Pay_No.ToString();
                    PayStatus.Buy_Email = CookieHelper.Email;
                    PayStatus.Buy_ID = CookieHelper.UID;

                    PayStatus.Trade_No = "29038423784523849573247856";
                    PayStatus.Status = Pay_State.ApplyOk.ToString();
                    PayListService.UpdateOrder(PayStatus);

                    var Upgrade = false;
                    var MoneyType = "0201";
                    if (vip != null)
                    {
                        Server.Money = Server.Month * 10;
                        MoneyType = "0206";

                        if (vip.EndTime.CompareTo(DateTime.Now) > 0 && Server.ServerType > vip.VipLevel)
                        {
                            Upgrade = true;
                            var day = UIHelper.DateDiff(DateDiffType.Day, DateTime.Now, vip.EndTime);
                            var UpgradeMoney = day * 2;
                            Member_MoneyService.AddMoney(MemberID, Server.Money, "0202");
                        }
                    }
                    else
                    {
                        MoneyType = "0205";
                        Server.Money = Server.Month * 5;
                    }

                    Member_MoneyService.AddMoney(MemberID, Server.Money, MoneyType);

                    if (vip == null)
                    {
                        model.AddTime = DateTime.Now;
                        model.VipLevel = Server.ServerType;
                        model.StartTime = DateTime.Now;
                        model.MemberID = MemberID;
                        model.EndTime = DateTime.Now.AddMonths(Server.Month + Server.GiftMonth);
                        model.Description = PayOrder.ProductType;
                        model.PayTime = 1;
                        Create(model);
                    }
                    else
                    {
                        model.ID = vip.ID;
                        model.MemberID = MemberID;
                        model.VipLevel = Server.ServerType;
                        if (vip.EndTime.CompareTo(DateTime.Now) > 0)
                        {
                            if (Upgrade)
                            {
                                model.EndTime = DateTime.Now.AddMonths(Server.Month + Server.GiftMonth);
                            }
                            else
                            {
                                model.EndTime = vip.EndTime.AddMonths(Server.Month + Server.GiftMonth);
                            }
                        }
                        else
                        {
                            model.EndTime = DateTime.Now.AddMonths(Server.Month + Server.GiftMonth);
                        }

                        Update(model);

                    }
                    Member_MoneyService.AddMoney(MemberID, Server.GiftMoney, "0201");

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }
示例#12
0
 public ActionResult Message(int id, AddCompanyMessageViewModel model)
 {
     ServiceResult result = new ServiceResult();
     if (ModelState.IsValid)
     {
         var memberID = Convert.ToInt32(CookieHelper.UID);
         result = companyService.AddCompanyMessage(id, memberID, model);
         result.Message = "留言" + (result.Success ? "成功!" : "失败!");
         TempData["Service_Result"] = result;
         if (result.Success)
         {
             return RedirectToAction("index");
         }
         else
         {
             return View(model);
         }
     }
     else
     {
         result.Message = "表单输入有误!";
         result.AddServiceError("表单输入有误!");
     }
     return View(model);
 }
示例#13
0
        public ServiceResult PayTopSliderImg(List<SliderImg> model, int price)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    model.ForEach(x => Create(x));

                    Member_MoneyService.AddMoney(model[0].MemberID, -price, "0701");

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }
示例#14
0
        public ServiceResult CreateCompanyAuthInfo(int MemberID, BizAuthModel model)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                var company = Find(MemberID);

                DB_Service.Attach<Company>(company);

                CompanyImg cimg = new CompanyImg()
                {
                    FocusImgUrl = model.CompanyImg.Split(',')[0],
                    ImgUrls = model.CompanyImg,
                    MemberID = MemberID,
                    CompanyID = company.CompanyID
                };
                company.CompanyImg = cimg;

                LinkManImg limg = new LinkManImg()
                {
                    FocusImgUrl = model.LinManImg.Split(',')[0],
                    ImgUrls = model.LinManImg,
                    MemberID = MemberID,
                    CompanyID = company.CompanyID
                };
                company.LinkManImg = limg;

                CompanyLogoImg logoimg = new CompanyLogoImg()
                {
                    FocusImgUrl = model.Logo,
                    ImgUrls = model.Logo,
                    CompanyID = company.CompanyID,
                    MemberID = MemberID
                };

                company.CompanyLogoImg = logoimg;

                company.Status = (int)CompanyStatus.CompanyApply;

                DB_Service.Commit();
            }
            catch (DbEntityValidationException ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }
示例#15
0
 public ActionResult CheckFavorite(int id)
 {
     ServiceResult result = new ServiceResult();
     var MemberID = CookieHelper.MemberID;
     try
     {
         if (member_FavoriteService.GetALL().Any(x => x.MemberID == MemberID && x.MediaID == id))
         {
             result.AddServiceError("已经收藏了该媒体");
             result.Message = "已经收藏了该媒体";
         }
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
示例#16
0
 public ActionResult AddMessage(int id, string name, string content)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         AddCompanyMessageViewModel model = new AddCompanyMessageViewModel()
         {
             Name = name,
             Content = content
         };
         var AddmemberID = Convert.ToInt32(CookieHelper.UID);
         result = companyService.AddCompanyMessage(id, AddmemberID, model);
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     result.Message = "留言" + (result.Success ? "成功!" : "失败!");
     return Json(result);
 }
示例#17
0
 public ServiceResult SaveCompanyLogo(int MemberID, CompanyLogo logo)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var company = IncludeFind(MemberID);
         DB_Service.Attach<Company>(company);
         company.CompanyLogoImg.FocusImgUrl = logo.LogoUrl;
         company.CompanyLogoImg.ImgUrls = logo.LogoUrl;
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#18
0
 public ServiceResult SaveCompanyCredentials(int MemberID, CompanyCredentials credentials)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var company = DB_Service.Set<Company>().Include(x => x.CompanyCredentialsImg).Single(x => x.MemberID == MemberID);
         DB_Service.Attach<Company>(company);
         CompanyCredentialsImg cimg = new CompanyCredentialsImg()
         {
             ImgUrl = credentials.Url,
             MemberID = MemberID,
             Title = credentials.Name
         };
         company.CompanyCredentialsImg.Add(cimg);
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#19
0
 public ServiceResult SaveCompanyBanner(int MemberID, CompanyBanner banner)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var company = DB_Service.Set<Company>().Include(x => x.CompanyBannerImg).Single(x => x.MemberID == MemberID);
         DB_Service.Attach<Company>(company);
         if (company.CompanyBannerImg == null)
         {
             company.CompanyBannerImg = new CompanyBannerImg();
         }
         company.CompanyBannerImg.FocusImgUrl = banner.BannerUrl;
         company.CompanyBannerImg.ImgUrls = banner.BannerUrl;
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#20
0
 public ServiceResult EditCompanyNotice(int MemberID, AddCompanyNoticeViewModel model)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var notice = GetCompanyNotice(model.ID);
         DB_Service.Attach<CompanyNotice>(notice);
         notice.Title = model.Name;
         notice.Content = model.Content;
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#21
0
 public ServiceResult DeleteCompanyCredentials(int MemberID, int CredentialsID)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var model = GetCompanyCredentialsSingle(CredentialsID);
         DB_Service.Remove<CompanyCredentialsImg>(model);
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#22
0
 public ActionResult AddFavorite(int id)
 {
     ServiceResult result = new ServiceResult();
     var MemberID = CookieHelper.MemberID;
     if (!member_FavoriteService.GetALL().Any(x => x.MemberID == MemberID && x.MediaID == id))
     {
         try
         {
             Member_Favorite m_f = new Member_Favorite()
             {
                 MediaID = id,
                 MemberID = MemberID,
                 AddTime = DateTime.Now
             };
             member_FavoriteService.Create(m_f);
         }
         catch (Exception ex)
         {
             result.Message = "添加收藏出错!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
         }
     }
     else
     {
         result.Message = "已经收藏了该媒体";
         result.AddServiceError("已经收藏了该媒体");
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
示例#23
0
        public ServiceResult PayMoney(int MemberID, PayList PayOrder)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    PayStatusViewModel PayStatus = new PayStatusViewModel();
                    PayStatus.Pay_No = PayOrder.Pay_No.ToString();
                    PayStatus.Buy_Email = CookieHelper.Email;
                    PayStatus.Buy_ID = CookieHelper.UID;
                    PayStatus.Trade_No = "29038423784523849573247856";
                    PayStatus.Status = Pay_State.ApplyOk.ToString();
                    PayListService.UpdateOrder(PayStatus);

                    Member_MoneyService.AddMoney(MemberID, PayOrder.VMoney.Value, "0204");

                    Member_MoneyService.AddMoney(MemberID, Convert.ToInt32(PayOrder.Money.Value), "0203");

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }
示例#24
0
 public ActionResult Contact(ContactModel model)
 {
     ViewBag.MenuItem = "contact";
     ServiceResult result = new ServiceResult();
     if (ModelState.IsValid)
     {
         try
         {
             var memberID = Convert.ToInt32(CookieHelper.UID);
             memberService.SaveMemberContact(memberID, model);
             result.Message = "联系信息保存成功!";
             TempData["Service_Result"] = result;
         }
         catch (Exception ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
         }
     }
     else
     {
         result.Message = "表单输入有误!";
         result.AddServiceError("表单输入有误!");
     }
     return View(model);
 }
示例#25
0
 public ActionResult AddScheme(AddSchemeViewModel model)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         Scheme_Media sm = new Scheme_Media();
         sm.MediaID = model.id;
         sm.StartTime = Convert.ToDateTime(model.startTime);
         sm.EndTime = Convert.ToDateTime(model.endTime);
         sm.Price = Convert.ToDecimal(model.price);
         sm.PeriodCode = model.periodCode;
         sm.PeriodCount = model.periodCount;
         if (string.IsNullOrEmpty(model.schemeName) && model.schemeId != 0)
         {
             sm.SchemeID = model.schemeId;
             if (scheme_MediaService.GetALL().Where(x => x.MediaID == model.id && x.SchemeID == model.schemeId).Any())
             {
                 result.AddServiceError("该方案已经包含了此媒体");
                 result.Message = "该方案已经包含了此媒体!";
             }
         }
         else
         {
             Member_Scheme ms = new Member_Scheme()
             {
                 AddTime = DateTime.Now,
                 Name = model.schemeName,
                 Description = model.schemeDescription,
                 LastTime = DateTime.Now,
                 MemberID = CookieHelper.MemberID
             };
             member_SchemeService.Create(ms);
             sm.SchemeID = ms.ID;
         }
         if (result.Success)
         {
             scheme_MediaService.Create(sm);
             result.Message = "加入方案成功!";
         }
     }
     catch (Exception ex)
     {
         result.Message = "加入方案失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
示例#26
0
 public ServiceResult UpdateCompanyCredentials(int MemberID, CompanyCredentials credentials)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var companyCredentials = GetCompanyCredentialsSingle(credentials.ID);
         DB_Service.Attach<CompanyCredentialsImg>(companyCredentials);
         companyCredentials.ImgUrl = credentials.Url;
         companyCredentials.Title = credentials.Name;
         DB_Service.Commit();
     }
     catch (Exception ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }
示例#27
0
        public ActionResult EditSchemeMedia(AjaxEditSchemeViewModel model)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                var startTime = Convert.ToDateTime(model.startTime);

                var schemeMedia = new Scheme_Media()
                {
                    ID = model.id,
                    PeriodCode = model.periodCode,
                    PeriodCount = model.periodCount,
                    StartTime = startTime,
                    Price = Convert.ToDecimal(model.price),
                    EndTime = startTime.AddDays(model.periodCode * model.periodCount)
                };

                scheme_MediaService.Update(schemeMedia);
            }
            catch (Exception ex)
            {
                result.Message = "加入方案失败!";
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return Json(result, JsonRequestBehavior.AllowGet);
        }
示例#28
0
        public ActionResult Add(OutDoorViewModel model)
        {
            ViewBag.MenuItem = "media-publish";
            if (!CheckMemberStatus())
            {
                return Redirect(Url.Action("openbiz", "register"));
            }
            ServiceResult result = new ServiceResult();
            var AreaAttArray = new List<int>();
            TempData["Service_Result"] = result;

            if (!ModelState.IsValid)
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");
            }
            else
            {
                try
                {
                    AreaAttArray = model.AreaAtt.Split(',').Select(x => Convert.ToInt32(x)).ToList();
                    outDoorService.Create(model);
                    result.Message = "添加户外成功!";
                    return RedirectToAction("preverify");
                }
                catch (DbEntityValidationException ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                }

            }

            ViewBag.Data_AreaAtt = areaAttService.GetSelectList(AreaAttArray);
            return View(model);
        }
示例#29
0
        public ServiceResult UpdateCompanyAuthInfo(int MemberID, BizAuthModel model)
        {
            ServiceResult result = new ServiceResult();
            try
            {
                var company = IncludeFind(MemberID);

                DB_Service.Attach<Company>(company);

                company.CompanyImg.FocusImgUrl = model.CompanyImg.Split(',')[0];
                company.CompanyImg.ImgUrls = model.CompanyImg;
                company.LinkManImg.FocusImgUrl = model.LinManImg.Split(',')[0];
                company.LinkManImg.ImgUrls = model.LinManImg;
                company.CompanyLogoImg.FocusImgUrl = model.Logo;
                company.CompanyLogoImg.ImgUrls = model.Logo;

                company.Status = (int)CompanyStatus.CompanyApply;

                DB_Service.Commit();
            }
            catch (DbEntityValidationException ex)
            {
                result.AddServiceError(Utilities.GetInnerMostException(ex));
            }
            return result;
        }
示例#30
0
 public ServiceResult UpdateCompanyContact(int MemberID, CompanyContactInfoViewModel model)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var company = IncludeFind(MemberID);
         DB_Service.Attach<Company>(company);
         company.LinkMan = model.LinkMan;
         company.Fax = model.Fax;
         company.Mobile = model.Mobile;
         company.MSN = model.MSN;
         company.Phone = model.Phone;
         company.QQ = model.QQ;
         company.Sex = model.Sex;
         DB_Service.Commit();
     }
     catch (DbEntityValidationException ex)
     {
         result.AddServiceError(Utilities.GetInnerMostException(ex));
     }
     return result;
 }