public static PagedList <StrongPushADRecord> GetStrongPushADRecord(LoginRegisterDataView model) { PagerQuery pq = new PagerQuery(); pq.CurrentPage = model.Page; pq.PageSize = 10; pq.RecordCount = DAL.PagedListDAL <FreezeLog> .GetRecordCount(string.Format(@" select count(0) from " + database3 + @".strongpushadrecord where Plat ={0} and Agent={1} ", model.Platform, model.Channels ), sqlconnectionString); pq.Sql = string.Format(@" select * from " + database3 + @".strongpushadrecord where Plat ={2} and Agent={3} ORDER BY CreateTime DESC limit {0}, {1} ", pq.StartRowNumber, pq.PageSize, model.Platform, model.Channels); PagedList <StrongPushADRecord> obj = new PagedList <StrongPushADRecord>(DAL.PagedListDAL <StrongPushADRecord> .GetListByPage(pq, sqlconnectionString), pq.CurrentPage, pq.PageSize, pq.RecordCount); return(obj); }
public static int UpdateStrongPushAD(LoginRegisterDataView model) { StrongPushAD ad = GetStrongPushAD(model); if (ad == null) { return(StrongPushADDAL.AddStrongPushAD(model)); } else { return(StrongPushADDAL.UpdateStrongPushAD(model)); } }
public static int AddStrongPushAD(LoginRegisterDataView model) { using (var cn = new MySqlConnection(sqlconnectionString)) { cn.Open(); int i = cn.Execute(@"insert into " + database3 + @".strongpushad(Plat,Agent,Url,Type,CreateTime) values (@Plat,@Agent,@Url,@Type,'" + DateTime.Now + @"')", new { Plat = model.Platform, Agent = model.Channels, Url = model.Url, Type = model.Type }); cn.Close(); return(i); } }
public static int UpdateStrongPushAD(LoginRegisterDataView model) { using (var cn = new MySqlConnection(sqlconnectionString)) { cn.Open(); int i = cn.Execute(@"Update " + database3 + @".strongpushad set Url = @Url,Type=@Type where Plat = @Plat and Agent = @Agent ", new { Url = model.Url, Plat = model.Platform, Agent = model.Channels, Type = model.Type }); cn.Close(); return(i); } }
public static StrongPushAD GetStrongPushAD(LoginRegisterDataView model) { using (var cn = new MySqlConnection(sqlconnectionString)) { StringBuilder str = new StringBuilder(); str.AppendFormat(@" select * from " + database3 + @".strongpushad where Plat = @Plat and Agent = @Agent ORDER BY CreateTime DESC; "); IEnumerable <StrongPushAD> i = cn.Query <StrongPushAD>(str.ToString(), new { Plat = model.Platform, Agent = model.Channels }); cn.Close(); return(i.FirstOrDefault()); } }
public static int AddStrongPushAD(LoginRegisterDataView model) { return(StrongPushADDAL.AddStrongPushAD(model)); }
public static StrongPushAD GetStrongPushAD(LoginRegisterDataView model) { return(StrongPushADDAL.GetStrongPushAD(model)); }
public ActionResult GetStrongPushAD(Dictionary <string, string> queryvalues) { int Platform = queryvalues.ContainsKey("Platform") ? Convert.ToInt32(queryvalues["Platform"]) : 1; //设备 int Channels = queryvalues.ContainsKey("Channels") ? Convert.ToInt32(queryvalues["Channels"]) : 0; //设备 LoginRegisterDataView model = new LoginRegisterDataView(); model.Channels = Channels; model.Platform = Platform; bool Mark = false; Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_QUERY_SERVERSTATUS, new byte[0] { })); switch ((CenterCmd)tbind.header.CommandID) { case CenterCmd.CS_QUERY_SERVERSTATUS: { Service_Query_ServerStatus_S ServiceQueryServerStatusS = Service_Query_ServerStatus_S.ParseFrom(tbind.body.ToBytes()); if (ServiceQueryServerStatusS.Close == true) { Mark = true; } } break; case CenterCmd.CS_CONNECT_ERROR: Mark = true; break; } if (Mark == true) { StrongPushAD enti = StrongPushADBLL.GetStrongPushAD(model); if (enti == null) { model.Url = ""; model.Type = -1; return(Json(new { ret = 0, Url = "", Type = -1, }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { ret = 1, Url = enti.Url, Type = enti.Type, }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { ret = 0, Url = "", Type = -1, }, JsonRequestBehavior.AllowGet)); } }