public ActionResult Create(tbl_CommonTerms tbl_commonterms)
        {
            if (tbl_commonterms==null)
            {
                ModelState.AddModelError("", "Please fill all mandatory fields marked with *)");
                return View(tbl_commonterms);
            }

            tbl_commonterms.CreatedBy = User.Identity.Name;
            tbl_commonterms.CreatedDate = DateTime.Now;
            tbl_commonterms.TermType = 3;
            if (ModelState.IsValid)
            {
                db.tbl_CommonTerms.AddObject(tbl_commonterms);
                //Audit
                db.tbl_AuditTrail.AddObject(new tbl_AuditTrail
                {
                    Action = "CREATE",
                    ActionItem = "Common Printing Problem",
                    UserName = User.Identity.Name,
                    ActionDate = DateTime.Now
                });
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(tbl_commonterms);
        }
Exemplo n.º 2
0
        public ActionResult Create(tbl_CommonTerms tbl_commonterms, int id)
        {
            tbl_commonterms.TermType = id;
            tbl_commonterms.CreatedBy = User.Identity.Name;
            tbl_commonterms.CreatedDate = DateTime.Now;

            if (ModelState.IsValid)
            {
                db.tbl_CommonTerms.AddObject(tbl_commonterms);
                switch (id)
                {
                    case 1:
                    db.tbl_AuditTrail.AddObject(new tbl_AuditTrail
                    {
                        Action = "CREATE",
                        ActionItem = "Common Paper Term",
                        UserName = User.Identity.Name,
                        ActionDate = DateTime.Now
                    });
                    break;

                    case 2:
                    db.tbl_AuditTrail.AddObject(new tbl_AuditTrail
                    {
                        Action = "CREATE",
                        ActionItem = "Common Priting Term",
                        UserName = User.Identity.Name,
                        ActionDate = DateTime.Now
                    });
                    break;

                    case 3:
                    db.tbl_AuditTrail.AddObject(new tbl_AuditTrail
                    {
                        Action = "CREATE",
                        ActionItem = "Common Printing Problem",
                        UserName = User.Identity.Name,
                        ActionDate = DateTime.Now
                    });
                    break;

                    case 4:
                    db.tbl_AuditTrail.AddObject(new tbl_AuditTrail
                    {
                        Action = "CREATE",
                        ActionItem = "Common Photocopier Problem",
                        UserName = User.Identity.Name,
                        ActionDate = DateTime.Now
                    });
                    break;

                }

                db.SaveChanges();
                return RedirectToAction("Index/"+id);
            }

            return View(tbl_commonterms);
        }
        public ActionResult Create(tbl_CommonTerms tbl_commonterms)
        {
            tbl_commonterms.CreatedBy = User.Identity.Name;
            tbl_commonterms.CreatedDate = DateTime.Now;
            tbl_commonterms.TermType = 4;
            if (ModelState.IsValid)
            {
                db.tbl_CommonTerms.AddObject(tbl_commonterms);
                //Audit
                db.tbl_AuditTrail.AddObject(new tbl_AuditTrail
                {
                    Action = "CREATE",
                    ActionItem = "Common Photocopier Problem",
                    UserName = User.Identity.Name,
                    ActionDate = DateTime.Now
                });
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(tbl_commonterms);
        }
 /// <summary>
 /// Create a new tbl_CommonTerms object.
 /// </summary>
 /// <param name="ctTerms_Id">Initial value of the CtTerms_Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="termType">Initial value of the TermType property.</param>
 /// <param name="iSActive">Initial value of the ISActive property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 public static tbl_CommonTerms Createtbl_CommonTerms(global::System.Int32 ctTerms_Id, global::System.String title, global::System.String description, global::System.Int32 termType, global::System.Boolean iSActive, global::System.String createdBy, global::System.DateTime createdDate)
 {
     tbl_CommonTerms tbl_CommonTerms = new tbl_CommonTerms();
     tbl_CommonTerms.CtTerms_Id = ctTerms_Id;
     tbl_CommonTerms.Title = title;
     tbl_CommonTerms.Description = description;
     tbl_CommonTerms.TermType = termType;
     tbl_CommonTerms.ISActive = iSActive;
     tbl_CommonTerms.CreatedBy = createdBy;
     tbl_CommonTerms.CreatedDate = createdDate;
     return tbl_CommonTerms;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the tbl_CommonTerms EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotbl_CommonTerms(tbl_CommonTerms tbl_CommonTerms)
 {
     base.AddObject("tbl_CommonTerms", tbl_CommonTerms);
 }
Exemplo n.º 6
0
 public ActionResult Edit(tbl_CommonTerms tbl_commonterms)
 {
     if (ModelState.IsValid)
     {
         db.tbl_CommonTerms.Attach(tbl_commonterms);
         db.ObjectStateManager.ChangeObjectState(tbl_commonterms, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(tbl_commonterms);
 }
        public ActionResult Edit(tbl_CommonTerms tbl_commonterms)
        {
            tbl_commonterms.ModifiedBy = User.Identity.Name;
            tbl_commonterms.ModifiedDate = DateTime.Now;

            if (ModelState.IsValid)
            {
                db.tbl_CommonTerms.Attach(tbl_commonterms);
                db.ObjectStateManager.ChangeObjectState(tbl_commonterms, EntityState.Modified);
                //Audit
                db.tbl_AuditTrail.AddObject(new tbl_AuditTrail
                {
                    Action = "UPDATE",
                    ActionItem = "Common Photocopier Problem",
                    UserName = User.Identity.Name,
                    ActionDate = DateTime.Now
                });
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(tbl_commonterms);
        }