public void UpdateExObj_ToDB(UpdateAction action, ExpensesObj objToActionOn) { try { _dBhandler.UpdateObjInMonthTable(action, objToActionOn, _loadedDataTime); CalcStats(); } catch (Exception ex) { //todo: throw notification throw ex; } }
public async void UpdateObjInMonthTable(UpdateAction action, ExpensesObj newExpensesObj, DateTime dateTime) { //todo: add callback to savings var monthTableName = getTableNameByDate(dateTime); SQLiteCommand command = Connection.CreateCommand(); command.CommandType = CommandType.Text; command.Parameters.Add(new SQLiteParameter("@IdGuid", newExpensesObj.IdGuid)); command.Parameters.Add(new SQLiteParameter("@NewCategory", newExpensesObj.Category)); command.Parameters.Add(new SQLiteParameter("@NewSubCategory", newExpensesObj.SubCategory)); command.Parameters.Add(new SQLiteParameter("@NewExpectedAmount", newExpensesObj.ExpectedAmount)); command.Parameters.Add(new SQLiteParameter("@NewActualAmount", newExpensesObj.ActualAmount)); command.Parameters.Add(new SQLiteParameter("@NewDescription", newExpensesObj.Description)); switch (action) { case UpdateAction.Add: command.CommandText = @"insert into " + monthTableName + " (Guid, Category, SubCategory, ExpectedAmount, ActualAmount, Description) values " + "(@IdGuid, @NewCategory, @NewSubCategory, @NewExpectedAmount, @NewActualAmount, @NewDescription)"; break; case UpdateAction.Remove: command.CommandText = @"DELETE FROM " + monthTableName + " Where Guid=@IdGuid"; break; case UpdateAction.Update: command.CommandText = @"UPDATE " + monthTableName + " SET Category=@NewCategory, SubCategory=@NewSubCategory, ExpectedAmount=@NewExpectedAmount, ActualAmount=@NewActualAmount, Description=@NewDescription " + "Where Guid=@IdGuid"; break; } await Dbwriter(command); }
public void UpdateExObj_ToDB(UpdateAction action, ExpensesObj objToActionOn) { throw new NotImplementedException(); }