コード例 #1
0
ファイル: BooksController.cs プロジェクト: yenrr/Code
    /// <summary>
    /// Add a new book instance to that product
    /// </summary>
    /// <param name="title"></param>
    /// <param name="isbn"></param>
    /// <param name="product_mode"></param>
    /// <param name="sPublisherNumber"></param>
    /// <param name="sPublisherName"></param>
    /// <param name="productID"></param>
    /// <param name="subtitle"></param>
    /// <param name="edition"></param>
    /// <param name="copyRightYear"></param>
    /// <param name="desc"></param>
    /// <param name="BindingTypeNumber"></param>
    /// <returns></returns>
    public BookInstance AddBookInstance(string title, string isbn, string product_mode, ref string sPublisherNumber, ref string sPublisherName,
                                        decimal productID, string subtitle, string edition, string copyRightYear, string desc, string BindingTypeNumber = "")
    {
        SDSPortalApplication app           = new SDSPortalApplication();
        BookInstance         _bookinstance = new BookInstance();

        string[] sTitle = title.Split('^');
        if (sTitle.Length > 0 && sTitle.Length > 1 && product_mode == "existing")
        {
            _bookinstance.BOOK_TITLE = sTitle[0];
            string[] sBookNumberPublisher = sTitle[1].Split(',');
            if (sBookNumberPublisher.Length > 1)
            {
                sPublisherNumber = sBookNumberPublisher[1]; // GetPublisher(_book.BOOK_NUMBER, "book") ;
                sPublisherName   = _publishersController.GetPublisherName(sPublisherNumber);
            }
        }
        else
        {
            _bookinstance.BOOK_TITLE = title;
        }
        _bookinstance.PRODUCT_ID    = productID;
        _bookinstance.DATE_ADDED    = DateTime.Now;
        _bookinstance.BOOK_SUBTITLE = subtitle;

        _bookinstance.BOOK_EDITION      = edition;
        _bookinstance.BOOK_COPYRIGHT_YR = copyRightYear;
        _bookinstance.DESCRIPTION       = desc;

        Book _book = AddBook(isbn, sPublisherNumber, sPublisherName, _bookinstance.BOOK_TITLE, BindingTypeNumber);

        _bookinstance.BOOK_ID = _book.BOOK_ID;

        _bookinstance.Add(app.SDSConnection);
        return(_bookinstance);
    }