Example #1
0
        public static SwitcherDS GetSwitcher(int switcherID)
        {
            //Get a new or existing switcher
            SwitcherDS switcher = new SwitcherDS();

            try {
                if (switcherID == 0)
                {
                    //New
                    SwitcherDS.SwitcherDetailTableRow row = switcher.SwitcherDetailTable.NewSwitcherDetailTableRow();
                    row.SwitcherID  = switcherID;
                    row.LastName    = "";
                    row.FirstName   = "";
                    row.Phone       = "";
                    row.TerminalID  = 0;
                    row.IsActive    = true;
                    row.LastUpdated = DateTime.Now;
                    row.UserID      = System.Environment.UserName;
                    row.RowVersion  = "";
                    switcher.SwitcherDetailTable.AddSwitcherDetailTableRow(row);
                }
                else
                {
                    //Existing
                    DataSet ds = Mediator.FillDataset("", "SwitcherDetailTable", new object[] { switcherID });
                    if (ds != null)
                    {
                        switcher.Merge(ds);
                    }
                }
            }
            catch (Exception ex) { throw ex; }
            return(switcher);
        }
Example #2
0
        public static SwitcherDS ViewSwitchers(int terminalID)
        {
            //Get a list of switchers
            SwitcherDS switchers = new SwitcherDS();

            try {
                DataSet ds = Mediator.FillDataset("", "SwitcherViewTable", new object[] { terminalID });
                if (ds != null)
                {
                    switchers.Merge(ds.Tables["SwitcherViewTable"].Select("TerminalID=" + terminalID, "LastName", DataViewRowState.CurrentRows));
                }
            }
            catch (Exception ex) { throw ex; }
            return(switchers);
        }