Exemplo n.º 1
0
        /// <summary>
        /// insert new row in the table
        /// </summary>
        /// <param name="currentDate">business object</param>
        /// <returns>true of successfully insert</returns>
        public bool UpdateWeeklyReportXref(clsWeekRange businessObject)
        {
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = "dbo.[sp_UpdateWeeklyReportXref]";
            sqlCommand.CommandType = CommandType.StoredProcedure;

            // Use connection object of base class
            sqlCommand.Connection = MainConnection;

            try
            {
                sqlCommand.Parameters.Add(new SqlParameter("@WEEK_RANGE", SqlDbType.Int, 11, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.WeekRangeID));
                sqlCommand.Parameters.Add(new SqlParameter("@EMP_ID", SqlDbType.Int, 11, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.EmpID));
                sqlCommand.Parameters.Add(new SqlParameter("@STATUS", SqlDbType.Int, 2, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.Status));
                sqlCommand.Parameters.Add(new SqlParameter("@DATE_SUBMITTED", SqlDbType.Date, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.Date_Submitted));

                MainConnection.Open();
                sqlCommand.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception("clsWeeklyReport::UpdateWeeklyReportXref::Error occured.", ex);
            }
            finally
            {
                MainConnection.Close();
                sqlCommand.Dispose();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Populate business object from data reader
 /// </summary>
 /// <param name="businessObject">business object</param>
 /// <param name="dataReader">data reader</param>
 internal void PopulateBusinessObjectFromReaderForWeekRange(clsWeekRange businessObject, IDataReader dataReader)
 {
     businessObject.WeekRangeID = dataReader.GetInt32(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.WeekRangeID.ToString()));
     businessObject.StartWeek   = dataReader.GetDateTime(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.StartWeek.ToString()));
     businessObject.EndWeek     = dataReader.GetDateTime(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.EndWeek.ToString()));
     businessObject.DateRange   = dataReader.GetString(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.DateRange.ToString()));
 }
Exemplo n.º 3
0
        /// <summary>
        /// insert new row in the table
        /// </summary>
        /// <param name="currentDate">business object</param>
        /// <returns>true of successfully insert</returns>
        public bool InsertWeekRange(clsWeekRange businessObject)
        {
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = "dbo.[sp_InsertWeekRange]";
            sqlCommand.CommandType = CommandType.StoredProcedure;

            // Use connection object of base class
            sqlCommand.Connection = MainConnection;

            try
            {
                sqlCommand.Parameters.Add(new SqlParameter("@CURRENT_DATE", SqlDbType.Date, 8, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.StartWeek));
                MainConnection.Open();
                sqlCommand.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception("clsWeeklyReport::InsertWeekRange::Error occured.", ex);
            }
            finally
            {
                MainConnection.Close();
                sqlCommand.Dispose();
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Populate business object from data reader
 /// </summary>
 /// <param name="businessObject">business object</param>
 /// <param name="dataReader">data reader</param>
 internal void PopulateBusinessObjectFromReaderForWeeklyReports(clsWeekRange businessObject, IDataReader dataReader)
 {
     businessObject.WeekRangeID    = dataReader.GetInt32(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.WeekRangeID.ToString()));
     businessObject.StartWeek      = dataReader.GetDateTime(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.StartWeek.ToString()));
     businessObject.EndWeek        = dataReader.GetDateTime(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.EndWeek.ToString()));
     businessObject.Status         = dataReader.GetInt32(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.Status.ToString()));
     businessObject.Date_Submitted = dataReader.GetDateTime(dataReader.GetOrdinal(clsWeekRange.clsWeekRangeFields.Date_Submitted.ToString()));
 }
Exemplo n.º 5
0
        /// <summary>
        /// Populate business objects from the data reader
        /// </summary>
        /// <param name="dataReader">data reader</param>
        /// <returns>list of clsWeekRange</returns>
        internal List <clsWeekRange> PopulateObjectsFromReaderForWeeklyReports(IDataReader dataReader)
        {
            List <clsWeekRange> list = new List <clsWeekRange>();

            while (dataReader.Read())
            {
                clsWeekRange businessObject = new clsWeekRange();
                PopulateBusinessObjectFromReaderForWeeklyReports(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }