예제 #1
0
 //
 // GET: /Employee/Search
 public ActionResult Search()
 {
     var employees = new Employee[0];
     if (Request.IsAjaxRequest())
     {
         return PartialView("SearchPartial", employees);
     }
     return View(employees);
 }
예제 #2
0
        public void Update(Employee v)
        {
            Employee r = _context.NorthwindWebService.UpdateEmployee(v);

            v.EmployeeID = r.EmployeeID;
            v.LastName = r.LastName;
            v.FirstName = r.FirstName;
            v.Title = r.Title;
            v.TitleOfCourtesy = r.TitleOfCourtesy;
            v.BirthDate = r.BirthDate;
            v.HireDate = r.HireDate;
            v.Address = r.Address;
            v.City = r.City;
            v.Region = r.Region;
            v.PostalCode = r.PostalCode;
            v.Country = r.Country;
            v.HomePhone = r.HomePhone;
            v.Extension = r.Extension;
            v.Notes = r.Notes;
            v.PhotoPath = r.PhotoPath;
        }
예제 #3
0
        public ActionResult Search(Employee employee, string dateFrom, string dateTo)
        {
            var context = new Context();
            //			ViewData["employee"] = default(Employee);
            //			if (!string.IsNullOrEmpty(employeeId))
            //			{
            //				ViewData["employee"] = new EmployeeRepository(context).Read(Convert.ToInt32(employeeId));
            //			}

            DateTime dateFromParsed = default(DateTime);
            if (!string.IsNullOrEmpty(dateFrom) && !DateTime.TryParse(dateFrom, out dateFromParsed))
            {
                ModelState.AddModelError("dateFrom", "error parsing dateFrom");
            }
            ViewData["dateFrom"] = dateFromParsed;

            DateTime dateToParsed = default(DateTime);
            if (!string.IsNullOrEmpty(dateTo) && !DateTime.TryParse(dateTo, out dateToParsed))
            {
                ModelState.AddModelError("dateTo", "error parsing dateTo");
            }
            ViewData["dateTo"] = dateToParsed;

            var orders = new Order[0];
            if (ModelState.IsValid)
            {
                orders = new OrderRepository(context).Search((Employee)ViewData["employee"], (DateTime)ViewData["dateFrom"], (DateTime) ViewData["dateFrom"]);
            }
            return View(orders);
        }
예제 #4
0
 public Employee CreateEmployee(Employee employee)
 {
     object[] results = Invoke("CreateEmployee", new object[] {employee});
     return ((Employee) (results[0]));
 }
예제 #5
0
 public Order[] SearchOrder(Employee employee, DateTime dateFrom, DateTime dateTo)
 {
     object[] results = Invoke("SearchOrder", new object[] {employee, dateFrom, dateTo});
     return ((Order[]) (results[0]));
 }
예제 #6
0
 public void DeleteEmployee(Employee employee)
 {
     object[] results = Invoke("DeleteEmployee", new object[] {employee});
 }
예제 #7
0
 public Order[] Search(Employee employee, DateTime dateFrom, DateTime dateTo)
 {
     return _context.NorthwindWebService.SearchOrder(employee, dateFrom, dateTo);
 }
예제 #8
0
 public void Delete(Employee v)
 {
     _context.NorthwindWebService.DeleteEmployee(v);
 }
예제 #9
0
 public ActionResult Search(string lastName, string firstName, string title)
 {
     var employees = new Employee[0];
     try
     {
         employees = new EmployeeRepository(new Context()).Search(lastName, firstName, title);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(string.Empty, ex.Message);
     }
     return PartialView("SearchPartial", employees);
 }