Пример #1
0
 public ReaderService.Chapter ChaptertoSvcChapter(Models.Chapter b)
 {
     ReaderService.Chapter val = new ReaderService.Chapter();
     val.BookID            = b.BookID;
     val.ChapterAddress    = b.ChapterAddress;
     val.ChapterHtml       = b.ChapterHTML;
     val.ChapterID         = b.ChapterID;
     val.ChapterName       = b.ChapterName;
     val.ChapterText       = b.ChapterText;
     val.PreviousChapterID = b.PreviousChapterID;
     return(val);
 }
Пример #2
0
        public Models.Chapter GetLastChapter(int bookID)
        {
            //MasterController mc = new MasterController();
            Models.Chapter chap = new Models.Chapter();

            using (ReaderService.ReaderServiceSoapClient svc = new ReaderService.ReaderServiceSoapClient())
            {
                chap = this.SvcChaptertoChapter(svc.GetLastChapter(ProgramStatics.Token, bookID));
            }

            return(chap);
        }
Пример #3
0
        public Models.Chapter SvcChaptertoChapter(ReaderService.Chapter b)
        {
            Models.Chapter val = new Models.Chapter();
            val.BookID            = b.BookID;
            val.ChapterAddress    = b.ChapterAddress;
            val.ChapterHTML       = b.ChapterHtml;
            val.ChapterID         = b.ChapterID;
            val.ChapterName       = b.ChapterName;
            val.ChapterText       = b.ChapterText;
            val.PreviousChapterID = b.PreviousChapterID;

            return(val);
        }
Пример #4
0
        //public int PreviousChapterID { get; set; }


        public void SaveChapter()
        {
            if (string.IsNullOrEmpty(this.ChapterText))
            {
                return;
            }
            Models.Chapter c = new Models.Chapter();
            c.ChapterAddress = this.ChapterAddress;
            c.ChapterHTML    = Compression.CompressString(this.ChapterHtml);
            c.BookID         = this.BookID;
            c.ChapterName    = this.ChapterName;
            c.ChapterText    = Compression.CompressString(this.ChapterText);
            //return;
            int itemp = 0;

            if (!string.IsNullOrEmpty(this.PreviousChapterAddress))
            {
                using (ReaderServiceSoapClient svc = new ReaderServiceSoapClient())
                {
                    itemp = svc.GetPreviousChapterID(ProgramStatics.Token, this.PreviousChapterAddress, this.BookID);// GetPreviousChapterID();
                }
            }
            c.PreviousChapterID = itemp;

            int id;

            using (ReaderServiceSoapClient svc = new ReaderServiceSoapClient())
            {
                id = svc.ChapterExists(ProgramStatics.Token, this.ChapterAddress);// ChapterExists();
            }

            if (id >= 0)
            {
                c.ChapterID = id;
                using (ReaderServiceSoapClient svc = new ReaderServiceSoapClient())
                {
                    svc.OverwriteChapter(ProgramStatics.Token, this.ChaptertoSvcChapter(c));// OverwriteChapter(id);
                }
            }
            else
            {
                using (ReaderServiceSoapClient svc = new ReaderServiceSoapClient())
                {
                    svc.InsertChapter(ProgramStatics.Token, this.ChaptertoSvcChapter(c));// InsertChapter();
                }
            }
        }