public static object GetOptionsByProduct(SessionInfo sessioninfo, ProductCode productcode) { try { InstrumentBusiness _instrumentBusiness = new InstrumentBusiness(); //Get data from database var ins = _instrumentBusiness.GetByProduct(sessioninfo, productcode) .OrderBy(p => p.LABEL) .Select(c => new { DisplayText = c.LABEL, Value = c.ID }); //Return result to jTable return new { Result = "OK", Options = ins }; } catch (BusinessWorkflowsException bex) { return new { Result = "ERROR", Message = bex.Message }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public static object GetInstrumentByName(SessionInfo sessioninfo, ProductCode productcode,string name) { try { InstrumentBusiness _instrumentBusiness = new InstrumentBusiness(); //Get data from database var ins = _instrumentBusiness.GetByProduct(sessioninfo, productcode).Where(c => c.ISACTIVE == true && c.LABEL.StartsWith(name)).OrderBy(c => c.LABEL); //Return result to jTable return new { Result = "OK", Records = ins }; } catch (BusinessWorkflowsException bex) { return new { Result = "ERROR", Message = bex.Message }; } catch (Exception ex) { return new { Result = "ERROR", Message = ex.Message }; } }
public void GetByProductTest1() { InstrumentBusiness target = new InstrumentBusiness(); // TODO: Initialize to an appropriate value SessionInfo sessioninfo = null; // TODO: Initialize to an appropriate value Guid productID = new Guid(); // TODO: Initialize to an appropriate value List<MA_INSTRUMENT> expected = null; // TODO: Initialize to an appropriate value List<MA_INSTRUMENT> actual; actual = target.GetByProduct(sessioninfo, productID); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }