Example #1
0
        public JNPApproval GetJNPApprovalByStaffingObjectID(long staffingObjectID, enumStaffingObjectType staffingObjectTypeID)
        {
            JNPApproval entity = new JNPApproval();

            entity.ID            = -1;
            entity.SupervisorID  = -1;
            entity.HRPersonnelID = -1;

            DataTable dt = ExecuteDataTable("spr_GetJNPApprovalByStaffingObjectID", staffingObjectID, (int)staffingObjectTypeID);

            if (dt != null && dt.Rows.Count > 0)
            {
                entity.ID                  = dt.Rows[0].Field <long>("ApprovalID");
                entity.SupervisorID        = dt.Rows[0].IsNull("SupervisorID") ? -1 : dt.Rows[0].Field <int>("SupervisorID");
                entity.SupervisorFullName  = dt.Rows[0].IsNull("SupervisorFullName") ? string.Empty : dt.Rows[0].Field <string>("SupervisorFullName");
                entity.SupervisorOrgTitle  = dt.Rows[0].IsNull("SupervisorOrgTitle") ? string.Empty : dt.Rows[0].Field <string>("SupervisorOrgTitle");
                entity.SupervisorSignDate  = dt.Rows[0].Field <DateTime?>("SupervisorSignDate");
                entity.HRPersonnelID       = dt.Rows[0].IsNull("HRPersonnelID") ? -1 : dt.Rows[0].Field <int>("HRPersonnelID");
                entity.HRPersonnelFullName = dt.Rows[0].IsNull("HRPersonnelFullName") ? string.Empty : dt.Rows[0].Field <string>("HRPersonnelFullName");
                entity.HRPersonnelOrgTitle = dt.Rows[0].IsNull("HRPersonnelOrgTitle") ? string.Empty : dt.Rows[0].Field <string>("HRPersonnelOrgTitle");
                entity.HRPersonnelSignDate = dt.Rows[0].Field <DateTime?>("HRPersonnelSignDate");
                entity.JNPID               = dt.Rows[0].Field <long>("JNPID");
                entity.JAID                = dt.Rows[0].Field <long>("JAID");
                entity.CRID                = dt.Rows[0].IsNull("CRID") ? -1 : dt.Rows[0].Field <long>("CRID");
                entity.JQID                = dt.Rows[0].Field <long>("JQID");
            }

            return(entity);
        }
Example #2
0
        public JNPApproval GetJNPApprovalByID(long approvalID)
        {
            JNPApproval entity;

            DataTable dt = ExecuteDataTable("spr_GetJNPApprovalByID", approvalID);

            if (dt != null && dt.Rows.Count > 0)
            {
                entity = new JNPApproval();

                entity.ID                  = dt.Rows[0].Field <long>("ApprovalID");
                entity.SupervisorID        = dt.Rows[0].Field <int>("SupervisorID");
                entity.SupervisorFullName  = dt.Rows[0].Field <string>("SupervisorFullName");
                entity.SupervisorOrgTitle  = dt.Rows[0].Field <string>("SupervisorOrgTitle");
                entity.SupervisorSignDate  = dt.Rows[0].Field <DateTime?>("SupervisorSignDate");
                entity.HRPersonnelID       = dt.Rows[0].Field <int>("HRPersonnelID");
                entity.HRPersonnelFullName = dt.Rows[0].Field <string>("HRPersonnelFullName");
                entity.HRPersonnelOrgTitle = dt.Rows[0].Field <string>("HRPersonnelOrgTitle");
                entity.HRPersonnelSignDate = dt.Rows[0].Field <DateTime?>("HRPersonnelSignDate");
                entity.JNPID               = dt.Rows[0].Field <long>("JNPID");
                entity.JAID                = dt.Rows[0].Field <long>("JAID");
                entity.CRID                = dt.Rows[0].Field <long>("CRID");
                entity.JQID                = dt.Rows[0].Field <long>("JQID");
            }
            else
            {
                throw new Exception("You cannot create a JNPApproval object from a null data table.");
            }

            return(entity);
        }
