public BookStatus GetBookName(int id)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
        SqlCommand cmd = da.GetCommand("select * from Lib_Book_Details where  Lib_Book_Id = '" + id+ "'");
        BookStatus ob = GetData(cmd);
        return ob;
 }
        public bool InsertBook(BookStatus obj)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("insert into [dbo].[Lib_Book_Details] ([Book_Title],[Lib_Book_Author_Name],[Lib_Book_In_Inventory],[Category_Name])" + "values(@Title,@Author,@Quantity,@Category)");
            SqlParameter    p   = new SqlParameter("@Title", SqlDbType.VarChar, 50);

            p.Value = obj.BookTitle;
            SqlParameter p1 = new SqlParameter("@Author", SqlDbType.VarChar, 50);

            p1.Value = obj.AuthorName;
            SqlParameter p2 = new SqlParameter("@Quantity", SqlDbType.Int);

            p2.Value = obj.BookInventory;
            SqlParameter p3 = new SqlParameter("@Category", SqlDbType.VarChar, 50);

            p3.Value = obj.Catagory;
            cmd.Parameters.Add(p);
            cmd.Parameters.Add(p1);
            cmd.Parameters.Add(p2);
            cmd.Parameters.Add(p3);
            cmd.Connection.Open();
            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }
 public BookStatus GetBookName(string name)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
        SqlCommand cmd = da.GetCommand("select * from Lib_Book_Details where  Book_title like '%" + name + "%'");
        BookStatus ob = GetData(cmd);
        return ob;
 }
 public UserInfo GetUserName(String name)
 {
     SqlDBdataAccess db = new SqlDBdataAccess();
     SqlCommand cmd = db.GetCommand("select * from Lib_Users where User_Name like '%" + name + "%'");
     UserInfo ob = GetData(cmd);
     return ob;
 }
 public List<CatagoryInfo> GetCategoryName()
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
     SqlCommand cmd = da.GetCommand("select * from Lib_Book_Category");
     List<CatagoryInfo> ob = GetData(cmd);
     return ob;
 }
        public UserInfo GetUserName(String name)
        {
            SqlDBdataAccess db  = new SqlDBdataAccess();
            SqlCommand      cmd = db.GetCommand("select * from Lib_Users where User_Name like '%" + name + "%'");
            UserInfo        ob  = GetData(cmd);

            return(ob);
        }
Beispiel #7
0
        public BookStatus GetBookName(int id)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("select * from Lib_Book_Details where  Lib_Book_Id = '" + id + "'");
            BookStatus      ob  = GetData(cmd);

            return(ob);
        }
Beispiel #8
0
        public BookStatus GetBookName(string name)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("select * from Lib_Book_Details where  Book_title like '%" + name + "%'");
            BookStatus      ob  = GetData(cmd);

            return(ob);
        }
        public List <CatagoryInfo> GetCategoryName()
        {
            SqlDBdataAccess     da  = new SqlDBdataAccess();
            SqlCommand          cmd = da.GetCommand("select * from Lib_Book_Category");
            List <CatagoryInfo> ob  = GetData(cmd);

            return(ob);
        }
        public List <BookIssueInfo> GetIssueInfo(int id)
        {
            SqlDBdataAccess      da  = new SqlDBdataAccess();
            SqlCommand           cmd = da.GetCommand("select * from Lib_Book_Issued_Details where  Lib_Book_Id = '" + id + "'");
            List <BookIssueInfo> ob  = GetData(cmd);

            return(ob);
        }
Beispiel #11
0
        public CatagoryInfo GetCategoryName(String name)
        {
            SqlDBdataAccess db  = new SqlDBdataAccess();
            SqlCommand      cmd = db.GetCommand("select * from Lib_Book_Category where Category_Name like '%" + name + "%'");
            CatagoryInfo    ob  = GetData(cmd);

            return(ob);
        }
 public bool DeleteIssue(int id)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
        SqlCommand cmd = da.GetCommand("delete  from [dbo].[Lib_Book_Issued_Details] where Lib_Book_Issued_Id=@id ");
        SqlParameter p = new SqlParameter("@id", SqlDbType.Int);
        p.Value = id;
        cmd.Parameters.Add(p);
        cmd.Connection.Open();
        int val = cmd.ExecuteNonQuery();
        cmd.Connection.Close();
        return val > 0;
 }
 public bool InsertCategory(CatagoryInfo obj)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
     SqlCommand cmd = da.GetCommand("insert into [dbo].[Lib_Book_Category] ([Category_Name])" + "values(@CategoryName)");
     SqlParameter p = new SqlParameter("@CategoryName", SqlDbType.VarChar, 50);
     p.Value = obj.CatagoryName;
     cmd.Parameters.Add(p);
     cmd.Connection.Open();
     int val = cmd.ExecuteNonQuery();
     cmd.Connection.Close();
     return val > 0;
 }
