Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="accountID"></param>
        /// <param name="leaveRequestType"></param>
        /// <param name="requestStatus"></param>
        /// <returns></returns>
        public List <LeaveRequestItem> GetLeaveRequestItemByAccountIDAndRequestStatus(int accountID,
                                                                                      LeaveRequestTypeEnum leaveRequestType, RequestStatus requestStatus)
        {
            List <LeaveRequestItem> leaveRequestItemList = new List <LeaveRequestItem>();
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_ParmAccountID, SqlDbType.Int).Value          = accountID;
            cmd.Parameters.Add(_ParmLeaveRequestTypeID, SqlDbType.Int).Value = (int)leaveRequestType;
            cmd.Parameters.Add(_ParmLeaveRequestStatus, SqlDbType.Int).Value = requestStatus.Id;
            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetLeaveRequestItemByAccountIDAndRequestStatus", cmd))
            {
                while (sdr.Read())
                {
                    LeaveRequestItem leaveRequestItem =
                        new LeaveRequestItem((int)sdr[_DBPKID], Convert.ToDateTime(sdr[_DBFromDate]),
                                             Convert.ToDateTime(sdr[_DBToDate]), Convert.ToDecimal(sdr[_DBAbsentHours]),
                                             RequestStatus.FindRequestStatus((int)sdr[_DBLeaveRequestStatus]));

                    leaveRequestItemList.Add(leaveRequestItem);
                }
            }
            return(leaveRequestItemList);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据员工ID,请假类型,状态,累加请假小时
        /// </summary>
        /// <param name="accountID"></param>
        /// <param name="status"></param>
        /// <param name="leaveRequestTypeEnum"></param>
        /// <returns></returns>
        public decimal SumLeaveRequestCostTimeByEmployeeIDStatusApplyType(int accountID, RequestStatus status, LeaveRequestTypeEnum leaveRequestTypeEnum)
        {
            decimal    count = 0;
            SqlCommand cmd   = new SqlCommand();

            cmd.Parameters.Add(_DBAccountID, SqlDbType.Int).Value            = accountID;
            cmd.Parameters.Add(_ParmLeaveRequestStatus, SqlDbType.Int).Value = status.Id;
            cmd.Parameters.Add(_ParmLeaveRequestTypeID, SqlDbType.Int).Value = leaveRequestTypeEnum;
            using (SqlDataReader sdr = SqlHelper.ExecuteReader("SumLeaveRequestCostTimeByEmployeeIDAndStatus", cmd))
            {
                while (sdr.Read())
                {
                    try
                    {
                        count = (decimal)sdr[_DbTotalHout];
                    }
                    catch
                    {
                        count = 0;
                    }
                }
            }
            return(count);
        }