private void btnDeptPortalUpdateFile_Click(object sender, EventArgs e) { this.Hide(); Department_Portal portal = new Department_Portal(); portal.Show(); }
private void btnDeptLogin_Click(object sender, EventArgs e) { string userName = txtDeptUsername.Text; string userPassword = txtDeptPassword.Text; if (userName.Equals("")) { MessageBox.Show("Please enter your Username!"); } else if (userPassword.Equals("")) { MessageBox.Show("Please enter your Password!"); } else { string query = "Select * from UserSignUp Where Username= '******' AND Password = '******'"; objDbAccess.readDatathroughAdapter(query, dtUsers); if (dtUsers.Rows.Count == 1) { Dept_class.username = dtUsers.Rows[0]["Username"].ToString(); MessageBox.Show("Congratulations, You are logged in Successfully!!"); objDbAccess.closeConn(); this.Hide(); Department_Portal dept = new Department_Portal(); dept.Show(); } else { MessageBox.Show("Invalid Credentials!!. Provide Correct Username and Password"); } } }
private void btnUpdateFileRegister_Click(object sender, EventArgs e) { string fileNumber = txtUpdateFileNumber.Text; string newSubject = txtUpdateFileSubject.Text; string newSubDetails = txtUpdateFileSubjectDetails.Text; string newFileBrowsed = txtUpdateFileBrowsed.Text; string newDateLastUpdated = dateUpdateFileLastUpdated.Text; string newActionTakenToFile = txtUpdateFileAction.Text; string newFilesstatus = txtUpdateFileStatus.Text; if (newSubject.Equals("")) { MessageBox.Show("Please enter the Subject!!"); } else if (newSubDetails.Equals("")) { MessageBox.Show("Please enter the Subject Details!!"); } else if (newFileBrowsed.Equals("")) { MessageBox.Show("Please choose your File!!"); } else if (newActionTakenToFile.Equals("")) { MessageBox.Show("Please enter the number of actions taken to file!!"); } else if (newFilesstatus.Equals("")) { MessageBox.Show("Please enter the status of the File!!"); } else { string query = "Update fileRegistration SET SUBJECT = '" + @newSubject + "',SUB_DETAILS = '" + @newSubDetails + "',FILE_BROWSED = '" + @newFileBrowsed + "',F_LAST_UPDATED = '" + @newDateLastUpdated + "',TOT_ACTION = '" + @newActionTakenToFile + "',FILE_STATUS = '" + @newFilesstatus + "' where FILE_NO = '" + fileNumber + "'"; SqlCommand updateCommand = new SqlCommand(query); updateCommand.Parameters.AddWithValue("@newSubject", @newSubject); updateCommand.Parameters.AddWithValue("@newSubDetails", @newSubDetails); updateCommand.Parameters.AddWithValue("@newFileBrowsed", @newFileBrowsed); updateCommand.Parameters.AddWithValue("@newDateLastUpdated", @newDateLastUpdated); updateCommand.Parameters.AddWithValue("@newActionTakenToFile", @newActionTakenToFile); updateCommand.Parameters.AddWithValue("@newFilesstatus", newFilesstatus); int row = objDbAccess.executeQuery(updateCommand); if (row == 1) { MessageBox.Show("File is Successfully Updated!!"); this.Hide(); Department_Portal dept = new Department_Portal(); dept.Show(); } else { MessageBox.Show("Error occured while updating the File!.. Please try again!!"); } } }