public frmAddEditBook(FormCreatingReason reason)
        {
            InitializeComponent();
            try
            {
                bType = new BookType();
                bookTypeBindingSource.DataSource = bType;

                switch (reason)
                {
                    case FormCreatingReason.NewItem:
                        Text = "Новая книга учета";
                        _isEditing = false;
                        break;
                    case FormCreatingReason.EditItem:
                        tbTitle.Text = SelectedBook.Instance.Title;
                        cbBookType.SelectedValue = SelectedBook.Instance.Type;

                        Text = "Редактировать книгу учета";
                        _isEditing = true;
                        break;
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace, "Ooops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = DialogResult.None;
            }
        }
Exemple #2
0
    public static async Task <IBook> GetBookFromFile(IStorageFile file, BookType type, Windows.UI.Xaml.XamlRoot xamlRoot = null, bool skipPasswordEntryPdf = false)
    {
        switch (type)
        {
        case BookType.Epub: goto Epub;

        case BookType.Zip: goto Zip;

        case BookType.Rar: goto SharpCompress;

        case BookType.SevenZip: goto SharpCompress;

        case BookType.Pdf: goto Pdf;
        }


        Pdf :;
        return(await GetBookPdf(await file.OpenReadAsync(), file.Name, xamlRoot, skipPasswordEntryPdf));

        Zip :;
        return(await GetBookZip((await file.OpenReadAsync()).AsStream()));

        SharpCompress :;
        return(await GetBookSharpCompress((await file.OpenReadAsync()).AsStream()));

        Epub :;
        {
            return(new BookEpub(file));
        }
    }
Exemple #3
0
        public override void OnDoubleClick(Mobile from)
        {
            Player pm = from as Player;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }

            else if (pm.LevelofUnderstanding[(int)BookType] >= 100)
            {
                pm.SendMessage("You have already learned all you can about this language.");
            }
            else
            {
                pm.LevelofUnderstanding[(int)BookType] += Utility.RandomMinMax(1, 2);
                pm.SendMessage("Your knowledge of the {0} language has increased.", BookType.ToString());

                if (pm.LevelofUnderstanding[(int)BookType] > 100)
                {
                    pm.LevelofUnderstanding[(int)BookType] = 100;
                }

                Delete();
            }
        }
 public int Delete(BookType booktype)
 {
     //return (BookTypeDAL.Delete(booktype));
     ChangeString(booktype, 3);
     json = HttpHelper.Get(handlerurl);
     return(Convert.ToInt32(json));
 }
        private BookType GetTransformationBookType(XProcessingInstruction bookType, string logFormat,
                                                   string logValidValueFormat)
        {
            BookType     transformationBookType    = null;
            const string bookTypeName              = "BookType";
            const string invalidXsltTransformation = "Xslt tranformation without book type processing instruction.";

            if (bookType == null)
            {
                if (m_log.IsErrorEnabled)
                {
                    m_log.ErrorFormat(logFormat, bookTypeName);
                }

                throw new InvalidXsltTransformationException(invalidXsltTransformation);
            }
            BookTypeEnum value;

            if (Enum.TryParse(bookType.Data.Trim(), true, out value))
            {
                transformationBookType = m_categoryRepository.FindBookTypeByType(value);
            }
            else
            {
                if (m_log.IsErrorEnabled)
                {
                    m_log.ErrorFormat(logValidValueFormat, bookTypeName, bookType.Data);
                }
                throw new InvalidEnumArgumentException();
            }
            return(transformationBookType);
        }
Exemple #6
0
        public void Initialize()
        {
            TEST_QUANTITY                 = 5;
            TEST_ADD_QUANTITY             = 4;
            TEST_CAT_NAME                 = "testowa kategoria";
            testCategory                  = new Category();
            testCategory.Name             = TEST_CAT_NAME;
            testBook                      = new BookType();
            testGetBook                   = new BookType();
            testBook.Id                   = 47123;
            testBook.Title                = "Książka testowa";
            testBook.Authors              = "Autor testowy";
            testBook.Category             = testCategory;
            testBook.QuantityMap          = new QuantityMap();
            testBook.QuantityMap.Quantity = TEST_QUANTITY;
            testBook.Price                = 40;


            categoryList = new List <Category>();
            bookTypeList = new List <BookType>();

            booksInformationDaoMock = _factory.CreateMock <IBooksInformationDao>();
            bis.BooksInformationDao = booksInformationDaoMock.MockObject;
            sms.BooksInformationDao = booksInformationDaoMock.MockObject;

            booksInformationDaoMock.Expects.One.MethodWith <IEnumerable <BookType> >(x => x.GetAllBooks()).WillReturn(bookTypeList);
            booksInformationDaoMock.Expects.One.MethodWith <IList <Category> >(x => x.GetAllCategories()).WillReturn(categoryList);
            booksInformationDaoMock.Expects.One.MethodWith <BookType>(x => x.GetBookTypeById(testBook.Id)).WillReturn(testBook);
            booksInformationDaoMock.Expects.One.MethodWith <BookType>(x => x.GetBookTypeById(testGetBook.Id)).WillReturn(testGetBook);

            storehouseManagementDaoMock = _factory.CreateMock <IStorehouseManagementDao>();
            sms.StorehouseManagementDao = storehouseManagementDaoMock.MockObject;

            NMock.Actions.InvokeAction markSold = new NMock.Actions.InvokeAction(new Action(() => changeQuantity()));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.MarkSold(testBook.Id, testBook.QuantityMap.Quantity)).Will(markSold);
            storehouseManagementDaoMock.Expects.One.MethodWith <bool>(x => x.MarkSold(-1, 5)).WillReturn(false);

            NMock.Actions.InvokeAction saveCategory = new NMock.Actions.InvokeAction(new Action(() => categoryList.Add(testCategory)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.SaveCategory(testCategory)).Will(saveCategory);
            NMock.Actions.InvokeAction saveBookType = new NMock.Actions.InvokeAction(new Action(() => bookTypeList.Add(testBook)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.SaveBookType(testBook)).Will(saveBookType);
            NMock.Actions.InvokeAction addCategory = new NMock.Actions.InvokeAction(new Action(() => categoryList.Add(testCategory)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.AddCategory(TEST_CAT_NAME)).Will(addCategory);
            NMock.Actions.InvokeAction addBookType = new NMock.Actions.InvokeAction(new Action(() => bookTypeList.Add(testBook)));
            storehouseManagementDaoMock.Expects.Any.MethodWith(x => x.AddBookType(testBook.Title, testBook.Authors, testBook.Price, TEST_QUANTITY, testBook.Category)).Will(addBookType);
            // NMock.Actions.InvokeAction addQuantity = new NMock.Actions.InvokeAction(new Action(() =>

            quantityMap = new QuantityMap()
            {
                Quantity = 0
            };

            image = new BookImage()
            {
                URL = ""
            };
            category = new Category()
            {
            };
        }
 public Book(String title, String author, DateTime releaseDate, BookType type = BookType.UNKNOWN)
 {
     this.title = title;
     this.author = author;
     this.releaseDate = releaseDate;
     this.type = type;
 }
Exemple #8
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(Title);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(Author.ToString());
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(BookType.ToString());
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(CurrencySymbol);
            writer.Write("&nbsp;");
            writer.Write(String.Format("{0:F2}", Price));
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderEndTag();
        }
        public async Task<IActionResult> Edit(int id, [Bind("Name,Id")] BookType bookType)
        {
            if (id != bookType.Id)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bookType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookTypeExists(bookType.Id))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(bookType);
        }
Exemple #10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            BookType BookType = new BookType();

            int flag = Convert.ToInt32(context.Request["flag"]);

            BookType.ID   = Convert.ToInt32(context.Request["ID"]);
            BookType.Name = context.Request["Name"];
            BookType.Day  = Convert.ToInt32(context.Request["Day"]);

            if (flag == 0)
            {
                DataTable GetBookType = BookTypeDAL.GetBookType();
                string    json        = Common.JsonHelper.DataSetToJson(GetBookType);
                context.Response.Write(json);
            }
            else if (flag == 1)
            {
                int Insert = BookTypeDAL.Insert(BookType);
                context.Response.Write(Insert);
            }
            else if (flag == 2)
            {
                int Update = BookTypeDAL.Update(BookType);
                context.Response.Write(Update);
            }
            else if (flag == 3)
            {
                int Delete = BookTypeDAL.Delete(BookType);
                context.Response.Write(Delete);
            }
        }
Exemple #11
0
        public static List <BookType> GetBookTypeList()
        {
            List <BookType> list = new List <BookType>();

            BookType  bt = null;
            DataTable dt = DBHelper.GetDataTable(@"SELECT [typeID]
                                              ,[typeName]
                                              ,[borrowDay]
                                               FROM[dbo].[tb_bookType]");

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    try
                    {
                        bt           = new BookType();
                        bt.typeID    = dr["typeID"] == DBNull.Value ? -1 : (int)dr["typeID"];
                        bt.typeName  = dr["typeName"] == DBNull.Value ? string.Empty : dr["typeName"].ToString().Trim();
                        bt.borrowDay = dr["borrowDay"] == DBNull.Value ? -1 : (int)dr["borrowDay"];
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    finally
                    {
                        list.Add(bt);
                    }
                }
            }


            return(list);
        }
Exemple #12
0
 public Book(string author, string title, string pages, BookType type) // cia enum konstruktoriuje ?
 {
     this.BookAuthor = author;
     this.BookTitle  = title;
     this.BookPages  = pages;
     BookID          = Guid.NewGuid();
 }
Exemple #13
0
        private void search_Click(object sender, EventArgs e)
        {
            if (!Check())
            {
                return;
            }
            table.Clear();
            Book book = new Book();

            book.Name   = bkname_rbtn.Checked ? key : "";
            book.Author = auth_rbtn.Checked ? key : "";
            book.ISBN   = isbn_rbtn.Checked ? key : "";
            book.Press  = press_rbtn.Checked ? key : "";
            List <BookMaster> bklist = new List <BookMaster>(SearchByKeyword(book));
            int      i           = bkTypebox.SelectedIndex;
            bool     define_type = i > 0;
            BookType bookType    = i > 1 ? (BookType)(i - 1) : 0;

            foreach (BookMaster b in bklist)
            {
                if (!(define_type && b.Info.Type != bookType))
                {
                    Add(b.Info);
                }
            }
            //table.AcceptChanges();
        }
