Exemplo n.º 1
0
        /// <summary>
        /// Create a new Work_Package object.
        /// </summary>
        /// <param name="id">Initial value of the id property.</param>
        /// <param name="name">Initial value of the name property.</param>
        /// <param name="task_id">Initial value of the task_id property.</param>
        /// <param name="status">Initial value of the status property.</param>
        /// <param name="workorder">Initial value of the workorder property.</param>
        /// <param name="createddate">Initial value of the createddate property.</param>
        public static Work_Package CreateWork_Package(global::System.Int32 id, global::System.String name, global::System.Int32 task_id, global::System.Int16 status, global::System.Int32 workorder, global::System.DateTime createddate)
        {
            Work_Package work_Package = new Work_Package();

            work_Package.id          = id;
            work_Package.name        = name;
            work_Package.task_id     = task_id;
            work_Package.status      = status;
            work_Package.workorder   = workorder;
            work_Package.createddate = createddate;
            return(work_Package);
        }
Exemplo n.º 2
0
        public Work_Package InsertPackage(Work_Package wp)
        {
            wp.createddate = DateTime.Now;

            IPFinalDBDataContext finalDB = new IPFinalDBDataContext();
            var task = from w in finalDB.Work_Packages
                       where w.task_id == wp.task_id
                       select w.workorder;

            int maxOrder = 0;
            if (task != null && task.Count() > 0)
                maxOrder = task.Max<int>();
            wp.workorder = maxOrder + 5;
            finalDB.Work_Packages.InsertOnSubmit(wp);
            finalDB.SubmitChanges();

            return wp;
        }
Exemplo n.º 3
0
 partial void DeleteWork_Package(Work_Package instance);
Exemplo n.º 4
0
 partial void UpdateWork_Package(Work_Package instance);
Exemplo n.º 5
0
 partial void InsertWork_Package(Work_Package instance);
Exemplo n.º 6
0
        public Work_Package UpdatePackage(Work_Package wp)
        {
            IPFinalDBDataContext finalDB = new IPFinalDBDataContext();
            var package = (from d in finalDB.Work_Packages
                           where d.id == wp.id
                           select d).Single();

            package.description = wp.description;
            package.name = wp.name;
            package.status = wp.status;
            package.notes = wp.notes;
            finalDB.SubmitChanges();

            return package;
        }
Exemplo n.º 7
0
 partial void DeleteWork_Package(Work_Package instance);
Exemplo n.º 8
0
 partial void UpdateWork_Package(Work_Package instance);
Exemplo n.º 9
0
 partial void InsertWork_Package(Work_Package instance);
Exemplo n.º 10
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Work_Package EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToWork_Package(Work_Package work_Package)
 {
     base.AddObject("Work_Package", work_Package);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Create a new Work_Package object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="name">Initial value of the name property.</param>
 /// <param name="task_id">Initial value of the task_id property.</param>
 /// <param name="status">Initial value of the status property.</param>
 /// <param name="workorder">Initial value of the workorder property.</param>
 /// <param name="createddate">Initial value of the createddate property.</param>
 public static Work_Package CreateWork_Package(global::System.Int32 id, global::System.String name, global::System.Int32 task_id, global::System.Int16 status, global::System.Int32 workorder, global::System.DateTime createddate)
 {
     Work_Package work_Package = new Work_Package();
     work_Package.id = id;
     work_Package.name = name;
     work_Package.task_id = task_id;
     work_Package.status = status;
     work_Package.workorder = workorder;
     work_Package.createddate = createddate;
     return work_Package;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Work_Package EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToWork_Package(Work_Package work_Package)
 {
     base.AddObject("Work_Package", work_Package);
 }
Exemplo n.º 13
0
 public ActionResult Edit(int? id, FormCollection form)
 {
     Work_Package model = new Work_Package()
     {
         id = id ?? -1,
         name = form["name"],
         description = form["description"],
         notes = form["notes"],
         task_id = int.Parse(form["task_id"]),
         status = short.Parse(form["status"])
     };
     try
     {
         if (id == null)
         {
             ps.InsertPackage(model);
             return RedirectToAction("Index");
         }
         else
         {
             ps.UpdatePackage(model);
             return RedirectToAction("Details", new { id = model.id });
         }
     }
     catch //(Exception ex)
     {
         return View(model);
     }
 }