Ejemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体(根据姓名)
        /// </summary>
        public Gunark.Model.user GetModelByName(string USER_REALNAME)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select USER_ID,USER_POLICENUMB,USER_REALNAME,USER_NAME,USER_PWD,USER_STATE,USER_ADDRESS,USER_OFFICETELEP,USER_MOBILTELEP,USER_SEX,USER_EMAIL,USER_POSTCODE,USER_PRIVIEGES,USER_GUNLICENSE,USER_GUNLICENSEDATE,USER_POLICEKINDS,USER_RANK,USER_REMARK,USER_CARD,USER_JOBSTATUS,UNITINFO_CODE,USER_FINGER_ID,GROUP_ID,USER_BANNED from gunark_user ");
            strSql.Append(" where USER_REALNAME=@USER_REALNAME ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@USER_REALNAME", MySqlDbType.VarChar, 255)
            };
            parameters[0].Value = USER_REALNAME;

            Gunark.Model.user model = new Gunark.Model.user();
            DataSet           ds    = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Gunark.Model.user model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into gunark_user(");
            strSql.Append("USER_ID,USER_POLICENUMB,USER_REALNAME,USER_NAME,USER_PWD,USER_STATE,USER_ADDRESS,USER_OFFICETELEP,USER_MOBILTELEP,USER_SEX,USER_EMAIL,USER_POSTCODE,USER_PRIVIEGES,USER_GUNLICENSE,USER_GUNLICENSEDATE,USER_POLICEKINDS,USER_RANK,USER_REMARK,USER_CARD,USER_JOBSTATUS,UNITINFO_CODE,USER_FINGER_ID,GROUP_ID,USER_BANNED)");
            strSql.Append(" values (");
            strSql.Append("@USER_ID,@USER_POLICENUMB,@USER_REALNAME,@USER_NAME,@USER_PWD,@USER_STATE,@USER_ADDRESS,@USER_OFFICETELEP,@USER_MOBILTELEP,@USER_SEX,@USER_EMAIL,@USER_POSTCODE,@USER_PRIVIEGES,@USER_GUNLICENSE,@USER_GUNLICENSEDATE,@USER_POLICEKINDS,@USER_RANK,@USER_REMARK,@USER_CARD,@USER_JOBSTATUS,@UNITINFO_CODE,@USER_FINGER_ID,@GROUP_ID,@USER_BANNED)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@USER_ID",             MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_POLICENUMB",     MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_REALNAME",       MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_NAME",           MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_PWD",            MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_STATE",          MySqlDbType.Int32,    10),
                new MySqlParameter("@USER_ADDRESS",        MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_OFFICETELEP",    MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_MOBILTELEP",     MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_SEX",            MySqlDbType.Int32,    10),
                new MySqlParameter("@USER_EMAIL",          MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_POSTCODE",       MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_PRIVIEGES",      MySqlDbType.Int32,    10),
                new MySqlParameter("@USER_GUNLICENSE",     MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_GUNLICENSEDATE", MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_POLICEKINDS",    MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_RANK",           MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_REMARK",         MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_CARD",           MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_JOBSTATUS",      MySqlDbType.Int32,     1),
                new MySqlParameter("@UNITINFO_CODE",       MySqlDbType.VarChar, 255),
                new MySqlParameter("@USER_FINGER_ID",      MySqlDbType.VarChar, 255),
                new MySqlParameter("@GROUP_ID",            MySqlDbType.VarChar,  50),
                new MySqlParameter("@USER_BANNED",         MySqlDbType.Int32, 10)
            };
            parameters[0].Value  = model.USER_ID;
            parameters[1].Value  = model.USER_POLICENUMB;
            parameters[2].Value  = model.USER_REALNAME;
            parameters[3].Value  = model.USER_NAME;
            parameters[4].Value  = model.USER_PWD;
            parameters[5].Value  = model.USER_STATE;
            parameters[6].Value  = model.USER_ADDRESS;
            parameters[7].Value  = model.USER_OFFICETELEP;
            parameters[8].Value  = model.USER_MOBILTELEP;
            parameters[9].Value  = model.USER_SEX;
            parameters[10].Value = model.USER_EMAIL;
            parameters[11].Value = model.USER_POSTCODE;
            parameters[12].Value = model.USER_PRIVIEGES;
            parameters[13].Value = model.USER_GUNLICENSE;
            parameters[14].Value = model.USER_GUNLICENSEDATE;
            parameters[15].Value = model.USER_POLICEKINDS;
            parameters[16].Value = model.USER_RANK;
            parameters[17].Value = model.USER_REMARK;
            parameters[18].Value = model.USER_CARD;
            parameters[19].Value = model.USER_JOBSTATUS;
            parameters[20].Value = model.UNITINFO_CODE;
            parameters[21].Value = model.USER_FINGER_ID;
            parameters[22].Value = model.GROUP_ID;
            parameters[23].Value = model.USER_BANNED;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Gunark.Model.user DataRowToModel(DataRow row)
 {
     Gunark.Model.user model = new Gunark.Model.user();
     if (row != null)
     {
         if (row["USER_ID"] != null)
         {
             model.USER_ID = row["USER_ID"].ToString();
         }
         if (row["USER_POLICENUMB"] != null)
         {
             model.USER_POLICENUMB = row["USER_POLICENUMB"].ToString();
         }
         if (row["USER_REALNAME"] != null)
         {
             model.USER_REALNAME = row["USER_REALNAME"].ToString();
         }
         if (row["USER_NAME"] != null)
         {
             model.USER_NAME = row["USER_NAME"].ToString();
         }
         if (row["USER_PWD"] != null)
         {
             model.USER_PWD = row["USER_PWD"].ToString();
         }
         if (row["USER_STATE"] != null && row["USER_STATE"].ToString() != "")
         {
             model.USER_STATE = int.Parse(row["USER_STATE"].ToString());
         }
         if (row["USER_ADDRESS"] != null)
         {
             model.USER_ADDRESS = row["USER_ADDRESS"].ToString();
         }
         if (row["USER_OFFICETELEP"] != null)
         {
             model.USER_OFFICETELEP = row["USER_OFFICETELEP"].ToString();
         }
         if (row["USER_MOBILTELEP"] != null)
         {
             model.USER_MOBILTELEP = row["USER_MOBILTELEP"].ToString();
         }
         if (row["USER_SEX"] != null && row["USER_SEX"].ToString() != "")
         {
             model.USER_SEX = int.Parse(row["USER_SEX"].ToString());
         }
         if (row["USER_EMAIL"] != null)
         {
             model.USER_EMAIL = row["USER_EMAIL"].ToString();
         }
         if (row["USER_POSTCODE"] != null)
         {
             model.USER_POSTCODE = row["USER_POSTCODE"].ToString();
         }
         if (row["USER_PRIVIEGES"] != null && row["USER_PRIVIEGES"].ToString() != "")
         {
             model.USER_PRIVIEGES = int.Parse(row["USER_PRIVIEGES"].ToString());
         }
         if (row["USER_GUNLICENSE"] != null)
         {
             model.USER_GUNLICENSE = row["USER_GUNLICENSE"].ToString();
         }
         if (row["USER_GUNLICENSEDATE"] != null)
         {
             model.USER_GUNLICENSEDATE = row["USER_GUNLICENSEDATE"].ToString();
         }
         if (row["USER_POLICEKINDS"] != null)
         {
             model.USER_POLICEKINDS = row["USER_POLICEKINDS"].ToString();
         }
         if (row["USER_RANK"] != null)
         {
             model.USER_RANK = row["USER_RANK"].ToString();
         }
         if (row["USER_REMARK"] != null)
         {
             model.USER_REMARK = row["USER_REMARK"].ToString();
         }
         if (row["USER_CARD"] != null)
         {
             model.USER_CARD = row["USER_CARD"].ToString();
         }
         if (row["USER_JOBSTATUS"] != null && row["USER_JOBSTATUS"].ToString() != "")
         {
             model.USER_JOBSTATUS = int.Parse(row["USER_JOBSTATUS"].ToString());
         }
         if (row["UNITINFO_CODE"] != null)
         {
             model.UNITINFO_CODE = row["UNITINFO_CODE"].ToString();
         }
         if (row["USER_FINGER_ID"] != null)
         {
             model.USER_FINGER_ID = row["USER_FINGER_ID"].ToString();
         }
         if (row["GROUP_ID"] != null)
         {
             model.GROUP_ID = row["GROUP_ID"].ToString();
         }
         if (row["USER_BANNED"] != null && row["USER_BANNED"].ToString() != "")
         {
             model.USER_BANNED = int.Parse(row["USER_BANNED"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体(根据姓名)
        /// </summary>
        public Gunark.Model.user GetModelByName(string USER_REALNAME)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select USER_ID,USER_POLICENUMB,USER_REALNAME,USER_NAME,USER_PWD,USER_STATE,USER_ADDRESS,USER_OFFICETELEP,USER_MOBILTELEP,USER_SEX,USER_EMAIL,USER_POSTCODE,USER_PRIVIEGES,USER_GUNLICENSE,USER_GUNLICENSEDATE,USER_POLICEKINDS,USER_RANK,USER_REMARK,USER_CARD,USER_JOBSTATUS,UNITINFO_CODE,USER_FINGER_ID,GROUP_ID,USER_BANNED from gunark_user ");
            strSql.Append(" where USER_REALNAME=@USER_REALNAME ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@USER_REALNAME", MySqlDbType.VarChar,255)			};
            parameters[0].Value = USER_REALNAME;

            Gunark.Model.user model = new Gunark.Model.user();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Gunark.Model.user DataRowToModel(DataRow row)
 {
     Gunark.Model.user model = new Gunark.Model.user();
     if (row != null)
     {
         if (row["USER_ID"] != null)
         {
             model.USER_ID = row["USER_ID"].ToString();
         }
         if (row["USER_POLICENUMB"] != null)
         {
             model.USER_POLICENUMB = row["USER_POLICENUMB"].ToString();
         }
         if (row["USER_REALNAME"] != null)
         {
             model.USER_REALNAME = row["USER_REALNAME"].ToString();
         }
         if (row["USER_NAME"] != null)
         {
             model.USER_NAME = row["USER_NAME"].ToString();
         }
         if (row["USER_PWD"] != null)
         {
             model.USER_PWD = row["USER_PWD"].ToString();
         }
         if (row["USER_STATE"] != null && row["USER_STATE"].ToString() != "")
         {
             model.USER_STATE = int.Parse(row["USER_STATE"].ToString());
         }
         if (row["USER_ADDRESS"] != null)
         {
             model.USER_ADDRESS = row["USER_ADDRESS"].ToString();
         }
         if (row["USER_OFFICETELEP"] != null)
         {
             model.USER_OFFICETELEP = row["USER_OFFICETELEP"].ToString();
         }
         if (row["USER_MOBILTELEP"] != null)
         {
             model.USER_MOBILTELEP = row["USER_MOBILTELEP"].ToString();
         }
         if (row["USER_SEX"] != null && row["USER_SEX"].ToString() != "")
         {
             model.USER_SEX = int.Parse(row["USER_SEX"].ToString());
         }
         if (row["USER_EMAIL"] != null)
         {
             model.USER_EMAIL = row["USER_EMAIL"].ToString();
         }
         if (row["USER_POSTCODE"] != null)
         {
             model.USER_POSTCODE = row["USER_POSTCODE"].ToString();
         }
         if (row["USER_PRIVIEGES"] != null && row["USER_PRIVIEGES"].ToString() != "")
         {
             model.USER_PRIVIEGES = int.Parse(row["USER_PRIVIEGES"].ToString());
         }
         if (row["USER_GUNLICENSE"] != null)
         {
             model.USER_GUNLICENSE = row["USER_GUNLICENSE"].ToString();
         }
         if (row["USER_GUNLICENSEDATE"] != null)
         {
             model.USER_GUNLICENSEDATE = row["USER_GUNLICENSEDATE"].ToString();
         }
         if (row["USER_POLICEKINDS"] != null)
         {
             model.USER_POLICEKINDS = row["USER_POLICEKINDS"].ToString();
         }
         if (row["USER_RANK"] != null)
         {
             model.USER_RANK = row["USER_RANK"].ToString();
         }
         if (row["USER_REMARK"] != null)
         {
             model.USER_REMARK = row["USER_REMARK"].ToString();
         }
         if (row["USER_CARD"] != null)
         {
             model.USER_CARD = row["USER_CARD"].ToString();
         }
         if (row["USER_JOBSTATUS"] != null && row["USER_JOBSTATUS"].ToString() != "")
         {
             model.USER_JOBSTATUS = int.Parse(row["USER_JOBSTATUS"].ToString());
         }
         if (row["UNITINFO_CODE"] != null)
         {
             model.UNITINFO_CODE = row["UNITINFO_CODE"].ToString();
         }
         if (row["USER_FINGER_ID"] != null)
         {
             model.USER_FINGER_ID = row["USER_FINGER_ID"].ToString();
         }
         if (row["GROUP_ID"] != null)
         {
             model.GROUP_ID = row["GROUP_ID"].ToString();
         }
         if (row["USER_BANNED"] != null && row["USER_BANNED"].ToString() != "")
         {
             model.USER_BANNED = int.Parse(row["USER_BANNED"].ToString());
         }
     }
     return model;
 }