Пример #1
0
        public static List <EmailAlert> GetEmployeeLeaveApprovalNotificationList(int financialPeriodId, DateTime firstDay, DateTime lastDay, int employeeId, string leaveType)
        {
            List <EmailAlert> list = new List <EmailAlert>();

            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetEmployeeLeaveApprovalNotificationList";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@FinancialPeriodId", DbType.Int32, financialPeriodId);
            db.AddInParameter(dbCommand, "@FirstDay", DbType.DateTime, firstDay);
            db.AddInParameter(dbCommand, "@LastDay", DbType.DateTime, lastDay);
            db.AddInParameter(dbCommand, "@EmployeeId", DbType.Int32, employeeId);
            db.AddInParameter(dbCommand, "@LeaveType", DbType.String, leaveType);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    EmailAlert emailAlert = new EmailAlert();
                    emailAlert.EmailAddress = dataReader["EmailAddress"].ToString();
                    emailAlert.EmailSubject = dataReader["EmailSubject"].ToString();
                    emailAlert.EmailBody    = dataReader["EmailBody"].ToString();

                    list.Add(emailAlert);
                }
            }
            return(list);
        }
Пример #2
0
        public static List <EmailAlert> GetEmployeeLeaveReportsToDecisionNotification(int employeeLeaveDaysId)
        {
            List <EmailAlert> list = new List <EmailAlert>();

            Database  db         = DatabaseFactory.CreateDatabase("Spar-StoreRep");
            string    sqlCommand = "GetEmployeeLeaveReportsToDecisionNotification";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@EmployeeLeaveDaysId", DbType.Int32, employeeLeaveDaysId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    EmailAlert emailAlert = new EmailAlert();
                    emailAlert.EmailAddress          = dataReader["EmailAddress"].ToString();
                    emailAlert.EmailSubject          = dataReader["EmailSubject"].ToString();
                    emailAlert.EmailBody             = dataReader["EmailBody"].ToString();
                    emailAlert.EmailAddressReportsTo = dataReader["EmailAddressReportsTo"].ToString();

                    list.Add(emailAlert);
                }
            }
            return(list);
        }