public int AddProject(Project obj) { obj.DateUpdate = DateTime.Now; obj.DateAdd = DateTime.Now; obj.Suser = System.Web.Security.Membership.GetUser().ToString(); db.Projects.AddObject(obj); db.SaveChanges(); return (obj.ProjectID); }
public dbActionResult EditProject(Project obj) { try { obj.DateUpdate = DateTime.Now; obj.Suser = System.Web.Security.Membership.GetUser().ToString(); db.Projects.Attach(obj); db.ObjectStateManager.ChangeObjectState(obj, EntityState.Modified); db.SaveChanges(); dbActionResult returnObj = new dbActionResult(); returnObj.intResult = obj.ProjectID; returnObj.exConcur = null; returnObj.exData = null; return (returnObj); } catch (OptimisticConcurrencyException ex) { dbActionResult returnObj = new dbActionResult(); returnObj.intResult = -1; returnObj.exConcur = ex; returnObj.exData = null; return (returnObj); } catch (DataException ex) { dbActionResult returnObj = new dbActionResult(); returnObj.intResult = -2; returnObj.exConcur = null; returnObj.exData = ex; return (returnObj); } }
/// <summary> /// Create a new Project object. /// </summary> /// <param name="projectID">Initial value of the ProjectID property.</param> /// <param name="descriptionEng">Initial value of the DescriptionEng property.</param> /// <param name="descriptionRus">Initial value of the DescriptionRus property.</param> public static Project CreateProject(global::System.Int32 projectID, global::System.String descriptionEng, global::System.String descriptionRus) { Project project = new Project(); project.ProjectID = projectID; project.DescriptionEng = descriptionEng; project.DescriptionRus = descriptionRus; return project; }
public void DetachProject(Project obj) { db.Projects.Detach(obj); }
/// <summary> /// Deprecated Method for adding a new object to the Projects EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProjects(Project project) { base.AddObject("Projects", project); }