public ActionResult EnterMyHome() { EmployeeListView employeesView = new EmployeeListView(); EmployeeBusinessLayer empBal = new EmployeeBusinessLayer(); List <Employee> employees = empBal.GetEmployees(); List <EmployeeView> employeeViews = new List <EmployeeView>(); foreach (Employee emp in employees) { EmployeeView employeeView = new EmployeeView(); employeeView.EmployeeName = emp.FirstName + " " + emp.LastName; employeeView.Salary = emp.Salary.ToString("C"); if (emp.Salary > 1500) { employeeView.SalaryColor = "yellow"; } else { employeeView.SalaryColor = "green"; } employeeViews.Add(employeeView); } employeesView.Employees = employeeViews; employeesView.UserName = "******"; return(View("MyHome", employeesView)); }
protected void LoadData() { DataSet ds = new DataSet(); ds.ReadXml(Server.MapPath("Employee.xml")); EmployeeListView.DataSource = ds; EmployeeListView.DataBind(); }
public IEnumerable <EmployeeListView> QueryEmployeeInfo(EmployeeQueryParameter condition, Pagination pagination) { var result = new List <EmployeeListView>(); using (var dbOperator = new DbOperator(Provider, ConnectionString)) { if (!string.IsNullOrEmpty(condition.Name)) { dbOperator.AddParameter("@iName", condition.Name); } if (!string.IsNullOrEmpty(condition.Login)) { dbOperator.AddParameter("@iUserName", condition.Login); } if (condition.Enabled.HasValue) { dbOperator.AddParameter("@iEnabled", condition.Enabled.Value); } if (!string.IsNullOrWhiteSpace(condition.IpLimitation)) { dbOperator.AddParameter("@iIpLimitation", condition.IpLimitation); } dbOperator.AddParameter("@iOwner", condition.Owner); dbOperator.AddParameter("@iPageSize", pagination.PageSize); dbOperator.AddParameter("@iPageIndex", pagination.PageIndex); System.Data.Common.DbParameter totalCount = dbOperator.AddParameter("@oTotalCount"); totalCount.DbType = System.Data.DbType.Int32; totalCount.Direction = System.Data.ParameterDirection.Output; using (var reader = dbOperator.ExecuteReader("[dbo].[P_QueryEmployees]", System.Data.CommandType.StoredProcedure)) { while (reader.Read()) { var info = new EmployeeListView(); info.Name = reader.GetString(0); info.Gender = (Common.Enums.Gender)reader.GetByte(1); info.UserName = reader.GetString(2); info.RoleName = reader.GetString(3); info.Email = reader.GetString(4); info.Cellphone = reader.GetString(5); info.Enabled = reader.GetBoolean(6); info.IsAdministrator = reader.GetBoolean(7); info.Id = reader.GetGuid(8); info.Remark = reader.IsDBNull(9) ? string.Empty : reader.GetString(9); info.IpLimitation = reader.IsDBNull(10) ? string.Empty : reader.GetString(10); result.Add(info); } } if (pagination.GetRowCount) { pagination.RowCount = (int)totalCount.Value; } } return(result); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); RegistryContext context = new RegistryContext(SetupDatabaseConnection()); // apply any missing migrations context.Database.Migrate(); EmployeeListViewModel employeeList = new EmployeeListViewModel(context); EmployeeListView employeeListView = new EmployeeListView(employeeList); employeeListView.Show(); }
void Handle_TextChanged(object sender, Xamarin.Forms.TextChangedEventArgs e) { var _container = BindingContext as SearchBarListViewModel; EmployeeListView.BeginRefresh(); if (string.IsNullOrWhiteSpace(e.NewTextValue)) { EmployeeListView.ItemsSource = _container.MyListCollector; } else { EmployeeListView.ItemsSource = _container.MyListCollector.Where(i => i.MyName.Contains(e.NewTextValue)); } EmployeeListView.EndRefresh(); }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { var Index = EmployeeListView.SelectedIndex; var Id = EmployeeDirectory.Employees[Index].StringId; // Check for valid input if (Index >= 0) { EmployeeDirectory.DeleteEmployee(Index); EmployeeListView.Items.Refresh(); EmployeeListView.UnselectAll(); // Report command CommandsList.Add(string.Format("- Employee with Id: {0} has been removed", Id)); CommandsListView.Items.Refresh(); } }
public static Page GetMainPage() { var task = Task.Run(async() => { Service = await MemoryDirectoryService.FromCsv("XamarinDirectory.csv"); }); task.Wait(); var employeeList = new ContentPage(); if (uiImplementation == UIImplementation.CSharp) { employeeList = new EmployeeListView(); } else if (uiImplementation == UIImplementation.Xaml) { employeeList = new EmployeeListXaml(); } return(new NavigationPage(employeeList)); }
public EmployeeListPage() { BindingContext = App.Locator.EmployeeViewModel; _viewmodel = BindingContext as EmployeeViewModel; InitializeComponent(); Title = PageConstants.EMPLOYEE_LIST_PAGE_TITLE; var toolbarItem = new ToolbarItem { //Text = "+" Icon = Constants.PLUS_IMAGE }; toolbarItem.Clicked += async(sender, e) => { await Navigation.PushAsync(new EmployeePage() { BindingContext = new Employee() }); }; ToolbarItems.Add(toolbarItem); EmployeeListView.SetBinding(ListView.ItemsSourceProperty, PropertyConstants.EMPLOYEE_LIST); }