/// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(SeatManage.ClassModel.LibraryInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_SM_Library(");
            strSql.Append("LibraryNo,LibraryName,SchoolNo,AreaInfo)");
            strSql.Append(" values (");
            strSql.Append("@LibraryNo,@LibraryName,@SchoolNo,@AreaInfo)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LibraryNo",   SqlDbType.NVarChar,  50),
                new SqlParameter("@LibraryName", SqlDbType.NVarChar, 100),
                new SqlParameter("@SchoolNo",    SqlDbType.Int,        4),
                new SqlParameter("@AreaInfo",    SqlDbType.Text)
            };
            parameters[0].Value = model.No;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.School.No;
            parameters[3].Value = model.AreaToXml();
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SeatManage.ClassModel.LibraryInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_SM_Library set ");
            strSql.Append("LibraryName=@LibraryName,");
            strSql.Append("SchoolNo=@SchoolNo,");
            strSql.Append("AreaInfo=@AreaInfo");
            strSql.Append(" where LibraryNo=@LibraryNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LibraryName", SqlDbType.NVarChar, 100),
                new SqlParameter("@SchoolNo",    SqlDbType.Int,        4),
                new SqlParameter("@AreaInfo",    SqlDbType.Text),
                new SqlParameter("@LibraryNo",   SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.School.No;
            parameters[2].Value = model.AreaToXml();
            parameters[3].Value = model.No;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 新增图书馆
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool AddNewLibrary(SeatManage.ClassModel.LibraryInfo model)
 {
     try
     {
         return(t_sm_library_dal.Add(model));
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 删除图书馆
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool DeleteLibrary(SeatManage.ClassModel.LibraryInfo model)
 {
     try
     {
         return(t_sm_library_dal.Delete(model));
     }
     catch
     {
         throw;
     }
 }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(SeatManage.ClassModel.LibraryInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from T_SM_Library ");
            strSql.Append(" where LibraryNo=@LibraryNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LibraryNo", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.No;

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

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