public static object GetCSAByCtpyID(SessionInfo sessioninfo, Guid ID) { try { CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database List <CSAAgreementModel> results = new List <CSAAgreementModel>(); var csa = _counterpartyBusiness.GetCSAByCtpyID(sessioninfo, ID); var products = _lookupBusiness.GetProductAll(); if (csa != null) { var csaproduct = from c in csa.MA_CSA_PRODUCT join product in products on c.PRODUCT_ID equals product.ID select new { LABEL = product.LABEL }; CSAAgreementModel ca = new CSAAgreementModel(); ca.CSA_TYPE_ID = csa.CSA_TYPE_ID; ca.ID = csa.ID; ca.ISACTIVE = csa.ISACTIVE; ca.PRODUCTS = String.Join(",", csaproduct.Select(p => p.LABEL)); results.Add(ca); } //Return result to jTable return(new { Result = "OK", Records = results, TotalRecordCount = results.Count }); } catch (BusinessWorkflowsException bex) { return(new { Result = "ERROR", Message = bex.Message }); } catch (Exception ex) { return(new { Result = "ERROR", Message = ex.Message }); } }
public static object GetCSAByCtpyID(SessionInfo sessioninfo, Guid ID) { try { CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness(); LookupBusiness _lookupBusiness = new LookupBusiness(); //Get data from database List<CSAAgreementModel> results = new List<CSAAgreementModel>(); var csa = _counterpartyBusiness.GetCSAByCtpyID(sessioninfo, ID); var products = _lookupBusiness.GetProductAll(); if (csa != null) { var csaproduct = from c in csa.MA_CSA_PRODUCT join product in products on c.PRODUCT_ID equals product.ID select new { LABEL = product.LABEL }; CSAAgreementModel ca = new CSAAgreementModel(); ca.CSA_TYPE_ID = csa.CSA_TYPE_ID; ca.ID = csa.ID; ca.ISACTIVE = csa.ISACTIVE; ca.PRODUCTS = String.Join(",", csaproduct.Select(p => p.LABEL)); results.Add(ca); } //Return result to jTable return new { Result = "OK", Records = results, TotalRecordCount = results.Count }; } catch (BusinessWorkflowsException bex) { return new { Result = "ERROR", Message = bex.Message }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }