示例#1
0
        private static JAWorkflowStatus  FillObjectFromRowData(DataRow returnRow)
        {
            JAWorkflowStatus jaw = new JAWorkflowStatus();

            try
            {
                jaw.JAWorkflowRecID    = (long)returnRow["JAWorkflowRecID"];
                jaw.JAID               = (long)returnRow["JAID"];
                jaw.JAWorkflowStatusID = (int)returnRow["JAWorkflowStatusID"];

                if (returnRow["IsCurrent"] != DBNull.Value)
                {
                    jaw.IsCurrent = (bool)returnRow["IsCurrent"];
                }


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


                if (returnRow["CreateDate"] != DBNull.Value)
                {
                    jaw.CreateDate = (DateTime)returnRow["CreateDate"];
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
                jaw = null;
            }
            return(jaw);
        }
示例#2
0
        public static void Delete(JAWorkflowStatus jaw)
        {
            if (jaw.JAWorkflowRecID == -1)
            {
                throw new Exception("You must set the primary key before using this business object.");
            }
            else
            {
                DbCommand commandWrapper = GetDbCommand("spr_DeleteJAWorkflowStatus");
                try
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@jAWorkflowRecID", jaw.JAWorkflowRecID));
                    commandWrapper.Parameters.Add(new SqlParameter("@JAID", jaw.JAID));

                    if (jaw.CreatedByID == -1)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@createdByID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@createdByID", jaw.CreatedByID));
                    }

                    ExecuteNonQuery(commandWrapper);
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        }
示例#3
0
        private static JAWorkflowStatus  loadData(DataTable returnTable)
        {
            JAWorkflowStatus jaw = new JAWorkflowStatus();

            if (returnTable.Rows.Count > 0)
            {
                DataRow returnRow = returnTable.Rows[0];

                jaw = FillObjectFromRowData(returnRow);
            }
            return(jaw);
        }
示例#4
0
        public static long SetCurrentWorkflowStatus(JAWorkflowStatus jaw, TransactionManager currentTransaction)
        {
            long      jawRecID       = -1;
            DbCommand commandWrapper = GetDbCommand("spr_SetCurrentWorkflowStatus");

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

                // get the new JAWorkflowRecID of the record
                commandWrapper.Parameters.Add(returnParam);
                commandWrapper.Parameters.Add(new SqlParameter("@StaffingObjectID", jaw.JAID));
                commandWrapper.Parameters.Add(new SqlParameter("@StaffingObjectTypeID", enumStaffingObjectType.JA));
                commandWrapper.Parameters.Add(new SqlParameter("@WorkflowStatusID", jaw.JAWorkflowStatusID));


                if (jaw.CreatedByID == -1)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@createdByID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@createdByID", jaw.CreatedByID));
                }


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

                jawRecID = (long)returnParam.Value;
            }
            catch (Exception ex)
            {
                if ((currentTransaction != null) && (currentTransaction.IsOpen))
                {
                    currentTransaction.Rollback();
                }
                HandleException(ex);
            }

            return(jawRecID);
        }
示例#5
0
        public static JAWorkflowStatus GetByID(int loadByID)
        {
            JAWorkflowStatus jaw = new JAWorkflowStatus();
            // Load Object by ID
            DataTable returnTable;

            try
            {
                returnTable = ExecuteDataTable("spr_GetJAWorkflowStatuByID", loadByID);
                jaw         = loadData(returnTable);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
            return(jaw);
        }
示例#6
0
        internal static List <JAWorkflowStatus> GetCollection(DataTable dataItems)
        {
            List <JAWorkflowStatus> listCollection = new List <JAWorkflowStatus>();
            JAWorkflowStatus        current        = null;

            if (dataItems != null)
            {
                for (int i = 0; i < dataItems.Rows.Count; i++)
                {
                    current = FillObjectFromRowData(dataItems.Rows[i]);;
                    listCollection.Add(current);
                }
            }
            else
            {
                throw new Exception("You cannot create a JAWorkflowStatus collection from a null data table.");
            }

            return(listCollection);
        }
示例#7
0
        public static long Add(JAWorkflowStatus jaw)
        {
            long      jawRecID       = -1;
            DbCommand commandWrapper = GetDbCommand("spr_AddJAWorkflowStatus");

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

                // get the new JAWorkflowRecID of the record
                commandWrapper.Parameters.Add(returnParam);
                commandWrapper.Parameters.Add(new SqlParameter("@jAID", jaw.JAID));
                commandWrapper.Parameters.Add(new SqlParameter("@jAWorkflowStatusID", jaw.JAWorkflowStatusID));
                commandWrapper.Parameters.Add(new SqlParameter("@isCurrent", jaw.IsCurrent));

                if (jaw.CreatedByID == -1)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@createdByID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@createdByID", jaw.CreatedByID));
                }


                ExecuteNonQuery(commandWrapper);

                jawRecID = (long)returnParam.Value;
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            return(jawRecID);
        }
示例#8
0
 public static long SetCurrentWorkflowStatus(JAWorkflowStatus jaw)
 {
     return(SetCurrentWorkflowStatus(jaw, null));
 }
示例#9
0
        /// <summary>
        /// Determines whether the specified System.Object is equal to the current object.
        /// </summary>
        /// <param name="obj">The System.Object to compare with the current object.</param>
        /// <returns>Returns true if the specified System.Object is equal to the current object; otherwise, false.</returns>
        public override bool Equals(Object obj)
        {
            JAWorkflowStatus JAWorkflowStatusobj = obj as JAWorkflowStatus;

            return((JAWorkflowStatusobj == null) ? false : (this.JAWorkflowRecID == JAWorkflowStatusobj.JAWorkflowRecID));
        }