using System;
using System.Data;
using System.Configuration;

using Sky.Darkness.Commons.DataAccess;

/// <summary>
/// PaperTitleNumberDAO 的摘要说明
/// </summary>
public class PaperTitleNumberDAO : GenericDaoSql<PaperTitleNumber, string>
{
    public PaperTitleNumberDAO()
    {
    }

    public int GetTitleNumberByType(int parentId,string titleType)
    {
        string strSql = "SELECT COUNT(*) FROM dbo.paperTitleNumber WHERE titleType='" + titleType + "' AND paperid=" + parentId;
        return (int)SqlHelper.ExecuteScalar(strSql);
    }

    public int AddTitleNumber(string titleType,int titleNumber,int paperId)
    {
        string strSql = "UPDATE dbo.paperTitleNumber SET titleNumber = titleNumber + " + titleNumber + " WHERE paperId=" + paperId + " AND titleType='" + titleType + "'";
        return (int)SqlHelper.ExecuteNonQuery(strSql);
    }

}
