public ActionResult AddFeedbackrecord(Feedbackrecord feedbackrecord) { Members member = membersService.GetByID(feedbackrecord.Memberid); if (feedbackrecord.Ishdz == 0) { if (TryUpdateModel(feedbackrecord, new string[] { "Ishdz", "Money", "Status", "Hdzaccount", "Remark" }) && ModelState.IsValid) { feedbackrecord.Feedbackid = Guid.NewGuid(); feedbackrecord.Createdate = DateTime.Now; feedbackrecord.Updatedate = DateTime.Now; feedbackrecord.Remains = member.Feedbackmoney - feedbackrecord.Money; feedbackrecordService.Create(feedbackrecord); feedbackrecordService.SaveChanges(); } } else { if (TryUpdateModel(feedbackrecord, new string[] { "Ishdz", "Money", "Status", "Bankaccount", "Remark" }) && ModelState.IsValid) { feedbackrecord.Feedbackid = Guid.NewGuid(); feedbackrecord.Createdate = DateTime.Now; feedbackrecord.Updatedate = DateTime.Now; feedbackrecord.Cash = feedbackrecord.Money / 2; feedbackrecord.Remains = member.Feedbackmoney - feedbackrecord.Money; feedbackrecordService.Create(feedbackrecord); feedbackrecordService.SaveChanges(); } } member.Feedbackmoney -= feedbackrecord.Money; membersService.SpecificUpdate(member, new string[] { "Feedbackmoney" }); membersService.SaveChanges(); return(RedirectToAction("Feedbackrecord")); }
public ActionResult Feedbackcount() { int i = 0; Guid Memberid = Guid.Parse(Session["Memberid"].ToString()); Members member = membersService.GetByID(Session["Memberid"]); IEnumerable <Feedbackproduct> FeedbackproductList = feedbackproductService.Get().OrderBy(o => o.Createdate); int[] Product = new int[FeedbackproductList.Count()]; foreach (Feedbackproduct Feedbackproduct in FeedbackproductList) { if (orderfacebooklistService.Get().Where(a => a.Memberid == Memberid).Where(a => a.Order.Ordernumber.Contains("hdz")).Where(x => x.Feedbackproductid == Feedbackproduct.Feedbackproductid).Count() == 0) { i++; } else { Product[i] = orderfacebooklistService.Get().Where(a => a.Memberid == Memberid).Where(a => a.Order.Ordernumber.Contains("hdz")).Where(x => x.Feedbackproductid == Feedbackproduct.Feedbackproductid).Count(); } } if (member.Isreal == true) { ViewBag.Levelid = memberlevelService.Get().Where(a => a.Levelname == "真人").FirstOrDefault().Levelid; } else { ViewBag.Levelid = memberlevelService.Get().Where(a => a.Levelname == "一般").FirstOrDefault().Levelid; } ViewBag.HeODate = member.Createdate.ToString("yyyy/MM/dd"); // 加入HeO的時間 ViewBag.Feedbackproduct = feedbackproductService.Get().OrderBy(o => o.Createdate); ViewBag.FeedbackCount = Product; return(View()); }
public ActionResult Logout() { Members members = membersService.GetByID(Session["Memberid"]); /*** 登入時間改為現在 ****/ members.Logindate = ((int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds - 28800); membersService.SpecificUpdate(members, new string[] { "Logindate" }); membersService.SaveChanges(); Session.RemoveAll(); // 將所有Session清除 return(RedirectToAction("Home", "HomeMs")); }
// GET: Ajax /***** 批量刪除 ****/ public JsonResult AjaxDeleteChecked(Guid[] Memberid) { if (Memberid != null) { foreach (Guid thismemberid in Memberid) { Members Members = membersService.GetByID(thismemberid); Members.Isenable = 0; membersService.SpecificUpdate(Members, new string[] { "Isenable" }); } membersService.SaveChanges(); } return(this.Json("Success")); }
public ActionResult Member() { IEnumerable <Feedbackproduct> Feedbackproduct = feedbackproductService.Get(); Members member = membersService.GetByID(Session["Memberid"]); IEnumerable <Memberauthorization> Memberauthorization = memberauthorizationService.Get().Where(a => a.Memberid == member.Memberid); if (member.Isreal == true) { ViewBag.Levelid = memberlevelService.Get().Where(a => a.Levelname == "真人").FirstOrDefault().Levelid; } else { ViewBag.Levelid = memberlevelService.Get().Where(a => a.Levelname == "一般").FirstOrDefault().Levelid; } ViewBag.Memberauthorization = Memberauthorization; ViewBag.Feedbackproduct = Feedbackproduct; ViewBag.Facebookstatus = member.Facebookstatus; return(View()); }
public ActionResult DeleteMembers(Guid Memberid) { Members members = membersService.GetByID(Memberid); members.Isenable = 0; membersService.SpecificUpdate(members, new string[] { "Isenable" }); membersService.SaveChanges(); return(RedirectToAction("Members")); }
protected override void OnActionExecuted(ActionExecutedContext filterContext) { if (Session["Memberid"] != null) { int Now = (int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds - 28800; // 目前時間總秒數 Guid Memberid = Guid.Parse((Session["Memberid"]).ToString()); Guid Normalid = memberlevelService.Get().Where(a => a.Levelname == "一般").FirstOrDefault().Levelid; // 一般會員的ID Members member = membersService.GetByID(Memberid); // 該會員的詳細資料 Viprecord viprecord = viprecordService.Get().Where(a => a.Memberid == Memberid).Where(x => x.Status == 2).OrderByDescending(o => o.Enddate).FirstOrDefault(); /*** 判斷該會員剩餘VIP天數 ***/ if (viprecord != null) { Double Day = (viprecord.Enddate - DateTime.Now).TotalDays; if (Day > 0) { ViewBag.Remainday = Convert.ToInt16(Math.Ceiling(Day)); } else { ViewBag.Remainday = 0; if (member.Levelid != Normalid) { member.Levelid = Normalid; membersService.SpecificUpdate(member, new string[] { "Levelid" }); membersService.SaveChanges(); } } } member.Logindate = Now + 1200; // 登入時間為目前時間+20分鐘 membersService.SpecificUpdate(member, new string[] { "Logindate" }); membersService.SaveChanges(); /*** 判斷該會員是否有買過VIP ***/ ViewBag.Checkvip = viprecordService.Get().Where(a => a.Memberid == Memberid).Where(x => x.Status == 2).Count(); } ViewBag.BlobUrl = url + "/" + container + "/"; ViewBag.WebsiteTitle = websitetitle; ViewBag.AddActive = (ViewBag.CartItems > 0) ? "add-active" : ""; base.OnActionExecuted(filterContext); }
public JsonResult AjaxMember(Guid uuid) { Members Member = membersSerice.GetByID(Session["Memberid"]); Memberauthorization memberauthorization = memberauthorizationService.Get().Where(a => a.Memberid == Member.Memberid).Where(x => x.Feedbackproductid == uuid).FirstOrDefault(); if (memberauthorization != null) { memberauthorization.Checked = !memberauthorization.Checked; memberauthorizationService.SaveChanges(); } else { memberauthorization = new Memberauthorization(); memberauthorization.Id = Guid.NewGuid(); memberauthorization.Memberid = Member.Memberid; memberauthorization.Feedbackproductid = uuid; memberauthorization.Checked = true; memberauthorizationService.Create(memberauthorization); memberauthorizationService.SaveChanges(); } return(this.Json("success")); }
/*** Service要帳密 ***/ public JsonResult GetAccount(string Id, int number, string Ordernumber) { if (Id == "heo_order") { Setting setting = settingService.Get().FirstOrDefault(); Order order = orderService.Get().Where(a => a.Ordernumber == Ordernumber).FirstOrDefault(); // 撈訂單的詳細資料 Feedbackproduct feedbackproduct = feedbackproductService.Get().Where(a => a.Feedbackproductname.Contains(order.Service)).FirstOrDefault(); // 撈訂單產品的詳細資料 IEnumerable <Orderfaceooklist> orderfacebookList = orderfacebooklistService.Get().Where(a => a.Order.Ordernumber == Ordernumber); // 撈訂單之前的按讚名單紀錄 IEnumerable <Order> old_order = orderService.Get().Where(x => x.Ordernumber != order.Ordernumber).Where(c => c.Service == feedbackproduct.Feedbackproductname).Where(a => a.Url == order.Url); // 撈所有訂單裡網址為訂單的資料 List <get_old_member> MemberList = new List <get_old_member>(); /**** 判斷訂單是不是HEO內部的單 ***/ if (order.Ordernumber.Contains("heo")) { /*** 先將自己給排除掉 ****/ MemberList.Add( new get_old_member { Memberid = order.Members.Memberid }); } /**** 將這張單的按讚列表的人排除掉 *****/ if (orderfacebookList.Count() > 0) { foreach (Orderfaceooklist thisorderfacebookList in orderfacebookList) { MemberList.Add( new get_old_member { Memberid = Guid.Parse(thisorderfacebookList.Memberid.ToString()) } ); } } /*** 將同網址的訂單的按站讚列表的人排除掉 ****/ if (old_order.Count() > 0) { foreach (Order thisold_order in old_order) { IEnumerable <Orderfaceooklist> oldorderfacebooklist = orderfacebooklistService.Get().Where(a => a.Orderid == thisold_order.Orderid); foreach (Orderfaceooklist thisoldorderfaceooklist in oldorderfacebooklist) { MemberList.Add( new get_old_member { Memberid = Guid.Parse(thisoldorderfaceooklist.Memberid.ToString()) } ); } } } Guid VipLevelid = memberlevelService.Get().Where(a => a.Levelname == "VIP").FirstOrDefault().Levelid; // VIP層級的ID if (order.Ordernumber.Contains("heo")) { /*** HEO內部下的訂單 ***/ List <get_member> AccountList = new List <get_member>(); /*** 先撈前台登入、仿前台登入的使用者 ***/ IEnumerable <Members> members = membersService.Get().Where(s => s.Is_import == 0 || s.Is_import == 2).Where(c => c.Levelid != VipLevelid).Where(x => x.Lastdate <= Now).Where(a => a.Logindate >= Now).Where(c => c.Memberloginrecord.OrderByDescending(a => a.Createdate).FirstOrDefault().Status == 1).OrderBy(x => x.Lastdate); // 撈層級非VIP的帳號詳細資料 if (members != null) { foreach (Members thismembers in members) { bool used = false; int loop; for (loop = 0; loop < MemberList.Count(); loop++) { if (thismembers.Memberid.Equals(MemberList[loop].Memberid)) { used = true; } } if (used == false) { AccountList.Add( new get_member { memberid = thismembers.Memberid, account = thismembers.Account, password = thismembers.Password, useragent_phone = thismembers.Useragent_phone, facebookcookie = thismembers.Facebookcookie, } ); used = false; } } foreach (get_member entity in AccountList.Take(number)) { /*** 將此會員更新下次互惠時間 ****/ Members member = membersService.GetByID(entity.memberid); member.Lastdate = Now + (int)setting.Time; membersService.SpecificUpdate(member, new string[] { "Lastdate" }); } membersService.SaveChanges(); return(this.Json(AccountList.Take(number), JsonRequestBehavior.AllowGet)); } else { /*** 前台沒人可以抓了,改抓機器人 ***/ IEnumerable <Members> Botmembers = membersService.Get().Where(s => s.Is_import == 1).Where(x => x.Lastdate <= Now).Where(c => c.Memberloginrecord.OrderByDescending(a => a.Createdate).FirstOrDefault().Status != 2).OrderBy(x => x.Lastdate); if (members != null) { bool used = false; foreach (Members thismembers in Botmembers) { int loop; for (loop = 0; loop < MemberList.Count(); loop++) { if (thismembers.Memberid.Equals(MemberList[loop].Memberid)) { used = true; } } if (used == false) { AccountList.Add( new get_member { memberid = thismembers.Memberid, account = thismembers.Account, password = thismembers.Password, useragent_phone = thismembers.Useragent_phone, facebookcookie = thismembers.Facebookcookie, } ); used = false; } } if (AccountList.Count() < number) { return(this.Json("數量不足", JsonRequestBehavior.AllowGet)); } else { foreach (get_member entity in AccountList.Take(number)) { /*** 將此會員更新下次互惠時間 ****/ Members member = membersService.GetByID(entity.memberid); member.Lastdate = Now + (int)setting.Time; membersService.SpecificUpdate(member, new string[] { "Lastdate" }); } membersService.SaveChanges(); return(this.Json(AccountList.Take(number), JsonRequestBehavior.AllowGet)); } } else { return(this.Json("數量不足", JsonRequestBehavior.AllowGet)); } } } else { /*** HDZ餵來的訂單 ***/ IEnumerable <Members> members = membersService.Get().Where(x => x.Lastdate <= Now).Where(b => b.Memberloginrecord.OrderByDescending(x => x.Createdate).FirstOrDefault().Status != 2).Where(s => s.Memberauthorization.Where(q => q.Feedbackproductid == feedbackproduct.Feedbackproductid).FirstOrDefault().Checked == true).OrderBy(x => x.Lastdate); if (members != null) { List <get_member> AccountList = new List <get_member>(); bool used_accoount = false; foreach (Members thismembers in members) { int loop; if (MemberList.Count() > 0) { for (loop = 0; loop < MemberList.Count(); loop++) { if ((thismembers.Memberid.Equals(MemberList[loop].Memberid)) == true) { used_accoount = true; } } } if (!used_accoount) { AccountList.Add( new get_member { memberid = thismembers.Memberid, account = thismembers.Account, password = thismembers.Password, useragent_phone = thismembers.Useragent_phone, facebookcookie = thismembers.Facebookcookie, } ); } used_accoount = false; } /*** 可用人數小於該訂單所需人數 ***/ if (AccountList.Count < number) { return(this.Json("數量不足", JsonRequestBehavior.AllowGet)); } else { foreach (get_member entity in AccountList.Take(number)) { /*** 將此會員更新下次互惠時間 ****/ Members member = membersService.GetByID(entity.memberid); member.Lastdate = Now + (int)setting.Time; membersService.SpecificUpdate(member, new string[] { "Lastdate" }); } } membersService.SaveChanges(); return(this.Json(AccountList.Take(number), JsonRequestBehavior.AllowGet)); } else { return(this.Json("數量不足", JsonRequestBehavior.AllowGet)); } } } else { string status = "Error"; return(this.Json(status, JsonRequestBehavior.AllowGet)); } }
public void DepositReceive(string TradeInfo) { string Receive = Newebpay.DecryptAES256(TradeInfo); var NewebpayRecive = JsonConvert.DeserializeObject <dynamic>(Receive); // 將Newebpay回傳的json格式轉成物件 string DepositNumber = NewebpayRecive.Result.MerchantOrderNo; // 取得儲值編號 Viprecord viprecord = viprecordService.Get().Where(a => a.Depositnumber == DepositNumber).FirstOrDefault(); Returnstatus returnstatus = new Returnstatus(); returnstatus.Text = Receive; returnstatus.Createdate = DateTime.Now; returnstatusService.Create(returnstatus); returnstatusService.SaveChanges(); if (NewebpayRecive.Result.PaymentType == "VACC") { /*** 將付款方式、Newebpay交易編號、開始時間、截止時間 ***/ Viprecord old_data = viprecordService.Get().Where(a => a.Memberid == viprecord.Memberid).OrderByDescending(x => x.Enddate).FirstOrDefault(); viprecord.Paymenttype = NewebpayRecive.Result.PaymentType; viprecord.Status = 2; if (old_data != null) { if (old_data.Enddate < DateTime.Now) { viprecord.Startdate = DateTime.Now; viprecord.Enddate = DateTime.Now.AddDays(Convert.ToDouble(viprecord.Day)); } else { viprecord.Startdate = old_data.Enddate; viprecord.Enddate = old_data.Enddate.AddDays(Convert.ToDouble(viprecord.Day)); } } else { viprecord.Startdate = DateTime.Now; viprecord.Enddate = DateTime.Now.AddDays(Convert.ToDouble(viprecord.Day)); } viprecordService.SpecificUpdate(viprecord, new string[] { "Paymenttype", "Startdate", "Enddate", "Status" }); viprecordService.SaveChanges(); /*** 更新會員層級狀態 ***/ Members member = membersService.GetByID(viprecord.Memberid); Memberlevel memberlevel = memberlevelService.Get().Where(a => a.Levelname == "VIP").FirstOrDefault(); member.Levelid = memberlevel.Levelid; membersService.SpecificUpdate(member, new string[] { "Levelid" }); membersService.SaveChanges(); } else if (NewebpayRecive.Result.PaymentType == "CVS") { /*** 將付款方式、Newebpay交易編號、開始時間、截止時間 ***/ Viprecord old_data = viprecordService.Get().Where(a => a.Memberid == viprecord.Memberid).OrderByDescending(x => x.Enddate).FirstOrDefault(); viprecord.Paymenttype = NewebpayRecive.Result.PaymentType; viprecord.Status = 2; if (old_data != null) { if (old_data.Enddate < DateTime.Now) { viprecord.Startdate = DateTime.Now; viprecord.Enddate = DateTime.Now.AddDays(Convert.ToDouble(viprecord.Day)); } else { viprecord.Startdate = old_data.Enddate; viprecord.Enddate = old_data.Enddate.AddDays(Convert.ToDouble(viprecord.Day)); } } else { viprecord.Startdate = DateTime.Now; viprecord.Enddate = DateTime.Now.AddDays(Convert.ToDouble(viprecord.Day)); } viprecordService.SpecificUpdate(viprecord, new string[] { "Paymenttype", "Startdate", "Enddate", "Status" }); viprecordService.SaveChanges(); /*** 更新會員層級狀態 ***/ Members member = membersService.GetByID(viprecord.Memberid); Memberlevel memberlevel = memberlevelService.Get().Where(a => a.Levelname == "VIP").FirstOrDefault(); member.Levelid = memberlevel.Levelid; membersService.SpecificUpdate(member, new string[] { "Levelid" }); membersService.SaveChanges(); } }
public ActionResult Order(Order order) { int Now = (int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds - 28800; // 目前時間的總秒數 //Guid Vipid = memberlevelService.Get().Where(a => a.Levelname == "VIP").FirstOrDefault().Levelid; // VIPID int membersCount = membersService.Get().Where(x => x.Logindate >= Now).Where(b => b.Memberloginrecord.OrderByDescending(x => x.Createdate).FirstOrDefault().Status == 1).Count(); // 扣除Vip會員的所有可用人數 if (order.Count > membersCount) { ViewBag.TotalNumber = membersService.Get().Count(); // 會員總人數 Setting Setting = settingService.Get().FirstOrDefault(); ViewBag.Max = Setting.Max; ViewBag.Min = Setting.Min; TempData["message"] = "數量錯誤,請重新下單!" + membersCount; return(RedirectToAction("Order", "OrderMs")); } Members member = membersService.GetByID(Session["Memberid"]); Memberblacklist blacklist = new Memberblacklist(); string ipaddress; ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (ipaddress == "" || ipaddress == null) { ipaddress = Request.ServerVariables["REMOTE_ADDR"]; } if (order.Url.IndexOf("facebook.com") != -1 && order.Count != null) { if (order.Url.IndexOf("photos") != -1 || order.Url.IndexOf("posts") != -1 || order.Url.IndexOf("video") != -1 || order.Url.IndexOf("permalink") != -1 || order.Url.IndexOf("photo") != -1) { string Url = order.Url.Replace(" ", ""); // 將訂單的空白字元砍掉 Guid Memberid = Guid.Parse(Session["Memberid"].ToString()); int? MemberCooldown = member.Memberlevel.Memberlevelcooldown.FirstOrDefault().Cooldowntime; // 該會員的冷卻時間(一般/VIP) if (member.Isreal == true) { Guid Realid = memberlevelService.Get().Where(a => a.Levelname == "真人").FirstOrDefault().Levelid; // 取得真人ID int? RealCooldowntime = memberlevelcooldownService.Get().Where(a => a.Levelid == Realid).FirstOrDefault().Cooldowntime; // 取得真人的冷卻時間 if (MemberCooldown > RealCooldowntime) { Cooldowntime = RealCooldowntime; } else { Cooldowntime = MemberCooldown; } } else { Cooldowntime = MemberCooldown; } IEnumerable <Order> old_order = orderService.Get().Where(a => a.Memberid == Memberid).OrderByDescending(o => o.Createdate); if (old_order.ToList().Count() == 0) { if (TryUpdateModel(order, new string[] { "Count" }) && ModelState.IsValid) { order.Orderid = Guid.NewGuid(); order.Createdate = DateTime.Now; order.Updatedate = DateTime.Now; order.Memberid = Memberid; order.Remains = order.Count; order.Url = Url; order.Ordernumber = "heo" + DateTime.Now.ToString("HHmmssfff"); Session["OrderNumber"] = order.Ordernumber; order.Service = "讚"; orderService.Create(order); orderService.SaveChanges(); } return(RedirectToAction("OrderResult")); } else { DateTime date = old_order.FirstOrDefault().Createdate.AddSeconds(Convert.ToDouble(Cooldowntime)); if (DateTime.Now > date) { if (TryUpdateModel(order, new string[] { "Count", }) && ModelState.IsValid) { order.Orderid = Guid.NewGuid(); order.Createdate = DateTime.Now; order.Updatedate = DateTime.Now; order.Memberid = Memberid; order.Remains = order.Count; order.Url = Url; order.Ordernumber = "heo" + DateTime.Now.ToString("HHmmssfff"); Session["OrderNumber"] = order.Ordernumber; order.Service = "讚"; orderService.Create(order); orderService.SaveChanges(); } return(RedirectToAction("OrderResult")); } else { double time = ((date - DateTime.Now).TotalSeconds); Session["Date"] = Convert.ToInt16(time); return(RedirectToAction("OrderCooldown")); } } } else { ViewBag.TotalNumber = membersService.Get().Count(); // 會員總人數 Setting Setting = settingService.Get().FirstOrDefault(); ViewBag.Max = Setting.Max; ViewBag.Min = Setting.Min; TempData["message"] = "網址輸入錯誤,請重新下單!!!"; return(RedirectToAction("Order", "OrderMs")); } } else if (order.Url.Contains("'") || order.Url.Contains("\"") || order.Count == null) // 亂輸入者,則被寫到黑名單的表裡面,並記載IP、Useragent、MemberId { blacklist.Account = member.Account; blacklist.Memberid = Guid.Parse(Session["Memberid"].ToString()); blacklist.Useragent = Request.UserAgent; blacklist.IP_Addr = ipaddress; memberblacklistService.Create(blacklist); memberblacklistService.SaveChanges(); Session.RemoveAll(); return(RedirectToAction("Home", "HomeMs")); } blacklist.Account = member.Account; blacklist.Memberid = Guid.Parse(Session["Memberid"].ToString()); blacklist.Useragent = Request.UserAgent; blacklist.IP_Addr = ipaddress; memberblacklistService.Create(blacklist); memberblacklistService.SaveChanges(); Session.RemoveAll(); return(RedirectToAction("Home", "HomeMs")); }