protected void btnRegister_Click(object sender, EventArgs e) { try { objBal = new ClsBAL(); string message = ""; if (btnRegister.Text == "Register") { if (txtDateOfBirth.Text == "") { txtDateOfBirth.Text = "1/1/1990"; } if (txtCommissionPercentage.Text == "") { txtCommissionPercentage.Text = "0"; } if (chkDomesticFlights.Checked == false) { lblDomesticFlights.Text = "0"; } else { lblDomesticFlights.Text = "1"; } if (chkInternationalFlights.Checked == false) { lblInterNationalFlights.Text = "0"; } else { lblInterNationalFlights.Text = "1"; } if (chkInternationalFlights.Checked == false) { lblInterNationalFlights.Text = "0"; } else { lblInterNationalFlights.Text = "1"; } if (chkBuses.Checked == false) { lblBuses.Text = "0"; } else { lblBuses.Text = "1"; } if (chkHotels.Checked == false) { lblHotels.Text = "0"; } else { lblHotels.Text = "1"; } if (chkRecharge.Checked == false) { lblRecharge.Text = "0"; } else { lblRecharge.Text = "1"; } if (Session["UserID"] != null) { if (Session["Role"].ToString() == "Distributor") { ddlRole.SelectedItem.Text = "Agent"; role = "Agent"; } else if (Session["Role"].ToString() == "Admin") { role = ddlRole.SelectedItem.Text; } else if (Session["Role"].ToString() == "BSD") { role = ddlBSD.SelectedItem.Text; } } message = objBal.AddAgent(txtAgentName.Text.Trim().ToString(), ddlType.SelectedItem.Text.ToString(), Convert.ToDateTime(txtDateOfBirth.Text.ToString()), txtCity.Text.Trim().ToString(), ddlState.SelectedItem.Text.ToString(), txtAddress.Text.Trim().ToString(), txtPinCode.Text.Trim().ToString(), txtMobileNo.Text.Trim().ToString(), txtAlternateMobileNo.Text.Trim().ToString(), txtLandlineNo.Text.Trim().ToString(), txtEmailId.Text.Trim().ToString(), txtPAN.Text.Trim().ToString(), txtDetails.Text.Trim().ToString(), ddlStatus.SelectedItem.Text.ToString(), txtUsername.Text.Trim().ToString(), txtPassword.Text.Trim().ToString(), Convert.ToInt32(Session["UserID"].ToString()), Convert.ToInt32(Session["UserID"].ToString()), Convert.ToInt32(txtCommissionPercentage.Text.ToString()), role, "", lblDomesticFlights.Text.ToString(), lblInterNationalFlights.Text.ToString(), lblBuses.Text.ToString(), lblHotels.Text.ToString(), lblRecharge.Text.ToString(), txtDistrict.Text.Trim().ToString() ); if (message == "Username is already existed. Please choose another one.") { lblMsg.InnerHtml = "UserName/EmailId is already exists please choose another one"; } if (message == "Agent registration is completed successfully.") { mail(); lblDomesticFlights.Visible = false; lblInterNationalFlights.Visible = false; lblBuses.Visible = false; lblHotels.Visible = false; lblRecharge.Visible = false; //lblMsg.InnerHtml = message; if (Session["Role"].ToString() == "Admin" || Session["Role"].ToString() == "Distributor") { if (ddlRole.SelectedItem.Text == "Agent") { lblMsg.InnerHtml = message; } else if (ddlRole.SelectedItem.Text == "Distributor") { lblMsg.InnerHtml = "Distributor Registration is completed successfully."; } else if (ddlRole.SelectedItem.Text == "BSD") { lblMsg.InnerHtml = "BSD Registration is completed successfully."; } } else { if (ddlBSD.SelectedItem.Text == "Agent") { lblMsg.InnerHtml = message; } else { lblMsg.InnerHtml = "Employee Registration is compleated successfully."; } } } } else if (btnRegister.Text == "Update") { if (txtDateOfBirth.Text == "") { txtDateOfBirth.Text = "1/1/1990"; } if (chkDomesticFlights.Checked == false) { lblDomesticFlights.Text = "0"; } else { lblDomesticFlights.Text = "1"; } if (chkInternationalFlights.Checked == false) { lblInterNationalFlights.Text = "0"; } else { lblInterNationalFlights.Text = "1"; } if (chkInternationalFlights.Checked == false) { lblInterNationalFlights.Text = "0"; } else { lblInterNationalFlights.Text = "1"; } if (chkBuses.Checked == false) { lblBuses.Text = "0"; } else { lblBuses.Text = "1"; } if (chkHotels.Checked == false) { lblHotels.Text = "0"; } else { lblHotels.Text = "1"; } if (chkRecharge.Checked == false) { lblRecharge.Text = "0"; } else { lblRecharge.Text = "1"; } message = objBal.UpdateAgent(txtAgentName.Text.Trim().ToString(), ddlType.SelectedItem.Text.ToString(), Convert.ToDateTime(txtDateOfBirth.Text), txtCity.Text.Trim().ToString(), ddlState.SelectedItem.Text.ToString(), txtAddress.Text.Trim().ToString(), txtPinCode.Text.Trim().ToString(), txtMobileNo.Text.Trim().ToString(), txtAlternateMobileNo.Text.Trim().ToString(), txtLandlineNo.Text.Trim().ToString(), txtEmailId.Text.Trim().ToString(), txtPAN.Text.Trim().ToString(), txtDetails.Text.Trim().ToString(), ddlStatus.SelectedItem.Text.ToString(), txtPassword.Text.Trim().ToString(), Convert.ToInt32(btnRegister.CommandArgument.ToString()), Convert.ToInt32(Session["UserID"].ToString()), Convert.ToInt32(txtCommissionPercentage.Text.ToString()), lblDomesticFlights.Text.ToString(), lblInterNationalFlights.Text.ToString(), lblBuses.Text.ToString(), lblHotels.Text.ToString(), lblRecharge.Text.ToString() ); } //lblMsg.InnerHtml = message; lblDomesticFlights.Visible = false; lblInterNationalFlights.Visible = false; lblBuses.Visible = false; lblHotels.Visible = false; lblRecharge.Visible = false; } catch (Exception ex) { lblMsg.InnerHtml = ex.Message; } }