/// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.JmpMonitorMinuteDetails model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jmp_monitor_minute_details set ");

            strSql.Append(" AppId = @AppId , ");
            strSql.Append(" MonitorType = @MonitorType , ");
            strSql.Append(" WhichHour = @WhichHour , ");
            strSql.Append(" Minutes = @Minutes , ");
            strSql.Append(" where id=@id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",          SqlDbType.Int,       4),
                new SqlParameter("@AppId",       SqlDbType.Int,       4),
                new SqlParameter("@MonitorType", SqlDbType.Int,       4),
                new SqlParameter("@WhichHour",   SqlDbType.NVarChar, -1),
                new SqlParameter("@Minutes",     SqlDbType.NVarChar, -1)
            };

            parameters[0].Value = model.Id;
            parameters[1].Value = model.AppId;
            parameters[2].Value = model.MonitorType;
            parameters[3].Value = model.WhichHour;
            parameters[4].Value = model.Minutes;
            var rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            return(rows > 0);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.JmpMonitorMinuteDetails model)
        {
            var strSql = new StringBuilder();

            strSql.Append("insert into jmp_monitor_minute_details(");
            strSql.Append("AppId,MonitorType,WhichHour,Minutes,CreatedById,CreatedByName");
            strSql.Append(") values (");
            strSql.Append("@AppId,@MonitorType,@WhichHour,@Minutes,@CreatedById,@CreatedByName");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AppId",         SqlDbType.Int,       4),
                new SqlParameter("@MonitorType",   SqlDbType.Int,       4),
                new SqlParameter("@WhichHour",     SqlDbType.NVarChar, -1),
                new SqlParameter("@Minutes",       SqlDbType.NVarChar, -1),
                new SqlParameter("@CreatedById",   SqlDbType.NVarChar, -1),
                new SqlParameter("@CreatedByName", SqlDbType.NVarChar, -1)
            };

            parameters[0].Value = model.AppId;
            parameters[1].Value = model.MonitorType;
            parameters[2].Value = model.WhichHour;
            parameters[3].Value = model.Minutes;
            parameters[4].Value = model.CreatedById;
            parameters[5].Value = model.CreatedByName;

            var obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            return(obj == null ? 0 : Convert.ToInt32(obj));
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.JmpMonitorMinuteDetails GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,AppId,MonitorType,WhichHour,Minutes,CreatedOn,CreatedById,CreatedByName");
            strSql.Append("  from jmp_monitor_minute_details ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;


            var model = new Model.JmpMonitorMinuteDetails();
            var ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AppId"].ToString() != "")
                {
                    model.AppId = int.Parse(ds.Tables[0].Rows[0]["AppId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreatedById"].ToString() != "")
                {
                    model.CreatedById = int.Parse(ds.Tables[0].Rows[0]["CreatedById"].ToString());
                }
                model.CreatedByName = ds.Tables[0].Rows[0]["CreatedByName"].ToString();
                if (ds.Tables[0].Rows[0]["Minutes"].ToString() != "")
                {
                    model.Minutes = int.Parse(ds.Tables[0].Rows[0]["Minutes"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MonitorType"].ToString() != "")
                {
                    model.MonitorType = int.Parse(ds.Tables[0].Rows[0]["MonitorType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["WhichHour"].ToString() != "")
                {
                    model.WhichHour = int.Parse(ds.Tables[0].Rows[0]["WhichHour"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreatedOn"].ToString() != "")
                {
                    model.CreatedOn = DateTime.Parse(ds.Tables[0].Rows[0]["CreatedOn"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Model.JmpMonitorMinuteDetails> DataTableToList(DataTable dt)
        {
            var modelList = new List <Model.JmpMonitorMinuteDetails>();
            var rowsCount = dt.Rows.Count;

            if (rowsCount <= 0)
            {
                return(modelList);
            }
            for (var n = 0; n < rowsCount; n++)
            {
                var model = new Model.JmpMonitorMinuteDetails();
                if (dt.Rows[0]["id"].ToString() != "")
                {
                    model.Id = int.Parse(dt.Rows[0]["id"].ToString());
                }
                if (dt.Rows[0]["AppId"].ToString() != "")
                {
                    model.AppId = int.Parse(dt.Rows[0]["AppId"].ToString());
                }
                if (dt.Rows[0]["CreatedById"].ToString() != "")
                {
                    model.CreatedById = int.Parse(dt.Rows[0]["CreatedById"].ToString());
                }
                model.CreatedByName = dt.Rows[0]["CreatedByName"].ToString();
                if (dt.Rows[0]["Minutes"].ToString() != "")
                {
                    model.Minutes = int.Parse(dt.Rows[0]["Minutes"].ToString());
                }
                if (dt.Rows[0]["MonitorType"].ToString() != "")
                {
                    model.MonitorType = int.Parse(dt.Rows[0]["MonitorType"].ToString());
                }
                if (dt.Rows[0]["WhichHour"].ToString() != "")
                {
                    model.WhichHour = int.Parse(dt.Rows[0]["WhichHour"].ToString());
                }
                if (dt.Rows[0]["CreatedOn"].ToString() != "")
                {
                    model.CreatedOn = DateTime.Parse(dt.Rows[0]["CreatedOn"].ToString());
                }

                modelList.Add(model);
            }
            return(modelList);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.JmpMonitorMinuteDetails model)
 {
     return(_dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.JmpMonitorMinuteDetails model)
 {
     return(_dal.Add(model));
 }