public static string GetStaffingObjetValidationErros(long StaffingObjectID, enumStaffingObjectType StaffingObjectTypeID, ref bool hasErrors, bool ValidateSignature) { StringBuilder finalError = new StringBuilder(); List <ValidationError> errorList = new List <ValidationError>(); errorList = ValidateStaffingObject(StaffingObjectID, StaffingObjectTypeID, ValidateSignature); int i = 1; if (errorList.Count > 0) { hasErrors = true; foreach (ValidationError item in errorList) { if (i == 1) // This is to prevent extra bullet that appears in validation summary control { finalError.AppendFormat("{0}", item.ErrorMessage); } else { finalError.AppendFormat("<li>{0}</li>", item.ErrorMessage); } i = i + 1; } } else { hasErrors = false; } return(finalError.ToString()); }
public static long CheckStaffingObject(long staffingObjectID, enumStaffingObjectType staffingObjectTypeID, enumActionType checkActionTypeID, int userID, TransactionManager currentTransaction) { long checkID = -1; try { if (checkActionTypeID == enumActionType.CheckIn || checkActionTypeID == enumActionType.CheckOut) { if (currentTransaction != null) { checkID = (long)ExecuteScalar(currentTransaction, "spr_JNPCheck", staffingObjectID, staffingObjectTypeID, (int)checkActionTypeID, userID); } else { checkID = (long)ExecuteScalar("spr_JNPCheck", staffingObjectID, staffingObjectTypeID, (int)checkActionTypeID, userID); } } else { throw new ApplicationException("You can either Check in or Check Out the object.<br/>Provided action value is not correct."); } } catch (Exception ex) { if ((currentTransaction != null) && (currentTransaction.IsOpen)) { currentTransaction.Rollback(); } HandleException(ex); } return(checkID); }
protected virtual void FillObjectFromRowData(DataRow returnRow) { this._checkID = (long)returnRow["CheckID"]; if (returnRow["CheckStaffingObjectID"] != DBNull.Value) { this._checkStaffingObjectID = (long)returnRow["CheckStaffingObjectID"]; } if (returnRow["CheckStaffingObjectTypeID"] != DBNull.Value) { this._checkStaffingObjectTypeID = (enumStaffingObjectType)returnRow["CheckStaffingObjectTypeID"]; } if (returnRow["CheckActionTypeID"] != DBNull.Value) { this._checkActionTypeID = (int)returnRow["CheckActionTypeID"]; } if (returnRow["CheckUserID"] != DBNull.Value) { this._checkUserID = (int)returnRow["CheckUserID"]; } if (returnRow["CheckDate"] != DBNull.Value) { this._checkDate = (DateTime)returnRow["CheckDate"]; } }
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); }
public static long Check(long CheckStaffingObjectID, enumStaffingObjectType staffingObjectType, enumActionType actionType, int CheckUserID, DateTime CheckDate) { long checkID = -1; try { int CheckStaffingObjectTypeID = (int)staffingObjectType; int CheckActionTypeID = (int)actionType; checkID = (long)ExecuteScalar("spr_JNPCheck", CheckStaffingObjectID, CheckStaffingObjectTypeID, CheckActionTypeID, CheckUserID, CheckDate); } catch (Exception ex) { HandleException(ex); } return(checkID); }
public static long CheckStaffingObject(long staffingObjectID, enumStaffingObjectType staffingObjectTypeID, enumActionType checkActionTypeID, int userID) { return(CheckStaffingObject(staffingObjectID, staffingObjectTypeID, checkActionTypeID, userID, null)); }
public static List <ValidationError> ValidateStaffingObject(long StaffingObjectID, enumStaffingObjectType StaffingObjectTypeID, bool ValidateSignature) { List <ValidationError> errorList = new List <ValidationError>(); DbCommand commandWrapper = GetDbCommand("spr_ValidateStaffingObjectAndGetErrorMessages"); try { commandWrapper.Parameters.Add(new SqlParameter("@StaffingObjectTypeID", (int)StaffingObjectTypeID)); commandWrapper.Parameters.Add(new SqlParameter("@StaffingObjectID", StaffingObjectID)); commandWrapper.Parameters.Add(new SqlParameter("@validateSignature", ValidateSignature)); SqlParameter returnParam = new SqlParameter("@validationSuccessful", SqlDbType.Bit); returnParam.Direction = ParameterDirection.Output; commandWrapper.Parameters.Add(returnParam); errorList = ValidationError.GetCollection(ExecuteDataTable(commandWrapper)); } catch (Exception ex) { HandleException(ex); } return(errorList); }