/// <summary>
        /// The index.
        /// </summary>
        /// <returns>ViewResult
        /// </returns>
        public ViewResult Index()
        {
            int count = 0;
            PagedListOfEmployeeuTvS1Dbc employee = this.serviceClient.FindEmployeeByTitle(out count, null, 1, 10);

            return(View(employee.ToList()));
        }
        /// <summary>
        /// The find employee by title.
        /// </summary>
        /// <param name="totalcount">
        /// The totalcount.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="pageIndex">
        /// The page index.
        /// </param>
        /// <param name="pageSize">
        /// The page size.
        /// </param>
        /// <returns>
        /// </returns>
        public PagedListOfEmployeeuTvS1Dbc FindEmployeeByTitle(
            out int totalcount, string title, int?pageIndex, int pageSize)
        {
            var list = new PagedListOfEmployeeuTvS1Dbc();

            list.AddRange(employeeList);
            totalcount = list.Count();
            return(list);
        }
        // GET: /Employee/

        // GET: /Employee/Create
        #region Public Methods

        /// <summary>
        /// The create.
        /// </summary>
        /// <returns>
        /// </returns>
        public ActionResult Create()
        {
            int count = 0;
            PagedListOfEmployeeuTvS1Dbc employees = this.serviceClient.FindEmployeeByTitle(out count, null, 1, 10);
            var contactlist = this.serviceClient.GetPagedListContact(out count, 1, 10);

            this.ViewBag.ContactID = new SelectList(contactlist, "ContactID", "FirstName");
            this.ViewBag.ManagerID = new SelectList(employees, "EmployeeID", "LoginID");
            return(this.View());
        }
Пример #4
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                int count = 0;
                PagedListOfEmployeeuTvS1Dbc datalist = this.serviceClient.FindEmployeeByTitle(out count, null, 1, 10);

                this.pager.RecordCount = count;
                this.BindData();
            }
        }
        /// <summary>
        /// GetTitle for Autocomplete
        /// </summary>
        /// <returns>
        /// JsonResult
        /// </returns>
        public JsonResult GetTitle(string term)
        {
            if (!string.IsNullOrEmpty(term))
            {
                int count = 0;
                //TODO:Change search text return Title column only
                PagedListOfEmployeeuTvS1Dbc employeelist = this.serviceClient.FindEmployeeByTitle(out count, null, 1, 20);

                return(Json(employeelist.Where(el => el.Title.ToLower().Contains(term.ToLower())).Select(ee => ee.Title)
                            , JsonRequestBehavior.AllowGet));
            }
            return(null);
        }
        /// <summary>
        /// The edit.
        /// </summary>
        /// <param name="id">
        /// The id.
        /// </param>
        /// <returns>
        /// </returns>
        public ActionResult Edit(int id)
        {
            Employee employee = this.serviceClient.GetEmployee(id);

            int count = 0;
            PagedListOfEmployeeuTvS1Dbc employeelist = this.serviceClient.FindEmployeeByTitle(out count, null, 1, 10);

            var contactlist = this.serviceClient.GetPagedListContact(out count, 1, 10);

            this.ViewBag.ContactID = new SelectList(contactlist, "ContactID", "FirstName");
            this.ViewBag.ManagerID = new SelectList(employeelist, "EmployeeID", "LoginID", employee.ManagerID);
            return(View(employee));
        }
        public ActionResult Create(ServicePoxry.AWServiceReference.Employee employee)
        {
            if (this.ModelState.IsValid)
            {
                this.serviceClient.CreateEmployee(employee);
                return(this.RedirectToAction("Index"));
            }

            int count = 0;
            PagedListOfEmployeeuTvS1Dbc employeelist = this.serviceClient.FindEmployeeByTitle(out count, null, 1, 10);
            var contactlist = this.serviceClient.GetPagedListContact(out count, 1, 10);

            this.ViewBag.ContactID = new SelectList(contactlist, "ContactID", "FirstName");
            this.ViewBag.ManagerID = new SelectList(employeelist, "EmployeeID", "LoginID", employee.ManagerID);
            return(View(employee));
        }
 /// <summary>
 /// The find employee by title.
 /// </summary>
 /// <param name="totalcount">
 /// The totalcount.
 /// </param>
 /// <param name="title">
 /// The title.
 /// </param>
 /// <param name="pageIndex">
 /// The page index.
 /// </param>
 /// <param name="pageSize">
 /// The page size.
 /// </param>
 /// <returns>
 /// </returns>
 public PagedListOfEmployeeuTvS1Dbc FindEmployeeByTitle(
     out int totalcount, string title, int? pageIndex, int pageSize)
 {
     var list = new PagedListOfEmployeeuTvS1Dbc();
     list.AddRange(employeeList);
     totalcount = list.Count();
     return list;
 }