示例#1
0
    public DataSet GetNewsDetail(int newsId)
    {
        if (1 > newsId)
        {
            return(new DataSet());
        }

        string procedureName = "News_Browse";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@News_ID", SqlDbType.Int, -1, newsId) };
        return(base.GetDataSet(procedureName, parameters));
    }
示例#2
0
    public int DeleteNews(int newsId)
    {
        if (1 > newsId)
        {
            return(0);
        }

        string procedureName = "News_Delete";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@News_ID", SqlDbType.Int, -1, newsId) };

        return(Convert.ToInt32(base.ExecStoredProcedure(procedureName, parameters)));
    }
    public string GetInformationName(int informationId)
    {
        if (1 > informationId)
        {
            return(string.Empty);
        }

        string sql = "SELECT name FROM category WHERE id = @InformationId";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@InformationId", SqlDbType.Int, -1, informationId) };

        return(base.GetSingleDataInColumn(sql, parameters, "name"));
    }
    public DataSet GetInformation(int categoryId)
    {
        if (1 > categoryId)
        {
            return(new DataSet());
        }

        string sql = "SELECT * FROM View_Information_List WHERE category_id = @CategoryId";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@CategoryId", SqlDbType.Int, -1, categoryId) };

        return(base.GetDataSet(sql, parameters));
    }
示例#5
0
    public int GetNewsPageCountOutline(int outlineId, int pageSize)
    {
        if (1 > outlineId || 1 > pageSize)
        {
            return(0);
        }

        string procedureName = "News_Calculate_Page_Outline";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@Outline_Type", SqlDbType.Int, -1, outlineId),
                                      BasicDAO.MakeInParameter("@Page_Size",    SqlDbType.Int, -1, pageSize) };

        return(Convert.ToInt32(base.ExecStoredProcedure(procedureName, parameters)));
    }
示例#6
0
    public string IsSupervisor(string alias, string cipher)
    {
        if (null == alias || null == cipher || alias.Equals(string.Empty) || cipher.Equals(string.Empty) || 20 < alias.Length || 20 < cipher.Length)
        {
            return(string.Empty);
        }

        string sql = "SELECT id FROM supervisor WHERE alias = @inAlias and cipher = @inCipher";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@inAlias",  SqlDbType.NVarChar, alias.Length,  alias),
                                      BasicDAO.MakeInParameter("@inCipher", SqlDbType.NVarChar, cipher.Length, cipher) };

        return(base.GetSingleDataInColumn(sql, parameters, "id"));
    }
    public int UpdateInformation(int informationId, string inArticle)
    {
        if (1 > informationId)
        {
            return(0);
        }
        string article = (null == inArticle) ? string.Empty : inArticle;

        string procedureName = "Information_Modify";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@Category_Id", SqlDbType.Int,                  -1, informationId),
                                      BasicDAO.MakeInParameter("@Article",     SqlDbType.NVarChar, article.Length, article) };

        return(Convert.ToInt32(base.ExecStoredProcedure(procedureName, parameters)));
    }
示例#8
0
    public int EditNews(int newsID, int categoryID, string title, string article)
    {
        if (1 > categoryID || null == title || null == article || title.Equals(string.Empty) || article.Equals(string.Empty))
        {
            return(0);
        }

        string sql = "News_Edit";

        SqlParameter[] parameter = { BasicDAO.MakeInParameter("@News_ID",     SqlDbType.Int,                  -1, newsID),
                                     BasicDAO.MakeInParameter("@Category_ID", SqlDbType.Int,                  -1, categoryID),
                                     BasicDAO.MakeInParameter("@Title",       SqlDbType.NChar,    title.Length,   title),
                                     BasicDAO.MakeInParameter("@Article",     SqlDbType.NVarChar, article.Length, article) };

        return(Convert.ToInt32(ExecStoredProcedure(sql, parameter).ToString()));
    }
示例#9
0
    public int PublishNews(int categoryId, int supervisorId, string title, string article)
    {
        if (1 > categoryId || 1 > supervisorId ||
            null == title || null == article || title.Equals(string.Empty) || article.Equals(string.Empty))
        {
            return(0);
        }

        string procedureName = "News_Publish";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@Category_ID",   SqlDbType.Int,      -1, categoryId),
                                      BasicDAO.MakeInParameter("@Supervisor_ID", SqlDbType.Int,      -1, supervisorId),
                                      BasicDAO.MakeInParameter("@Title",         SqlDbType.NVarChar, -1, title),
                                      BasicDAO.MakeInParameter("@Article",       SqlDbType.NVarChar, -1, article) };

        return(Convert.ToInt32(base.ExecStoredProcedure(procedureName, parameters)));
    }
示例#10
0
    public DataSet GetSingleOutlineNewsListWithPageNumber(int outlineId, int pageSize, int pageRequest)
    {
        if (1 > outlineId || 1 > pageSize || 1 > pageRequest)
        {
            return(new DataSet());
        }

        string procedureName = "News_Get_List_Outline";

        SqlParameter[] parameters = { BasicDAO.MakeInParameter("@Outline_Type", SqlDbType.Int, -1, outlineId),
                                      BasicDAO.MakeInParameter("@Page_Size",    SqlDbType.Int, -1, pageSize),
                                      BasicDAO.MakeInParameter("@Page_Request", SqlDbType.Int, -1, pageRequest) };

        DataSet result = base.ExecStoredProcedureGetDataSet(procedureName, parameters) as DataSet;

        return((null == result) ? new DataSet() : result);
    }
示例#11
0
    public DataSet GetAllCategory()
    {
        string    sql      = "SELECT * FROM outline";
        DataTable outlines = base.GetDataTable(sql, null);
        DataSet   dataSet  = new DataSet();

        foreach (DataRow dr in outlines.Rows)
        {
            sql = "SELECT * FROM category WHERE outline_id = @outlineId";
            SqlParameter[] parameters    = { BasicDAO.MakeInParameter("@outlineId", SqlDbType.Int, -1, Convert.ToInt32(dr["id"])) };
            DataTable      categoryTable = base.GetDataTable(sql, parameters);
            categoryTable.TableName = dr["id"].ToString();
            dataSet.Tables.Add(categoryTable);
        }

        return(dataSet);
    }