Ejemplo n.º 1
0
        private void AddWorkTypeCmd(object model)
        {
            var worktype = model as WorkType;

            if (string.IsNullOrWhiteSpace(worktype.WorkTypeName))
            {
                return;
            }

            _repositoryManager.AddWorkType(worktype);
            WorkTypeToAdd = new WorkType();
            var works = _repositoryManager.GetWorkTypes();

            WorkTypes            = ProcessWorkTypeKeyValue(works);
            LabourToAdd.WorkType = WorkTypes.First();
            OnPropertyChanged(nameof(LabourToAdd));
        }
Ejemplo n.º 2
0
        private void AddLabourCmd(object model)
        {
            ErrorMessage = "";
            var labour = model as Labour;


            if (labour.Payment < 1 || labour.PaymentDate == default(DateTime) || SelectedContractor.ContractorId == 0 || labour.WorkType.WorkTypeId == 0)
            {
                ErrorMessage = "*Please check the entry. Some field's Values are missing.";
                return;
            }
            labour.SiteId     = SiteId;
            labour.CreateDate = DateTime.Now;
            labour.Contractor = Contractors.Single(x => x.ContractorId == SelectedContractor.ContractorId);

            _repositoryManager.AddLabourPayment(labour);
            LabourToAdd            = new Labour();
            LabourToAdd.Contractor = Contractors.First();
            LabourToAdd.WorkType   = WorkTypes.First();
            SelectedContractor     = ContractorList.First();
            Labours = new ObservableCollection <Labour>(_repositoryManager.GetLabourPayments(SiteId));
            OnPropertyChanged(nameof(LabourToAdd));
            OnPropertyChanged(nameof(SelectedContractor));
        }