public List <B_DownPositionEntity> GetB_DownPositionList(ProjectSourceTypeOptions projectSourceType, int downtype, int istag, int restype, int project, string position, string name, string pagename, string pagetype, int beginsize, int pagesize, int softid2, out int count) { count = 0; string datasql = string.Format(@" select SoftId,ProjectSource,ProjectSourceType,ResType,Position,Name,PageName,PageType,ByTag bytag4mysql,DownType from Cfg_DownPositions where projectsource=?projectsource and ProjectSourceType=?projectsourcetype and softid=?softid and restype=?restype and bytag=?bytag {0} {1} {2} {3} {4} ", position == "" ? "" : " and position like '%" + position + "%'", name == "" ? "" : " and name like '%" + name + "%'", pagename == "" ? "" : " and pagename like '%" + pagename + "%'", downtype == -1 ? "" : " and downtype=?downtype ", pagetype == "不区分页面类型" ? "" : " and pagetype=?pagetype" ); string resultsql1 = string.Format(@"select SoftId,ProjectSource,ProjectSourceType,ResType,Position,Name,PageName,PageType,bytag4mysql,DownType from({0}) as result order by position limit {1},{2};", datasql, beginsize, pagesize); string resultsql2 = string.Format(@"select count(1) from({0}) as result", datasql); string lastsql = resultsql1 + " " + resultsql2; var param = new [] { new MySqlParameter("?softid", softid2), new MySqlParameter("?projectsource", project), new MySqlParameter("?projectsourcetype", (int)projectSourceType), new MySqlParameter("?restype", restype), new MySqlParameter("?downtype", downtype), new MySqlParameter("?bytag", istag), new MySqlParameter("?pagetype", pagetype) }; var list = new List <B_DownPositionEntity>(); using (IDataReader read = MySqlHelper.ExecuteReader(mysql_statdb_connstring, lastsql, param)) { while (read.Read()) { list.Add(new B_DownPositionEntity(read)); } if (read.NextResult()) { if (read.Read()) { count = Convert.ToInt32(read[0]); } } } return(list); }
public List <B_DownPositionEntity> GetB_DownPositionListByCache(ProjectSourceTypeOptions projectSourceType, int downtype, int istag, int restype, int project, string position, string name, string pagename, string pagetype, int beginsize, int pagesize, int softid2, out int count) { //return net91com.Core.Web.CacheHelper.Get<List<B_ResCateEntity>> // (BuildCacheKey("GetResCateCache", type), Core.CacheTimeOption.TenMinutes, // () => new B_ResCate_DataAccess().GetResCate(type)); //string key = BuildCacheKey("GetB_DownPositionListByCache", projectSourceType, restype, project, position, // name, pagename, beginsize, pagesize); return(new B_DownPosition_DataAccess().GetB_DownPositionList(projectSourceType, downtype, istag, restype, project, position, name, pagename, pagetype, beginsize, pagesize, softid2, out count)); }
/// <summary> /// 根据项目来源,项目来源类型,资源类型 /// </summary> /// <param name="projectSourceType"></param> /// <param name="restype"></param> /// <param name="project"></param> /// <returns></returns> public List <B_DownPositionEntity> GetB_DownPositionListByCache(ProjectSourceTypeOptions projectSourceType, int restype, int project, int softid = -1) { string datasql = string.Format(@" select ProjectSource, ProjectSourceType, ResType, Position, `Name`, PageName, PageType, ByTag bytag4mysql, DownType, AddTime, SoftID, TagID from Cfg_DownPositions where projectsourcetype=?projectsourcetype {0} {1} {2}", restype == -1?"":" and restype=?restype" , softid == -1 ? "" : " and softid=?softid" , project == -1 ? "" : " and projectsource=?projectsource"); MySqlParameter[] param = new MySqlParameter[] { new MySqlParameter("?softid", softid), new MySqlParameter("?projectsource", project), new MySqlParameter("?restype", restype), new MySqlParameter("?projectsourcetype", (int)projectSourceType), }; var us = new List <B_DownPositionEntity>(); using (IDataReader read = MySqlHelper.ExecuteReader(mysql_statdb_connstring, datasql, param)) { while (read.Read()) { us.Add(new B_DownPositionEntity(read)); } } return(us); }
/// <summary> /// 获取具体位置 /// </summary> /// <param name="projectsourcetype"></param> /// <param name="restype"></param> /// <param name="project"></param> /// <param name="position"></param> /// <returns></returns> public B_DownPositionEntity GetB_DownPosition(ProjectSourceTypeOptions projectsourcetype, int restype, int project, string position) { string datasql = string.Format(@" select ProjectSource, ProjectSourceType, ResType, Position, `Name`, PageName, PageType, ByTag bytag4mysql, DownType, AddTime, SoftID, TagID from Cfg_DownPositions where projectsource=?projectsource and projectsourcetype=?projectsourcetype and restype=?restype and position=?position "); MySqlParameter[] param = new MySqlParameter[] { new MySqlParameter("?projectsource", project), new MySqlParameter("?restype", restype), new MySqlParameter("?projectsourcetype", (int)projectsourcetype), new MySqlParameter("?position", position) }; B_DownPositionEntity us = null; using (IDataReader read = MySqlHelper.ExecuteReader(mysql_statdb_connstring, datasql, param)) { if (read.Read()) { us = new B_DownPositionEntity(read); } } return(us); }
public B_DownPositionEntity GetB_DownPosition(ProjectSourceTypeOptions projectsourcetype, int restype, int projectsource, string positionid) { return(new B_DownPosition_DataAccess().GetB_DownPosition(projectsourcetype, restype, projectsource, positionid)); }
public List <B_DownPositionEntity> GetB_DownPositionListByCache(ProjectSourceTypeOptions projectSourceType, int restype, int project, int softid = -1) { return(new B_DownPosition_DataAccess().GetB_DownPositionListByCache(projectSourceType, restype, project, softid)); }
/// <summary> /// 获取不区分项目来源的html /// </summary> /// <param name="shownoproject">是否展示不区分来源</param> /// <param name="outdichtml">对应json字典输出</param> /// <returns></returns> protected string GetProjectSourceHtml(bool shownoproject, ref string outdichtml, ProjectSourceTypeOptions type = ProjectSourceTypeOptions.Domestic) { StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); var projectSources = AvailableProjectSources.Where(a => a.ProjectSourceType == type || a.ProjectSourceType == ProjectSourceTypeOptions.None).ToList(); List <int> lst = UtilityHelp.GetDefaultProjectSources(this.Context, projectSources); var projectid = lst.Count <= 0 ? -1 : lst[0]; bool isContainedInCookie = projectSources.Select(p => p.ProjectSourceID).Contains(projectid); for (int i = 0; i < projectSources.Count(); i++) { if (!shownoproject && projectSources[i].ProjectSourceID == 0) { continue; } if (isContainedInCookie) { sb.AppendFormat("<option value='{0}' {2}>{1}</option>", projectSources[i].ProjectSourceID, projectSources[i].Name, projectid == projectSources[i].ProjectSourceID ? "selected=\"selected\"" : ""); } else { sb.AppendFormat("<option value='{0}' {2}>{1}</option>", projectSources[i].ProjectSourceID, projectSources[i].Name, i == 0 ? "selected=\"selected\"" : ""); } sb2.AppendFormat("\"{0}\":\"{1}\",", projectSources[i].ProjectSourceID, projectSources[i].Name); } outdichtml = "{" + sb2.ToString().TrimEnd(',') + "}"; return(sb.ToString()); }