Ejemplo n.º 1
0
        private string GetCategoryList()
        {
            CategoryService = new CategoryService();
            List <object> CategoryObj = BaseService.GetObjectList(CategoryService, Request);

            CategoryCount = CategoryService.ObjectCount();
            if (CategoryObj != null)
            {
                List <category> Categories            = (List <category>)ObjectUtil.ConvertList(CategoryObj, typeof(List <category>));
                List <category> CategoriesToSerialize = new List <category>();
                if (Categories.Count > 0)
                {
                    foreach (category Category in Categories)
                    {
                        category NewClass = (category)ObjectUtil.GetObjectValues(new string[] {
                            "id", "category_name"
                        }, Category);
                        CategoriesToSerialize.Add(NewClass);
                    }

                    return(JsonConvert.SerializeObject(CategoriesToSerialize));
                }
                return("0");
            }
            return("0");
        }
Ejemplo n.º 2
0
        private string GetVisitsList()
        {
            VisitService = new VisitService();
            List <object> VisitsObj = BaseService.GetObjectList(VisitService, Request);

            VisitCount = VisitService.ObjectCount();
            if (VisitsObj != null)
            {
                List <visit> Visits            = (List <visit>)ObjectUtil.ConvertList(VisitsObj, typeof(List <visit>));
                List <visit> VisitsToSerialize = new List <visit>();
                if (Visits.Count > 0)
                {
                    foreach (visit Vst in Visits)
                    {
                        visit Visit = (visit)ObjectUtil.GetObjectValues(new string[] {
                            "id", "student_id", "date", "info"
                        }, Vst);

                        VisitsToSerialize.Add(Visit);
                    }

                    return(JsonConvert.SerializeObject(VisitsToSerialize));
                }
                return("0");
            }
            return("0");
        }
Ejemplo n.º 3
0
        private string GetAuthorList()
        {
            AuthorService = new AuthorService();
            List <object> AuthorObj = BaseService.GetObjectList(AuthorService, Request);

            AuthorCount = AuthorService.ObjectCount();
            if (AuthorObj != null)
            {
                List <author> Authors            = (List <author>)ObjectUtil.ConvertList(AuthorObj, typeof(List <author>));
                List <author> AuthorsToSerialize = new List <author>();
                if (Authors.Count > 0)
                {
                    foreach (author Auhtor in Authors)
                    {
                        author NewClass = (author)ObjectUtil.GetObjectValues(new string[] {
                            "id", "name", "address", "email", "phone"
                        }, Auhtor);
                        AuthorsToSerialize.Add(NewClass);
                    }

                    return(JsonConvert.SerializeObject(AuthorsToSerialize));
                }
                return("0");
            }
            return("0");
        }
Ejemplo n.º 4
0
        private string GetPublisherList()
        {
            PublisherService = new PublisherService();
            List <object> PublisherObj = BaseService.GetObjectList(PublisherService, Request);

            PublisherCount = PublisherService.ObjectCount();
            if (PublisherObj != null)
            {
                List <publisher> Publishers            = (List <publisher>)ObjectUtil.ConvertList(PublisherObj, typeof(List <publisher>));
                List <publisher> PublishersToSerialize = new List <publisher>();
                if (Publishers.Count > 0)
                {
                    foreach (publisher Publisher in Publishers)
                    {
                        publisher NewClass = (publisher)ObjectUtil.GetObjectValues(new string[] {
                            "id", "name", "address", "contact"
                        }, Publisher);
                        PublishersToSerialize.Add(NewClass);
                    }

                    return(JsonConvert.SerializeObject(PublishersToSerialize));
                }
                return("0");
            }
            return("0");
        }
Ejemplo n.º 5
0
        private string GetClassList()
        {
            ClassService = new ClassService();
            List <object> ClassObj = BaseService.GetObjectList(ClassService, Request);

            ClassCoount = ClassService.ObjectCount();
            if (ClassObj != null)
            {
                List <@class> Classes            = (List <@class>)ObjectUtil.ConvertList(ClassObj, typeof(List <@class>));
                List <@class> ClassesToSerialize = new List <@class>();
                if (Classes.Count > 0)
                {
                    foreach (@class CLass in Classes)
                    {
                        @class NewClass = (@class)ObjectUtil.GetObjectValues(new string[] {
                            "id", "class_name"
                        }, CLass);
                        ClassesToSerialize.Add(NewClass);
                    }

                    return(JsonConvert.SerializeObject(ClassesToSerialize));
                }
                return("0");
            }
            return("0");
        }
