public EmployeeViewModel() { Employee = new Employee(); BadgeId = Container.BadgeId; EName = Container.EName; Manager = Container.Manager; Designation = Container.Designation; Skill = Container.Skill; Level = Container.Level; EnableAddButton = Container.Enable; list = new ObservableCollection< Employee>(); PeerList = new ObservableCollection<Employee>(); Some = new ObservableCollection<Employee>(); generateHierarchy(); }
public async void newUser() { if (!string.IsNullOrWhiteSpace(BadgeId)&& !string.IsNullOrWhiteSpace(ManagerId)&& !string.IsNullOrWhiteSpace(Manager)&& !string.IsNullOrWhiteSpace(EName)) { SQLiteAsyncConnection connection = new SQLiteAsyncConnection("Test.db"); var result = await connection.QueryAsync<Employee>("SELECT * from Employee where BadgeId=\"" + BadgeId + "\""); if (result.Count==0) { #region //SQLiteAsyncConnection connection = new SQLiteAsyncConnection("Test.db"); var Employee = new Employee() { BadgeId = BadgeId, EName = EName, Password = "******", Manager = Manager, ManagerId = ManagerId, Level = Level, Designation = ComboItem, Skill = "" }; await connection.InsertAsync(Employee);//await connection.QueryAsync<Employee>("SELECT * from Employee where BadgeId=\"" + LoginModel.BadgeId + "\""); var updateMsg = new MessageDialog("The employee with BadgId: " + BadgeId + " is added. Do you Wanna add another Employee"); await updateMsg.ShowAsync(); ((Frame)Window.Current.Content).Navigate(typeof(View.NewEmployee)); #endregion } else { var errmsg = new MessageDialog("Employee with BadgeId: " + BadgeId + " already Exists"); await errmsg.ShowAsync(); } } else { var errmsg = new MessageDialog("one of the Fields is empty"); await errmsg.ShowAsync(); } }