Exemplo n.º 1
0
        //For entering into the application as a Guest.
        private void lblGuest_Click(object sender, EventArgs e)
        {
            MangingFormAndControls th = new MangingFormAndControls(new frmDeshBoard());

            this.Close();
            th.threading();
        }
Exemplo n.º 2
0
        private void lblRegister_Click(object sender, EventArgs e)
        {
            MangingFormAndControls th = new MangingFormAndControls(new frmCreateAccount());

            this.Close();
            th.threading();
        }
Exemplo n.º 3
0
        //Delete button click event for Document delete.
        private void btnDeleteText_Click(object sender, EventArgs e)
        {
            DialogResult dr = MsgBox.Show("Do You want to Update the Document ?", "Confirmation", "YES", "NO");

            if (dr == DialogResult.Yes)
            {
                DatabaseNonQuery.InsertUpdateDelete($"Delete from TblText where id='{articleId}'");
                MangingFormAndControls.PanelClear(PanelText);
                ArticleLoader();
                MessageBox.Show("File Deleted From Storage", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 4
0
 //Allows user to delete their records.
 private void DeleteReference(object sender, EventArgs e)
 {
     if (UserInfo.id == userId)
     {
         DatabaseNonQuery.InsertUpdateDelete($"Delete from TblReference where id ='{id}'");
         ShowTableData();
         MangingFormAndControls.PanelClear(PanelRefrenceFields);
     }
     else
     {
         MsgBox.Show("You cannot Delete This Reference.", "Error", "OK", "Cancel");
     }
 }
Exemplo n.º 5
0
 //Updates saved refrences if the user is trying to update own recoard.
 private void UpdateReference(object sender, EventArgs e)
 {
     if (txtTitle.Text == "" || cmbDocType.SelectedIndex == 0 || txtYear.Text == "" || txtPublisher.Text == "" || txtNameOfSource.Text == "" || txtPageNumber.Text == "")///
     {
         MessageBox.Show("Title, Document type, Year, Publisher, Name of Source, Page Number fields cannot be empty.", "Field Empty", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (UserInfo.id == userId)
         {
             DatabaseNonQuery.InsertUpdateDelete($"Update TblReference set Title ='{txtTitle.Text}', Author ='{txtAuthorsList.Text}' , DocumentType = '{cmbDocType.Text}', Year ='{txtYear.Text}', Publisher = '{txtPublisher.Text}' , Abstract = '{txtAbstract.Text}' , NameOfSource = '{txtNameOfSource.Text}' , Issue = '{txtIssue.Text}' , Volume = '{txtVolume.Text}' , PageNumbers = '{txtPageNumber.Text}' , Notes = '{txtNotes.Text}', UserID = '{UserInfo.id}' where id ='{id}'");
             ShowTableData();
             MangingFormAndControls.PanelClear(PanelRefrenceFields);
         }
         else
         {
             MsgBox.Show("You cannot Edit This Reference.", "Error", "OK", "Cancel");
         }
     }
 }
Exemplo n.º 6
0
 //Saves textbox's data to the database. if the user is not a Guest.
 private void SaveReference(object sender, EventArgs e)
 {
     if (txtTitle.Text == "" || cmbDocType.SelectedIndex == 0 || txtYear.Text == "" || txtPublisher.Text == "" || txtNameOfSource.Text == "" || txtPageNumber.Text == "")
     {
         MessageBox.Show("Title, Document type, Year, Publisher, Name of Source, Page Number fields cannot be empty.", "Field Empty", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (UserInfo.loggedIn == true)
         {
             DatabaseNonQuery.InsertUpdateDelete($"Insert into TblReference (Title, Author, DocumentType, Year, Publisher, Abstract, NameOfSource, Issue, Volume, PageNumbers, Notes, UserID) values('{txtTitle.Text}','{txtAuthorsList.Text}','{cmbDocType.Text}','{txtYear.Text}','{txtPublisher.Text}','{txtAbstract.Text}','{txtNameOfSource.Text}','{txtIssue.Text}','{txtVolume.Text}','{txtPageNumber.Text}','{txtNotes.Text}','{UserInfo.id}')");
             ShowTableData();
             MangingFormAndControls.PanelClear(PanelRefrenceFields);
         }
         else
         {
             //Shows error if it is Guest.
             MsgBox.Show("Please Signup / Login First", "Operation Fail", "Ok", "Cancel");
         }
     }
 }
Exemplo n.º 7
0
        private void btnLogIn_Click_1(object sender, EventArgs e)
        {
            //Checks Userid and password mathches for application running.
            if (txtUsername.Text == "")
            {
                MessageBox.Show($"Please Enter User ID", "User Regisration", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                UserInfo.UserLogIn($"Select * from Users Where UserId='{txtUsername.Text}' and Password = '******'");
                if (txtUsername.Text == UserInfo.UserId && txtPassword.Text == UserInfo.Password)
                {
                    //After checking if required filds mathches userinfo classes field is set true and show user's first name and last name in the welcome screen.
                    UserInfo.loggedIn = true;
                    DialogResult result = MsgBox.Show($"Welcome {UserInfo.FirstName} {UserInfo.LastName}", $"Logged in as {UserInfo.UserType}", "OK", "Cancel");

                    //If user press ok button than application runs. Otherwise application restarts.
                    if (result == DialogResult.Yes)
                    {
                        //Form threading starts for closing this form and starting other form.
                        MangingFormAndControls th = new MangingFormAndControls(new frmDeshBoard());
                        this.Close();
                        th.threading();
                    }
                    else
                    {
                        ////Whole application restarts.
                        Application.Restart();
                    }
                }
                else
                {
                    MsgBox.Show($"Wrong UserName / Password", "Log In faild", "Try Again", "Cancel");
                }
            }
        }
Exemplo n.º 8
0
 //Clears all textbox's of the panel.
 private void ClearTextBoxes(object sender, EventArgs e)
 {
     MangingFormAndControls.PanelClear(PanelRefrenceFields);
 }
Exemplo n.º 9
0
 //Formats author's names and keeps them for database entry.
 private void btnAdd_Click(object sender, EventArgs e)
 {
     txtAuthorsList.Text += $"{txtLastName.Text}, {txtFirstName.Text} {txtMiddleName.Text}; ";
     MangingFormAndControls.PanelClear(panelAuthorName);
 }