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

            strSql.Append("update WxMinUnSysUser set ");
            strSql.Append("WxUid=@WxUid,");
            strSql.Append("SysUname=@SysUname,");
            strSql.Append("SysType=@SysType,");
            strSql.Append("SchId=@SchId,");
            strSql.Append("Mobile=@Mobile,");
            strSql.Append("RecTime=@RecTime");
            strSql.Append(" where AutoId=@AutoId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WxUid",    SqlDbType.VarChar,   50),
                new SqlParameter("@SysUname", SqlDbType.VarChar,   50),
                new SqlParameter("@SysType",  SqlDbType.TinyInt,    1),
                new SqlParameter("@SchId",    SqlDbType.Int,        4),
                new SqlParameter("@Mobile",   SqlDbType.VarChar,   50),
                new SqlParameter("@RecTime",  SqlDbType.DateTime),
                new SqlParameter("@AutoId",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.WxUid;
            parameters[1].Value = model.SysUname;
            parameters[2].Value = model.SysType;
            parameters[3].Value = model.SchId;
            parameters[4].Value = model.Mobile;
            parameters[5].Value = model.RecTime;
            parameters[6].Value = model.AutoId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SchSystem.Model.WxMinUnSysUser model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into WxMinUnSysUser(");
            strSql.Append("WxUid,SysUname,SysType,SchId,Mobile,RecTime)");
            strSql.Append(" values (");
            strSql.Append("@WxUid,@SysUname,@SysType,@SchId,@Mobile,@RecTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WxUid",    SqlDbType.VarChar, 50),
                new SqlParameter("@SysUname", SqlDbType.VarChar, 50),
                new SqlParameter("@SysType",  SqlDbType.TinyInt,  1),
                new SqlParameter("@SchId",    SqlDbType.Int,      4),
                new SqlParameter("@Mobile",   SqlDbType.VarChar, 50),
                new SqlParameter("@RecTime",  SqlDbType.DateTime)
            };
            parameters[0].Value = model.WxUid;
            parameters[1].Value = model.SysUname;
            parameters[2].Value = model.SysType;
            parameters[3].Value = model.SchId;
            parameters[4].Value = model.Mobile;
            parameters[5].Value = model.RecTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SchSystem.Model.WxMinUnSysUser DataRowToModel(DataRow row)
 {
     SchSystem.Model.WxMinUnSysUser model = new SchSystem.Model.WxMinUnSysUser();
     if (row != null)
     {
         if (row["AutoId"] != null && row["AutoId"].ToString() != "")
         {
             model.AutoId = int.Parse(row["AutoId"].ToString());
         }
         if (row["WxUid"] != null)
         {
             model.WxUid = row["WxUid"].ToString();
         }
         if (row["SysUname"] != null)
         {
             model.SysUname = row["SysUname"].ToString();
         }
         if (row["SysType"] != null && row["SysType"].ToString() != "")
         {
             model.SysType = int.Parse(row["SysType"].ToString());
         }
         if (row["SchId"] != null && row["SchId"].ToString() != "")
         {
             model.SchId = int.Parse(row["SchId"].ToString());
         }
         if (row["Mobile"] != null)
         {
             model.Mobile = row["Mobile"].ToString();
         }
         if (row["RecTime"] != null && row["RecTime"].ToString() != "")
         {
             model.RecTime = DateTime.Parse(row["RecTime"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SchSystem.Model.WxMinUnSysUser GetModel(int AutoId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 AutoId,WxUid,SysUname,SysType,SchId,Mobile,RecTime from WxMinUnSysUser ");
            strSql.Append(" where AutoId=@AutoId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AutoId", SqlDbType.Int, 4)
            };
            parameters[0].Value = AutoId;

            SchSystem.Model.WxMinUnSysUser model = new SchSystem.Model.WxMinUnSysUser();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

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