public string AddSoftware(Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest software) { try { MLIADService.SetNoCache(); return(repository.AddSoftware(software)); } catch (Exception ex) { throw ex; } }
public string EditSoftware(Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest software) { try { MLIADService.SetNoCache(); string retval = "failure"; if (software.oper == "edit") { retval = repository.EditSoftware(software); } else if (software.oper == "delete") { retval = repository.DeleteSoftware(software.id); } return(retval); } catch (Exception ex) { throw ex; } }
public List<Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest> SearchSoftware(Associate.SoftwareRequest software, int pageIndex, int pageSize, ref int? count) { using (AssociateConnDataContext asscon = new AssociateConnDataContext()) { try { Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest retval = new Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest(); var softwares = (from s in asscon.SearchSoftware(software.SoftResourceID, software.SoftCategoryID, software.ProjectID, ref count) select new Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest() { SoftRequestID = s.SoftRequestID, SoftCategory = s.SoftCategory, SoftResource = s.SoftResource, SoftVersion = s.SoftVersion, ProjectName = s.ProjectName }).ToList<Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest>(); pageSize = (pageSize < 1 ? 10 : pageSize); pageIndex = (pageIndex < 0 ? 0 : pageIndex); count = softwares.Count; if (count < pageSize) { pageIndex = 0; return softwares; } else if (softwares.Count < pageSize * pageIndex) { pageIndex = 0; return new List<BusinessLogic.Associate.SoftwareRequest>(softwares.Take(pageSize)); } else { int a = Convert.ToInt32(((count - pageSize * pageIndex) >= pageSize) ? pageSize : (count - pageSize * pageIndex)); return new List<BusinessLogic.Associate.SoftwareRequest>(softwares.Skip(pageSize * pageIndex).Take(a)); } } catch (Exception ex) { throw ex; } } }
public Pager <Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest> SearchSoftware(Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest software, string page, string row, string totalcount) { try { int?count = 0; int pageIndex = Convert.ToInt32(page); int pageSize = Convert.ToInt32(row); Pager <Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest> pager = new Pager <Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest>(); MLIADService.SetNoCache(); List <Cog.MLIAD.BusinessLogic.Associate.SoftwareRequest> softwares = repository.SearchSoftware(software, (pageIndex - 1), pageSize, ref count); pager.Items = softwares; pager.Page = pageIndex; pager.ItemCount = (count == null) ? 0 : Convert.ToInt32(count); pager.PageTotal = ((pager.ItemCount + pageSize - 1) / pageSize); pager.PageSize = pageSize; return(pager); } catch (Exception ex) { throw ex; } }