Ejemplo n.º 6
0
        private string GetStudentList()
        {
            studentService = new StudentService();
            List <object> StudentObj = BaseService.GetObjectList(studentService, Request);

            StudentCount = studentService.ObjectCount();
            if (StudentObj != null)
            {
                List <student> Students            = (List <student>)ObjectUtil.ConvertList(StudentObj, typeof(List <student>));
                List <student> StudentsToSerialize = new List <student>();
                if (Students.Count > 0)
                {
                    foreach (student Std in Students)
                    {
                        @class StdClass = new @class()
                        {
                            id         = Std.class_id,
                            class_name = [email protected]_name
                        };

                        student StdNew = (student)ObjectUtil.GetObjectValues(new string[] {
                            "id", "name", "bod", "class_id", "address", "email"
                        }, Std);
                        StdNew.@class = StdClass;
                        StudentsToSerialize.Add(StdNew);
                    }

                    return(JsonConvert.SerializeObject(StudentsToSerialize));
                }
                return("0");
            }
            return("0");
        }
Ejemplo n.º 7
0
        private void GenerateListBook()
        {
            Dictionary <string, object> Params = new Dictionary <string, object>();

            if (TitleKeyWord.Equals(""))
            {
                return;
            }
            Params.Add("title", TitleKeyWord);
            List <object> ObjList = bookService.SearchAdvanced(Params, 10);

            BookList = (List <book>)ObjectUtil.ConvertList(ObjList, typeof(List <book>));

            foreach (book b in BookList)
            {
                Button btnBook = new Button();
                btnBook.UseSubmitBehavior = false;
                btnBook.CausesValidation  = false;
                btnBook.Text            = b.title + " | author: " + b.author.name;
                btnBook.CommandArgument = b.id;
                btnBook.PostBackUrl     = "/Web/Admin/Transaction/BookIssue.aspx?book_master_id=" + b.id;
                //   btnBook.Click += new EventHandler(BtnBookClick);
                btnBook.CssClass = "btn btn-success";
                btnBook.ID       = "BOOK_" + b.id;
                PanelBookList.Controls.Add(btnBook);
            }
            //    InputMasterBook.Text = TitleKeyWord;
            TitleKeyWord = "";
        }
Ejemplo n.º 8
0
        public List <book_record> FindByBookId(string Id)
        {
            string             sql         = "select * from book_record where book_id = '" + Id + "'";
            List <book_record> book_record = (List <book_record>)ObjectUtil.ConvertList(ListWithSql(sql), typeof(List <book_record>));

            return(book_record);
        }
Ejemplo n.º 9
0
        private string GetBookIssueList()
        {
            BookIssueService = new book_issueService();
            List <object> book_issuesObj = BaseService.GetObjectList(BookIssueService, Request);

            BookIssueCount = BookIssueService.ObjectCount();
            if (book_issuesObj != null)
            {
                List <book_issue> book_issues            = (List <book_issue>)ObjectUtil.ConvertList(book_issuesObj, typeof(List <book_issue>));
                List <book_issue> book_issuesToSerialize = new List <book_issue>();
                if (book_issues.Count > 0)
                {
                    foreach (book_issue BookIssue in book_issues)
                    {
                        book_issue book_issue = (book_issue)ObjectUtil.GetObjectValues(new string[] {
                            "id", "book_record_id", "book_issue_id", "issue_id", "qty", "book_return"
                        }, BookIssue);

                        book_issuesToSerialize.Add(book_issue);
                    }

                    return(JsonConvert.SerializeObject(book_issuesToSerialize));
                }
                return("0");
            }
            return("0");
        }
Ejemplo n.º 10
0
        private void SearchAdvanced(Dictionary <string, object> Params)
        {
            BookList.Clear();
            List <object> ObjList = BookService.SearchAdvanced(Params, Limit, Offset);

            BookList = (List <book>)ObjectUtil.ConvertList(ObjList, typeof(List <book>));
            UpdateCatalogList();
        }
Ejemplo n.º 11
0
        private void SearchUniversal(string key)
        {
            BookList.Clear();
            List <object> ObjList = BookService.SearchBookUniversal(key, Limit, Offset);

            BookList = (List <book>)ObjectUtil.ConvertList(ObjList, typeof(List <book>));
            UpdateCatalogList();
        }
Ejemplo n.º 12
0
        public List <book_issue> GetByBookIssueIdReturned(string id)
        {
            Dictionary <string, object> Params = new Dictionary <string, object>();

            Params.Add("book_issue_id", id);
            List <object> ReturnedBookIssues = SearchAdvanced(Params);

            return((List <book_issue>)ObjectUtil.ConvertList(ReturnedBookIssues, typeof(List <book_issue>)));
        }
