Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 /// <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;
 }
Esempio n. 4
0
 public void DetachProject(Project obj)
 {
     db.Projects.Detach(obj);
 }
Esempio n. 5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Projects EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProjects(Project project)
 {
     base.AddObject("Projects", project);
 }