贤人必须成人,成人才能达己.

共同进步

  :: :: 博问 :: 闪存 :: 新随笔 :: :: :: 管理 ::

  public IList<PlatInfo > GetPlatCount()
        {
            IList<PlatInfo> PlatCount = new List<PlatInfo>();


            string sql = string.Format("select PlatformId ,S_PassIdNum ,E_PassIdNum from PlatformAssign ");
            DataTable tempTable = this.shell.SqlHelper.ExecuteDataTable(this.shell.SqlHelper.ConnectionStrings[2], CommandType.Text, sql, "PlatformAssign", null);

            foreach (DataRow dr in tempTable.Rows)
            {
                PlatInfo pi = new PlatInfo();
                pi.PlatformId = int.Parse  (dr["PlatformId"].ToString ());
                pi.S_PassIdNum = (dr["S_PassIdNum"].ToString ());
                pi.E_PassIdNum =  (dr["E_PassIdNum"].ToString ());
                PlatCount.Add(pi);
            }

            return PlatCount;
        }
        public int  UpdateInfo(int PlatformId, int S_PassIdNum, int E_PassIdNum)
        {
            string sql = string.Format("update  PlatformAssign set S_PassIdNum={1} ,E_PassIdNum={2} where PlatformId={0}", PlatformId, S_PassIdNum, E_PassIdNum);
            return  this.shell.SqlHelper.ExecuteNonQuery (this.shell .SqlHelper .ConnectionStrings [2],CommandType.Text ,sql ,null );
        }
        public IList<PlatInfo> GetRouteCount()
        {
            IList<PlatInfo> PlatCount = new List<PlatInfo>();


            string sql = string.Format("select RouteId,RouteName from Route ");
            DataTable tempTable = this.shell.SqlHelper.ExecuteDataTable(this.shell.SqlHelper.ConnectionStrings[1], CommandType.Text, sql, "Route", null);

            foreach (DataRow dr in tempTable.Rows)
            {
                PlatInfo pi = new PlatInfo();
                pi.RouteID = int.Parse(dr["RouteId"].ToString());
                pi.RouteName = (dr["RouteName"].ToString());
              
                PlatCount.Add(pi);
            }

            return PlatCount;
        }
        public IList<PlatBingRoute > SelectPlatCount(int platid)
        {
            IList<PlatBingRoute> PlatCount = new List<PlatBingRoute>();


            string sql = string.Format("select AutoID,PlatID, RouteID from  PlatBindRoute where PlatID='{0}' ", platid);
            DataTable tempTable = this.shell.SqlHelper.ExecuteDataTable(this.shell.SqlHelper.ConnectionStrings[2], CommandType.Text, sql, "PlatBindRoute", null);

            foreach (DataRow dr in tempTable.Rows)
            {
                PlatBingRoute  pi = new PlatBingRoute();
                pi.AutoID = int.Parse(dr["AutoID"].ToString());
                pi.PlatID = int.Parse(dr["PlatID"].ToString());
                pi.RouteID  = (dr["RouteID"].ToString());

                PlatCount.Add(pi);
            }

            return PlatCount;
        }


        public int insertBingInfo(int PlatformId,string RouteID)
        {
            string sql = string.Format("insert into PlatBindRoute (PlatID, RouteID) values('{0}','{1}') ", PlatformId, RouteID);
            return this.shell.SqlHelper.ExecuteNonQuery(this.shell.SqlHelper.ConnectionStrings[2], CommandType.Text, sql, null);
        }
        public int delRecord(int AutoID)
        {
            string sql = string.Format("delete  PlatBindRoute where AutoID='{0}'",AutoID );
            return this.shell.SqlHelper.ExecuteNonQuery(this.shell.SqlHelper.ConnectionStrings[2], CommandType.Text, sql, null);
        }
        public int ExistRecord(int platID,string routeID)
        {
            string sql = string.Format("select count(*) from PlatBindRoute where PlatID='{0}'and RouteID='{1}'",platID ,routeID );
            return int.Parse (this.shell.SqlHelper.ExecuteScalar(this.shell .SqlHelper .ConnectionStrings [2], CommandType.Text ,sql ,null ).ToString ());
        }

posted on 2008-01-27 17:56  adi  阅读(194)  评论(0编辑  收藏  举报