Exemple #14
0
        public async Task <IActionResult> Create(BookViewModel bookViewModel)
        {
            try
            {
                Language language = _dbContext.Languages.Find(bookViewModel.selectedLanguage);
                BookType bookType = _dbContext.BookTypes.Find(bookViewModel.selectedBookType);

                Book book = new Book
                {
                    ID          = bookViewModel.ID,
                    Name        = bookViewModel.Name,
                    Discription = bookViewModel.Discription,
                    BookType    = bookType,
                    Language    = language
                };
                _dbContext.Books.Add(book);
                await _dbContext.SaveChangesAsync();

                return(RedirectToPage("/Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #15
0
 public Book(BookType type, string barcode, int pageCount)
 {
     GoodType = CategoryHelper.CreateCategory("Книги");
     GoodCategory = CategoryHelper.CreateCategory(type.Theme, GoodType.Id);
     Barcode = barcode;
     PageCount = pageCount;
 }
Exemple #16
0
        // GET: BookType/Create
        public ActionResult Create()
        {
            BookType bookType = new BookType();

            bookType.ID = Guid.NewGuid();
            return(View(bookType));
        }
Exemple #17
0
        private void FrmProduct_Load(object sender, EventArgs e)
        {
            if (state != "update")
            {
                this.Btn_Confirm.Visible = false;
                this.Btn_Update.Visible  = false;
            }
            else
            {
                this.Txt_Number.ReadOnly = true;
                this.Txt_Name.ReadOnly   = true;
                this.Txt_Amount.ReadOnly = true;
                this.Txt_RateA.ReadOnly  = true;
                this.Txt_RateB.ReadOnly  = true;
                this.Btn_Confirm.Visible = false;
                this.Btn_Add.Visible     = false;

                type = DAL.dalBook.getSomeType(barcode);
                this.Txt_Number.Text = type.Number;
                this.Txt_Name.Text   = type.Name;
                this.Txt_Amount.Text = type.amount.ToString();
                this.Txt_RateA.Text  = type.rateA.ToString();
                this.Txt_RateB.Text  = type.rateB.ToString();
            }
        }
Exemple #18
0
        public void Deserialize(string path)
        {
            string[] data = File.ReadAllLines("file.txt");
            BookList.Clear();
            for (int i = 0; i < data.Length / 2; i++)
            {
                BookType type = BookType.Unknown;
                int      code = Int32.Parse(data[i * 2 + 1]);
                switch (data[i * 2])
                {
                case "Horror":
                    type = BookType.Horror;
                    break;

                case "Comedy":
                    type = BookType.Comedy;
                    break;

                case "Drama":
                    type = BookType.Drama;
                    break;
                }
                BookList.Add(new LibraryBook(type, code));
            }
        }
 public Book(string name, Author author, string description, BookType bookType)
 {
     _name        = name;
     _author      = author;
     _description = description;
     _bookType    = bookType;
 }
 public Book(SerializationInfo info, StreamingContext context)
 {
     _name        = info.GetString("name");
     _author      = (Author)info.GetValue("author", typeof(Author));
     _description = info.GetString("description");
     _bookType    = (BookType)info.GetValue("bookType", typeof(BookType));
 }
Exemple #21
0
        public void WrongCategoryIdRightUserParameterTest()
        {
            List <BookType> bookList = new List <BookType>();

            for (long i = 0; i < 10; i++)
            {
                BookType bookd = new BookType()
                {
                    Id = i
                };
                bookList.Add(bookd);
                booksInformationServiceMock.
                Expects.
                Any.
                MethodWith(x => x.GetBookTypeById(i)).WillReturn(bookd);
            }

            long wrongCategoryId = -1;



            booksInformationServiceMock.Expects.One.
            MethodWith(x => x.GetBooksByCategoryId(wrongCategoryId)).
            WillReturn(new List <BookType>());

            booksInformationServiceMock.Expects.One.
            MethodWith(x => x.GetAllBooks()).
            WillReturn(bookList);



            IEnumerable <BookType> result = suggestionService.GetSuggestionsForUser(0, wrongCategoryId);

            Assert.AreEqual(result.Count(), 5);
        }
Exemple #22
0
        public static List <BookType> GetBookType()
        {
            var dbUtil   = new DatabaseManager();
            var bookType = new List <BookType>();

            using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB")))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.CommandText    = "spGetBookType_Prooflist";
                    cmd.CommandTimeout = 180;
                    cmd.Parameters.Clear();
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var book = new BookType
                            {
                                ID             = ReferenceEquals(reader["ID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["ID"]),
                                strDescription = ReferenceEquals(reader["strDescription"], DBNull.Value) ? "" : Convert.ToString(reader["strDescription"]),
                            };
                            bookType.Add(book);
                        }
                    }
                }
            }
            return(bookType);
        }
Exemple #23
0
        public void Print(BookType bookType)
        {
            switch (bookType)
            {
            case BookType.All:
                foreach (var book in _books)
                {
                    book.Print();
                }
                break;

            case BookType.Technical:
                foreach (var book in _books)
                {
                    if (book is TecnicalBook)
                    {
                        book.Print();
                    }
                }
                break;

            case BookType.Fiction:
                foreach (var book in _books.Where(c => c is FictionBook))
                {
                    if (book is FictionBook)
                    {
                        book.Print();
                    }
                }
                break;
            }
        }
Exemple #24
0
        //Select an event triggered by a node in TreeView
        private void tvBookType_AfterSelect(object sender, TreeViewEventArgs e)
        {
            //Gets the information for the selection node
            TreeNode objTreeNode = tvBookType.SelectedNode;

            //Assign a value
            txtTypeId.Text   = objTreeNode.Tag.ToString();
            txtTypeName.Text = objTreeNode.Text;

            //Classification for judgment
            if (txtTypeId.Text == "1")  //Node
            {
                txtParentTypeId.Text   = "NULL";
                txtParentTypeName.Text = "NULL";
                rtbDESC.Text           = objBookTypeServices.GetTypeDESC(Convert.ToInt32(txtTypeId.Text));
            }
            else
            {
                //Get parent Information
                BookType objBookType = objBookTypeServices.GetParentType(Convert.ToInt32(txtTypeId.Text));
                //Assign a value
                rtbDESC.Text           = objBookType.DESC;
                txtParentTypeId.Text   = objBookType.TypeId.ToString();
                txtParentTypeName.Text = objBookType.TypeName;
            }
        }
 internal Book(int bookNumber, BookType testament, string name, string abbreviation)
 {
     Number = bookNumber;
     Testament = testament;
     Name = name;
     Abbreviation = abbreviation;
 }
        public ActionResult Edit(BookType bookType)
        {
            if (ModelState.IsValid)
            {
                db.Entry(bookType).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    if (ex.InnerException.InnerException.Message.Contains("_Index"))
                    {
                        ModelState.AddModelError(string.Empty, "El género no puede ser guardado porque existe uno con el mismo nombre.");
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, ex.Message);
                    }
                }
            }

            return(View(bookType));
        }