Ejemplo n.º 13
0
        public book_record FindByIdFull(string Id)
        {
            string             sql         = "select * from book_record where id = '" + Id + "'";
            List <book_record> book_record = (List <book_record>)ObjectUtil.ConvertList(ListWithSql(sql), typeof(List <book_record>));

            if (book_record.Count > 0)
            {
                return(book_record[0]);
            }
            return(null);
        }
Ejemplo n.º 14
0
        private book_issue GetBookIssue()
        {
            BookIssueService = new book_issueService();
            List <object> BookIssues = BaseService.GetObjectList(BookIssueService, Request);

            if (BookIssues != null && BookIssues.Count > 0)
            {
                List <book_issue> BookIssuesList = (List <book_issue>)ObjectUtil.ConvertList(BookIssues, typeof(List <book_issue>));
                return(BookIssuesList.ElementAt(0));
            }
            return(null);
        }
Ejemplo n.º 15
0
        private string GetBookList()
        {
            bookService = new BookService();
            List <object> BooksObj = BaseService.GetObjectList(bookService, Request);

            BookCount = bookService.ObjectCount();
            if (BooksObj != null)
            {
                List <book> Books            = (List <book>)ObjectUtil.ConvertList(BooksObj, typeof(List <book>));
                List <book> BooksToSerialize = new List <book>();
                if (Books.Count > 0)
                {
                    foreach (book B in Books)
                    {
                        book Book = (book)ObjectUtil.GetObjectValues(
                            new string[] { "id", "title", "page", "isbn", "img", "publisher_id", "author_id", "category_id", "review" }, B
                            );
                        category newCat = (category)ObjectUtil.GetObjectValues(new string[]
                        {
                            "id", "category_name"
                        }, B.category);
                        B.publisher.books = null;
                        B.author.books    = null;
                        B.category.books  = null;
                        ICollection <book_record> BRs = new List <book_record>();
                        foreach (book_record BR in B.book_record)
                        {
                            book_record BRNew = (book_record)ObjectUtil.GetObjectValues(
                                new string[] { "id", "book_code", "available", "book_id" }, BR);
                            BRs.Add(BRNew);
                        }
                        Book.category    = newCat;
                        Book.author      = B.author;
                        Book.publisher   = B.publisher;
                        Book.book_record = BRs;
                        BooksToSerialize.Add(Book);
                    }

                    return(JsonConvert.SerializeObject(BooksToSerialize));
                }
                return("0");
            }
            return("0");
        }
Ejemplo n.º 16
0
        // GET: Admin
        public ActionResult Index()
        {
            if (!UserValid())
            {
                return(RedirectToAction("Index", "Home"));
            }

            EventService EventSvc = new EventService();
            Dictionary <string, object> Params = new Dictionary <string, object>();
            DateTime Now = DateTime.Now;

            Params.Add("date.day", Now.Day);
            Params.Add("date.year", Now.Year);
            Params.Add("date.month", Now.Month);
            Params.Add("user_id", LoggedUser.id);

            List <@event> ToDayEvents = (List <@event>)ObjectUtil.ConvertList(EventSvc.SearchAdvanced(Params, 10), typeof(List <@event>));

            ViewData["TodayEvents"] = ToDayEvents;

            return(View());
        }
Ejemplo n.º 17
0
        protected void ButtonSearch_Click(object sender, EventArgs e)
        {
            string ID = TextBoxStudentID.Text;
            Dictionary <string, object> ParamsIssue = new Dictionary <string, object>();

            ParamsIssue.Add("student_id", ID);
            ParamsIssue.Add("exact", true);
            ParamsIssue.Add("type", "issue");
            List <object> ObjList = IssueService.SearchAdvanced(ParamsIssue);

            Issues = (List <issue>)ObjectUtil.ConvertList(ObjList, typeof(List <issue>));

            Dictionary <string, object> ParamsReturn = new Dictionary <string, object>();

            ParamsReturn.Add("student_id", ID);
            ParamsReturn.Add("exact", true);
            ParamsReturn.Add("type", "return");
            List <object> ObjList2 = IssueService.SearchAdvanced(ParamsReturn);

            IssuesReturn = (List <issue>)ObjectUtil.ConvertList(ObjList2, typeof(List <issue>));
            PopulateStudentDetail(ID);
            PopulateIssueList();
        }