Example #1
0
        public int DeleteBook(string ID, string path)
        {
            DbCon  con    = new DbCon(path);
            string cmdstr = "delete from Books where bookId='" + ID + "'";

            return(con.ExecuteDDLCommand(cmdstr));
        }
Example #2
0
        public bool UpdateStock(string ID, string dbpath)
        {
            DbCon con = new DbCon();
            int   k   = con.ExecuteDDLCommand("UPDATE Books SET BookStock = BookStock + 1 WHERE (BookID = '" + ID + "')");

            if (k > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool updateFine(student_fine sf, string path)
        {
            DbCon con = new DbCon(path);
            int   r   = con.ExecuteDDLCommand("update student_fine set fineamount=" + sf.FineAmount + " where studentID='" + sf.StudentID + "'");

            if (r > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool AddFine(student_fine sf, string path)
        {
            DbCon con = new DbCon(path);
            int   r   = con.ExecuteDDLCommand("insert into student_fine values('" + sf.StudentID + "'," + sf.FineAmount + ")");

            if (r > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool ReturnBook(string StudID, string BookID, string path)
        {
            DbCon  con    = new DbCon(path);
            string cmdstr = "update StudentIssueRegister set returndate=" + DateTime.Today + ",status='return' where StudentID='" + StudID + "' and bookid='" + BookID + "'";
            int    r      = con.ExecuteDDLCommand(cmdstr);

            if (r > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool IssueBook(issue_register ir, string path)
        {
            DbCon con = new DbCon(path);
            int   r   = con.ExecuteDDLCommand("insert into StudentIssueRegister values ('" +
                                              ir.StudentID + "','" + ir.BookID + "'," + ir.IssueDate + "," + ir.ReturnDate + ",'" + ir.Status + "')");

            if (r > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #7
0
        public int DeleteStudent(string ID, string path)
        {
            int   res = 0;
            DbCon con = new DbCon(path);

            if (StudentExists(ID, path))
            {
                res = 0;
            }
            else
            {
                string cmdstr = "Delete from student where studentID='" + ID + "'";
                res = con.ExecuteDDLCommand(cmdstr);
            }
            return(res);
        }
Example #8
0
        public int AddStudent(Student s, string path)
        {
            int   res = 0;
            DbCon con = new DbCon(path);

            if (StudentExists(s.StudentID, path))
            {
                res = 0;
            }
            else
            {
                string cmdstr = "insert into student values('" + s.StudentID + "','" + s.StudentName + "','" + s.StudentAdd + "','" + s.StudentMail + "','" + s.StudentPhone + "')";
                res = con.ExecuteDDLCommand(cmdstr);
            }
            return(res);
        }
Example #9
0
        public int SaveBooks(Books b, string dbpath)
        {
            try
            {
                DbCon  con = new DbCon(dbpath);
                string cmdstr;
                cmdstr = "insert into books values('" + b.BookID + "','" + b.BookName + "','" + b.PublisherName + "','"
                         + b.PublisherAdd + "','" + b.AuthorName + "','" + b.AuthorAdd + "'," + b.BookPrice + "," + b.BookPafes
                         + ",'" + b.CatagoryName + "'," + b.Stock + ")";

                int x = con.ExecuteDDLCommand(cmdstr);
                return(x);
            }
            catch (Exception ex)
            {
                return(0);
                //throw ex;
            }
        }
Example #10
0
        public int EditStudent(string Old, Student New, string path)
        {
            int   res = 0;
            DbCon con = new DbCon(path);

            if (StudentExists(Old, path))
            {
                res = 0;
            }
            else
            {
                string cmdstr = "update student" +
                                "set " +
                                "studentName='" + New.StudentName + "'," +
                                "studentAdd='" + New.StudentAdd + "'," +
                                "studentEmail='" + New.StudentMail + "'," +
                                "studentph1='" + New.StudentPhone + "' " +
                                "where studentId='" + Old + "';";
                res = con.ExecuteDDLCommand(cmdstr);
            }
            return(res);
        }