public static YardSectionDS GetYardSection(int yardID, int yardSectionID) { //Get a new or existing yard section YardSectionDS yardSection = new YardSectionDS(); try { if (yardSectionID == 0) { //New YardSectionDS.YardSectionDetailTableRow row = yardSection.YardSectionDetailTable.NewYardSectionDetailTableRow(); row.SectionID = 0; row.SectionNumber = ""; row.Description = ""; row.YardID = yardID; row.IsActive = true; row.LastUpdated = DateTime.Now; row.UserID = System.Environment.UserName; row.RowVersion = ""; yardSection.YardSectionDetailTable.AddYardSectionDetailTableRow(row); } else { //Existing DataSet ds = Mediator.FillDataset("", "YardSectionDetailTable", new object[] { yardID, yardSectionID }); if (ds != null) { yardSection.Merge(ds); } } } catch (Exception ex) { throw ex; } return(yardSection); }
public static YardSectionDS ViewYardSections(int yardID) { //Get a list of yard sections YardSectionDS sections = new YardSectionDS(); try { DataSet ds = Mediator.FillDataset("", "YardSectionListTable", new object[] { yardID }); if (ds != null) { sections.Merge(ds.Tables["YardSectionListTable"].Select("", "SectionNumber", DataViewRowState.CurrentRows)); } } catch (Exception ex) { throw ex; } return(sections); }