Example #3
0
        protected virtual void FillObjectFromRowData(DataRow returnRow)
        {
            DataColumnCollection columns = returnRow.Table.Columns;

            if (returnRow["JNPID"] != DBNull.Value)
            {
                this._JNPID = (long)returnRow["JNPID"];
            }

            if (returnRow["JNPTypeID"] != DBNull.Value)
            {
                int tempValue = (int)returnRow["JNPTypeID"];

                if (Enum.IsDefined(typeof(enumJNPType), tempValue))
                {
                    this._JNPTypeID = (enumJNPType)tempValue;
                }
            }

            if (returnRow["JNPOptionTypeID"] != DBNull.Value)
            {
                int tempValue = (int)returnRow["JNPOptionTypeID"];

                if (Enum.IsDefined(typeof(eJNPOptionType), tempValue))
                {
                    this._JNPOptionTypeID = (eJNPOptionType)tempValue;
                }
            }

            if (returnRow["IsStandardJNP"] != DBNull.Value)
            {
                this._isStandardJNP = (bool)returnRow["IsStandardJNP"];
            }

            if (returnRow["IsDEU"] != DBNull.Value)
            {
                this._isDEU = (bool)returnRow["IsDEU"];
            }

            if (returnRow["IsMP"] != DBNull.Value)
            {
                this._isMP = (bool)returnRow["IsMP"];
            }

            if (returnRow["IsExceptedService"] != DBNull.Value)
            {
                this._isExceptedService = (bool)returnRow["IsExceptedService"];
            }

            if (returnRow["PayPlanID"] != DBNull.Value)
            {
                this._payPlanID = (int)returnRow["PayPlanID"];
            }

            if (returnRow["PayPlanTitle"] != DBNull.Value)
            {
                this._payPlanTitle = returnRow["PayPlanTitle"].ToString();
            }

            if (returnRow["SeriesID"] != DBNull.Value)
            {
                this._seriesID = (int)returnRow["SeriesID"];
            }

            if (returnRow["SeriesName"] != DBNull.Value)
            {
                this._seriesName = returnRow["SeriesName"].ToString();
            }

            if (returnRow["IsInterdisciplinary"] != DBNull.Value)
            {
                this._isInterdisciplinary = (bool)returnRow["IsInterdisciplinary"];
            }

            if (returnRow["AdditionalSeriesID"] != DBNull.Value)
            {
                this._additionalSeriesID = (int)returnRow["AdditionalSeriesID"];
            }

            if (returnRow["AdditionalSeriesName"] != DBNull.Value)
            {
                this._additionalSeriesName = returnRow["AdditionalSeriesName"].ToString();
            }

            if (returnRow["LowestAdvertisedGrade"] != DBNull.Value)
            {
                this._lowestAdvertisedGrade = (int)returnRow["LowestAdvertisedGrade"];
            }

            if (returnRow["HighestAdvertisedGrade"] != DBNull.Value)
            {
                this._highestAdvertisedGrade = (int)returnRow["HighestAdvertisedGrade"];
            }

            if (returnRow["HighestAdvertisedGradeName"] != DBNull.Value)
            {
                this._highestAdvertisedGradeName = returnRow["HighestAdvertisedGradeName"].ToString();
            }

            if (returnRow["RegionID"] != DBNull.Value)
            {
                this._regionID = (int)returnRow["RegionID"];
            }

            if (returnRow["RegionName"] != DBNull.Value)
            {
                this._regionName = returnRow["RegionName"].ToString();
            }

            if (returnRow["OrganizationCodeID"] != DBNull.Value)
            {
                this._organizationCodeID = (int)returnRow["OrganizationCodeID"];
            }

            if (columns.Contains("OrganizationCode"))
            {
                if (returnRow["OrganizationCode"] != DBNull.Value)
                {
                    this._organizationCode = returnRow["OrganizationCode"].ToString();
                }
            }
            if (columns.Contains("OrganizationName"))
            {
                if (returnRow["OrganizationName"] != DBNull.Value)
                {
                    this._organizationName = returnRow["OrganizationName"].ToString();
                }
            }

            if (returnRow["JNPTitle"] != DBNull.Value)
            {
                this._JNPTitle = returnRow["JNPTitle"].ToString();
            }

            if (returnRow["DutyLocation"] != DBNull.Value)
            {
                this._dutyLocation = returnRow["DutyLocation"].ToString();
            }

            if (returnRow["VacancyID"] != DBNull.Value)
            {
                this._vacancyID = returnRow["VacancyID"].ToString();
            }

            if (returnRow["FullPDID"] != DBNull.Value)
            {
                this._fullPDID = (long)returnRow["FullPDID"];
            }

            if (returnRow["FullPDName"] != DBNull.Value)
            {
                this._fullPDName = returnRow["FullPDName"].ToString();
            }

            if (returnRow["AdditionalPDID"] != DBNull.Value)
            {
                this._additionalPDID = (long)returnRow["AdditionalPDID"];
            }

            if (returnRow["AdditionalPDName"] != DBNull.Value)
            {
                this._additionalPDName = returnRow["AdditionalPDName"].ToString();
            }

            if (returnRow["JAID"] != DBNull.Value)
            {
                this._JAID = (long)returnRow["JAID"];
            }

            if (returnRow["CRID"] != DBNull.Value)
            {
                this._CRID = (long)returnRow["CRID"];
            }

            if (returnRow["JQID"] != DBNull.Value)
            {
                this._JQID = (long)returnRow["JQID"];
            }

            if (returnRow["FPPSPDID"] != DBNull.Value)
            {
                this._FPPSPDID = returnRow["FPPSPDID"].ToString();
            }

            if (returnRow["CreatedByID"] != DBNull.Value)
            {
                this._createdByID = (int)returnRow["CreatedByID"];
            }

            if (returnRow["CreateDate"] != DBNull.Value)
            {
                this._createDate = (DateTime)returnRow["CreateDate"];
            }

            if (returnRow["UpdatedByID"] != DBNull.Value)
            {
                this._updatedByID = (int)returnRow["UpdatedByID"];
            }

            if (returnRow["UpdateDate"] != DBNull.Value)
            {
                this._updateDate = (DateTime)returnRow["UpdateDate"];
            }

            if (returnRow["ResultedInSuccessfulHiring"] != DBNull.Value)
            {
                this._resultedInSuccessfulHiring = (bool)returnRow["ResultedInSuccessfulHiring"];
            }

            if (returnRow["CopyFromJNPID"] != DBNull.Value)
            {
                this._copyFromJNPID = (long)returnRow["CopyFromJNPID"];
            }

            JNPApproval jnpApproval = GetJNPApprovalInfo(this._JNPID);

            if (jnpApproval.SupervisorSignDate != null)
            {
                this._IsJNPSignedBySupervisor = true;
            }

            if (jnpApproval.HRPersonnelSignDate != null)
            {
                this._IsJNPSignedByHR = true;
            }
        }
