public void ArchiveGrid(int gridId) { using (var model = new fundgridEntities()) { var gridToArchive = (from g in model.grids where g.id == gridId select g).FirstOrDefault(); gridToArchive.status = Status.archived.ToString(); model.SaveChanges(); } }
public void CreateNewProject(Project project) { var loggedInUserId = UserSession.LoggedInUser.UserId.ToString(); using(var model = new fundgridEntities()) { var newProject = new Fundgrid.Data.project() { name = project.Name, description = project.Description, owner_id = loggedInUserId, }; model.projects.Add(newProject); model.SaveChanges(); } }
public void AssignItemToGrid(int gridId, int number, string owner, decimal paidAmount) { int result; using (var model = new fundgridEntities()) { var selectedGridItem = new grid_item { grid_id = gridId, number = number, amount = paidAmount, owner = owner }; model.grid_item.Add(selectedGridItem); result = model.SaveChanges(); } }
public bool CreateNewGrid(int projectId, int rows, int columns, decimal itemValue, decimal incrementValue, string gridName, string gridDescription) { int result; using (var model = new fundgridEntities()) { var selectedGrid = new grid { name = gridName, description = gridDescription, project_id = projectId, dimension_rows = rows, dimension_column = columns, item_value = itemValue, increment_value = incrementValue, status = Status.active.ToString() }; model.grids.Add(selectedGrid); result = model.SaveChanges(); } return result > 0; }
public void EditProject(int id, string name, string description) { using (var model = new fundgridEntities()) { var editProject = (from p in model.projects where p.id == id select p).FirstOrDefault(); editProject.name = name; editProject.description = description; model.SaveChanges(); } }
private void removeProject(int projectId) { using (var model = new fundgridEntities()) { var selectedProject = (from p in model.projects where p.id == projectId select p).FirstOrDefault(); model.projects.Remove(selectedProject); model.SaveChanges(); } }
private void removeGridItems(int gridId) { using (var model = new fundgridEntities()) { var gridItems = (from gi in model.grid_item where gi.grid_id == gridId select gi).ToList(); foreach (var item in gridItems) { model.grid_item.Remove(item); model.SaveChanges(); } } }
private void removeGrid(int gridId) { using (var model = new fundgridEntities()) { var removeGrid = (from g in model.grids where g.id == gridId select g).FirstOrDefault(); model.grids.Remove(removeGrid); model.SaveChanges(); } }