Beispiel #14
0
        public bool DeleteIssue(int id)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("delete  from [dbo].[Lib_Book_Issued_Details] where Lib_Book_Issued_Id=@id ");
            SqlParameter    p   = new SqlParameter("@id", SqlDbType.Int);

            p.Value = id;
            cmd.Parameters.Add(p);
            cmd.Connection.Open();
            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }
        public bool InsertCategory(CatagoryInfo obj)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("insert into [dbo].[Lib_Book_Category] ([Category_Name])" + "values(@CategoryName)");
            SqlParameter    p   = new SqlParameter("@CategoryName", SqlDbType.VarChar, 50);

            p.Value = obj.CatagoryName;
            cmd.Parameters.Add(p);
            cmd.Connection.Open();
            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }
 public bool ReturnBook(int id, int quantity)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
        SqlCommand cmd = da.GetCommand("update [dbo].[Lib_Book_Details] set Lib_Book_In_Inventory=@quantity where Lib_Book_Id=@id");
        SqlParameter p = new SqlParameter("@quantity", SqlDbType.Int);
        p.Value = quantity; ;
        SqlParameter p1 = new SqlParameter("@id", SqlDbType.Int);
        p1.Value = id ;
        cmd.Parameters.Add(p);
        cmd.Parameters.Add(p1);
        cmd.Connection.Open();
        int val = cmd.ExecuteNonQuery();
        cmd.Connection.Close();
        return val > 0;
 }
 public bool ReturnBook1(string name, int quantity)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
        SqlCommand cmd = da.GetCommand("update [dbo].[Lib_Book_Details] set Lib_Book_In_Inventory=@quantity where Book_Title=@name");
        SqlParameter p = new SqlParameter("@quantity", SqlDbType.Int);
        p.Value = quantity; ;
        SqlParameter p1 = new SqlParameter("@name", SqlDbType.VarChar, 50);
        p1.Value = name; ;
        cmd.Parameters.Add(p);
        cmd.Parameters.Add(p1);
        cmd.Connection.Open();
        int val = cmd.ExecuteNonQuery();
        cmd.Connection.Close();
        return val > 0;
 }
 public bool ChangePassword(string name, string password)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
     SqlCommand cmd = da.GetCommand("update [dbo].[Lib_Users] set User_Password=@password where User_Name=@name");
     SqlParameter p = new SqlParameter("@password", SqlDbType.VarChar,50);
     p.Value = password;
     SqlParameter p1 = new SqlParameter("@name", SqlDbType.VarChar, 50);
     p1.Value = name; ;
     cmd.Parameters.Add(p);
     cmd.Parameters.Add(p1);
     cmd.Connection.Open();
     int val = cmd.ExecuteNonQuery();
     cmd.Connection.Close();
     return val > 0;
 }
Beispiel #19
0
        public bool ReturnBook(int id, int quantity)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("update [dbo].[Lib_Book_Details] set Lib_Book_In_Inventory=@quantity where Lib_Book_Id=@id");
            SqlParameter    p   = new SqlParameter("@quantity", SqlDbType.Int);

            p.Value = quantity;;
            SqlParameter p1 = new SqlParameter("@id", SqlDbType.Int);

            p1.Value = id;
            cmd.Parameters.Add(p);
            cmd.Parameters.Add(p1);
            cmd.Connection.Open();
            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }
Beispiel #20
0
        public bool ChangePassword(string name, string password)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("update [dbo].[Lib_Users] set User_Password=@password where User_Name=@name");
            SqlParameter    p   = new SqlParameter("@password", SqlDbType.VarChar, 50);

            p.Value = password;
            SqlParameter p1 = new SqlParameter("@name", SqlDbType.VarChar, 50);

            p1.Value = name;;
            cmd.Parameters.Add(p);
            cmd.Parameters.Add(p1);
            cmd.Connection.Open();
            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }
 public bool InsertIssue(BookIssueInfo obj)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
        SqlCommand cmd = da.GetCommand("insert into [dbo].[Lib_Book_Issued_Details] ([Lib_Book_Id],[Lib_Book_Issued_To],[Lib-Book_Issued_On])" + "values(@id,@IssueDate,@Name)");
        SqlParameter p = new SqlParameter("@id", SqlDbType.Int);
        p.Value = obj.Id;
        SqlParameter p1 = new SqlParameter("@IssueDate", SqlDbType.DateTime);
        p1.Value = DateTime.Now;
        SqlParameter p2 = new SqlParameter("@Name", SqlDbType.VarChar,50);
        p2.Value = obj.Name;
        cmd.Parameters.Add(p);
        cmd.Parameters.Add(p1);
        cmd.Parameters.Add(p2);
        cmd.Connection.Open();
        int val = cmd.ExecuteNonQuery();
        cmd.Connection.Close();
        return val > 0;
 }
 public bool Insert(UserInfo obj)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
     SqlCommand cmd = da.GetCommand("insert into [dbo].[Lib_Users] ([User_Name],[User_Password],[Lib_Book_Issued_Id])" + "values(@Name,@Password,@Status)");
     SqlParameter p = new SqlParameter("@Name", SqlDbType.VarChar,50);
     p.Value = obj.UserName;
     SqlParameter p1 = new SqlParameter("@Password", SqlDbType.VarChar, 50);
     p1.Value = obj.UserPassword;
     SqlParameter p2 = new SqlParameter("@Status", SqlDbType.Int);
     p2.Value = obj.Status;
     cmd.Parameters.Add(p);
     cmd.Parameters.Add(p1);
     cmd.Parameters.Add(p2);
     cmd.Connection.Open();
     int val = cmd.ExecuteNonQuery();
     cmd.Connection.Close();
     return val > 0;
 }
