Beispiel #1
0
    // get list of DTO employees
    public List <EmployeeDTOTable> getEmployees()
    {
        using (var context = new hctDBEntities())
        {
            List <Employee>         cl = context.Employees.OrderBy(i => i.Id).ToList();
            List <EmployeeDTOTable> dl = new List <EmployeeDTOTable>();

            foreach (Employee c in cl)
            {
                EmployeeDTOTable cdt = new EmployeeDTOTable();
                cdt.EmployeeID  = c.empID;
                cdt.FirstName   = c.fname;
                cdt.LastName    = c.lname;
                cdt.Status      = c.status;
                cdt.Email1      = c.email1;
                cdt.HomePhone   = c.homePhone;
                cdt.MobilePhone = c.mobilePhone;
                cdt.Rate        = String.Format("{0:0.00}", c.rate);

                ;
                dl.Add(cdt);
            }
            return(dl);
        }
    }
    public List <QuoteDTOTable> getQuotes()
    {
        using (var context = new hctDBEntities())
        {
            List <Quote>         q  = context.Quotes.OrderBy(i => i.Id).ToList();
            List <QuoteDTOTable> ql = new List <QuoteDTOTable>();

            foreach (Quote i in q)
            {
                QuoteDTOTable cdt = new QuoteDTOTable();
                cdt.QuoteCode = i.quoteCode;
                cdt.Price     = i.totalPrice.ToString();
                cdt.Time      = i.totalTime.ToString();
                ql.Add(cdt);
            }
            return(ql);
        }
    }
    public List<InvoiceDTOTable> getInvoices()
    {
        using (var context = new hctDBEntities())
        {
            List<Invoice> inv = context.Invoices.OrderBy(i => i.Id).ToList();
            List<InvoiceDTOTable> il = new List<InvoiceDTOTable>();

            foreach (Invoice i in inv)
            {
                InvoiceDTOTable cdt = new InvoiceDTOTable();
                cdt.InvoiceID = i.InvoiceID;
                cdt.DateCreated = i.dateCreated.ToString();
                cdt.Name = i.name;
                cdt.PaymentStatus = i.paymentStatus;
                cdt.JobStatus = i.jobStatus;
                il.Add(cdt);
            }
            return il;
        }
    }
    public List <InvoiceDTOTable> getInvoices()
    {
        using (var context = new hctDBEntities())
        {
            List <Invoice>         inv = context.Invoices.OrderBy(i => i.Id).ToList();
            List <InvoiceDTOTable> il  = new List <InvoiceDTOTable>();

            foreach (Invoice i in inv)
            {
                InvoiceDTOTable cdt = new InvoiceDTOTable();
                cdt.InvoiceID     = i.InvoiceID;
                cdt.DateCreated   = i.dateCreated.ToString();
                cdt.Name          = i.name;
                cdt.PaymentStatus = i.paymentStatus;
                cdt.JobStatus     = i.jobStatus;
                il.Add(cdt);
            }
            return(il);
        }
    }
Beispiel #5
0
    // get a DTO of customer depending on required "displayable" data
    public List <CustomerDTOTable> getCustomers()
    {
        using (var context = new hctDBEntities())
        {
            List <Customer>         cl = context.Customers.OrderBy(i => i.Id).ToList();
            List <CustomerDTOTable> dl = new List <CustomerDTOTable>();

            foreach (Customer c in cl)
            {
                Person           p   = context.People.Where(pp => pp.Customer_Id == c.Id).FirstOrDefault();
                CustomerDTOTable cdt = new CustomerDTOTable();
                cdt.CustomerID = c.custID;
                cdt.FirstName  = p.fname;
                cdt.LastName   = p.lname;
                cdt.JoinDate   = c.joinDate.ToString();
                cdt.Status     = c.status;
                dl.Add(cdt);
            }
            return(dl);
        }
    }
    public List<QuoteDTOTable> getQuotes()
    {
        using (var context = new hctDBEntities())
        {
            List<Quote> q = context.Quotes.OrderBy(i => i.Id).ToList();
            List<QuoteDTOTable> ql = new List<QuoteDTOTable>();

            foreach (Quote i in q)
            {
                QuoteDTOTable cdt = new QuoteDTOTable();
                cdt.QuoteCode = i.quoteCode;
                cdt.Price = i.totalPrice.ToString();
                cdt.Time = i.totalTime.ToString();
                ql.Add(cdt);
            }
            return ql;
        }
    }
    // get list of DTO employees
    public List<EmployeeDTOTable> getEmployees()
    {
        using (var context = new hctDBEntities())
        {
            List<Employee> cl = context.Employees.OrderBy(i => i.Id).ToList();
            List<EmployeeDTOTable> dl = new List<EmployeeDTOTable>();

            foreach (Employee c in cl)
            {
                EmployeeDTOTable cdt = new EmployeeDTOTable();
                cdt.EmployeeID = c.empID;
                cdt.FirstName = c.fname;
                cdt.LastName = c.lname;
                cdt.Status = c.status;
                cdt.Email1 = c.email1;
                cdt.HomePhone = c.homePhone;
                cdt.MobilePhone = c.mobilePhone;
                cdt.Rate = String.Format("{0:0.00}", c.rate);

                ;
                dl.Add(cdt);
            }
            return dl;
        }
    }
    // get a DTO of customer depending on required "displayable" data
    public List<CustomerDTOTable> getCustomers()
    {
        using (var context = new hctDBEntities())
        {
            List<Customer> cl = context.Customers.OrderBy(i => i.Id).ToList();
            List<CustomerDTOTable> dl = new List<CustomerDTOTable>();

            foreach (Customer c in cl)
            {
                Person p = context.People.Where(pp => pp.Customer_Id == c.Id).FirstOrDefault();
                CustomerDTOTable cdt = new CustomerDTOTable();
                cdt.CustomerID = c.custID;
                cdt.FirstName = p.fname;
                cdt.LastName = p.lname;
                cdt.JoinDate = c.joinDate.ToString();
                cdt.Status = c.status;
                dl.Add(cdt);
            }
            return dl;
        }
    }