public static List <ATTParticipant> GetParticipant(int OrgID, int ProgramID) { List <ATTParticipant> ParticipantList = new List <ATTParticipant>(); try { foreach (DataRow row in DLLParticipant.GetParticipant(OrgID, ProgramID).Rows) { ATTParticipant ObjAtt = new ATTParticipant ( 0, 0, double.Parse(row["P_ID"].ToString()), ((row["NAME"] == System.DBNull.Value) ? "" : (string)row["NAME"]), "12/12/12", "O" ); ParticipantList.Add(ObjAtt); } return(ParticipantList); } catch (Exception ex) { throw ex; } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (lstProgram.SelectedIndex == -1) { this.lblStatusMessage.Text = "Select Program First"; this.programmaticModalPopup.Show(); return; } if (grdParticipant.Rows.Count > 0) { List <ATTParticipant> lstParticipant = new List <ATTParticipant>(); try { foreach (GridViewRow rowPerson in grdPerson.Rows) { bool blnPersonAlreadyExists = false; CheckBox cb; cb = (CheckBox)(rowPerson.Cells[0].FindControl("chkSelectPerson")); if (cb.Checked) { foreach (GridViewRow row in grdParticipant.Rows) { if (row.Cells[2].Text.Trim() == rowPerson.Cells[1].Text.Trim()) { blnPersonAlreadyExists = true; break; } else { blnPersonAlreadyExists = false; } } if (!blnPersonAlreadyExists) { ATTParticipant attP = new ATTParticipant((int)Session["OrgID"], int.Parse(lstProgram.SelectedValue.ToString()), int.Parse(rowPerson.Cells[1].Text.ToString()), "", Session["NepDate"].ToString(), ""); lstParticipant.Add(attP); } } } BLLParticipant.SaveParticipant(lstParticipant); this.lstProgram_SelectedIndexChanged(sender, e); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); return; } } else { this.lblStatusMessage.Text = "Search Person to add Participant"; this.programmaticModalPopup.Show(); return; } }
public static bool SaveParticipant(ATTParticipant objParticipant) { try { return(DLLParticipant.SaveParticipant(objParticipant)); } catch (Exception ex) { throw ex; } }
public static bool SaveParticipant(ATTParticipant ObjParticipant) { GetConnection GetConn = new GetConnection(); OracleTransaction Tran = GetConn.GetDbConn(Module.DLPDS).BeginTransaction(); double personID; string InsertUpdatePostSql = ""; try { personID = DLLPerson.AddPersonnelDetails(ObjParticipant.ObjPerson, Tran); if (ObjParticipant.LstParticipantPost.Count > 0) { DLLParticipantPost.SaveParticipantPost(ObjParticipant.LstParticipantPost, Tran, personID); } OracleParameter[] ParamArray = new OracleParameter[4]; ParamArray[0] = Utilities.GetOraParam(":p_ORG_ID", ObjParticipant.OrgID, OracleDbType.Int64, ParameterDirection.Input); ParamArray[1] = Utilities.GetOraParam(":p_PROGRAM_ID", ObjParticipant.ProgramID, OracleDbType.Int64, ParameterDirection.Input); ParamArray[2] = Utilities.GetOraParam(":p_P_ID", personID, OracleDbType.Double, ParameterDirection.Input); ParamArray[3] = Utilities.GetOraParam(":p_JOINING_DATE", ObjParticipant.JoiningDate, OracleDbType.Varchar2, ParameterDirection.Input); if (ObjParticipant.PID == 0) { InsertUpdatePostSql = "SP_ADD_PARTICIPANT"; } else if (ObjParticipant.PID > 0) { InsertUpdatePostSql = "SP_EDIT_PARTICIPANT"; } SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdatePostSql, ParamArray); ObjParticipant.PID = personID; Tran.Commit(); return(true); } catch (OracleException oex) { PCS.COREDL.OracleError oe = new PCS.COREDL.OracleError(); throw new ArgumentException(oe.GetOraError(oex.Number, oex.Message)); } catch (Exception ex) { Tran.Rollback(); throw ex; } finally { GetConn.CloseDbConn(); } }
protected void btnOK_Click(object sender, EventArgs e) { ATTFacultyMember objFacultyMember = null; ATTParticipantPost objparticipantPost; ATTPerson objPerson; ATTParticipant objParticipant = null; byte[] ImageData = new byte[0]; int? intCountryId = null; int? intBirthDistrict = null; int? intReligion = null; ATTUserLogin user = (ATTUserLogin)Session["Login_User_Detail"]; string strUser = user.UserName; int intOrgID = user.OrgID; int intFacultyID = int.Parse(Session["FacultyID"].ToString()); if (this.txtProgramID.Text != "") { if (this.ddlPost.SelectedIndex == 0) { this.lblStatusMessage.Text = "Select Post of Participant"; this.programmaticModalPopup.Show(); return; } } if (this.ddlPost.SelectedIndex > 0) { if (this.ddlPostLevel.SelectedIndex == 0) { this.lblStatusMessage.Text = "Select Post Level"; this.programmaticModalPopup.Show(); return; } } try { if (this.ddlCountry.SelectedIndex > 0) { intCountryId = int.Parse(this.ddlCountry.SelectedValue.ToString()); } if (this.ddlBirthDistrict.SelectedIndex > 0) { intBirthDistrict = int.Parse(this.ddlBirthDistrict.SelectedValue.ToString()); } //Following code has been disabled since ddlReligion not required. Ashok. //if (this.ddlReligion.SelectedIndex > 0) // intReligion = int.Parse(this.ddlReligion.SelectedValue.ToString()); objPerson = new ATTPerson( 0, this.txtFName_Rqd.Text.Trim(), this.txtMName.Text.Trim(), this.txtSurName_Rqd.Text.Trim(), this.txtDOB.Text.Trim(), ((this.ddlGender.SelectedIndex <= 0) ? "" : (this.ddlGender.SelectedValue)), ((this.ddlMarStatus.SelectedIndex <= 0) ? "" : (this.ddlMarStatus.SelectedValue)), this.txtFatherName.Text.Trim(), this.txtGFatherName.Text.Trim(), intCountryId, intBirthDistrict, intReligion, user.OrgID, 104, ((Label)this.Master.FindControl("lblUsername")).Text, DateTime.Parse(Session["EngDate"].ToString()), ImageData, "P" ); if (this.txtProgramID.Text == "") { objFacultyMember = new ATTFacultyMember(intOrgID, intFacultyID, 0, Session["NepDate"].ToString(), ""); objFacultyMember.ObjPerson = objPerson; } else { objParticipant = new ATTParticipant(intOrgID, int.Parse(this.txtProgramID.Text.ToString()), 0, "", Session["NepDate"].ToString(), ""); objParticipant.ObjPerson = objPerson; } if (this.ddlPost.SelectedIndex > 0) { objparticipantPost = new ATTParticipantPost(0, int.Parse(ddlPost.SelectedValue.ToString()), int.Parse(ddlPostLevel.SelectedValue.ToString()), Session["NepDate"].ToString()); objparticipantPost.Action = "A"; if (this.txtProgramID.Text == "") { objFacultyMember.LstParticipantPost.Add(objparticipantPost); } else { objParticipant.LstParticipantPost.Add(objparticipantPost); } } foreach (GridViewRow row in this.grdAddress.Rows) { if (CheckNullString(row.Cells[10].Text.ToString()) != "") { int?intDistrict = null; int?intVDC = null; int?intWard = null; if (CheckNullString(row.Cells[7].Text.ToString()) != "") { intDistrict = int.Parse(CheckNullString(row.Cells[7].Text.ToString())); } if (CheckNullString(row.Cells[8].Text.ToString()) != "") { intVDC = int.Parse(CheckNullString(row.Cells[8].Text.ToString())); } if (CheckNullString(row.Cells[5].Text.ToString()) != "") { intWard = int.Parse(CheckNullString(row.Cells[5].Text.ToString())); } ATTPersonAddress PersonAddressATT = new ATTPersonAddress ( 0, row.Cells[1].Text, int.Parse(row.Cells[11].Text), intDistrict, intVDC, intWard, CheckNullString(row.Cells[6].Text), CheckNullString(row.Cells[9].Text), ((Label)this.Master.FindControl("lblUsername")).Text, DateTime.Parse(Session["EngDate"].ToString()) ); PersonAddressATT.Action = CheckNullString(row.Cells[10].Text.ToString()); objPerson.LstPersonAddress.Add(PersonAddressATT); } } foreach (GridViewRow row in this.grdPhone.Rows) { if (CheckNullString(row.Cells[7].Text.ToString()) != "") { ATTPersonPhone PersonPhoneATT = new ATTPersonPhone ( 0, row.Cells[1].Text, int.Parse(row.Cells[3].Text), CheckNullString(row.Cells[4].Text), CheckNullString(row.Cells[5].Text), CheckNullString(row.Cells[6].Text), ((Label)this.Master.FindControl("lblUsername")).Text, DateTime.Parse(Session["EngDate"].ToString()) ); PersonPhoneATT.Action = CheckNullString(row.Cells[7].Text.ToString()); objPerson.LstPersonPhone.Add(PersonPhoneATT); } } foreach (GridViewRow row in this.grdEMail.Rows) { if (CheckNullString(row.Cells[7].Text) != "") { ATTPersonEMail PersonEMailATT = new ATTPersonEMail ( 0, row.Cells[1].Text, int.Parse(row.Cells[3].Text), CheckNullString(row.Cells[4].Text), CheckNullString(row.Cells[5].Text), CheckNullString(row.Cells[6].Text), ((Label)this.Master.FindControl("lblUsername")).Text, DateTime.Parse(Session["EngDate"].ToString()) ); PersonEMailATT.Action = CheckNullString(row.Cells[7].Text.ToString()); objPerson.LstPersonEMail.Add(PersonEMailATT); } } if (this.txtProgramID.Text == "") { BLLFacultyMember.SaveFacultyMember(objFacultyMember); } else { BLLParticipant.SaveParticipant(objParticipant); } ClearControls(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }