コード例 #1
0
ファイル: Register.cs プロジェクト: topu29/Digital-Library
        private void Register_button_Click(object sender, EventArgs e)
        {
            try
            {
                if (User_name_textBox.Text != "" && Password_textBox.Text != "")
                {
                    Digital_library_entity information = new Digital_library_entity();

                    information.User_name = User_name_textBox.Text;
                    information.Password  = Password_textBox.Text;

                    Digital_library_bl LibraryBL = new Digital_library_bl();

                    if (LibraryBL.setinformation(information))
                    {
                        //MessageBox.Show("Entry Successfull");
                        Login_form login = new Login_form();
                        login.Show();
                        this.Hide();
                        // clear();
                    }
                    else
                    {
                        MessageBox.Show("Wrong Entry!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        private void Login_button_Click(object sender, EventArgs e)
        {
            try
            {
                if (User_name_textBox.Text != "" && Password_textBox.Text != "")
                {
                    Digital_library_entity information = new Digital_library_entity();

                    information.User_name = User_name_textBox.Text;
                    information.Password  = Password_textBox.Text;

                    Digital_library_bl LibraryBL = new Digital_library_bl();

                    if (LibraryBL.checkinformation(information))
                    {
                        //MessageBox.Show("Entry Successfull");
                        Home_form home = new Home_form();
                        home.Show();
                        this.Hide();
                        // clear();
                    }
                    else
                    {
                        MessageBox.Show("Invalid user name or password!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        public bool check_information(Digital_library_entity information)
        {
            try
            {
                SqlConnection connection = new SqlConnection(connstring);

                connection.Open();
                string password = getSHA1Hasing( getSHA1Hasing(information.Password));
                string name = information.User_name;

                SqlCommand cmd = new SqlCommand("SELECT Password FROM tbl_login WHERE Name = '" + name + "'", connection);
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    string p = reader["Password"].ToString();
                    if( p == password)
                        return true;
                }
                reader.Close();
                connection.Close();
                return false;

               /* string type = null;
                for (int i = 0; reader.Read(); i++)
                {
                    type = reader[0].ToString();

                }*/
                
               
                //
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
           

        }
コード例 #4
0
        public bool EntryBook(Digital_library_entity information)
        {
            try
            {
                SqlConnection connection = new SqlConnection(connstring);

                connection.Open();

                SqlCommand cmd = new SqlCommand("INSERT INTO tbl_Entry_new_book VALUES('" + information.Serial_No + "' ,'" + information.Book_Name + "' ,'" + information.Author + "' ,'" + information.Quantity + "' ,'" + information.Category + "','" + information.Arrival_Date + "')", connection);
                cmd.ExecuteNonQuery();

                connection.Close();

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
コード例 #5
0
        public bool Set_information(Digital_library_entity information)
        {
            try
            {
                SqlConnection connection = new SqlConnection(connstring);

                connection.Open();
                string password = getSHA1Hasing(getSHA1Hasing(information.Password));

                SqlCommand cmd = new SqlCommand("INSERT INTO tbl_login VALUES('" + information.User_name + "' ,'" + password + "')", connection);
                cmd.ExecuteNonQuery();

                connection.Close();

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(false);
            }
        }
コード例 #6
0
        private void Save_button_Click(object sender, EventArgs e)
        {
            try
            {
                if (Book_ID_textBox.Text != "" && Book_Name_textBox.Text != "" && Author_textBox.Text != "" && Quantity_textBox.Text != "" && Category_textBox.Text != "")
                {
                    Digital_library_entity information = new Digital_library_entity();

                    information.Book_Name    = Book_Name_textBox.Text;
                    information.Author       = Author_textBox.Text;
                    information.Category     = Category_textBox.Text;
                    information.Quantity     = Quantity_textBox.Text;
                    information.Serial_No    = Book_ID_textBox.Text;
                    information.Arrival_Date = Arrival_Date_textBox.Text;

                    Digital_library_bl LibraryBL = new Digital_library_bl();

                    if (LibraryBL.Entry_book(information))
                    {
                        MessageBox.Show("Entry Successfull");
                        Home_form home = new Home_form();
                        home.Show();
                        this.Hide();
                        // clear();
                    }
                    else
                    {
                        MessageBox.Show("Wrong Entry!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #7
0
        private void Save_button_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox_student_ID.Text != "" && textBox1_name.Text != "" && textBox2_disciplene.Text != "" && textBox3_batch.Text != "" && textBox4_contact_no.Text != "" && textBox5_homeDistrict.Text != "")
                {
                    Digital_library_entity information = new Digital_library_entity();

                    information.Discipline    = textBox2_disciplene.Text;
                    information.Student_ID    = textBox_student_ID.Text;
                    information.Batch         = textBox3_batch.Text;
                    information.Student_name  = textBox1_name.Text;
                    information.Contact_no    = textBox4_contact_no.Text;
                    information.home_district = textBox5_homeDistrict.Text;

                    Digital_library_bl LibraryBL = new Digital_library_bl();

                    if (LibraryBL.Entry_student(information))
                    {
                        MessageBox.Show("Entry Successfull");
                        Home_form home = new Home_form();
                        home.Show();
                        this.Hide();
                        // clear();
                    }
                    else
                    {
                        MessageBox.Show("Wrong Entry!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
 public bool checkinformation(Digital_library_entity information)
 {
     return(library_dal.check_information(information));
 }
コード例 #9
0
 public bool Entry_book(Digital_library_entity information)
 {
     return(library_dal.EntryBook(information));
 }
コード例 #10
0
 public bool setinformation(Digital_library_entity information)
 {
     return(library_dal.Set_information(information));
 }