Example #4
0
        public long Add(JNPApproval entity, TransactionManager currentTransaction, SignatureType signaturetypeID)
        {
            long returnCode = -1;

            DbCommand commandWrapper = GetDbCommand("spr_AddJNPApproval");

            try
            {
                SqlParameter returnParam = new SqlParameter("@newApprovalID", SqlDbType.BigInt);
                returnParam.Direction = ParameterDirection.Output;

                // get the new ApprovalID of the record
                commandWrapper.Parameters.Add(returnParam);

                if (entity.SupervisorID <= 0)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@supervisorID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@supervisorID", entity.SupervisorID));
                }

                if (string.IsNullOrEmpty(entity.SupervisorFullName))
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@supervisorFullName", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@supervisorFullName", entity.SupervisorFullName));
                }

                if (string.IsNullOrEmpty(entity.SupervisorOrgTitle))
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@supervisorOrgTitle", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@supervisorOrgTitle", entity.SupervisorOrgTitle));
                }

                if (!entity.SupervisorSignDate.HasValue)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@supervisorSignDate", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@supervisorSignDate", entity.SupervisorSignDate));
                }

                if (entity.HRPersonnelID <= 0)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelID", entity.HRPersonnelID));
                }

                if (string.IsNullOrEmpty(entity.HRPersonnelFullName))
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelFullName", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelFullName", entity.HRPersonnelFullName));
                }

                if (string.IsNullOrEmpty(entity.HRPersonnelOrgTitle))
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelOrgTitle", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelOrgTitle", entity.HRPersonnelOrgTitle));
                }

                if (!entity.HRPersonnelSignDate.HasValue)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelSignDate", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelSignDate", entity.HRPersonnelSignDate));
                }

                if (entity.JNPID <= 0)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@jNPID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@jNPID", entity.JNPID));
                }

                if (entity.JAID <= 0)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@jAID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@jAID", entity.JAID));
                }

                if (entity.CRID <= 0)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@cRID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@cRID", entity.CRID));
                }

                if (entity.JQID <= 0)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@jQID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@jQID", entity.JQID));
                }


                commandWrapper.Parameters.Add(new SqlParameter("@signatureTypeID", (int)signaturetypeID));

                if (currentTransaction != null)
                {
                    DatabaseUtility.ExecuteNonQuery(currentTransaction, commandWrapper);
                }
                else
                {
                    ExecuteNonQuery(commandWrapper);
                }

                returnCode = (long)returnParam.Value;
            }
            catch (Exception ex)
            {
                currentTransaction.Rollback();
                HandleException(ex);
            }

            return(returnCode);
        }
