Ejemplo n.º 1
0
        public ProjectExpense ToProjectExpense()
        {
            ProjectExpense projectExpense = new ProjectExpense();

            projectExpense.ExpenseID = ID;
            return(projectExpense);
        }
        public void Save(int projectId, string usage)
        {
            foreach (ProjectExpenseView item in ProjectExpenseTable.SelectedItems)
            {
                ProjectExpense projectExpense = ExpenseDBProvider.Instance().GetProjExpense(item.ID);

                projectExpense.ProjectID = projectId;
                projectExpense.Usage     = usage;
            }
            ExpenseDBProvider.Instance().Save();
            Refresh();
        }
Ejemplo n.º 3
0
        public ProjectExpenseView(ProjectExpense projectExpense, Expense expense, Project project = null)
        {
            ID        = projectExpense.ID;
            Usage     = projectExpense.Usage;
            TimeStamp = expense.TimeStamp;
            Product   = expense.Product;
            Price     = expense.Price;

            if (project != null)
            {
                ProjectID   = project.ID;
                ProjectName = project.ProjectName;
            }
        }
Ejemplo n.º 4
0
        public void Save()
        {
            List <ProjectExpense> projectExpenses = new List <ProjectExpense>();

            foreach (ExpenseView expense in ExpenseTable.ItemsSource)
            {
                if (expense.Dirty)
                {
                    ProjectExpense projectExpense = ExpenseDBProvider.Instance().GetProjExpenseByExpense(expense.ID);

                    if (projectExpense == null && expense.IsBusiness)
                    {
                        ExpenseDBProvider.Instance().Add(expense.ToProjectExpense());
                    }
                    else if (projectExpense != null && !expense.IsBusiness)
                    {
                        ExpenseDBProvider.Instance().Remove(projectExpense);
                    }
                }
            }
            ExpenseDBProvider.Instance().Save();
        }
Ejemplo n.º 5
0
 public void Remove(ProjectExpense projectExpense)
 {
     dbContext.ProjectExpense.Remove(projectExpense);
 }
Ejemplo n.º 6
0
 public void Add(ProjectExpense projectExpense)
 {
     dbContext.ProjectExpense.Add(projectExpense);
 }