示例#1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(R_UsersMachine model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into R_UsersMachine(");
            strSql.Append("UserID,MachineID,RecordIsDelete,RecordCreateTime,RecordUpdateTime)");
            strSql.Append(" values (");
            strSql.Append("@UserID,@MachineID,@RecordIsDelete,@RecordCreateTime,@RecordUpdateTime)");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",           SqlDbType.Int,       4),
                new SqlParameter("@MachineID",        SqlDbType.Int,       4),
                new SqlParameter("@RecordIsDelete",   SqlDbType.Bit,       1),
                new SqlParameter("@RecordCreateTime", SqlDbType.DateTime),
                new SqlParameter("@RecordUpdateTime", SqlDbType.DateTime)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.MachineID;
            parameters[2].Value = model.RecordIsDelete;
            parameters[3].Value = model.RecordCreateTime;
            parameters[4].Value = model.RecordUpdateTime;

            object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
示例#2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public R_UsersMachine DataRowToModel(DataRow row)
        {
            R_UsersMachine model = new R_UsersMachine();

            if (row != null)
            {
                if (row["RUMID"] != null && row["RUMID"].ToString() != "")
                {
                    model.RUMID = int.Parse(row["RUMID"].ToString());
                }
                if (row["UserID"] != null && row["UserID"].ToString() != "")
                {
                    model.UserID = int.Parse(row["UserID"].ToString());
                }
                if (row["MachineID"] != null && row["MachineID"].ToString() != "")
                {
                    model.MachineID = int.Parse(row["MachineID"].ToString());
                }
                if (row["RecordIsDelete"] != null && row["RecordIsDelete"].ToString() != "")
                {
                    if ((row["RecordIsDelete"].ToString() == "1") || (row["RecordIsDelete"].ToString().ToLower() == "true"))
                    {
                        model.RecordIsDelete = true;
                    }
                    else
                    {
                        model.RecordIsDelete = false;
                    }
                }
                if (row["RecordCreateTime"] != null && row["RecordCreateTime"].ToString() != "")
                {
                    model.RecordCreateTime = DateTime.Parse(row["RecordCreateTime"].ToString());
                }
                if (row["RecordUpdateTime"] != null && row["RecordUpdateTime"].ToString() != "")
                {
                    model.RecordUpdateTime = DateTime.Parse(row["RecordUpdateTime"].ToString());
                }
            }
            return(model);
        }
示例#3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(R_UsersMachine model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update R_UsersMachine set ");
            strSql.Append("UserID=@UserID,");
            strSql.Append("MachineID=@MachineID,");
            strSql.Append("RecordIsDelete=@RecordIsDelete,");
            strSql.Append("RecordCreateTime=@RecordCreateTime,");
            strSql.Append("RecordUpdateTime@=RecordUpdateTime");
            strSql.Append(" where RUMID=@RUMID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",           SqlDbType.Int,       4),
                new SqlParameter("@MachineID",        SqlDbType.Int,       4),
                new SqlParameter("@RecordIsDelete",   SqlDbType.Bit,       1),
                new SqlParameter("@RecordCreateTime", SqlDbType.DateTime),
                new SqlParameter("@RecordUpdateTime", SqlDbType.DateTime),
                new SqlParameter("@RUMID",            SqlDbType.Int, 4)
            };
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.MachineID;
            parameters[2].Value = model.RecordIsDelete;
            parameters[3].Value = model.RecordCreateTime;
            parameters[4].Value = model.RecordUpdateTime;
            parameters[5].Value = model.RUMID;

            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public R_UsersMachine GetModel(int RUMID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 RUMID,UserID,MachineID,RecordIsDelete,RecordCreateTime,RecordUpdateTime from R_UsersMachine ");
            strSql.Append(" where RUMID=@RUMID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RUMID", SqlDbType.Int, 4)
            };
            parameters[0].Value = RUMID;

            R_UsersMachine model = new R_UsersMachine();
            DataSet        ds    = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(R_UsersMachine model)
 {
     return(dal.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(R_UsersMachine model)
 {
     return(dal.Add(model));
 }