Exemple #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(Model.Tasks model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@TaskId",   SqlDbType.BigInt,      8),
                new SqlParameter("@Status",   SqlDbType.TinyInt,     1),
                new SqlParameter("@SendTime", SqlDbType.DateTime),
                new SqlParameter("@CmdType",  SqlDbType.SmallInt,    2),
                new SqlParameter("@CmdByte",  SqlDbType.Int,         4),
                new SqlParameter("@DevId",    SqlDbType.Int,         4),
                new SqlParameter("@Data",     SqlDbType.Binary,    512),
                new SqlParameter("@Length",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.TaskId;
            parameters[1].Value = model.Status;
            parameters[2].Value = model.SendTime;
            parameters[3].Value = model.CmdType;
            parameters[4].Value = model.CmdByte;
            parameters[5].Value = model.DevId;
            parameters[6].Value = model.Data;
            parameters[7].Value = model.Length;

            DbHelperSql.RunProcedure("T_Tasks_Update", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(Model.Modules model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id",          SqlDbType.Int,        4),
                new SqlParameter("@TypeId",      SqlDbType.Int,        4),
                new SqlParameter("@Name",        SqlDbType.NVarChar,  30),
                new SqlParameter("@Tag",         SqlDbType.NVarChar,  50),
                new SqlParameter("@Description", SqlDbType.NVarChar,  50),
                new SqlParameter("@URL",         SqlDbType.NVarChar, 500),
                new SqlParameter("@Disabled",    SqlDbType.Bit,        1),
                new SqlParameter("@Orders",      SqlDbType.Int,        4),
                new SqlParameter("@IsMenu",      SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.TypeId;
            parameters[2].Value = model.Name;
            parameters[3].Value = model.Tag;
            parameters[4].Value = model.Description;
            parameters[5].Value = model.Url;
            parameters[6].Value = model.Disabled;
            parameters[7].Value = model.Orders;
            parameters[8].Value = model.IsMenu;

            DbHelperSql.RunProcedure("T_Modules_Update", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public long Add(Model.Tasks model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@TaskId",   SqlDbType.BigInt,      8),
                new SqlParameter("@Status",   SqlDbType.TinyInt,     1),
                new SqlParameter("@SendTime", SqlDbType.DateTime),
                new SqlParameter("@CmdType",  SqlDbType.Int,         4),
                new SqlParameter("@CmdByte",  SqlDbType.Int,         4),
                new SqlParameter("@DevId",    SqlDbType.Int,         4),
                new SqlParameter("@Data",     SqlDbType.Binary,    512),
                new SqlParameter("@Length",   SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.Status;
            parameters[2].Value     = model.SendTime;
            parameters[3].Value     = model.CmdType;
            parameters[4].Value     = model.CmdByte;
            parameters[5].Value     = model.DevId;
            parameters[6].Value     = model.Data;
            parameters[7].Value     = model.Length;

            DbHelperSql.RunProcedure("T_Tasks_ADD", parameters, out rowsAffected);
            return((long)parameters[0].Value);
        }
Exemple #4
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(Model.Devs model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id",         SqlDbType.Int,        4),
                new SqlParameter("@DevCode",    SqlDbType.VarChar,   20),
                new SqlParameter("@StatId",     SqlDbType.VarChar,   20),
                new SqlParameter("@StartTime",  SqlDbType.DateTime),
                new SqlParameter("@PreEndTime", SqlDbType.DateTime),
                new SqlParameter("@EndTime",    SqlDbType.DateTime),
                new SqlParameter("@DevStatus",  SqlDbType.TinyInt,    1),
                new SqlParameter("@VideoURL",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.DevCode;
            parameters[2].Value = model.StatId;
            parameters[3].Value = model.StartTime;
            parameters[4].Value = model.PreEndTime;
            parameters[5].Value = model.EndTime;
            parameters[6].Value = model.DevStatus;
            parameters[7].Value = model.VideoUrl;

            DbHelperSql.RunProcedure("T_Devs_Update", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #5
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(Model.Files model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id",       SqlDbType.Int,        4),
                new SqlParameter("@StatCode", SqlDbType.VarChar,   20),
                new SqlParameter("@CapTime",  SqlDbType.DateTime),
                new SqlParameter("@Type",     SqlDbType.TinyInt,    1),
                new SqlParameter("@FileName", SqlDbType.VarChar,   50),
                new SqlParameter("@Path",     SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.StatCode;
            parameters[2].Value = model.CapTime;
            parameters[3].Value = model.Type;
            parameters[4].Value = model.FileName;
            parameters[5].Value = model.Path;

            DbHelperSql.RunProcedure("T_Files_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public long Add(Model.EsHour model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id",           SqlDbType.Int,        8),
                new SqlParameter("@StatId",       SqlDbType.Int,        4),
                new SqlParameter("@TP",           SqlDbType.Float,      8),
                new SqlParameter("@DB",           SqlDbType.Float,      8),
                new SqlParameter("@UpdateTime",   SqlDbType.DateTime),
                new SqlParameter("@DataStatus",   SqlDbType.Char,       1),
                new SqlParameter("@ValidDataNum", SqlDbType.Int,        4),
                new SqlParameter("@DevId",        SqlDbType.Int,        4),
                new SqlParameter("@Country",      SqlDbType.VarChar,   20),
                new SqlParameter("@Pm25",         SqlDbType.Float,      8),
                new SqlParameter("@Pm100",        SqlDbType.Float, 8)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.StatId;
            parameters[2].Value     = model.Tp;
            parameters[3].Value     = model.Db;
            parameters[4].Value     = model.UpdateTime;
            parameters[5].Value     = model.DataStatus;
            parameters[6].Value     = model.ValidDataNum;
            parameters[7].Value     = model.DevId;
            parameters[8].Value     = model.Country;
            parameters[9].Value     = model.Pm25;
            parameters[10].Value    = model.Pm100;
            DbHelperSql.RunProcedure("T_ESHour_ADD", parameters, out rowsAffected);
            return((long)parameters[0].Value);
        }
Exemple #7
0
        /// <summary>
        /// 获取用户所有的访问权限
        /// </summary>
        /// <returns></returns>
        public Dictionary <int, List <int> > GetAuths(int userId)
        {
            var authDic = new Dictionary <int, List <int> >();

            IDataParameter[] parameters =
            {
                new SqlParameter("@UserId", SqlDbType.Int, 4)
            };
            parameters[0].Value = userId;

            var ds = DbHelperSql.RunProcedure("T_UserAuthority_GetAuths", parameters, "ds");

            if (ds == null)
            {
                return(authDic);
            }
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                var authType = Convert.ToInt32(dr["AuthType"]);

                if (authDic.ContainsKey(authType))
                {
                    authDic[authType].Add(Convert.ToInt32(dr["AuthObjId"]));
                }
                else
                {
                    var list = new List <int> {
                        Convert.ToInt32(dr["AuthObjId"])
                    };
                    authDic.Add(authType, list);
                }
            }

            return(authDic);
        }
Exemple #8
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(Model.EsDay model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id",           SqlDbType.BigInt,     8),
                new SqlParameter("@StatId",       SqlDbType.Int,        4),
                new SqlParameter("@TP",           SqlDbType.Float,      8),
                new SqlParameter("@DB",           SqlDbType.Float,      8),
                new SqlParameter("@UpdateTime",   SqlDbType.DateTime),
                new SqlParameter("@DataStatus",   SqlDbType.Char,       1),
                new SqlParameter("@ValidDataNum", SqlDbType.Int,        4),
                new SqlParameter("@DevId",        SqlDbType.Int,        4),
                new SqlParameter("@Country",      SqlDbType.VarChar,   20),
                new SqlParameter("@Pm25",         SqlDbType.Float,      8),
                new SqlParameter("@Pm100",        SqlDbType.Float, 8)
            };
            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.StatId;
            parameters[2].Value  = model.Tp;
            parameters[3].Value  = model.Db;
            parameters[4].Value  = model.UpdateTime;
            parameters[5].Value  = model.DataStatus;
            parameters[6].Value  = model.ValidDataNum;
            parameters[7].Value  = model.DevId;
            parameters[8].Value  = model.Country;
            parameters[9].Value  = model.Pm25;
            parameters[10].Value = model.Pm100;

            DbHelperSql.RunProcedure("T_ESDay_Update", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #9
0
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetStatEsPerCountry(string country)
        {
            IDataParameter[] parameters =
            {
                new SqlParameter("@Country", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = country;

            return(DbHelperSql.RunProcedure("T_ESDay_GetStatESPerCountry", parameters, "ds"));
        }
Exemple #10
0
        public DataSet GetStatCurData(int statId)
        {
            IDataParameter[] parameters =
            {
                new SqlParameter("@StatId", SqlDbType.Int, 4)
            };
            parameters[0].Value = statId;

            return(DbHelperSql.RunProcedure("T_ESMin_GetCurData", parameters, "ds"));
        }
Exemple #11
0
        public DataSet GetDevRelatedStat(string strWhere)
        {
            IDataParameter[] parameters =
            {
                new SqlParameter("@StrWhere", SqlDbType.VarChar, 1000)
            };
            parameters[0].Value = strWhere;

            return(DbHelperSql.RunProcedure("T_Devs_GetRelatedStat", parameters, "ds"));
        }
Exemple #12
0
        public DataSet GetAvgCmpList(string strWhere)
        {
            IDataParameter[] parameters =
            {
                new SqlParameter("@strWhere", SqlDbType.VarChar, 1000)
            };
            parameters[0].Value = strWhere;


            return(DbHelperSql.RunProcedure("T_ESDay_GetAvgCMPList", parameters, "ds"));
        }
Exemple #13
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.TaskNotice GetModel(long taskId)
        {
            IDataParameter[] parameters =
            {
                new SqlParameter("@TaskId", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = taskId;

            var ds = DbHelperSql.RunProcedure("T_TaskNotice_GetModel", parameters, "ds");

            return(ds.Tables[0].Rows.Count > 0 ? DataRowToModel(ds.Tables[0].Rows[0]) : null);
        }
Exemple #14
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.EsHour GetModel(int id)
        {
            IDataParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = id;

            var ds = DbHelperSql.RunProcedure("T_ESHour_GetModel", parameters, "ds");

            return(ds.Tables[0].Rows.Count > 0 ? DataRowToModel(ds.Tables[0].Rows[0]) : null);
        }
Exemple #15
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(long taskId)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@TaskId", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = taskId;

            DbHelperSql.RunProcedure("T_TaskNotice_Delete", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #16
0
        /// <summary>
        /// 查询检测点的噪音小时均值
        /// </summary>
        /// <param name="country"></param>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public DataSet GetAvgNoiseStatList(string country, string strWhere)
        {
            IDataParameter[] parameters =
            {
                new SqlParameter("@Country",  SqlDbType.VarChar, 20),
                new SqlParameter("@strWhere", SqlDbType.VarChar, 1000)
            };

            parameters[0].Value = country;
            parameters[1].Value = strWhere;

            return(DbHelperSql.RunProcedure("T_ESHour_GetAvgNoiseStatList", parameters, "ds"));
        }
Exemple #17
0
        /// <summary>
        ///  删除用户权限
        /// </summary>
        public int DelAuths(int userId)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@UserId", SqlDbType.Int, 4)
            };
            parameters[0].Value = userId;

            DbHelperSql.RunProcedure("T_UserAuthority_DeleteByUserId", parameters, out rowsAffected);
            return(rowsAffected);
        }
Exemple #18
0
 /// <summary>
 /// 分页获取数据列表
 /// </summary>
 public DataSet GetList(int pageSize, int pageIndex, string strWhere)
 {
     IDataParameter[] parameters =
     {
         new SqlParameter("@PageSize",  SqlDbType.Int),
         new SqlParameter("@PageIndex", SqlDbType.Int),
         new SqlParameter("@strWhere",  SqlDbType.VarChar, 1000)
     };
     parameters[0].Value = pageSize;
     parameters[1].Value = pageIndex;
     parameters[2].Value = strWhere;
     return(DbHelperSql.RunProcedure("T_ESHour_GetListByPage", parameters, "ds"));
 }
Exemple #19
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = id;

            DbHelperSql.RunProcedure("T_ESMin_Delete", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #20
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool ExistsAddr(byte[] nodeId)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@NodeId", SqlDbType.Binary, 4)
            };
            parameters[0].Value = nodeId;

            var result = DbHelperSql.RunProcedure("T_DevAddr_Exists", parameters, out rowsAffected);

            return(result == 1);
        }
Exemple #21
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(long id)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = id;

            var result = DbHelperSql.RunProcedure("T_ESHour_Exists", parameters, out rowsAffected);

            return(result == 1);
        }
Exemple #22
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string name)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Name", SqlDbType.NVarChar, 30)
            };
            parameters[0].Value = name;

            var result = DbHelperSql.RunProcedure("T_ModuleType_Exists", parameters, out rowsAffected);

            return(result == 1);
        }
Exemple #23
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public int Delete(int id)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            var result = DbHelperSql.RunProcedure("T_ModuleType_Delete", parameters, out rowsAffected);

            return(result);
        }
Exemple #24
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.UserInGroups GetModel(int groupId, int userId)
        {
            IDataParameter[] parameters =
            {
                new SqlParameter("@GroupId", SqlDbType.Int, 4),
                new SqlParameter("@UserId",  SqlDbType.Int, 4)
            };
            parameters[0].Value = groupId;
            parameters[1].Value = userId;

            var ds = DbHelperSql.RunProcedure("T_UserInGroups_GetModel", parameters, "ds");

            return(ds.Tables[0].Rows.Count > 0 ? DataRowToModel(ds.Tables[0].Rows[0]) : null);
        }
Exemple #25
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string statCode)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@StatCode", SqlDbType.NVarChar, 20)
            };
            parameters[0].Value = statCode;

            var result = DbHelperSql.RunProcedure("T_Stats_Exists", parameters, out rowsAffected);

            return(result == 1);
        }
Exemple #26
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool UpdateDevAddr(int devId, byte[] nodeId)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@DevId",  SqlDbType.Int,    4),
                new SqlParameter("@NodeId", SqlDbType.Binary, 4)
            };
            parameters[0].Value = devId;
            parameters[1].Value = nodeId;

            DbHelperSql.RunProcedure("T_DevAddr_Update", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #27
0
        public bool UpdateStatus(long taskId, int status)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@TaskId", SqlDbType.BigInt,  8),
                new SqlParameter("@Status", SqlDbType.TinyInt, 1)
            };
            parameters[0].Value = taskId;
            parameters[1].Value = status;

            DbHelperSql.RunProcedure("T_Tasks_UpdateStatus", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #28
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public bool Add(Model.UserInGroups model)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@GroupId", SqlDbType.Int, 4),
                new SqlParameter("@UserId",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.GroupId;
            parameters[1].Value = model.UserId;

            DbHelperSql.RunProcedure("T_UserInGroups_ADD", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #29
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int groupId, int moduleId)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@GroupId",  SqlDbType.Int, 4),
                new SqlParameter("@ModuleId", SqlDbType.Int, 4)
            };
            parameters[0].Value = groupId;
            parameters[1].Value = moduleId;

            DbHelperSql.RunProcedure("T_GroupModules_Delete", parameters, out rowsAffected);
            return(rowsAffected > 0);
        }
Exemple #30
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int groupId, int userId)
        {
            int rowsAffected;

            IDataParameter[] parameters =
            {
                new SqlParameter("@GroupId", SqlDbType.Int, 4),
                new SqlParameter("@UserId",  SqlDbType.Int, 4)
            };
            parameters[0].Value = groupId;
            parameters[1].Value = userId;

            var result = DbHelperSql.RunProcedure("T_UserInGroups_Exists", parameters, out rowsAffected);

            return(result == 1);
        }