Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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();
            }
        }