Exemple #1
0
        /// <summary>
        /// 得到一个实体对象
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public static Model.RTKUserPurview GetModel(string UserName)
        {
            string strSql = "select * from RTKUserPurview where UserName = '******'";

            Model.RTKUserPurview model = new Model.RTKUserPurview();
            DataSet ds = DBHelperSQL.GetDataSet(strSql, connectionString);

            model.UserName = UserName;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.ID                   = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"]);
                model.VRSEnable            = Convert.ToInt32(ds.Tables[0].Rows[0]["VRSEnable"]);
                model.StartTime            = Convert.ToDateTime(ds.Tables[0].Rows[0]["StartTime"]);
                model.EndTime              = Convert.ToDateTime(ds.Tables[0].Rows[0]["EndTime"]);
                model.ServerType           = Convert.ToString(ds.Tables[0].Rows[0]["ServerType"]);
                model.SourceTable          = Convert.ToString(ds.Tables[0].Rows[0]["SourceTable"]);
                model.AreaID               = Convert.ToString(ds.Tables[0].Rows[0]["AreaID"]);
                model.CoorSystem           = Convert.ToString(ds.Tables[0].Rows[0]["CoorSystem"]);
                model.ElevationEnable      = Convert.ToInt32(ds.Tables[0].Rows[0]["ElevationEnable"]);
                model.ElevationMode        = Convert.ToString(ds.Tables[0].Rows[0]["ElevationMode"]);
                model.RoamingServiceEnable = Convert.ToInt32(ds.Tables[0].Rows[0]["RoamingServiceEnable"]);
                model.RoamingServiceArea   = Convert.ToString(ds.Tables[0].Rows[0]["RoamingServiceArea"]);
                model.RoamID               = Convert.ToString(ds.Tables[0].Rows[0]["RoamID"]);
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        public static bool Update1(Model.RTKUserPurview model)
        {
            string strSql = "update RTKUserPurview set  EndTime=@EndTime  where  UserName= '******'";

            SqlParameter EndTime = new SqlParameter("EndTime", SqlDbType.DateTime); EndTime.Value = model.EndTime;

            return(DBHelperSQL.GetNums(strSql, new SqlParameter[] { EndTime }, connectionString) == 1 ? true : false);
        }
Exemple #3
0
        /// <summary>
        /// 更新一条数据,根据ID
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool Update(Model.RTKUserPurview model)
        {
            string       strSql               = "update RTKUserPurview set UserName=@UserName, VRSEnable=@VRSEnable, StartTime=@StartTime, EndTime=@EndTime, ServerType=@ServerType, SourceTable=@SourceTable, AreaID=@AreaID, CoorSystem=@CoorSystem, ElevationEnable=@ElevationEnable, ElevationMode=@ElevationMode, RoamingServiceEnable=@RoamingServiceEnable, RoamingServiceArea=@RoamingServiceArea,RoamID=@RoamID where ID = " + model.ID.ToString();
            SqlParameter UserName             = new SqlParameter("UserName", SqlDbType.NVarChar); UserName.Value = model.UserName;
            SqlParameter VRSEnable            = new SqlParameter("VRSEnable", SqlDbType.Int); VRSEnable.Value = model.VRSEnable;
            SqlParameter StartTime            = new SqlParameter("StartTime", SqlDbType.DateTime); StartTime.Value = model.StartTime;
            SqlParameter EndTime              = new SqlParameter("EndTime", SqlDbType.DateTime); EndTime.Value = model.EndTime;
            SqlParameter ServerType           = new SqlParameter("ServerType", SqlDbType.NVarChar); ServerType.Value = model.ServerType;
            SqlParameter SourceTable          = new SqlParameter("SourceTable", SqlDbType.NVarChar); SourceTable.Value = model.SourceTable;
            SqlParameter AreaID               = new SqlParameter("AreaID", SqlDbType.NVarChar); AreaID.Value = model.AreaID;
            SqlParameter CoorSystem           = new SqlParameter("CoorSystem", SqlDbType.NVarChar); CoorSystem.Value = model.CoorSystem;
            SqlParameter ElevationEnable      = new SqlParameter("ElevationEnable", SqlDbType.Int); ElevationEnable.Value = model.ElevationEnable;
            SqlParameter ElevationMode        = new SqlParameter("ElevationMode", SqlDbType.NVarChar); ElevationMode.Value = model.ElevationMode;
            SqlParameter RoamingServiceEnable = new SqlParameter("RoamingServiceEnable", SqlDbType.Int); RoamingServiceEnable.Value = model.RoamingServiceEnable;
            SqlParameter RoamingServiceArea   = new SqlParameter("RoamingServiceArea", SqlDbType.NVarChar); RoamingServiceArea.Value = model.RoamingServiceArea;
            SqlParameter RoamID               = new SqlParameter("RoamID", SqlDbType.NVarChar); RoamID.Value = model.RoamID;

            return(DBHelperSQL.GetNums(strSql, new SqlParameter[] { UserName, VRSEnable, StartTime, EndTime, ServerType, SourceTable, AreaID, CoorSystem, ElevationEnable, ElevationMode, RoamingServiceEnable, RoamingServiceArea, RoamID }, connectionString) == 1 ? true : false);
        }