Exemple #27
0
        public Book InsertBook(string title, string authF, string authL, BookType type, TypeSql typeSql)
        {
            Book book = new Book();

            if (true)
            {
                try
                {
                    con.Open();
                    cmd.CommandText = "INSERT INTO book (book_title, book_auth_first, book_auth_last, book_type) VALUES(@TITLE, @FIRST, @LAST, @TYPE)";
                    cmd.Parameters.AddWithValue("@TITLE", title);
                    cmd.Parameters.AddWithValue("@FIRST", authF);
                    cmd.Parameters.AddWithValue("@LAST", authL);
                    cmd.Parameters.AddWithValue("@TYPE", type.Id);
                    cmd.ExecuteNonQuery();
                }
                catch (MySqlException e)
                {
                    book.Title = e.ToString();
                    log.Error("Insert Book Query Failure", e);
                }
                finally
                {
                    con.Close();
                }
            }
            else
            {
                book.Title = "Missing Parameters";
            }
            return(book);
        }
Exemple #28
0
        protected override int ExecuteWorkImplementation()
        {
            var bookTypeEnum = Mapper.Map <BookTypeEnum>(m_data.BookType);
            var bookType     = m_categoryRepository.GetBookTypeByEnum(bookTypeEnum);

            if (bookType == null)
            {
                bookType = new BookType {
                    Type = bookTypeEnum
                };
                m_categoryRepository.Create(bookType);
            }

            var parentCategory = m_data.ParentCategoryId != null
                ? m_categoryRepository.FindById <DataEntities.Database.Entities.Category>(m_data.ParentCategoryId)
                : null;

            var parentPath = parentCategory != null ? parentCategory.Path : string.Empty;

            var category = new DataEntities.Database.Entities.Category
            {
                BookType       = bookType,
                Description    = m_data.Description,
                ExternalId     = m_data.ExternalId,
                Path           = string.Empty,
                ParentCategory = parentCategory
            };
            var resultId = (int)m_categoryRepository.Create(category);

            category.Path = string.Format("{0}/{1}", parentPath, resultId);
            m_categoryRepository.Update(category);

            return(resultId);
        }