Beispiel #23
0
        public bool RemoveBook1(string name, int quantity)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("update [dbo].[Lib_Book_Details] set Lib_Book_In_Inventory=@quantity where Book_Title=@name");
            SqlParameter    p   = new SqlParameter("@quantity", SqlDbType.Int);

            p.Value = quantity;;
            SqlParameter p1 = new SqlParameter("@name", SqlDbType.VarChar, 50);

            p1.Value = name;;
            cmd.Parameters.Add(p);
            cmd.Parameters.Add(p1);
            cmd.Connection.Open();
            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }
 public bool InsertBook(BookStatus obj)
 {
     SqlDBdataAccess da = new SqlDBdataAccess();
     SqlCommand cmd = da.GetCommand("insert into [dbo].[Lib_Book_Details] ([Book_Title],[Lib_Book_Author_Name],[Lib_Book_In_Inventory],[Category_Name])" + "values(@Title,@Author,@Quantity,@Category)");
     SqlParameter p = new SqlParameter("@Title", SqlDbType.VarChar, 50);
     p.Value = obj.BookTitle;
     SqlParameter p1 = new SqlParameter("@Author", SqlDbType.VarChar, 50);
     p1.Value = obj.AuthorName;
     SqlParameter p2 = new SqlParameter("@Quantity", SqlDbType.Int);
     p2.Value = obj.BookInventory;
     SqlParameter p3 = new SqlParameter("@Category", SqlDbType.VarChar, 50);
     p3.Value = obj.Catagory;
     cmd.Parameters.Add(p);
     cmd.Parameters.Add(p1);
     cmd.Parameters.Add(p2);
     cmd.Parameters.Add(p3);
     cmd.Connection.Open();
     int val = cmd.ExecuteNonQuery();
     cmd.Connection.Close();
     return val > 0;
 }
        public bool InsertIssue(BookIssueInfo obj)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("insert into [dbo].[Lib_Book_Issued_Details] ([Lib_Book_Id],[Lib_Book_Issued_To],[Lib-Book_Issued_On])" + "values(@id,@IssueDate,@Name)");
            SqlParameter    p   = new SqlParameter("@id", SqlDbType.Int);

            p.Value = obj.Id;
            SqlParameter p1 = new SqlParameter("@IssueDate", SqlDbType.DateTime);

            p1.Value = DateTime.Now;
            SqlParameter p2 = new SqlParameter("@Name", SqlDbType.VarChar, 50);

            p2.Value = obj.Name;
            cmd.Parameters.Add(p);
            cmd.Parameters.Add(p1);
            cmd.Parameters.Add(p2);
            cmd.Connection.Open();
            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }
        public bool Insert(UserInfo obj)
        {
            SqlDBdataAccess da  = new SqlDBdataAccess();
            SqlCommand      cmd = da.GetCommand("insert into [dbo].[Lib_Users] ([User_Name],[User_Password],[Lib_Book_Issued_Id])" + "values(@Name,@Password,@Status)");
            SqlParameter    p   = new SqlParameter("@Name", SqlDbType.VarChar, 50);

            p.Value = obj.UserName;
            SqlParameter p1 = new SqlParameter("@Password", SqlDbType.VarChar, 50);

            p1.Value = obj.UserPassword;
            SqlParameter p2 = new SqlParameter("@Status", SqlDbType.Int);

            p2.Value = obj.Status;
            cmd.Parameters.Add(p);
            cmd.Parameters.Add(p1);
            cmd.Parameters.Add(p2);
            cmd.Connection.Open();
            int val = cmd.ExecuteNonQuery();

            cmd.Connection.Close();
            return(val > 0);
        }