Esempio n. 1
0
        public ActionResult Details(int EmployeeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers();
                    ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName");

                    EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers();

                    BusinessModelLayer.EmployeesSingle employees = employeesBusinessModelLayers.GetAllEmployeess().FirstOrDefault(x => x.EmployeeID == EmployeeID);

                    return(View(employees));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
 public IHttpActionResult Get()
 {
     try     // handle exogenous exceptions
     {
         try // log all exceptions
         {
             EmployeesBusinessModelLayers employeesBusinessModelLayers = new EmployeesBusinessModelLayers();
             List <BusinessModelLayer.EmployeesSingle> employeess      = employeesBusinessModelLayers.GetAllEmployeess();
             return(Ok(employeess));
         }
         catch (Exception ex)
         {
             BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
             exlog.SendExcepToDB(ex);
             throw;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
        public ActionResult Edit(int EmployeeID, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    EmployeesBusinessModelLayers employeesLUBusinessModelLayers = new EmployeesBusinessModelLayers();
                    ViewBag.Employeess = new SelectList(employeesLUBusinessModelLayers.EmployeesSelect, "EmployeeID", "LastName");

                    ViewBag.CurrentSort = sortOrder;
                    ViewBag.EmployeeID  = EmployeeID;

                    BusinessLayer.Validation pge      = new BusinessLayer.Validation();
                    List <SelectListItem>    PgeSizes = pge.PageSize();

                    //Assigning generic list to ViewBag
                    ViewBag.PgeSizeList = PgeSizes;

                    if (searchString != null)
                    {
                        page = 1;
                    }
                    else
                    {
                        searchString = currentFilter;
                    }

                    ViewBag.CurrentFilter = searchString;

                    //EMPLOYEES TABLE MASTER
                    BusinessModelLayer.Employees.EmployeesMasterDetailModel pageModel = new BusinessModelLayer.Employees.EmployeesMasterDetailModel();
                    EmployeesBusinessModelLayers         employeesBusinessModelLayers = new EmployeesBusinessModelLayers();
                    Employees.EmployeesMasterDetailModel employeesMasterDetailModel   = new Employees.EmployeesMasterDetailModel();

                    pageModel.Employees = employeesBusinessModelLayers.GetAllEmployeess().FirstOrDefault(x => x.EmployeeID == EmployeeID);

                    int pageSize = 10;
                    if (PgeSize != null)
                    {
                        Int32.TryParse(PgeSize, out pageSize);
                    }
                    ViewBag.PgeSize = pageSize;

                    int pageNumber = (page ?? 1);


                    //EMPLOYEETERRITORIES DETAIL BEGIN

                    ViewBag.EmployeeIDSortParm = String.IsNullOrEmpty(sortOrder) ? "EmployeeID_desc" : "";
                    EmployeeterritoriesBusinessModelLayers employeeterritoriesBusinessModelLayers = new EmployeeterritoriesBusinessModelLayers();

                    List <BusinessModelLayer.Vwemployeeterritories> employeeterritoriess = employeeterritoriesBusinessModelLayers.GetAllVwemployeeterritoriess().FindAll(x => x.EmployeeID == EmployeeID).ToList();

                    if (!String.IsNullOrEmpty(searchString))
                    {
                        employeeterritoriess = employeeterritoriess.Where(s => s.EmployeeID == EmployeeID && s.TerritoryID.ToString().ToLower().Contains(searchString.ToLower())).ToList();
                    }

                    switch (sortOrder)
                    {
                    case "EmployeeID_desc":
                        employeeterritoriess = employeeterritoriess.OrderByDescending(s => s.EmployeeID).ToList();
                        break;

                    default:      // EmployeeID ascending
                        employeeterritoriess = employeeterritoriess.OrderBy(s => s.EmployeeID).ToList();
                        break;
                    }
                    pageModel.EmployeeterritoriesVwDetl = employeeterritoriess.ToPagedList(pageNumber, pageSize);

                    //EMPLOYEETERRITORIES DETAIL END
                    return(View(pageModel));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }