public void ProcessMailForExpenses(string subjectName)
        {
            List <MailMessage> claims = mailHelper.getStringMessages(subjectName);

            foreach (MailMessage claim in claims)
            {
                //store the request....
                RequestDAO request = new RequestDAO();
                if (request.shouldProcess(claim.id))
                {
                    Request req = request.createRequestOrGetRequest(claim.from, claim.body, DateTime.Now, claim.id);
                    //call the rest service.
                    XmlDocument xdoc              = RestHelper.callRestService(restEndPoint, claim.body);
                    ExpenseDTO  expenseDTO        = Deserialiser.deserialiseContent <ExpenseDTO>(xdoc);
                    ExpenseDAO  expenseDAO        = new ExpenseDAO();
                    Expense     expenseToValidate = expenseDAO.CreateExpense(expenseDTO, req);

                    ExpenseValidator validator = new ExpenseValidator(expenseToValidate);

                    mailHelper.sendMessage(claim.from, validator.getMessage(), claim.id, string.Format("response to claim dated {0}", claim.date));
                    //deserialise the content
                    //validate the request
                    //store - valid request or failure and respond to user
                }
            }
        }
示例#2
0
        public List <Expense> RetrieveDataByEmail(string email)
        {
            ExpenseDAO     dao    = new ExpenseDAO();
            List <Expense> result = dao.SearchByEmail(email);

            return(result);
        }
示例#3
0
        public int DeleteByRow(long sid)
        {
            ExpenseDAO dao    = new ExpenseDAO();
            int        result = dao.DeletebyRow(sid);

            return(result);
        }
示例#4
0
        public List <Expense> selectGraphData(string date, string price)
        {
            ExpenseDAO     dao    = new ExpenseDAO();
            List <Expense> result = dao.SelectGraphData(date, price);

            return(result);
        }
示例#5
0
        public int UpdateExpense()
        {
            ExpenseDAO dao    = new ExpenseDAO();
            int        result = dao.Update(this);

            return(result);
        }
示例#6
0
        public int AddExpense(string email)
        {
            ExpenseDAO dao    = new ExpenseDAO();
            int        result = dao.Insert(this, email);

            return(result);
        }
示例#7
0
        public List <Expense> FilterDate(string startDate, string endDate)
        {
            //DateTime startDate =
            ExpenseDAO     dao    = new ExpenseDAO();
            List <Expense> result = dao.FilterByDate(startDate, endDate);

            return(result);
        }
示例#8
0
        public static ExpenseDAO mapToExpenseDAO(ExpenseDTO b)
        {
            ExpenseDAO a = new ExpenseDAO();

            a.Cost = b.Cost;
            a.Id   = b.Id;
            a.Name = b.Name;
            return(a);
        }
示例#9
0
        public static Expense MapToExpense(ExpenseDAO expense)
        {
            var c = new Expense();

            c.Id   = expense.Id;
            c.Name = expense.Name;
            c.Cost = expense.Cost;

            return(c);
        }
示例#10
0
        public List <Expense> GetAllExpense(string email)
        {
            ExpenseDAO dao = new ExpenseDAO();

            return(dao.SelectAll(email));
        }
示例#11
0
 public bool AddJobExpense(JobDAO j, ExpenseDAO ex)
 {
     return(ef.AddJobExpense(JobMapper.MapToJob(j), ExpenseMapper.MapToExpense(ex)));
 }
示例#12
0
 public bool DeleteExpense(ExpenseDAO ex)
 {
     return(ef.DeleteExpense(ExpenseMapper.MapToExpense(ex)));
 }
示例#13
0
 public bool UpdateExpense(ExpenseDAO ex)
 {
     return(ef.UpdateExpense(ExpenseMapper.MapToExpense(ex)));
 }
示例#14
0
 public bool AddExpense(ExpenseDAO ex)
 {
     return(ef.AddExpense(ExpenseMapper.MapToExpense(ex)));
 }
 public ExpenseBUS()
 {
     sDao = new ExpenseDAO();
 }