public Dictionary<int, ProgSwitchInfo> GetAllProgSwitchs(ref string errMessage)
        {
            Database db = DatabaseFactory.CreateDatabase();
            errMessage = "";
            var list = new Dictionary<int, ProgSwitchInfo>();
            try
            {
                ProgSwitchInfo progSwitchInfo;
                DataSet ds = ProgSwitchDataAccess.GetAllProgSwitchInfo(db);
                DataSet dsProgSwitchDetail;
                ProgSwitchDetailInfo progSwitchDetailInfo;

                //对于每一个程序切换
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    progSwitchInfo = new ProgSwitchInfo(ds.Tables[0].Rows[i]);

                    dsProgSwitchDetail = ProgSwitchDetailDataAccess.GetProgSwitchDetailByProgSwitchId(db, progSwitchInfo.Id);
                    progSwitchInfo.ListProgSwitchDetailInfo = new Dictionary<int, ProgSwitchDetailInfo>();
                    //对于一个程序切换中的所有与程序切换有联系的记录
                    foreach (DataRow drpsd in dsProgSwitchDetail.Tables[0].Rows)
                    {
                        progSwitchDetailInfo = new ProgSwitchDetailInfo(drpsd);

                        progSwitchInfo.ListProgSwitchDetailInfo.Add(progSwitchDetailInfo.ProgSwitchDetailId, progSwitchDetailInfo);
                    }

                    list.Add(progSwitchInfo.Id, progSwitchInfo);
                }
                return list;

            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                Logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return null;
            }
        }
        public ProgSwitchInfo GetProgSwitchById(ref string errMessage, int progSwitchId)
        {
            Database db = DatabaseFactory.CreateDatabase();
            errMessage = "";
            try
            {
                DataSet ds = ProgSwitchDataAccess.GetProgSwitchById(db, progSwitchId);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    return null;
                }
                var progSwitchInfo = new ProgSwitchInfo(ds.Tables[0].Rows[0]) { ListProgSwitchDetailInfo = new Dictionary<int, ProgSwitchDetailInfo>() };

                var progSwitchDetail = ProgSwitchDetailDataAccess.GetProgSwitchDetailByProgSwitchId(db, progSwitchInfo.Id);
                progSwitchInfo.ListProgSwitchDetailInfo = new Dictionary<int, ProgSwitchDetailInfo>();
                //对于一个程序切换中的所有与程序切换有联系的记录
                foreach (DataRow drpsd in progSwitchDetail.Tables[0].Rows)
                {
                    var progSwitchDetailInfo = new ProgSwitchDetailInfo(drpsd);
                    progSwitchInfo.ListProgSwitchDetailInfo.Add(progSwitchDetailInfo.ProgSwitchDetailId, progSwitchDetailInfo);
                }
                return progSwitchInfo;

            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                Logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return null;
            }
        }