Esempio n. 1
0
        // 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;
            }
        }