public GetAllLicence ( string status = "", string licence_name = "" ) : IEnumerable |
||
status | string | |
licence_name | string | |
Résultat | IEnumerable |
public ActionResult GetAllListForJsonByCategory(string lang, string status, string term, int categoryType) { var companyResult = new List<Company>(); var companyController = new CompanyController(); switch (categoryType) { case (int)category.company: companyResult = companyController.GetAllCompany(status, term).ToList(); return Json(new { companyResult }, JsonRequestBehavior.AllowGet); case (int)category.licence: var searchResult = new List<Search>(); var licenceResult = new List<Licence>(); var licenceController = new LicenceController(); licenceResult = licenceController.GetAllLicence(status, term).ToList(); if (licenceResult.Count > 0) { foreach (var licence in licenceResult) { var search = new Search(); var company = new Company(); var address = new StringBuilder(); company = companyController.GetCompanyById(licence.company_id, lang); search.original_licence_no = licence.original_licence_no; search.licence_status = licence.licence_status; search.application_id = licence.application_id; search.company_id = licence.company_id; search.licence_name = licence.licence_name; if (company != null && company.company_id > 0) { search.company_name = company.company_name; address.AppendFormat(company.addr_line_1).Append(" "); address.Append(company.addr_line_2).Append(" "); address.Append(company.addr_line_3).AppendLine(); address.Append(company.city).Append(","); address.Append(company.region_cd).Append(","); address.Append(company.country_cd).Append(","); address.Append(company.postal_code); search.company_address = address.ToString(); } searchResult.Add(search); } } return Json(new { searchResult }, JsonRequestBehavior.AllowGet); } return Json(new { companyResult }, JsonRequestBehavior.AllowGet); }
public ActionResult GetAllListForJsonByCategory(string lang, string status, string term, int categoryType) { var companyResult = new List <Company>(); var searchResult = new List <Search>(); var companyController = new CompanyController(); var numberTerm = 0; if (!string.IsNullOrWhiteSpace(term)) { numberTerm = UtilityHelper.GetNumberTerm(term); } switch (categoryType) { case (int)category.company: if (numberTerm > 0) { //companyResult.Add(companyController.GetCompanyById(numberTerm, lang,status)); var company = new Company(); company = companyController.GetCompanyById(numberTerm, status); if (company.company_id != 0) { companyResult.Add(companyController.GetCompanyById(numberTerm, status)); } } else { companyResult = companyController.GetAllCompany(status, term).ToList(); } return(Json(new { companyResult }, JsonRequestBehavior.AllowGet)); case (int)category.licence: var licenceController = new LicenceController(); var licenceResult = new List <Licence>(); //var locationController = new SbdLocationController(); if (numberTerm > 0) { licenceResult.Add(licenceController.GetLicenceById(numberTerm, status)); } else { if (status == "active") { licenceResult = licenceController.GetAllLicence(status, term).ToList(); } } if (licenceResult.Count > 0 && licenceResult[0].original_licence_no != 0) { foreach (var licence in licenceResult) { var search = new Search(); var company = new Company(); var address = new StringBuilder(); company = companyController.GetCompanyById(licence.company_id, status); search.original_licence_no = licence.original_licence_no; search.licence_status = licence.licence_status; //search.application_id = licence.application_id; search.company_id = licence.company_id; search.licence_name = licence.licence_name; if (company != null && company.company_id > 0) { search.company_name = company.company_name; search.company_address = UtilityHelper.BuildAddress(company); } searchResult.Add(search); } } return(Json(new { searchResult }, JsonRequestBehavior.AllowGet)); case (int)category.device: searchResult = new List <Search>(); var deviceResult = new List <Device>(); var deviceController = new DeviceController(); deviceResult = deviceController.GetAllDevice(status, term, 0).ToList(); if (deviceResult.Count > 0) { var controller = new LicenceController(); foreach (var device in deviceResult) { var search = new Search(); var company = new Company(); var licence = new Licence(); search.original_licence_no = device.original_licence_no; search.device_name = device.trade_name; search.device_id = device.device_id; licence = controller.GetLicenceById(device.original_licence_no, status); if (licence != null && licence.original_licence_no > 0) { search.licence_name = licence.licence_name; search.licence_status = licence.licence_status; //search.application_id = licence.application_id; company = companyController.GetCompanyById(licence.company_id, status); if (company != null && company.company_id > 0) { search.company_id = licence.company_id; search.company_name = company.company_name; search.company_address = UtilityHelper.BuildAddress(company); } } searchResult.Add(search); } } return(Json(new { searchResult }, JsonRequestBehavior.AllowGet)); case (int)category.deviceIdentifier: searchResult = new List <Search>(); var identifierResult = new List <DeviceIdentifier>(); var identifierController = new DeviceIdentifierController(); var devController = new DeviceController(); var licController = new LicenceController(); identifierResult = identifierController.GetAllDeviceIdentifier(status, term, 0, 0).ToList(); if (identifierResult.Count > 0) { foreach (var identifier in identifierResult) { var search = new Search(); var company = new Company(); var licence = new Licence(); var device = new Device(); search.original_licence_no = identifier.original_licence_no; search.device_id = identifier.device_id; search.device_identifier = identifier.device_identifier; device = devController.GetDeviceById(identifier.device_id); if (device != null && device.original_licence_no > 0) { search.device_name = device.trade_name; //if (status == "active") //{ licence = licController.GetLicenceById(device.original_licence_no, status); //} //else //{ // licence = licController.GetArchivedLicenceById(device.original_licence_no); //} if (licence != null && licence.original_licence_no > 0) { search.licence_name = licence.licence_name; search.licence_status = licence.licence_status; //search.application_id = licence.application_id; company = companyController.GetCompanyById(licence.company_id, status); if (company != null && company.company_id > 0) { search.company_id = licence.company_id; search.company_name = company.company_name; search.company_address = UtilityHelper.BuildAddress(company); } } } searchResult.Add(search); } } return(Json(new { searchResult }, JsonRequestBehavior.AllowGet)); } return(Json(new { companyResult }, JsonRequestBehavior.AllowGet)); }