//new daycards public async Task SaveDaycardAsync(DaycardType type, DateTime date) { switch (type) { case DaycardType.Accomplishment: await database.InsertAsync(new AccomplishmentDaycardModel { Date = date, Title = "MockTitle" }); break; case DaycardType.Cost: await database.InsertAsync(new CostDaycardModel { Date = date, Title = "MockTitle" }); break; case DaycardType.Equipment: await database.InsertAsync(new EquipmentDaycardModel { Date = date, Title = "MockTitle" }); break; case DaycardType.Labor: await database.InsertAsync(new LaborDaycardModel { Date = date, TimeReportingCode = TimeReportingCode.Code01, Title = "MockTitle" }); break; case DaycardType.Material: await database.InsertAsync(new MaterialDaycardModel { Date = date, Title = "MockTitle" }); break; } }
public async Task DeleDaycardByDateAsync(DaycardType type, DateTime date) { switch (type) { case DaycardType.Accomplishment: await database.Table <AccomplishmentDaycardModel>().Where(i => i.Date == date).DeleteAsync(); break; case DaycardType.Cost: await database.Table <CostDaycardModel>().Where(i => i.Date == date).DeleteAsync(); break; case DaycardType.Equipment: await database.Table <EquipmentDaycardModel>().Where(i => i.Date == date).DeleteAsync(); break; case DaycardType.Labor: await database.Table <LaborDaycardModel>().Where(i => i.Date == date).DeleteAsync(); break; case DaycardType.Material: await database.Table <MaterialDaycardModel>().Where(i => i.Date == date).DeleteAsync(); break; } }
public async Task SaveUpdatedDaycardAsync(DaycardType type, object daycardItem) { switch (type) { case DaycardType.Accomplishment: var model = (AccomplishmentDaycardViewModel)daycardItem; var newModel = new AccomplishmentDaycardModel { Id = model.IdDaycard, Date = model.DayUrl.Date, Quantity = model.Quantity, Title = model.Title }; await database.InsertAsync(newModel); break; case DaycardType.Cost: var modelCost = (CostDaycardViewModel)daycardItem; var newModelCost = new CostDaycardModel { Id = modelCost.IdDaycard, Date = modelCost.DayUrl.Date, Title = modelCost.Title, TotalCost = modelCost.TotalCost }; await database.InsertAsync(newModelCost); break; case DaycardType.Equipment: var modelEquipment = (EquipmentDaycardViewModel)daycardItem; var newModelEquipment = new EquipmentDaycardModel { Id = modelEquipment.IdDaycard, Date = modelEquipment.DayUrl.Date, Hours = modelEquipment.Hours, Miles = modelEquipment.Miles, Operator = modelEquipment.Operator, Title = modelEquipment.Title }; await database.InsertAsync(newModelEquipment); break; case DaycardType.Labor: var modelLabor = (LaborDaycardViewModel)daycardItem; var newModelLabor = new LaborDaycardModel { Id = modelLabor.IdDaycard, Date = modelLabor.DayUrl.Date, Title = modelLabor.Title, Hours = modelLabor.Hours, TimeReportingCode = modelLabor.TimeReportingCode }; await database.InsertAsync(newModelLabor); break; case DaycardType.Material: var modelMaterial = (MaterialDaycardViewModel)daycardItem; var newModelMaterial = new MaterialDaycardModel { Id = modelMaterial.IdDaycard, Date = modelMaterial.DayUrl.Date, Title = modelMaterial.Title, Quantity = modelMaterial.Quantity }; await database.InsertAsync(newModelMaterial); break; } }
public MainDaycardPageViewModel(DaycardType type, INavigation navigation) { database = new DatabaseRepository(); DaycardName = type.ToString() + " Day Cards"; Navigation = navigation; typeOfDaycard = type; AddDayCard = new Command(() => OnAddDayCardClicked()); GoBack = new Command(() => OnGoBackClicked()); FillMonthDates(); FillDaycardsList(); }
public async Task <List <IDaycard> > GetDaycardsByDateAndTypeAsync(DaycardType type, DateTime date) { switch (type) { case DaycardType.Accomplishment: return(new List <IDaycard>(await database.Table <AccomplishmentDaycardModel>().Where(i => i.Date == date).ToListAsync())); case DaycardType.Cost: return(new List <IDaycard>(await database.Table <CostDaycardModel>().Where(i => i.Date == date).ToListAsync())); case DaycardType.Equipment: return(new List <IDaycard>(await database.Table <EquipmentDaycardModel>().Where(i => i.Date == date).ToListAsync())); case DaycardType.Labor: return(new List <IDaycard>(await database.Table <LaborDaycardModel>().Where(i => i.Date == date).ToListAsync())); case DaycardType.Material: return(new List <IDaycard>(await database.Table <MaterialDaycardModel>().Where(i => i.Date == date).ToListAsync())); } return(null); }
public MainDaycardsPage(DaycardType type) { InitializeComponent(); BindingContext = new MainDaycardPageViewModel(type, Navigation); }