private void readRole() { bool IsApprove = false; bool IsView = false; bool IsShortList = false; EntNomAuthorizationDetails objNom = new EntNomAuthorizationDetails(); objNomDetails = new NominationDetails(); objNom = objNomDetails.readRoles(((UserDetails)Session[clsConstant.TOKEN]).Roles); IsUpload = objNom.isUpload; IsApprove = objNom.isApprove; IsShortList = objNom.isShortList; if (IsApprove == true) { IsUpload = true; IsView = true; } else if (IsShortList == true) { IsUpload = true; IsView = true; } else if (IsUpload == true) { IsView = true; } }
private void saveNomination(int userId = -1) { NominationDetails objNomDetail = null; nomID = Request.QueryString["nomI"]; string isFnl = Request.QueryString["isFinal"]; string loanId = drpLoanNoName.SelectedValue.ToString(); int agencyId = int.Parse(drpAgency.SelectedValue); string just = txtJustification.Text; if (just == "") { just = ""; } if (agencyId > 0) { objNomDetail = new NominationDetails(); int checkExisting = objNomDetail.editTraineeDetails(txtNewCandidateName.Text, txtLastName.Text, txtTelephone.Text, txtMobileNo.Text, txtEmail.Text, txtFaxNo.Text, int.Parse(loanId), agencyId, just, txtDesignation.Text, int.Parse(txtRefID.Text)); lblMessage.Text = "<b>Trainee Database has been updated successfully"; } else { lblMessage.Text = "Please Select valid Values for Agency"; } }
protected void btnDel_Click(object sender, EventArgs e) { try { objNomDetails = new NominationDetails(); int getUserID = int.Parse(Session["RowIndex"].ToString()); int delError = objNomDetails.deleteCandidateDetails(getUserID, -1, ((UserDetails)Session[clsConstant.TOKEN]).UserID, -1, 1); // if (delError == 1) { modPopDelMsg.Show(); lblMsgDel.Text = "Participant Deleted Successfully !!"; btnDel.Visible = false; btnYes.Text = "ok"; } else { modPopDelMsg.Show(); lblMsgDel.Text = "Error: Unable to Delete User"; btnDel.Visible = false; btnYes.Text = "ok"; } } catch (Exception ex) { logger.Error(ex); } }
protected void grdUserlist_RowDeleting1(object sender, GridViewDeleteEventArgs e) { try { int getIndex = 0; if (grdUserlist.DataKeys[e.RowIndex].Value.ToString() != "" && grdUserlist.Rows[e.RowIndex].Cells[10].Text != " ") // This means user is not nominated for any workshop can be deleted directly { getIndex = (int)grdUserlist.DataKeys[e.RowIndex].Value; objNomDetails = new NominationDetails(); if ((((UserDetails)Session[clsConstant.TOKEN]).SuperUser) == true) { int delError = objNomDetails.deleteCandidateDetails(getIndex, int.Parse(drpAgency.SelectedValue.ToString()), ((UserDetails)Session[clsConstant.TOKEN]).UserID, int.Parse(drpProgramDetails.SelectedValue.ToString())); if (delError == 0) { modPopDelMsg.Show(); lblMsgDel.Text = "Your are not Athuroized to delete the Participant !!"; lblMsgDel.Focus(); } else { modPopDelMsg.Show(); lblMsgDel.Text = "Participant Deleted Successfully !!"; lblMsgDel.Focus(); } } else { this.functionDelbyAge(getIndex); } } else { if ((((UserDetails)Session[clsConstant.TOKEN]).SuperUser) == true) { modPopDelMsg.Show(); btnDel.Visible = true; btnYes.Text = "No"; lblMsgDel.Text = "Do you want to delete this user permanently and corresponding information from the database ?"; btnYes.Focus(); Session["RowIndex"] = grdUserlist.Rows[e.RowIndex].Cells[1].Text; } else if ((((UserDetails)Session[clsConstant.TOKEN]).SuperUser) != true) { modPopDelMsg.Show(); lblMsgDel.Text = "This user is aleready deleted from the workshop !"; } } } catch (Exception ex) { logger.Error(ex); } }
//public void setUpdationProcess() //{ // if (IsExisting.Checked == true) // { // lblRef.Visible = true; // txtRefID.Visible = true; // btnUpdate.Visible = true; // btnUpdate.Enabled = true; // lblRef.Text = "Refernce ID"; // btnSubmit.Visible = false; // txtRefID.BorderColor = System.Drawing.Color.Black; // txtEmail.BorderColor = System.Drawing.Color.Black; // } // else if (IsNew.Checked == true) // { // txtRefID.Visible = false; // btnSubmit.Visible = true; // btnUpdate.Visible = false; // btnSubmit.Enabled = true; // existingUser = false; // lblRef.Visible = false; // txtRefID.BorderColor = System.Drawing.Color.Black; // txtEmail.BorderColor = System.Drawing.Color.Black; // } //} //void grdReset() //{ // grdUserName.DataSource = null; // grdUserName.DataBind(); //} private void getCount() { objNomDetails = new NominationDetails(); nomID = Request.QueryString["nomI"]; int countUser = objNomDetails.getCount(int.Parse(nomID)); hdnCount.Value = countUser.ToString(); }
private void saveNomination(int userId = -1) { NominationDetails objNomDetail = null; nomID = Request.QueryString["nomI"]; string isFnl = Request.QueryString["isFinal"]; string loanId = drpLoanNoName.SelectedValue.ToString(); int agencyId = int.Parse(drpAgency.SelectedValue); string just = txtJustification.Text; if (just == "") { just = ""; } if (agencyId > 0) { objNomDetail = new NominationDetails(); int checkExisting = objNomDetail.editNominatedCandidateDetails(txtNewCandidateName.Text, txtLastName.Text , txtTelephone.Text, txtMobileNo.Text, txtEmail.Text, txtFaxNo.Text, int.Parse(nomID), int.Parse(loanId), agencyId, just, txtDesignation.Text, IsExisting.Checked == true ? int.Parse(txtRefID.Text) : userId , isFnl == "" ? false : bool.Parse(isFnl)); if (checkExisting != 0) { this.getCount(); this.funcClear(); lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "<b>Your Nomination has been completed successfully"; lblMessage.Text += IsNew.Checked == true?"<br /><b>Note: Your Reference Key For Nomination Is" + " " + userId:""; this.grdReset(); } else { txtRefID.BorderColor = System.Drawing.Color.Red; lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "<b>User Already Nominated for this WorkShop"; btnUpdate.Enabled = false; } } else { lblMessage.Text = "Please Select valid Values for Agency"; } }
// protected void btnSubmit_Click(object sender, EventArgs e) protected void SubmitNewData() { NominationDetails objNomDetail = new NominationDetails(); string loanId = drpLoanNoName.SelectedValue.ToString(); int agencyId = int.Parse(drpAgency.SelectedValue); string just = txtJustification.Text; if (just == "") { just = ""; } try { int userID = objNomDetail.AddNominatedCandidateDetails(txtNewCandidateName.Text, txtLastName.Text , txtTelephone.Text, txtMobileNo.Text, txtEmail.Text, txtFaxNo.Text, LoanProject.SelectedValue == "L"?int.Parse(loanId): int.Parse(drpProject.SelectedValue.ToString()), agencyId, txtJustification.Text, txtDesignation.Text, LoanProject.SelectedValue); if (userID != 0) { this.saveNomination(userID); // this.grdReset(); } else { txtEmail.BorderColor = System.Drawing.Color.Red; lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "User Already Exists"; ViewState["isSuccess"] = null; lblError.Text = lblMessage.Text; ModalPopupExtender1.Show(); // btnSubmit.Enabled = false; } } catch (Exception ex) { lblMessage.Text = "User Already Exists"; lblMessage.ForeColor = System.Drawing.Color.Red; txtEmail.BorderColor = System.Drawing.Color.Red; txtNewCandidateName.BorderColor = System.Drawing.Color.Red; txtLastName.BorderColor = System.Drawing.Color.Red; lblError.Text = lblMessage.Text; ViewState["isSuccess"] = null; ModalPopupExtender1.Show(); // btnSubmit.Enabled = false; } }
protected void btnSubmit_Click(object sender, EventArgs e) { NominationDetails objNomDetail = new NominationDetails(); string loanId = drpLoanNoName.SelectedValue.ToString(); int agencyId = int.Parse(drpAgency.SelectedValue); string just = txtJustification.Text; if (just == "") { just = ""; } try { int userID = objNomDetail.AddNominatedCandidateDetails(txtNewCandidateName.Text, txtLastName.Text , txtTelephone.Text, txtMobileNo.Text, txtEmail.Text, txtFaxNo.Text, int.Parse(loanId), agencyId, txtJustification.Text, txtDesignation.Text, "L"); if (userID != 0) { this.saveNomination(userID); this.grdReset(); } else { txtEmail.BorderColor = System.Drawing.Color.Red; lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "User Already Exists"; btnSubmit.Enabled = false; } } catch (Exception ex) { lblMessage.Text = "User Already Exists"; lblMessage.ForeColor = System.Drawing.Color.Red; txtEmail.BorderColor = System.Drawing.Color.Red; txtNewCandidateName.BorderColor = System.Drawing.Color.Red; txtLastName.BorderColor = System.Drawing.Color.Red; btnSubmit.Enabled = false; } }
protected void btnYes_Click(object sender, EventArgs e) { objNomDetails = new NominationDetails(); objNomDetails.updateFinalWorkshop(int.Parse(Request.QueryString["nomI"])); }
private void readAllInfo(string userID, string emailID) { NomDetails objEnt = new NomDetails(); NominationDetails objNomDetail = new NominationDetails(); objEnt = objNomDetail.readNominationDetails(userID, emailID, 0); if (objEnt != null) { lblMessage.Text = "Information Available in Database"; string agency = objEnt.AgencyName; if (agency == "") { drpAgency.SelectedIndex = 0; } else { if (drpAgency.Items.FindByValue(agency) != null) { drpAgency.SelectedIndex = 0; drpAgency.SelectedValue = agency; } else { lblMessage.Text = "You can nominate your agency person only"; return; } } string loan = objEnt.LoanNumberName; if (loan == "") { this.getLoan(); drpLoanNoName.SelectedIndex = 0; } else { this.getLoan(); if (drpLoanNoName.Items.FindByValue(loan) != null) { drpLoanNoName.SelectedValue = loan; } } string designation = objEnt.designation; txtDesignation.Text = designation; txtNewCandidateName.Text = objEnt.FirstName; txtLastName.Text = objEnt.LastName; txtEmail.Text = objEnt.Email; txtTelephone.Text = objEnt.Telephone; txtMobileNo.Text = objEnt.Cellphone.ToString(); txtFaxNo.Text = objEnt.Fax.ToString(); txtJustification.Text = objEnt.justification.ToString(); btnUpdate.Enabled = true; btnUpdate.Visible = true; } else { if (userID != "") { if (objEnt == null) { lblMessage.Text = "<b>Invalid Reference ID - Please Try Again"; string Entered_RefID = txtRefID.Text; Utility objUtil = new Utility(); objUtil.ResetFormControl(this); this.grdReset(); txtRefID.Text = Entered_RefID; btnUpdate.Enabled = false; btnUpdate.Visible = false; } } else { lblMessage.Text = ""; } } }
private void grdbindGrid() { DataSet dSet = new DataSet(); dTab = new DataTable(); NominationDetails objNom = new NominationDetails(); dSet = objNom.getdataSourceGrd(drpRefrenceID.SelectedValue.ToString(), drpDesignation.SelectedItem.ToString(), drpPartName.SelectedValue.ToString(), txtEmail.Text, drpAgency.SelectedValue.ToString(), drpLoanNumber.SelectedValue.ToString(), drpProgramDetails.SelectedValue.ToString(), drpSelectApproved.SelectedValue.ToString(), int.Parse(drpSector.SelectedValue.ToString())); if (dSet != null) { grdUserlist.DataSource = dSet; grdUserlist.DataBind(); dTab = dSet.Tables[0]; Session[clsConstant.SESS_TABLE] = dTab; lblMessage.Visible = true; lblSector.Text = "Participant Count : " + dSet.Tables[1].Rows[0][0].ToString(); #region DELETE FUNCTION AS PER RIGHTS if ((((UserDetails)Session[clsConstant.TOKEN]).SuperUser) == true) { for (int ilp = 0; ilp < grdUserlist.Rows.Count; ilp++) { grdUserlist.Columns[15].Visible = true; } } else { if (((UserDetails)Session[clsConstant.TOKEN]).AgencyID != int.Parse(drpAgency.SelectedValue) && drpAgency.SelectedIndex == 0) { for (int ilp = 0; ilp < grdUserlist.Rows.Count; ilp++) { grdUserlist.Columns[15].Visible = false; } } else if (((UserDetails)Session[clsConstant.TOKEN]).AgencyID == int.Parse(drpAgency.SelectedValue)) { for (int ilp = 0; ilp < grdUserlist.Rows.Count; ilp++) { grdUserlist.Columns[15].Visible = true; } } else { for (int ilp = 0; ilp < grdUserlist.Rows.Count; ilp++) { grdUserlist.Columns[15].Visible = false; } } } #endregion if (drpSelectApproved.SelectedValue.ToString() == (0).ToString()) { foreach (GridViewRow dRow in grdUserlist.Rows) { var imgBtn = dRow.FindControl("imgDelUser") as ImageButton; IDataItemContainer container = (IDataItemContainer)imgBtn.NamingContainer; if (dRow.Cells[13].Text == " " && dRow.Cells[10].Text != " " && dRow.Cells[10].Text != "") { dRow.Cells[13].Text = "N"; } if ((((UserDetails)Session[clsConstant.TOKEN]).UserID) == 168 || (((UserDetails)Session[clsConstant.TOKEN]).UserID) == 149 || (((UserDetails)Session[clsConstant.TOKEN]).UserID) == 167) { if (dSet.Tables[0].Rows[container.DataItemIndex][11].ToString() == "True") { dRow.Cells[13].Text = "S"; dRow.Cells[15].Enabled = true; } else if (dSet.Tables[0].Rows[container.DataItemIndex][11].ToString() == "False") { dRow.Cells[13].Text = "N"; dRow.Cells[15].Enabled = true; } } else if (dSet.Tables[0].Rows[container.DataItemIndex][11].ToString() == "True") { dRow.Cells[13].Text = "S"; dRow.Cells[15].Enabled = false; } else if (dSet.Tables[0].Rows[container.DataItemIndex][11].ToString() == "False") { dRow.Cells[13].Text = "N"; dRow.Cells[15].Enabled = true; } if ((((UserDetails)Session[clsConstant.TOKEN]).UserID) == 168 || (((UserDetails)Session[clsConstant.TOKEN]).UserID) == 149 || (((UserDetails)Session[clsConstant.TOKEN]).UserID) == 167) { if (dSet.Tables[0].Rows[container.DataItemIndex][12].ToString() == "True") { dRow.Cells[13].Text = "A"; dRow.Cells[15].Enabled = true; } else if (dSet.Tables[0].Rows[container.DataItemIndex][12].ToString() == "False" && dSet.Tables[0].Rows[container.DataItemIndex][11].ToString() == "False") { dRow.Cells[13].Text = "N"; dRow.Cells[15].Enabled = true; } } else if (dSet.Tables[0].Rows[container.DataItemIndex][12].ToString() == "True") { dRow.Cells[13].Text = "A"; dRow.Cells[15].Enabled = false; } else if (dSet.Tables[0].Rows[container.DataItemIndex][12].ToString() == "False" && dSet.Tables[0].Rows[container.DataItemIndex][11].ToString() == "False" ) { dRow.Cells[13].Text = "N"; dRow.Cells[15].Enabled = true; } if (dRow.Cells[14].Text == "1") { dRow.Cells[14].Text = "Yes"; } else if (dRow.Cells[14].Text == "0") { dRow.Cells[14].Text = "No"; } } } else { for (int iLoop = 0; iLoop < grdUserlist.Rows.Count; iLoop++) { if (drpSelectApproved.SelectedValue.ToString() == (1).ToString()) // Selected { if (dSet.Tables[0].Rows[iLoop][11].ToString() == "True") { grdUserlist.Rows[iLoop].Cells[13].Text = "S"; grdUserlist.Rows[iLoop].Cells[15].Enabled = false; } } else if (drpSelectApproved.SelectedValue.ToString() == (2).ToString()) // Approved { if (dSet.Tables[0].Rows[iLoop][12].ToString() == "True") { grdUserlist.Rows[iLoop].Cells[13].Text = "A"; grdUserlist.Rows[iLoop].Cells[15].Enabled = false; } } else if (drpSelectApproved.SelectedValue.ToString() == (4).ToString()) // Nominated { if (grdUserlist.Rows[iLoop].Cells[13].Text != " ") { grdUserlist.Rows[iLoop].Cells[13].Text = "N"; } } else if (drpSelectApproved.SelectedValue.ToString() == (3).ToString()) // Attended { if (grdUserlist.Rows[iLoop].Cells[14].Text == "True") { grdUserlist.Rows[iLoop].Cells[14].Text = "Yes"; grdUserlist.Rows[iLoop].Cells[13].Text = "A"; } } } } } }
private void readAllInfo(string userID, string emailID) { NomDetails objEnt = new NomDetails(); NominationDetails objNomDetail = new NominationDetails(); objEnt = objNomDetail.readNominationDetails(userID, emailID, 0); if (objEnt != null) { // lblMessage.Text = "Information Available in Database"; string agency = objEnt.AgencyName; if (agency == "") { drpAgency.SelectedIndex = 0; } else { if (drpAgency.Items.FindByValue(agency) != null) { drpAgency.SelectedIndex = 0; drpAgency.SelectedValue = agency; } else { // lblMessage.Text = "You can nominate your agency person only"; return; } } string loan = objEnt.LoanNumberName; if (loan == "") { // this.getLoan(); drpLoanNoName.SelectedIndex = 0; } else { // this.getLoan(); if (drpLoanNoName.Items.FindByValue(loan) != null) { drpLoanNoName.SelectedIndex = 0; drpLoanNoName.SelectedValue = loan; } } string designation = objEnt.designation; txtDesignation.Text = designation; txtNewCandidateName.Text = objEnt.FirstName; txtLastName.Text = objEnt.LastName; txtEmail.Text = objEnt.Email; txtTelephone.Text = objEnt.Telephone; txtMobileNo.Text = objEnt.Cellphone.ToString(); txtFaxNo.Text = objEnt.Fax.ToString(); txtJustification.Text = objEnt.justification.ToString(); // btnUpdate.Enabled = true; } else { if (userID != "") { if (objEnt == null) { // lblMessage.Text = "<b>Invalid Reference ID - Please Try Again"; // lblError.Text = lblMessage.Text; // ModalPopupExtender1.Show(); //btnUpdate.Enabled = false; } } else { } // lblMessage.Text = ""; } }