private void Handle_Participant_TypeChange(string sValue, bool bResetControls) { switch (sValue) { case "0": pnlParticipant_Organization.Visible = false; pnlParticipant_Person.Visible = true; break; case "1": pnlParticipant_Person.Visible = true; pnlParticipant_Organization.Visible = true; break; case "2": pnlParticipant_Person.Visible = false; pnlParticipant_Organization.Visible = true; break; } if (bResetControls) { lblGlobal_Insert_Participants.Text = ""; tbParticipants_NameFirst.Text = ""; tbParticipants_NameLast.Text = ""; UC_DropDownListByAlphabet_Participants.ResetControls(); } }
private void Insert_Participants() { lblGlobal_Insert_Participants.ForeColor = System.Drawing.Color.ForestGreen; StringBuilder sb = new StringBuilder(); try { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { string sParticipant = null; string sParticipantSuffix = null; string sParticipantOrg = null; string sNameFirst = null; string sNameLast = null; string sFK_Suffix = null; int? iFK_Organization = null; string sParticipantType = null; string sWACRegion = null; if (rblParticipants.SelectedValue == "0" || rblParticipants.SelectedValue == "1") { if (!string.IsNullOrEmpty(tbParticipants_NameFirst.Text)) { sNameFirst = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbParticipants_NameFirst.Text, 48); } else { sb.Append("First Name is required. "); } if (!string.IsNullOrEmpty(tbParticipants_NameLast.Text)) { sNameLast = WACGlobal_Methods.Format_Global_StringLengthRestriction(tbParticipants_NameLast.Text, 48); } else { sb.Append("Last Name is required. "); } if (!string.IsNullOrEmpty(ddlParticipants_Suffix.SelectedValue)) { sFK_Suffix = ddlParticipants_Suffix.SelectedValue; sParticipantSuffix = ddlParticipants_Suffix.SelectedItem.Text; } } if (rblParticipants.SelectedValue == "1" || rblParticipants.SelectedValue == "2") { DropDownList ddl = UC_DropDownListByAlphabet_Participants.FindControl("ddl") as DropDownList; if (!string.IsNullOrEmpty(ddl.SelectedValue)) { iFK_Organization = Convert.ToInt32(ddl.SelectedValue); sParticipantOrg = ddl.SelectedItem.Text; } else { sb.Append("Organization is required."); } } sParticipant = WACGlobal_Methods.SpecialText_Global_Participant_Name_Org(sNameLast, sNameFirst, null, sParticipantSuffix, sParticipantOrg); sParticipantType = ddlParticipantType.SelectedValue; if (!string.IsNullOrEmpty(ddlWACRegion.SelectedValue)) { sWACRegion = ddlWACRegion.SelectedValue; } if (string.IsNullOrEmpty(sb.ToString())) { int?i = null; int iCode = wac.participant_add_express(sNameFirst, sNameLast, sFK_Suffix, iFK_Organization, sParticipantType, sWACRegion, Session["userName"].ToString(), ref i); if (iCode == 0) { //if (!string.IsNullOrEmpty(StringParticipantType)) //{ // int? i2 = null; // int iCode2 = wac.participantType_add(i, StringParticipantType, Session["userName"].ToString(), ref i2); // if (iCode2 != 0) WACAlert.Show("Successfully added Participant, but Error Inserting Participant Type: ", iCode2); //} Handle_Participant_TypeChange("0", true); lblGlobal_Insert_Participants.Text = "Successfully added Participant: " + sParticipant; } else { WACAlert.Show("Error Inserting Participant: ", iCode); } } else { WACAlert.Show(sb.ToString(), 0); } } } catch (Exception ex) { lblGlobal_Insert_Participants.ForeColor = System.Drawing.Color.Red; lblGlobal_Insert_Participants.Text = "Error Inserting Participant: " + ex.Message; } }