public static bool SaveFacultyMember(ATTFacultyMember objFacultyMember) { try { return(DLLFacultyMember.SaveFacultyMember(objFacultyMember)); } catch (Exception ex) { throw ex; } }
public static bool SaveFacultyMember(ATTFacultyMember objFacultyMember) { GetConnection GetConn = new GetConnection(); OracleTransaction Tran = GetConn.GetDbConn(Module.DLPDS).BeginTransaction(); double personID; string InsertUpdatePostSql = ""; try { personID = DLLPerson.AddPersonnelDetails(objFacultyMember.ObjPerson, Tran); if (objFacultyMember.LstParticipantPost.Count > 0) { DLLParticipantPost.SaveParticipantPost(objFacultyMember.LstParticipantPost, Tran, personID); } OracleParameter[] ParamArray = new OracleParameter[5]; ParamArray[0] = Utilities.GetOraParam(":p_ORG_ID", objFacultyMember.OrgID, OracleDbType.Int32, ParameterDirection.Input); ParamArray[1] = Utilities.GetOraParam(":p_FACULTY_ID", objFacultyMember.FacultyID, OracleDbType.Int32, ParameterDirection.Input); ParamArray[2] = Utilities.GetOraParam(":p_P_ID", personID, OracleDbType.Double, ParameterDirection.Input); ParamArray[3] = Utilities.GetOraParam(":p_FROM_DATE", objFacultyMember.FromDate, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[4] = Utilities.GetOraParam(":p_TO_DATE", objFacultyMember.ToDate, OracleDbType.Varchar2, ParameterDirection.Input); if (objFacultyMember.PID == 0) { InsertUpdatePostSql = "SP_ADD_FACULTY_MEMBER"; } else if (objFacultyMember.PID > 0) { InsertUpdatePostSql = "SP_EDIT_FACULTY_MEMBER"; } SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdatePostSql, ParamArray); objFacultyMember.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(); } }