Exemple #29
0
        public void BookTypeShouldBePrintedIfNemBookIsCreatedByDefault()
        {
            BookType expected = BookType.Printed;
            var      book     = new Book();

            Assert.Equal(expected, book.Type);
        }
 internal Book(int bookNumber, BookType testament, string name, string abbreviation)
 {
     Number       = bookNumber;
     Testament    = testament;
     Name         = name;
     Abbreviation = abbreviation;
 }
Exemple #31
0
 public Book(string name, string author, int year, BookType genre)
 {
     this.Name   = name;
     this.Author = author;
     this.Year   = year;
     this.Genre  = genre;
 }
Exemple #32
0
        public ActionResult AddNewType(string typeCode, string typeName)
        {
            string imgSrc = String.Empty;

            if (Session["TypeImgPath"] != null && Session["TypeImgPath"].ToString() != "")
            {
                imgSrc = (string)Session["TypeImgPath"];
            }
            BookType bt = new BookType()
            {
                Id       = Guid.NewGuid().ToString(),
                TypeCode = typeCode,
                TypeName = typeName,
                ImgSrc   = imgSrc
            };

            Session["TypeImgPath"] = null;
            bool success = btManager.InsertBookType(bt);//.AddInfo(upi);

            if (success)
            {
                TempData["mess"] = "成功添加新类型:" + bt.TypeName;
            }
            return(Redirect("Index"));
        }
        public async Task <int> Removetype(BookType bookType)
        {
            _DBContext.BookType.Remove(bookType);
            await _DBContext.SaveChangesAsync();

            return(0);
        }
        public async Task <int> UpdateType(BookType bookType)
        {
            _DBContext.BookType.Update(bookType);
            await _DBContext.SaveChangesAsync();

            return(bookType.Id);
        }
 public TypeButton(BookType begin)
     : this()
 {
     current = begin;
     this.Width = 482;
     this.Height = 114;
     setCurrentImage();
 }
        public frmAddEditCategory()
        {
            InitializeComponent();
            try
            {
                cType = new BookType();
                bookTypeBindingSource.DataSource = cType;

                Text = "Новая категория";

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace, "Ooops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = DialogResult.None;
            }
        }
Exemple #37
0
 public IList<BookInfo> GetBook(BookType type)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     List<BookInfo> books = new List<BookInfo>();
     SqlParameter[] objParams = new SqlParameter[1];
     objParams[0] = new SqlParameter("@type", SqlDbType.Int, 4);
     objParams[0].Value = (int)type;
     SqlDataReader reader = objSqlHelper.ExecuteReader("je_Book_GetBook",objParams);
     while (reader.Read())
     {
         BookInfo item = new BookInfo();
         item = GetBookByID(reader.GetInt32(reader.GetOrdinal("BookID")));
         books.Add(item);
     }
     reader.Close();
     return books;
 }
        public static CategoriesListDS FillData(int account)
        {
            CategoriesListDS _dsSource = new CategoriesListDS();
            BookType bType = new BookType();

            using (SQLiteConnection con = new SQLiteConnection(Settings.Default.AccountingConnectionString))
            {
                using (SQLiteCommand cmd = new SQLiteCommand())
                {
                    cmd.Connection = con;
                    cmd.CommandText = @"SELECT categoryId, type, title, (SELECT SUM(records.thesum) FROM records WHERE records.category=categoryId AND records.income='True') as 'income', (SELECT SUM(records.thesum) FROM records WHERE records.category=categoryId AND records.income='False') as 'expense' FROM category WHERE category.account=@account";

                    SQLiteParameter pAccount = new SQLiteParameter("account", account);
                    pAccount.Direction = ParameterDirection.Input;

                    cmd.Parameters.Add(pAccount);
                    con.Open();
                    using (SQLiteDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        while (rdr.Read())
                        {
                            decimal income = rdr.GetValue(3).GetType() == typeof(DBNull)?0:rdr.GetDecimal(3);
                            decimal expense = rdr.GetValue(4).GetType() == typeof(DBNull) ? 0 : rdr.GetDecimal(4);
                            string type = "";
                            bType.TryGetValue(rdr.GetString(1),out type);

                            _dsSource.Tables["Category"].Rows.Add(new object[] {
                                null,
                                rdr.GetInt32(0),
                                rdr.GetString(1),
                                type,
                                rdr.GetString(2),
                                income,
                                expense
                            });

                        }
                    }

                }
            }

            return _dsSource;
        }
        public frmAddEditCategory(int categoryId, string title, string type)
        {
            InitializeComponent();
            try
            {
                cType = new BookType();
                bookTypeBindingSource.DataSource = cType;

                tbTitle.Text = title;
                cbCategoryType.SelectedValue = type;
                _categoryId = categoryId;
                _originalType = type;

                Text = "Редактировать категорию";
                _isEditing = true;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace, "Ooops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = DialogResult.None;
            }
        }
Exemple #40
0
partial         void OnBookTypeChanging(BookType value);
Exemple #41
0
 /// <summary>
 /// 获取图书信息
 /// </summary>
 /// <returns></returns>
 public static IList<BookInfo> GetBook(BookType type)
 {
     return books.GetBook(type);
 }
 public void safeSetCurrent(BookType newType)
 {
     current = newType;
     setCurrentImage();
 }
 void swap(object sender, EventArgs e)
 {
     int c = ((int)current+1)%3;
     current = (BookType)c;
     setCurrentImage();
 }
 public void ToggleShowingType()
 {
     Debug.Log("ToggleShowingType");
     if (this.canToggle)
     {
         if (this.showingBookType == BookType.Normal)
         {
             this.showingBookType = BookType.Modify;
         }
         else
         {
             this.showingBookType = BookType.Normal;
         }
         this.UpdateUserShip();
     }
 }
 public Book[] GetBooksOfType(BookType type)
 {
     return Store.Select<Book>("BookType", type);
 }
        public Book[] GetBooksOfType(BookType type)
        {
            var books = new List<Book>();

            using (SqlCeCommand cmd = new SqlCeCommand(
                string.Format("SELECT * FROM Book WHERE BookType = {0}", (int)type), Connection))
            {
                using (var results = cmd.ExecuteResultSet(ResultSetOptions.Insensitive))
                {
                    CheckOrdinals(results);

                    while (results.Read())
                    {

                        books.Add(new Book
                        {
                            BookID = results.GetInt32(m_bookOrdinals["BookID"]),
                            AuthorID = results.GetInt32(m_bookOrdinals["AuthorID"]),
                            Title = results.GetString(m_bookOrdinals["Title"])
                        });
                    }
                }
            }

            return books.ToArray();
        }
Exemple #47
0
 public void SetAdditionalProperty(BookType type)
 {
     SpecializedCollection<string, string> additionalPropertyCollection = new SpecializedCollection<string, string>();
     additionalPropertyCollection.Add(type.Theme, type.Property);
     OtherPropertiesJSON = JsonConvert.SerializeObject(additionalPropertyCollection);
 }
 internal static Book Create(BookType testament, string name, string abbreviation)
 {
     if (testament == BookType.NewTestament) _newTestament++;
     else if (testament == BookType.OldTestament) _oldTestament++;
     Book b = new Book(testament == BookType.NewTestament ? _newTestament : _oldTestament,testament,name, abbreviation);
     return b;
 }
Exemple #49
0
 public Book()
 {
     Format = BookType.Paperback;
 }
Exemple #50
0
		public BookBuilder IsType(BookType bookType)
		{
			book.BookType = bookType;
			return this;
		}