public void Delete() { if (SelectedDataItem != null) { if (MessageBox.Show("Are you sure you want to delete all selected Groups??", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { IsInProgress = true; new Thread(() => { foreach (var item in DataGridSource) { if (item.IsChecked) { try { DataAccess.DeleteGroup(item.GId); DataAccess.DeleteGroupRoles(item.GId); } catch { MessageBox.Show("could not open connection with server!\nCheck your internet connection or server is connected", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } } } DataGridSource.ReFill(DataGridSource.Where(x => !x.IsChecked).ToList()); IsInProgress = false; }) { IsBackground = true }.Start(); GroupRolesSource.Clear(); } } }
protected void SelectedConstantChanging(CodesModel newValue) { IsInProgress = true; if (newValue != null) { DataGridSource.ReFill(SystemConstants.Where(x => x.CMasterId == newValue.CId)); } IsInProgress = false; }
public void Refresh() { new Thread(() => { Thread inProgress = new Thread(() => { IsInProgress = true; try { Persons = DataAccess.PersonsData(); PersonsAddress = DataAccess.PersonsAddressData(); PersonsCommunication = DataAccess.PersonsCommunicationData(); PersonsTypes = DataAccess.CodesData(SystemValues.MasterSystemConstants.PersonType); CommTypes = DataAccess.CodesData(SystemValues.MasterSystemConstants.CommunicationType); } catch { MessageBox.Show("could not open connection with server!\nCheck your internet connection or server is connected", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } foreach (var item in Persons) { var adress = PersonsAddress.Where(x => x.PeAdPerIdFk == item.PeId).FirstOrDefault(); if (adress != null) { item.PeAddress = $"{adress.PeAdCity.Trim()} - {adress.PeAdStreetName.Trim()}"; } var communication = PersonsCommunication.Where(x => x.CoPeIdFk == item.PeId); item.Type = PersonsTypes.Where(x => x.CId == item.PeType).FirstOrDefault()?.CName; item.PhoneNo = communication.Where(x => x.CoNameCfk.Equals(SystemValues.Communications.Phone)).FirstOrDefault()?.CoValue; item.MobileNo = communication.Where(x => x.CoNameCfk.Equals(SystemValues.Communications.Mobile)).FirstOrDefault()?.CoValue; item.Email = communication.Where(x => x.CoNameCfk.Equals(SystemValues.Communications.Emial)).FirstOrDefault()?.CoValue; } }) { IsBackground = true }; inProgress.Start(); while (inProgress.IsAlive) { if (RotateAngle > 360) { RotateAngle = 0; } RotateAngle += 18.25; Thread.Sleep(50); } while (RotateAngle > 0 && RotateAngle < 365) { RotateAngle += 18.25; Thread.Sleep(50); } RotateAngle = 0; DataGridSource.ReFill(Persons); IsInProgress = false; }) { IsBackground = true }.Start(); }
public void Refresh() { refrechThread = new Thread(() => { List <UsersModel> Users = new List <UsersModel>(); Thread inProgress = new Thread(() => { try { Groups = DataAccess.GroupsData(); Users = DataAccess.UsersData(); GroupRoles = DataAccess.GroupRolesData(); UserGroups = DataAccess.UserGroupsData(); Roles = DataAccess.RolesData(); SystemConstants = DataAccess.CodesData(); Persons = DataAccess.PersonsData(); PersonsAddress = DataAccess.PersonsAddressData(); PersonCommunications = DataAccess.PersonsCommunicationData(); } catch { MessageBox.Show("could not open connection whith server!\nCheck your internet connection or server is connected", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); return; } }) { IsBackground = true }; inProgress.Start(); while (inProgress.IsAlive) { if (RotateAngle > 360) { RotateAngle = 0; } RotateAngle += 18.25; Thread.Sleep(50); } while (RotateAngle > 0 && RotateAngle < 365) { RotateAngle += 18.25; Thread.Sleep(50); } RotateAngle = 0; DataGridSource.ReFill(Users); }) { IsBackground = true }; refrechThread.Start(); }
public void Refresh() { GroupRoles.Clear(); new Thread(() => { List <GroupsModel> dataSource = null; Thread inProgress = new Thread(() => { IsInProgress = true; try { dataSource = DataAccess.GroupsData(); GroupRoles = DataAccess.GroupRolesData(); Roles = DataAccess.RolesData(); } catch { MessageBox.Show("could not open connection with server!\nCheck your internet connection or server is connected", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }) { IsBackground = true }; inProgress.Start(); while (inProgress.IsAlive) { if (RotateAngle > 360) { RotateAngle = 0; } RotateAngle += 18.25; Thread.Sleep(50); } while (RotateAngle > 0 && RotateAngle < 365) { RotateAngle += 18.25; Thread.Sleep(50); } RotateAngle = 0; DataGridSource.ReFill(dataSource); IsInProgress = false; }) { IsBackground = true }.Start(); GroupRolesSource.Clear(); }
public void Delete() { if (SelectedDataItem != null) { if (MessageBox.Show("Are you sure you want to delete all selected Persons??", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { foreach (var item in DataGridSource) { if (item.IsChecked) { DataAccess.DeletePerson(item.PeId); DataAccess.DeletePersonCommunication(item.PeId); DataAccess.DeletePersonAddress(item.PeId); } } DataGridSource.ReFill(DataGridSource.Where(x => !x.IsChecked).ToList()); } } }
public void Delete() { if (SelectedDataItem != null) { if (MessageBox.Show("Are you sure you want to delete all selected Users??", "Delete", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { IsInProgress = true; new Thread(() => { foreach (var item in DataGridSource) { if (item.IsChecked) { try { DataAccess.DeleteUserGroups((int)item.UPIdFk); DataAccess.DeletePersonAddress((int)item.UPIdFk); DataAccess.DeletePersonCommunication((int)item.UPIdFk); DataAccess.DeletePerson((int)item.UPIdFk); DataAccess.DeleteUser((int)item.UPIdFk); } catch { MessageBox.Show($"could not open connection with server while deleting {item.UUserName}!\nCheck your internet connection or server is connected", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } } } DataGridSource.ReFill(DataGridSource.Where(x => !x.IsChecked).ToList()); IsInProgress = false; }) { IsBackground = true }.Start(); } } }
public VMGroupsAdd(List <RolesModel> roles) { DataGridSource.ReFill(roles); }
public VMGroupsEdit(List <RolesModel> roles, GroupsModel group) { Group = group; PresentGroup(group); DataGridSource.ReFill(roles); }