Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Parking.Core.Model.PBA_OWNER_INFO model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into PBA_OWNER_INFO(");
            strSql.Append("OWNER_CODE,OWNER_NAME,OWNER_PHONE,OWNER_ADDRESS,OWNER_PICTURE,OWNER_STATUS,ORGANIZATION_CODE,REMARK,CREATE_TIME,CREATE_USERNAME,UPDATE_TIME,UPDATE_USERNAME,PERMISSION_CODES,DIY_STR)");
            strSql.Append(" values (");
            strSql.Append("@OWNER_CODE,@OWNER_NAME,@OWNER_PHONE,@OWNER_ADDRESS,@OWNER_PICTURE,@OWNER_STATUS,@ORGANIZATION_CODE,@REMARK,@CREATE_TIME,@CREATE_USERNAME,@UPDATE_TIME,@UPDATE_USERNAME,@PERMISSION_CODES,@DIY_STR)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OWNER_CODE",        SqlDbType.VarChar,    50),
                new SqlParameter("@OWNER_NAME",        SqlDbType.VarChar,    50),
                new SqlParameter("@OWNER_PHONE",       SqlDbType.VarChar,    20),
                new SqlParameter("@OWNER_ADDRESS",     SqlDbType.VarChar,   200),
                new SqlParameter("@OWNER_PICTURE",     SqlDbType.VarChar,   200),
                new SqlParameter("@OWNER_STATUS",      SqlDbType.Int,         4),
                new SqlParameter("@ORGANIZATION_CODE", SqlDbType.VarChar,   200),
                new SqlParameter("@REMARK",            SqlDbType.VarChar,   200),
                new SqlParameter("@CREATE_TIME",       SqlDbType.DateTime),
                new SqlParameter("@CREATE_USERNAME",   SqlDbType.VarChar,    50),
                new SqlParameter("@UPDATE_TIME",       SqlDbType.DateTime),
                new SqlParameter("@UPDATE_USERNAME",   SqlDbType.VarChar,    50),
                new SqlParameter("@PERMISSION_CODES",  SqlDbType.Text),
                new SqlParameter("@DIY_STR",           SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.OWNER_CODE;
            parameters[1].Value  = model.OWNER_NAME;
            parameters[2].Value  = model.OWNER_PHONE;
            parameters[3].Value  = model.OWNER_ADDRESS;
            parameters[4].Value  = model.OWNER_PICTURE;
            parameters[5].Value  = model.OWNER_STATUS;
            parameters[6].Value  = model.ORGANIZATION_CODE;
            parameters[7].Value  = model.REMARK;
            parameters[8].Value  = model.CREATE_TIME;
            parameters[9].Value  = model.CREATE_USERNAME;
            parameters[10].Value = model.UPDATE_TIME;
            parameters[11].Value = model.UPDATE_USERNAME;
            parameters[12].Value = model.PERMISSION_CODES;
            parameters[13].Value = model.DIY_STR;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Parking.Core.Model.PBA_OWNER_INFO GetModel(string OWNER_CODE)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 OWNER_CODE,OWNER_NAME,OWNER_PHONE,OWNER_ADDRESS,OWNER_PICTURE,OWNER_STATUS,ORGANIZATION_CODE,REMARK,CREATE_TIME,CREATE_USERNAME,UPDATE_TIME,UPDATE_USERNAME,PERMISSION_CODES,DIY_STR from PBA_OWNER_INFO ");
            strSql.Append(" where OWNER_CODE=@OWNER_CODE ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OWNER_CODE", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = OWNER_CODE;

            Parking.Core.Model.PBA_OWNER_INFO model = new Parking.Core.Model.PBA_OWNER_INFO();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Parking.Core.Model.PBA_OWNER_INFO DataRowToModel(DataRow row)
 {
     Parking.Core.Model.PBA_OWNER_INFO model = new Parking.Core.Model.PBA_OWNER_INFO();
     if (row != null)
     {
         if (row["OWNER_CODE"] != null)
         {
             model.OWNER_CODE = row["OWNER_CODE"].ToString();
         }
         if (row["OWNER_NAME"] != null)
         {
             model.OWNER_NAME = row["OWNER_NAME"].ToString();
         }
         if (row["OWNER_PHONE"] != null)
         {
             model.OWNER_PHONE = row["OWNER_PHONE"].ToString();
         }
         if (row["OWNER_ADDRESS"] != null)
         {
             model.OWNER_ADDRESS = row["OWNER_ADDRESS"].ToString();
         }
         if (row["OWNER_PICTURE"] != null)
         {
             model.OWNER_PICTURE = row["OWNER_PICTURE"].ToString();
         }
         if (row["OWNER_STATUS"] != null && row["OWNER_STATUS"].ToString() != "")
         {
             model.OWNER_STATUS = int.Parse(row["OWNER_STATUS"].ToString());
         }
         if (row["ORGANIZATION_CODE"] != null)
         {
             model.ORGANIZATION_CODE = row["ORGANIZATION_CODE"].ToString();
         }
         if (row["REMARK"] != null)
         {
             model.REMARK = row["REMARK"].ToString();
         }
         if (row["CREATE_TIME"] != null && row["CREATE_TIME"].ToString() != "")
         {
             model.CREATE_TIME = DateTime.Parse(row["CREATE_TIME"].ToString());
         }
         if (row["CREATE_USERNAME"] != null)
         {
             model.CREATE_USERNAME = row["CREATE_USERNAME"].ToString();
         }
         if (row["UPDATE_TIME"] != null && row["UPDATE_TIME"].ToString() != "")
         {
             model.UPDATE_TIME = DateTime.Parse(row["UPDATE_TIME"].ToString());
         }
         if (row["UPDATE_USERNAME"] != null)
         {
             model.UPDATE_USERNAME = row["UPDATE_USERNAME"].ToString();
         }
         if (row["PERMISSION_CODES"] != null)
         {
             model.PERMISSION_CODES = row["PERMISSION_CODES"].ToString();
         }
         if (row["DIY_STR"] != null)
         {
             model.DIY_STR = row["DIY_STR"].ToString();
         }
     }
     return(model);
 }
Пример #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Parking.Core.Model.PBA_OWNER_INFO model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update PBA_OWNER_INFO set ");
            strSql.Append("OWNER_NAME=@OWNER_NAME,");
            strSql.Append("OWNER_PHONE=@OWNER_PHONE,");
            strSql.Append("OWNER_ADDRESS=@OWNER_ADDRESS,");
            strSql.Append("OWNER_PICTURE=@OWNER_PICTURE,");
            strSql.Append("OWNER_STATUS=@OWNER_STATUS,");
            strSql.Append("ORGANIZATION_CODE=@ORGANIZATION_CODE,");
            strSql.Append("REMARK=@REMARK,");
            strSql.Append("CREATE_TIME=@CREATE_TIME,");
            strSql.Append("CREATE_USERNAME=@CREATE_USERNAME,");
            strSql.Append("UPDATE_TIME=@UPDATE_TIME,");
            strSql.Append("UPDATE_USERNAME=@UPDATE_USERNAME,");
            strSql.Append("PERMISSION_CODES=@PERMISSION_CODES,");
            strSql.Append("DIY_STR=@DIY_STR");
            strSql.Append(" where OWNER_CODE=@OWNER_CODE ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OWNER_NAME",        SqlDbType.VarChar,    50),
                new SqlParameter("@OWNER_PHONE",       SqlDbType.VarChar,    20),
                new SqlParameter("@OWNER_ADDRESS",     SqlDbType.VarChar,   200),
                new SqlParameter("@OWNER_PICTURE",     SqlDbType.VarChar,   200),
                new SqlParameter("@OWNER_STATUS",      SqlDbType.Int,         4),
                new SqlParameter("@ORGANIZATION_CODE", SqlDbType.VarChar,   200),
                new SqlParameter("@REMARK",            SqlDbType.VarChar,   200),
                new SqlParameter("@CREATE_TIME",       SqlDbType.DateTime),
                new SqlParameter("@CREATE_USERNAME",   SqlDbType.VarChar,    50),
                new SqlParameter("@UPDATE_TIME",       SqlDbType.DateTime),
                new SqlParameter("@UPDATE_USERNAME",   SqlDbType.VarChar,    50),
                new SqlParameter("@PERMISSION_CODES",  SqlDbType.Text),
                new SqlParameter("@DIY_STR",           SqlDbType.VarChar,    50),
                new SqlParameter("@OWNER_CODE",        SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.OWNER_NAME;
            parameters[1].Value  = model.OWNER_PHONE;
            parameters[2].Value  = model.OWNER_ADDRESS;
            parameters[3].Value  = model.OWNER_PICTURE;
            parameters[4].Value  = model.OWNER_STATUS;
            parameters[5].Value  = model.ORGANIZATION_CODE;
            parameters[6].Value  = model.REMARK;
            parameters[7].Value  = model.CREATE_TIME;
            parameters[8].Value  = model.CREATE_USERNAME;
            parameters[9].Value  = model.UPDATE_TIME;
            parameters[10].Value = model.UPDATE_USERNAME;
            parameters[11].Value = model.PERMISSION_CODES;
            parameters[12].Value = model.DIY_STR;
            parameters[13].Value = model.OWNER_CODE;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }