public ActionResult ClubList(Dictionary <string, string> queryvalues) { string _target = queryvalues.ContainsKey("target") ? queryvalues["target"] : ""; int _id = queryvalues.ContainsKey("SearchExter") ? string.IsNullOrWhiteSpace(queryvalues["SearchExter"]) ? 0 : Convert.ToInt32(queryvalues["SearchExter"]) : 0; int Search = queryvalues.ContainsKey("Search") ? string.IsNullOrWhiteSpace(queryvalues["Search"]) ? 0 : Convert.ToInt32(queryvalues["Search"]) : 0; int _page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1; int page2 = queryvalues.ContainsKey("page2") ? Convert.ToInt32(queryvalues["page2"]) : 1; string _StartDate = queryvalues.ContainsKey("StartDate") ? queryvalues["StartDate"] : DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); string _ExpirationDate = queryvalues.ContainsKey("ExpirationDate") ? queryvalues["ExpirationDate"] : DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00"); GameRecordView model = new GameRecordView { UserID = _id, SearchExt = Session["name"].ToString(), SearchExter = _id, StartDate = _StartDate, ExpirationDate = _ExpirationDate, Page = _page }; ViewData["pageindex"] = _page; ViewData["pageindex2"] = page2; if (_target == "box") { int _pageGroup = queryvalues.ContainsKey("pageGroup") ? Convert.ToInt32(queryvalues["pageGroup"]) : 1; ViewData["ClubList_PageList"] = ClubBLL.GetMyRebate(model); return(PartialView("ClubList_PageList", ViewData["ClubList_PageList"])); } else if ((_target == "box2")) { ViewData["hid"] = "1"; model.Page = page2; model.SearchExter = Search; model.UserID = Search; ViewData["ClubListDetail"] = ClubBLL.GetMyRebateDetail(model); return(PartialView("ClubListDetail", ViewData["ClubListDetail"])); } else { int btn = queryvalues.ContainsKey("btn") ? string.IsNullOrWhiteSpace(queryvalues["btn"]) ? 0 : Convert.ToInt32(queryvalues["btn"]) : 0; int _pageGroup = queryvalues.ContainsKey("pageGroup") ? Convert.ToInt32(queryvalues["pageGroup"]) : 1; //Search ViewData["ClubList_PageList"] = ClubBLL.GetMyRebate(model); PagedList <UserClubDetail> obj = new PagedList <UserClubDetail>( new List <UserClubDetail>() , 1, 1, 1); ViewData["ClubListDetail"] = obj; if (btn == 1) { ViewData["hid"] = "1"; int tmp = model.SearchExter; model.SearchExter = Search; model.UserID = Search; ViewData["ClubListDetail"] = ClubBLL.GetMyRebateDetail(model); model.SearchExter = tmp; model.UserID = tmp; } return(View(model)); } }
public HttpResponseMessage SaveClub(ClubModel club) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); ClubBLL.SaveClub(ClubModel.MapClubModelToClub(club)); return(response); }
public ActionResult login(Dictionary <string, string> queryvalues) { string username = queryvalues.ContainsKey("username") ? queryvalues["username"] : ""; string password = queryvalues.ContainsKey("password") ? queryvalues["password"] : ""; string ReturnUrl = queryvalues.ContainsKey("ReturnUrl") ? queryvalues["ReturnUrl"] : ""; CLoginUser user = ClubBLL.GetCLoginUserByLoginName(new CLoginUser { UserAccount = username }); if (user == null || string.IsNullOrEmpty(user.UserAccount)) { return(Json( new { result = Result.UserDoesNotExist } )); } if (user.UserPassword == password) { Session["name"] = username; return(Json(RedirectToLocal(ReturnUrl))); } else { return(Json(new { result = Result.PasswordIsIncorrect })); } }
// GET: Base public ActionResult ClubList() { PagedList <CLoginUserClub> data = ClubBLL.GetCLoginUserClubListByPage(1, 35, -1); //将数据展示到前端 return(View()); }
public HttpResponseMessage GetClubByShortName(string shortName) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new ObjectContent <ClubModel>(ClubModel.MapClub(ClubBLL.GetClubByShortName(shortName)), new JsonMediaTypeFormatter()); return(response); }
public void TestMethod1() { ClubBLL bll = new ClubBLL(); var model = bll.GetModel(p => p.id == 1); JsonSerializer serializer = new JsonSerializer(); Console.WriteLine(JsonConvert.SerializeObject(model)); }
public void delete() { ClubBLL bll = new ClubBLL(); var model = bll.GetModel(p => p.id == 1); bll.Delete(model, true); JsonSerializer serializer = new JsonSerializer(); Console.WriteLine(JsonConvert.SerializeObject(model)); }
public HttpResponseMessage GetModuleLinks() { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); UserPrincipal loggedInUser = (UserPrincipal)HttpContext.Current.User; response.Content = new ObjectContent <List <ModuleLinkModel> >(ModuleLinkModel.MapModuleLinks( ClubBLL.GetModuleLinks(loggedInUser.AccountSession.ClubId)), new JsonMediaTypeFormatter()); return(response); }
public IHttpActionResult Get() { try { List <Club> todos = ClubBLL.List(); return(Content(HttpStatusCode.OK, todos)); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex)); } }
public IHttpActionResult Put(Club alumno) { try { ClubBLL.Update(alumno); return(Content(HttpStatusCode.OK, "Club actualizado correctamente")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IHttpActionResult> PostClub(Club club) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ClubBLL.Create(club); return(CreatedAtRoute("DefaultApi", new { id = club.id_club }, club)); }
public async Task <IHttpActionResult> GetClub(int id) { Club club = ClubBLL.Get(id); if (club == null) { return(NotFound()); } return(Ok(club)); }
public IHttpActionResult Post(Club alumno) { try { ClubBLL.Create(alumno); return(Content(HttpStatusCode.Created, "Club creado correctamente")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult Delete(int id) { try { ClubBLL.Delete(id); return(Ok("Club eliminado correctamente")); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex)); } }
public void update() { ClubBLL bll = new ClubBLL(); var model = new Model.club(); model.id = 2; model.name = "123321"; model.logo = "123321"; bll.Update(model, new[] { "id", "name", "logo" }); JsonSerializer serializer = new JsonSerializer(); Console.WriteLine(JsonConvert.SerializeObject(model)); }
public void add() { ClubBLL bll = new ClubBLL(); var model = new Model.club(); model.date = DateTime.Now; model.logo = "d"; model.name = "d"; model.state = 1; bll.Add(model); JsonSerializer serializer = new JsonSerializer(); Console.WriteLine(JsonConvert.SerializeObject(model)); }
public async Task <IHttpActionResult> PutClub(int id, Club club) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != club.id_club) { return(BadRequest()); } ClubBLL.Update(club); return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Get(int id) { try { Club result = ClubBLL.Get(id); if (result == null) { return(NotFound()); } return(Content(HttpStatusCode.OK, result)); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex)); } }
public HttpResponseMessage GetClub() { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); try { UserPrincipal loggedInUser = (UserPrincipal)HttpContext.Current.User; response.Content = new ObjectContent <ClubModel>(ClubModel.MapClub(ClubBLL.GetClub(loggedInUser.AccountSession.ClubId)), new JsonMediaTypeFormatter()); } catch (Exception ex) { LogHelper.LogError(string.Format("Error getting club..."), ex, 0); } return(response); }
public ActionResult ClubListDetail(Dictionary <string, string> queryvalues) { int _id = queryvalues.ContainsKey("UserID") ? string.IsNullOrWhiteSpace(queryvalues["UserID"]) ? 0 : Convert.ToInt32(queryvalues["UserID"]) : 0; int _page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1; string _StartDate = queryvalues.ContainsKey("StartDate") ? queryvalues["StartDate"] : DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); string _ExpirationDate = queryvalues.ContainsKey("ExpirationDate") ? queryvalues["ExpirationDate"] : DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00"); GameRecordView model = new GameRecordView { UserID = _id, StartDate = _StartDate, ExpirationDate = _ExpirationDate, Page = _page }; model.DataList = ClubBLL.GetMyRebateDetail(model); if (Request.IsAjaxRequest()) { return(PartialView("ClubListDetail", model.DataList)); } return(View(model.DataList)); }
// GET: api/Club public IQueryable <Club> GetClubs() { return(ClubBLL.Get()); }
public ActionResult MemberUpdateForVIP(Dictionary <string, string> queryvalues) { int _type = queryvalues.ContainsKey("Type") ? Convert.ToInt32(queryvalues["Type"]) : 0; int _id = queryvalues.ContainsKey("ID") ? Convert.ToInt32(queryvalues["ID"]) : 0; int _level = queryvalues.ContainsKey("Grade") ? Convert.ToInt32(queryvalues["Grade"]) : 0; int _point = queryvalues.ContainsKey("Point") ? Convert.ToInt32(queryvalues["Point"]) : 0; Role model = new Role(); model = RoleBLL.GetRoleByString(new Role() { ID = _id }); if (model == null) { return(View(model)); } model.UpdateProperty = _type; //数据修改操作 if (Request.IsAjaxRequest()) { //没有封号不能修改 if (model.IsFreeze == isSwitch.开) { return(Content("-1")); } if (_type == 3) //绑定俱乐部 { //检查是不是俱乐部,不是俱乐部,不让绑定 IEnumerable <ClubInfo> clubs = ClubBLL.GetClubInfo(_level); if (clubs != null && clubs.Count() > 0) { } else { return(Content("4"));//不是俱乐部 } Beland_Club_C BelandlubC; // model.Minu 传一个时间长短给服务器 BelandlubC = Beland_Club_C.CreateBuilder() .SetClubID((uint)_level) .SetDwUserID((uint)_id) .Build(); Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_BELAND_CLUB, BelandlubC.ToByteArray())); switch ((CenterCmd)tbind.header.CommandID) { case CenterCmd.CS_BELAND_CLUB: Beland_Club_S BelandClubS = Beland_Club_S.ParseFrom(tbind.body.ToBytes()); bool res = BelandClubS.Suc; if (res) { return(Content("5")); } else { return(Content("6")); } case CenterCmd.CS_CONNECT_ERROR: break; } return(Content("6")); //model.ClubID = _level; //int res = RoleBLL.UpdateRoleClub(model); //if(res == 1) //绑定不是俱乐部ID //{ // return Content("4"); //} //else //{ // return Content(res.ToString()); //} } //玩家数据为空 if (model.ExtInfo == null) { return(Content("-2")); } else { ///////////////////////////////////////////////////////////////////////////////// if (SystemType == "2")//万人德州 { BExtInfo BExtInfo = BExtInfo.ParseFrom(model.ExtInfo); if (_type == 1) //修改VIP等级 { VipInfo VipInfo22; VipInfo22 = VipInfo.CreateBuilder(BExtInfo.VipInfo) .SetGrade((int)_level) .SetCurrent((int)_point) .Build(); BExtInfo = BExtInfo.CreateBuilder(BExtInfo) .SetVipInfo(VipInfo22) .Build(); } else if (_type == 2) //修改等级 { LevelInfo LevelInfo22; LevelInfo22 = LevelInfo.CreateBuilder(BExtInfo.LevelInfo) .SetLevel(_level) .SetExp(_point) .Build(); BExtInfo = BExtInfo.CreateBuilder(BExtInfo) .SetLevelInfo(LevelInfo22) .Build(); } byte[] bs = BExtInfo.ToByteArray(); model.ExtInfo = bs; return(Content(RoleBLL.UpdateRole(model).ToString())); } else if (SystemType == "1") { byte[] Data = new byte[4]; Array.Copy(model.ExtInfo, 4, Data, 0, 4); int num = System.BitConverter.ToInt32(Data, 0); byte[] Grade = System.BitConverter.GetBytes(_level); byte[] Point = System.BitConverter.GetBytes(_point); for (int j = 0; j < 4; j++) { if (_type == 1) //修改VIP等级 { model.ExtInfo[16 + j] = Grade[j]; model.ExtInfo[20 + j] = Point[j]; } else if (_type == 2) //修改等级 { model.ExtInfo[36 + j] = Grade[j]; model.ExtInfo[40 + j] = Point[j]; } } return(Content(RoleBLL.UpdateRole(model).ToString())); } else { } } } //数据查询操作 if (model.ExtInfo == null) { return(View(model)); } else { if (SystemType == "2") { BExtInfo BExtInfo = BExtInfo.ParseFrom(model.ExtInfo); model.VipGrade = BExtInfo.VipInfo.Grade; //VIP等级 model.VipPoint = BExtInfo.VipInfo.Current; //VIP等级 model.LevelGrade = BExtInfo.LevelInfo.Level; //玩家等级 model.LevelPoint = BExtInfo.LevelInfo.Exp; //玩家等级 return(View(model)); } else { int indexData = 4; byte[] numData = new byte[4]; Array.Copy(model.ExtInfo, indexData, numData, 0, 4); int num = System.BitConverter.ToInt32(numData, 0); indexData = indexData + 4; byte[] DataInfo = new byte[num]; Array.Copy(model.ExtInfo, 0, DataInfo, 0, num); while (indexData < num) { //类型ID int typeid = System.BitConverter.ToInt32(DataInfo, indexData); indexData = indexData + 4; //数据长度 int datanum = System.BitConverter.ToInt32(DataInfo, indexData); indexData = indexData + 4; //VIP等级 if (typeid == 1) { model.VipGrade = System.BitConverter.ToInt32(DataInfo, indexData); model.VipPoint = System.BitConverter.ToInt32(DataInfo, indexData + 4); indexData = indexData + datanum; } //玩家等级 else if (typeid == 2) { model.LevelGrade = System.BitConverter.ToInt32(DataInfo, indexData); model.LevelPoint = System.BitConverter.ToInt32(DataInfo, indexData + 4); indexData = indexData + datanum; } else { indexData = indexData + datanum; } } return(View(model)); } } }
// GET: Club public ActionResult Index(Dictionary <string, string> queryvalues) { ILog log = LogManager.GetLogger("Club"); int uid = queryvalues.ContainsKey("uid") ? (string.IsNullOrEmpty(queryvalues["uid"])?-1:Convert.ToInt32(queryvalues["uid"])): -1; // uid = 10701; string hip = serverIP; int hport = Convert.ToInt32(serverPort); Dictionary <char, char> arrC = new Dictionary <char, char>(); /*'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'*/ arrC.Add('0', 'a'); arrC.Add('1', 'b'); arrC.Add('2', 'c'); arrC.Add('3', 'd'); arrC.Add('4', 'e'); arrC.Add('5', 'f'); arrC.Add('6', 'g'); arrC.Add('7', 'h'); arrC.Add('8', 'i'); arrC.Add('9', 'j'); string uidStr = uid.ToString(); string resStr = ""; for (int i = 0; i < uidStr.Length; i++) { char ci = arrC[uidStr[i]]; resStr += ci; } string code = resStr; resStr = gameUrl + resStr; //生成短网址 // resStr = BaiDuHelper.TransLongUrlToTinyUrl(resStr); //发送socket请求 IPAddress ip = IPAddress.Parse(hip); IPEndPoint ipe = new IPEndPoint(ip, hport); Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); clientSocket.Connect(ipe); Int16 head = 8; Int16 protol = 1; Int32 content = uid; byte[] headBytes = System.BitConverter.GetBytes(head); byte[] protolBytes = System.BitConverter.GetBytes(protol); byte[] contentBytes = System.BitConverter.GetBytes(content); byte[] c = new byte[headBytes.Length + protolBytes.Length + contentBytes.Length]; headBytes.CopyTo(c, 0); protolBytes.CopyTo(c, headBytes.Length); contentBytes.CopyTo(c, headBytes.Length + protolBytes.Length); clientSocket.Send(c); // = unpack("vv1/vv2/Lc1/Lc2/Lc3/a16c4/cc5",$out); //vv1/vv2/Lc1/Lc2/Lc3/a16c4/cc5 //2位/2位/4位/4位/4位/16位/1位 byte[] recBytes = new byte[1024]; int bytes = clientSocket.Receive(recBytes, recBytes.Length, 0); if (bytes <= 0) { //没有登录 return(View("Nologin", bytes)); } else { Int16 v1 = System.BitConverter.ToInt16(recBytes, 0); Int16 v2 = System.BitConverter.ToInt16(recBytes, 2); Int32 c1 = System.BitConverter.ToInt32(recBytes, 4); Int32 c2 = System.BitConverter.ToInt32(recBytes, 8); Int32 c3 = System.BitConverter.ToInt32(recBytes, 12); string c4 = Encoding.ASCII.GetString(recBytes, 16, 16); byte c5 = recBytes[32]; ClubInit model = new ClubInit() { C1 = c1, C2 = c2, C3 = c3, C4 = c4, C5 = c5, V1 = v1, V2 = v2, Mark = resStr, Ip = hip, Port = hport, UID = uid, Code = code }; clientSocket.Close(); //查询本周总贡献总额 Int64 weekTotal = ClubBLL.GetClubWeekTotal(uid); string fanli = "20"; string nextTotal = ""; string nextFanLi = ""; if (weekTotal < 500000000) { fanli = "25"; //当前返利 nextTotal = "5"; //下个返利服务费 nextFanLi = "30"; //下个返利比例 } else if (weekTotal < 1000000000) { fanli = "30"; nextTotal = "10"; nextFanLi = "35"; } else if (weekTotal < 1500000000) { fanli = "35"; nextTotal = "15"; nextFanLi = "40"; } else if (weekTotal < 2000000000) { fanli = "40"; nextTotal = "20"; nextFanLi = "45"; } else if (weekTotal < 3000000000) { fanli = "45"; nextTotal = "30"; nextFanLi = "50"; } else { fanli = "50"; } //if (weekTotal < 500000000) //{ // fanli = "20"; // nextTotal = "5"; // nextFanLi = "25"; //} //else if(weekTotal < 1000000000) //{ // fanli = "25"; // nextTotal = "10"; // nextFanLi = "30"; //} //else if (weekTotal < 3000000000) //{ // fanli = "30"; // nextTotal = "30"; // nextFanLi = "40"; //} //else if (weekTotal < 5000000000) //{ // fanli = "40"; // nextTotal = "50"; // nextFanLi = "50"; //} //else //{ // fanli = "50"; //} model.WeekTotal = weekTotal; model.FanLi = fanli; model.NextTotal = nextTotal; model.NextFanLi = nextFanLi; model.WeekTotalStr = weekTotal.ToString("#,0."); return(View(model)); } }
public ActionResult GetClubGives(Dictionary <string, string> queryvalues) { int uid = queryvalues.ContainsKey("clubid") ? (string.IsNullOrEmpty(queryvalues["clubid"]) ? -1 : Convert.ToInt32(queryvalues["clubid"])) : -1; //uid = 10701; IEnumerable <ClubGive> clubGives = ClubBLL.GetClubGive(uid); List <ClubGive> resclubGives; if (clubGives == null) { resclubGives = null; } else { resclubGives = new List <ClubGive>(); foreach (var item in clubGives) { ClubGive give = new ClubGive() { CreateTime = item.CreateTime.Replace("0:00:00", "").Replace("/", "-"), Gold = item.Gold, GoldStr = item.Gold.ToString("#,0.") }; resclubGives.Add(give); } } //查询本周总贡献总额 Int64 weekTotal = ClubBLL.GetClubWeekTotal(uid); string fanli = "20"; string nextTotal = ""; string nextFanLi = ""; if (weekTotal < 500000000) { fanli = "25"; //当前返利 nextTotal = "5"; //下个返利服务费 nextFanLi = "30"; //下个返利比例 } else if (weekTotal < 1000000000) { fanli = "30"; nextTotal = "10"; nextFanLi = "35"; } else if (weekTotal < 1500000000) { fanli = "35"; nextTotal = "15"; nextFanLi = "40"; } else if (weekTotal < 2000000000) { fanli = "40"; nextTotal = "20"; nextFanLi = "45"; } else if (weekTotal < 3000000000) { fanli = "45"; nextTotal = "30"; nextFanLi = "50"; } else { fanli = "50"; } //if (weekTotal < 500000000) //{ // fanli = "20"; // nextTotal = "5"; // nextFanLi = "25"; //} //else if (weekTotal < 1000000000) //{ // fanli = "25"; // nextTotal = "10"; // nextFanLi = "30"; //} //else if (weekTotal < 3000000000) //{ // fanli = "30"; // nextTotal = "30"; // nextFanLi = "40"; //} //else if (weekTotal < 5000000000) //{ // fanli = "40"; // nextTotal = "50"; // nextFanLi = "50"; //} //else //{ // fanli = "50"; //} return(Json(new { data = resclubGives, WeekTotal = weekTotal.ToString("#,0."), FanLi = fanli, NextTotal = nextTotal, NextFanLi = nextFanLi })); }
public ActionResult GetMember(Dictionary <string, string> queryvalues) { int clubid = queryvalues.ContainsKey("clubid") ? Convert.ToInt32(queryvalues["clubid"]) : -1; int type = queryvalues.ContainsKey("type") ? Convert.ToInt32(queryvalues["type"]) : -1; int curTime = queryvalues.ContainsKey("curTime") ? Convert.ToInt32(queryvalues["curTime"]) : 0; int page = queryvalues.ContainsKey("page") ? Convert.ToInt32(queryvalues["page"]) : 1; string preID = queryvalues.ContainsKey("preID") ? Convert.ToString(queryvalues["preID"]) : ""; DateTime time = DateTime.Now.AddDays(curTime * -1); time = new DateTime(time.Year, time.Month, time.Day, 0, 0, 0); //clubid = 10701; type = 2; int mycount = ClubBLL.GetClubUserCount(clubid); int actioncount = 0; if (type == 1) { actioncount = ClubBLL.GetCommonClubCount(clubid); } else { actioncount = ClubBLL.GetHYClubCount(clubid); } //获取数据 IEnumerable <MemberMender> data = ClubBLL.GetMemberMender(clubid, time, page); List <MemberMender> resData = new List <MemberMender>(); foreach (var item in data) { MemberMender mem = new MemberMender(); mem.Gold = item.Gold; mem.GoldStr = item.Gold.ToString("#,0."); mem.NickName = item.NickName; mem.ID = item.ID; if (item.LastLogin <= 0) { mem.BeforeLogin = "******"; } else if (item.LastLogin < 30) { mem.BeforeLogin = item.LastLogin + "天前"; } else if (item.LastLogin < 3 * 30) { mem.BeforeLogin = Convert.ToInt32(item.LastLogin / 30) + "个月前"; } else { mem.BeforeLogin = "******"; } resData.Add(mem); } return(Json(new { mycount = mycount, actioncount = actioncount, data = resData, time = time.ToString("yyyy-MM-dd") })); }