Example #5
0
        public void Update(JNPApproval entity, TransactionManager currentTransaction, SignatureType signaturetypeID)
        {
            if (base.ValidateKeyField(entity.ID))
            {
                DbCommand commandWrapper = GetDbCommand("spr_UpdateJNPApproval");

                try
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@approvalID", entity.ID));

                    if (entity.SupervisorID <= 0)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@supervisorID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@supervisorID", entity.SupervisorID));
                    }

                    if (string.IsNullOrEmpty(entity.SupervisorFullName))
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@supervisorFullName", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@supervisorFullName", entity.SupervisorFullName));
                    }

                    if (string.IsNullOrEmpty(entity.SupervisorOrgTitle))
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@supervisorOrgTitle", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@supervisorOrgTitle", entity.SupervisorOrgTitle));
                    }

                    if (!entity.SupervisorSignDate.HasValue)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@supervisorSignDate", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@supervisorSignDate", entity.SupervisorSignDate));
                    }

                    if (entity.HRPersonnelID <= 0)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelID", entity.HRPersonnelID));
                    }

                    if (string.IsNullOrEmpty(entity.HRPersonnelFullName))
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelFullName", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelFullName", entity.HRPersonnelFullName));
                    }

                    if (string.IsNullOrEmpty(entity.HRPersonnelOrgTitle))
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelOrgTitle", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelOrgTitle", entity.HRPersonnelOrgTitle));
                    }

                    if (!entity.HRPersonnelSignDate.HasValue)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelSignDate", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@hRPersonnelSignDate", entity.HRPersonnelSignDate));
                    }

                    if (entity.JNPID <= 0)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@jNPID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@jNPID", entity.JNPID));
                    }

                    if (entity.JAID <= 0)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@jAID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@jAID", entity.JAID));
                    }

                    if (entity.CRID <= 0)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@cRID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@cRID", entity.CRID));
                    }

                    if (entity.JQID <= 0)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@jQID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@jQID", entity.JQID));
                    }


                    commandWrapper.Parameters.Add(new SqlParameter("@signatureTypeID", (int)signaturetypeID));


                    if (currentTransaction != null)
                    {
                        DatabaseUtility.ExecuteNonQuery(currentTransaction, commandWrapper);
                    }
                    else
                    {
                        ExecuteNonQuery(commandWrapper);
                    }
                }
                catch (Exception ex)
                {
                    currentTransaction.Rollback();
                    HandleException(ex);
                }
            }
        }
Example #6
0
 public void Update(JNPApproval entity, SignatureType signaturetypeID)
 {
     Update(entity, null, signaturetypeID);
 }
Example #7
0
 public long Add(JNPApproval entity, SignatureType signaturetypeID)
 {
     return(Add(entity, null, signaturetypeID));
 }