示例#1
0
        public List <Budget_VehicleRange> SelectAll()
        {
            List <Budget_VehicleRange> VehicleRangeList = null;

            try
            {
                string sSQL = "SELECT * FROM VehicleRange";

                DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    VehicleRangeList = new List <Budget_VehicleRange>();
                    Budget_VehicleRange vehicleRange = null;
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        vehicleRange = new Budget_VehicleRange();
                        vehicleRange.VehicleRangeOID = new Guid(ds.Tables[0].Rows[i]["VehicleRangeOID"].ToString());
                        vehicleRange.Enable          = Convert.ToBoolean(ds.Tables[0].Rows[i]["Enable"].ToString());
                        vehicleRange.FileName        = ds.Tables[0].Rows[i]["FileName"].ToString();
                        vehicleRange.VehicleRangeURL = ds.Tables[0].Rows[i]["VehicleRangeURL"].ToString();
                        VehicleRangeList.Add(vehicleRange);
                    }
                }
            }
            catch (Exception ex) { }
            return(VehicleRangeList);
        }
示例#2
0
        public Budget_VehicleRange SelectByOID(Guid guidVehicleRangeOID)
        {
            Budget_VehicleRange vehicleRange = null;

            try
            {
                string         sSQL     = "SELECT * FROM VehicleRange WHERE VehicleRangeOID=@VehicleRangeOID";
                SqlParameter[] sqlParam = new SqlParameter[1];
                sqlParam[0]       = new SqlParameter("@VehicleRangeOID", SqlDbType.UniqueIdentifier);
                sqlParam[0].Value = guidVehicleRangeOID;
                DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, sSQL, sqlParam);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    vehicleRange = new Budget_VehicleRange();
                    vehicleRange.VehicleRangeOID = new Guid(ds.Tables[0].Rows[0]["VehicleRangeOID"].ToString());
                    vehicleRange.Enable          = Convert.ToBoolean(ds.Tables[0].Rows[0]["Enable"].ToString());
                    vehicleRange.FileName        = ds.Tables[0].Rows[0]["FileName"].ToString();
                    vehicleRange.VehicleRangeURL = ds.Tables[0].Rows[0]["VehicleRangeURL"].ToString();
                }
            }
            catch (Exception ex) { }
            return(vehicleRange);
        }