/// <summary> /// Les roles dans ce espace /// </summary> /// <param name="profileGuid"></param> /// <param name="userSpace"></param> /// <returns></returns> public IEnumerable GetUserClearances(Guid profileGuid, UserSpace userSpace) { switch (userSpace) { case UserSpace.AdminSpace: return(EnumsHelper.GetAllValuesAndDescriptions <AdminClearances>().Select(role => new ViewCard { Info1 = role.Key, Info2 = role.Value.ToString(), Info3 = Roles.IsUserInRole(Membership.GetUser(profileGuid)?.UserName, role.Value.ToString()) ? "Blue" : "Red", Bool1 = Roles.IsUserInRole(Membership.GetUser(profileGuid)?.UserName, role.Value.ToString()) })); //case UserSpace.PompisteSpace: // return EnumsHelper.GetAllValuesAndDescriptions<TeacherClearances>().Select(role => // new DataCard // { // Info1 = role.Key, // Info2 = role.Value.ToString(), // Info3 = Roles.IsUserInRole(Membership.GetUser(profileGuid)?.UserName, role.Value.ToString()) ? "Blue" : "Red", // Bool1 = Roles.IsUserInRole(Membership.GetUser(profileGuid)?.UserName, role.Value.ToString()) // }); } return(null); }
public AddPurchaseService(Guid companyGuid = default(Guid)) { InitializeComponent(); Dispatcher.BeginInvoke(new Action(async() => { if (companyGuid == default(Guid)) { ModernDialog.ShowMessage("Choisir un client", "eStation", MessageBoxButton.OK); Close(); return; } _STATUS.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <PurchaseState>(); _GRID.DataContext = new Purchase { Sum = 0, ProductType = ProductType.Service, PurchaseDate = DateTime.Now, PurchaseState = PurchaseState.UnPaid, CompanyGuid = companyGuid }; _TITLE_TEXT.Text = $"Bon de {(await App.Store.Sales.Get(companyGuid))?.Name}"; })); }
/// <summary> /// Espaces Utilisateur /// </summary> /// <param name="profileGuid"></param> /// <returns></returns> public IEnumerable UserSpaces(Guid profileGuid) { return(EnumsHelper.GetAllValuesAndDescriptions <UserSpace>().Select(role => new DataCard { Info1 = role.Key, Info2 = role.Value.ToString(), Info3 = Roles.IsUserInRole(Membership.GetUser(profileGuid)?.UserName, role.Value.ToString()) ? "Blue" : "Red", Bool1 = Roles.IsUserInRole(Membership.GetUser(profileGuid)?.UserName, role.Value.ToString()) })); }
/// <summary> /// /// </summary> public AddStaff(Guid staffToModGuid) { InitializeComponent(); new Task(() => { Dispatcher.BeginInvoke(new Action(() => { _CIVILITE_.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <PersonTitles>(); _STATUT.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <StaffStatus>(); _HEALTH_STATUT.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <HealthStates>(); _NATIONALITY.ItemsSource = App.Store.HumanResource.AllNationalities(); _BIRTH_PLACE.ItemsSource = App.Store.HumanResource.AllBirthPlaces(); _QUALIFICATION.ItemsSource = App.Store.HumanResource.AllStaffQualifications(); _DEPARTEMENT.ItemsSource = App.Store.HumanResource.AllDepartement(); _GRADE.ItemsSource = App.Store.HumanResource.AllGrades(); if (staffToModGuid == Guid.Empty) { _isAdd = true; var data = new Staff { Matricule = App.Store.HumanResource.GetNewStaffMatricule(), Experiences = 0, Statut = StaffStatus.Actif, Person = new Person { Title = PersonTitles.Mr, HealthState = HealthStates.Normal, BirthDate = DateTime.Today.AddYears(-20) } }; _GRID.DataContext = data; } else { var data = App.Store.HumanResource.GetStaff(staffToModGuid); _PHOTO_IDENTITY.Source = ImagesHelper.DecodePhoto(data.Person.PhotoIdentity); _MATRICULE_VALIDATOR.IsAdd = false; //_TITLE_TEXT.Text="MODIFICATION"; _GRID.DataContext = data; _MATRICULE.IsEnabled = false; } })); }).Start(); }
public AddPurchase(Guid companyGuid = default(Guid), bool isFuel = true) { _isFuel = isFuel; InitializeComponent(); Dispatcher.BeginInvoke(new Action(async() => { if (companyGuid == default(Guid)) { ModernDialog.ShowMessage("Choisir un client", "eStation", MessageBoxButton.OK); Close(); return; } _STATUS.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <PurchaseState>(); if (isFuel) { _PRODUCT.ItemsSource = (await App.Store.Fuels.GetFuels()).ToDictionary(c => c.Libel, f => f.FuelGuid); } else { _PRODUCT_NAME.Text = "Huile"; _QUANTITY_LABEL.Text = "Quantité (bidons)"; _PRODUCT.ItemsSource = (await App.Store.Oils.GetOils()).ToDictionary(c => c.Libel, f => f.OilGuid); } if (_PRODUCT.Items.Count == 0) { ModernDialog.ShowMessage(isFuel ? "Ajouter au moins un carburant dans stock" : "Ajouter au moins un huile dans stock", "eStation", MessageBoxButton.OK); Close(); return; } _GRID.DataContext = new Purchase { ProductType = isFuel ? ProductType.Fuel : ProductType.Oil, ProductGuid = ((KeyValuePair <string, Guid>)_PRODUCT.Items.GetItemAt(0)).Value, PurchaseDate = DateTime.Now, CompanyGuid = companyGuid, PurchaseState = PurchaseState.UnPaid }; _TITLE_TEXT.Text = $"Bon de {(await App.Store.Sales.Get(companyGuid)).Name}"; })); }
/// <summary> /// Espaces Utilisateur /// </summary> /// <param name="profileGuid"></param> /// <returns></returns> public IEnumerable UserSpaces(Guid profileGuid) { try { return(EnumsHelper.GetAllValuesAndDescriptions <UserSpace>().Select(role => new ViewCard() { Info1 = role.Key, Info2 = role.Value.ToString(), Info3 = Roles.IsUserInRole(Membership.GetUser(profileGuid)?.UserName, role.Value.ToString()) ? "Blue" : "Red", Bool1 = Roles.IsUserInRole(Membership.GetUser(profileGuid)?.UserName, role.Value.ToString()) })); } catch (Exception e) { DebugHelper.WriteException(e); return(null); } }
public NewClient(Guid clientToModGuid) { InitializeComponent(); new Task(() => { Dispatcher.BeginInvoke(new Action(() => { _CIVILITE_.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <PersonTitles>(); _STATUT.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <CustomerStatus>(); _NATIONALITY.ItemsSource = App.Store.Customers.AllNationalities(); if (clientToModGuid == Guid.Empty) { _isAdd = true; var obj = new Customer { Matricule = App.Store.Customers.NewMatricule(), CustomerStatus = CustomerStatus.Default, Person = new Person { Title = PersonTitles.Mr, HealthState = HealthStates.Normal, BirthDate = DateTime.Today.AddYears(-20) } }; _GRID.DataContext = obj; } else { var data = App.Store.Customers.GetCustomer(clientToModGuid); _PHOTO_IDENTITY.Source = ImagesHelper.DecodePhoto(data.Person.PhotoIdentity); _MATRICULE_VALIDATOR.IsAdd = false; _GRID.DataContext = data; _MATRICULE.IsEnabled = false; } })); }).Start(); }
public AddUser(Guid profileGuid) { InitializeComponent(); new Task(() => { Dispatcher.BeginInvoke(new Action(() => { if (profileGuid == Guid.Empty) { ModernDialog.ShowMessage("Profile non valide", "ESchool", MessageBoxButton.OK); Close(); return; } _USER_SPACE.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <UserSpace>(); var membUser = App.Store.Authentication.GetUser(profileGuid); var theStaff = App.Store.HumanResource.GetStaff(profileGuid); if (membUser == null) { _isAdd = true; var newData = new User { UserGuid = profileGuid, UserName = theStaff.Person.EmailAdress, EmailAdress = theStaff.Person.EmailAdress, PasswordQuestion = "", PasswordAnswer = "" }; _GRID.DataContext = newData; } else { var oldData = App.Store.Authentication.GetUser(profileGuid); _GRID.DataContext = oldData; _USER_NAME.IsEnabled = false; _USER_SPACE.IsEnabled = false; } })); }).Start(); }
public AddTransaction() { InitializeComponent(); new Task(() => { Dispatcher.BeginInvoke(new Action(() => { _TRANS_TYPE.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <TransactionType>(); _PAY_METHODE.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <PaymentMethode>(); _DATE_TRANS.DisplayDateStart = DateTime.Today.AddDays(-1); var newData = new Transaction { Designation = "", PaidToward = "", Amount = 0, PaymentMethode = PaymentMethode.Espece, TransactionDate = DateTime.Today, TransactionReference = App.Store.Economat.Finance.GetNewTransactionReference() }; _GRID.DataContext = newData; })); }).Start(); }
/// <summary> /// Espaces Utilisateur /// </summary> /// <returns></returns> public List <KeyValuePair <string, Enum> > UserSpaces(string userName) => new List <KeyValuePair <string, Enum> >(EnumsHelper.GetAllValuesAndDescriptions <UserSpace>() .Where(s => Roles.IsUserInRole(userName, s.Value.ToString())));
/// <summary> /// Ajouter Un Employement Pour Un Staff /// </summary> /// <param name="staffGuid"></param> /// <param name="employToModGuid"></param> public AddEmploy(Guid staffGuid, Guid employToModGuid) { InitializeComponent(); new Task(() => { Dispatcher.BeginInvoke(new Action(() => { if (staffGuid == Guid.Empty) { ModernDialog.ShowMessage("Staff Not Found", "ERREUR", MessageBoxButton.OK); Close(); return; } _CATEGORIE.ItemsSource = App.Store.HumanResource.AllCategories(); _GRADE.ItemsSource = App.Store.HumanResource.AllGrades(); _DEPARTEMENT.ItemsSource = App.Store.HumanResource.AllDepartements(); //_DIVISION.ItemsSource = App.DataS.HumanResource.AllDivisions(); //_PROJET.ItemsSource = App.DataS.HumanResource.AllProjets(); _REPORT_TO.ItemsSource = App.Store.HumanResource.AllStaffsNames(); _PAY_TYPE.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <PayType>(); _SALARY_REC.ItemsSource = EnumsHelper.GetAllValuesAndDescriptions <InstallmentRecurrence>(); if (employToModGuid == Guid.Empty) { //_MATIERE_NAME_VALIDATOR.ClasseGuid = classGuid; _isAdd = true; var data = new Employment { EmploymentGuid = Guid.NewGuid(), StaffGuid = staffGuid, Position = "", Category = _CATEGORIE.Items.GetItemAt(0) as string, Grade = _GRADE.Items.GetItemAt(0) as string, Departement = _DEPARTEMENT.Items.GetItemAt(0) as string, //Division = _DIVISION.Items.GetItemAt(0) as string, //Project = _PROJET.Items.GetItemAt(0) as string, ReportTo = _REPORT_TO.Items.GetItemAt(0) as string, PayType = PayType.SalaryOnly, HourlyPay = 0, SalaryRecurrence = InstallmentRecurrence.Monthly, StartDate = DateTime.Today, EndDate = DateTime.Today.AddYears(1), Description = "" }; _GRID.DataContext = data; } else { var data = App.Store.Economat.PayRoll.GetEmployment(employToModGuid); //_MATIERE_NAME_VALIDATOR.ClasseGuid = data.ClasseGuid; //_MATIERE_NAME_VALIDATOR.IsAdd = false; _TITLE_TEXT.Text = "MODIFICATION"; _GRID.DataContext = data; _SALARY_REC.IsEnabled = false; _NUM_REC.IsEnabled = false; _PAY_TYPE.IsEnabled = false; _HOURLY_PAY.IsEnabled = false; _DEBUT_EMP.IsEnabled = false; } })); }).Start(); }