Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Common.Model.User_DB model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update User_DB set ");
            strSql.Append("USER_ID=@USER_ID,");
            strSql.Append("USER_NAME=@USER_NAME,");
            strSql.Append("PASSWORD=@PASSWORD,");
            strSql.Append("USER_GROUP=@USER_GROUP,");
            strSql.Append("UPDATED_TIME=@UPDATED_TIME,");
            strSql.Append("UPDATED_BY=@UPDATED_BY,");
            strSql.Append("DEPARTMENT=@DEPARTMENT,");
            strSql.Append("FINGER_TEMPLATE=@FINGER_TEMPLATE,");
            strSql.Append("SHIFT=@SHIFT,");
            strSql.Append("FINGER_TEMPLATE_1=@FINGER_TEMPLATE_1");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@USER_ID",           SqlDbType.VarChar,   50),
                new SqlParameter("@USER_NAME",         SqlDbType.VarChar,   50),
                new SqlParameter("@PASSWORD",          SqlDbType.VarChar,   50),
                new SqlParameter("@USER_GROUP",        SqlDbType.VarChar,   50),
                new SqlParameter("@UPDATED_TIME",      SqlDbType.DateTime),
                new SqlParameter("@UPDATED_BY",        SqlDbType.VarChar,   50),
                new SqlParameter("@DEPARTMENT",        SqlDbType.VarChar,   50),
                new SqlParameter("@FINGER_TEMPLATE",   SqlDbType.VarChar,   -1),
                new SqlParameter("@SHIFT",             SqlDbType.VarChar,   50),
                new SqlParameter("@FINGER_TEMPLATE_1", SqlDbType.VarChar, -1)
            };
            parameters[0].Value = model.USER_ID;
            parameters[1].Value = model.USER_NAME;
            parameters[2].Value = model.PASSWORD;
            parameters[3].Value = model.USER_GROUP;
            parameters[4].Value = model.UPDATED_TIME;
            parameters[5].Value = model.UPDATED_BY;
            parameters[6].Value = model.DEPARTMENT;
            parameters[7].Value = model.FINGER_TEMPLATE;
            parameters[8].Value = model.SHIFT;
            parameters[9].Value = model.FINGER_TEMPLATE_1;

            int rows = Common.DB.SqlDB.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Common.Model.User_DB DataRowToModel(DataRow row)
 {
     Common.Model.User_DB model = new Common.Model.User_DB();
     if (row != null)
     {
         if (row["USER_ID"] != null)
         {
             model.USER_ID = row["USER_ID"].ToString();
         }
         if (row["USER_NAME"] != null)
         {
             model.USER_NAME = row["USER_NAME"].ToString();
         }
         if (row["PASSWORD"] != null)
         {
             model.PASSWORD = row["PASSWORD"].ToString();
         }
         if (row["USER_GROUP"] != null)
         {
             model.USER_GROUP = row["USER_GROUP"].ToString();
         }
         if (row["UPDATED_TIME"] != null && row["UPDATED_TIME"].ToString() != "")
         {
             model.UPDATED_TIME = DateTime.Parse(row["UPDATED_TIME"].ToString());
         }
         if (row["UPDATED_BY"] != null)
         {
             model.UPDATED_BY = row["UPDATED_BY"].ToString();
         }
         if (row["DEPARTMENT"] != null)
         {
             model.DEPARTMENT = row["DEPARTMENT"].ToString();
         }
         if (row["FINGER_TEMPLATE"] != null)
         {
             model.FINGER_TEMPLATE = row["FINGER_TEMPLATE"].ToString();
         }
         if (row["SHIFT"] != null)
         {
             model.SHIFT = row["SHIFT"].ToString();
         }
         if (row["FINGER_TEMPLATE_1"] != null)
         {
             model.FINGER_TEMPLATE_1 = row["FINGER_TEMPLATE_1"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Common.Model.User_DB model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into User_DB(");
            strSql.Append("USER_ID,USER_NAME,PASSWORD,USER_GROUP,UPDATED_TIME,UPDATED_BY,DEPARTMENT,FINGER_TEMPLATE,SHIFT,FINGER_TEMPLATE_1)");
            strSql.Append(" values (");
            strSql.Append("@USER_ID,@USER_NAME,@PASSWORD,@USER_GROUP,@UPDATED_TIME,@UPDATED_BY,@DEPARTMENT,@FINGER_TEMPLATE,@SHIFT,@FINGER_TEMPLATE_1)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@USER_ID",           SqlDbType.VarChar,   50),
                new SqlParameter("@USER_NAME",         SqlDbType.VarChar,   50),
                new SqlParameter("@PASSWORD",          SqlDbType.VarChar,   50),
                new SqlParameter("@USER_GROUP",        SqlDbType.VarChar,   50),
                new SqlParameter("@UPDATED_TIME",      SqlDbType.DateTime),
                new SqlParameter("@UPDATED_BY",        SqlDbType.VarChar,   50),
                new SqlParameter("@DEPARTMENT",        SqlDbType.VarChar,   50),
                new SqlParameter("@FINGER_TEMPLATE",   SqlDbType.VarChar,   -1),
                new SqlParameter("@SHIFT",             SqlDbType.VarChar,   50),
                new SqlParameter("@FINGER_TEMPLATE_1", SqlDbType.VarChar, -1)
            };
            parameters[0].Value = model.USER_ID;
            parameters[1].Value = model.USER_NAME;
            parameters[2].Value = model.PASSWORD;
            parameters[3].Value = model.USER_GROUP;
            parameters[4].Value = model.UPDATED_TIME;
            parameters[5].Value = model.UPDATED_BY;
            parameters[6].Value = model.DEPARTMENT;
            parameters[7].Value = model.FINGER_TEMPLATE;
            parameters[8].Value = model.SHIFT;
            parameters[9].Value = model.FINGER_TEMPLATE_1;

            int rows = Common.DB.SqlDB.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Common.Model.User_DB GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 USER_ID,USER_NAME,PASSWORD,USER_GROUP,UPDATED_TIME,UPDATED_BY,DEPARTMENT,FINGER_TEMPLATE,SHIFT,FINGER_TEMPLATE_1 from User_DB ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            Common.Model.User_DB model = new Common.Model.User_DB();
            DataSet ds = Common.DB.SqlDB.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }