// GET: DocumentType/Edit/5
 public ActionResult Edit(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.DCMT_TYPE.ToList().FirstOrDefault(p => p.Dcmt_id == id));
     }
 }
 // GET: Category/Edit/5
 public ActionResult Edit(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.CTGRY_TBL.FirstOrDefault(p=>p.CtgryId==id));
     }
 }
        public ActionResult Edit(int id, FormCollection collection, DEPT_TBL model)
        {
            try
            {
                using (DMSDbEntities db = new DMSDbEntities())
                {
                    var dept = db.DEPT_TBL.FirstOrDefault(p => p.Dpt_id == id);
                    if (dept != null)
                    {
                        var entry = db.Entry<DEPT_TBL>(model);
                        if (entry.State.Equals(EntityState.Detached))
                        {
                            db.DEPT_TBL.Attach(model);
                            
                        }
                        entry.State = EntityState.Modified;                                                    
                    }
                    db.SaveChanges();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
 // GET: Payment/Details/5
 public ActionResult Details(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.PYMT_TBL.FirstOrDefault(p=>p.Pymt_id==id));
     }
 }
 // GET: ProductType/Edit/5
 public ActionResult Edit(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.PRDCT_TYPE.ToList().FirstOrDefault(p => p.Product_type_id == id));
     }
 }
 // GET: Policy/Edit/5
 public ActionResult Edit(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {                
         return View(db.PLCY_TBL.ToList().FirstOrDefault(p=>p.Plcy_id==id));
     }
 }
 // GET: Document
 public ActionResult Index()
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.DCMNT_TBL.ToList());
     }
 }
 // GET: StorageLocation/Edit/5
 public ActionResult Edit(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.STRG_LOC_TBL.ToList().FirstOrDefault(p => p.STRG_ID == id));
     }
 }
Exemple #9
0
 // GET: User/Details/5
 public ActionResult Details(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.USER_TBL.FirstOrDefault(p=>p.USER_ID==id));
     }            
 }
 // GET: Document/Details/5
 public ActionResult Details(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.DCMNT_TBL.ToList().FirstOrDefault(p=>p.DCMT_ID==id));    
     }            
 }
 // GET: Department/Edit/5
 public ActionResult Edit(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.DEPT_TBL.FirstOrDefault(p=>p.Dpt_id==id));
     }
 }
 // GET: ProductType
 public ActionResult Index()
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         return View(db.PRDCT_TYPE.ToList());
     }
 }
Exemple #13
0
 // GET: User/Edit/5
 public ActionResult Edit(int id)
 {
     using (DMSDbEntities db = new DMSDbEntities())
     {
         try
         {
             return View(db.USER_TBL.ToList().FirstOrDefault(p => p.USER_ID == id));
         }
         catch (Exception)
         {
             return View();                    
         }
     }
     
 }
 public ActionResult Create(FormCollection collection,PRDCT_TYPE prdctTypeModel)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             db.PRDCT_TYPE.Add(prdctTypeModel);
             db.SaveChanges();
             return RedirectToAction("Index", db.PRDCT_TYPE.ToList());
         }
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Create(FormCollection collection,DEPT_TBL model)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             db.DEPT_TBL.Add(model);
             db.SaveChanges();
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Exemple #16
0
 public ActionResult Create(FormCollection collection,PLAN_TBL planModel)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             db.PLAN_TBL.Add(planModel);
             db.SaveChanges();
             return RedirectToAction("Index", db.PLAN_TBL.ToList());
         }
     }
     catch
     {
         return View();
     }
 }
Exemple #17
0
 public ActionResult Create(ROLE_TBL roleModel)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             db.ROLE_TBL.Add(roleModel);
             db.SaveChanges();
             return RedirectToAction("Index",db.ROLE_TBL.ToList());
         }                
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Create(DCMNT_TBL docModel, FormCollection collection)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             db.DCMNT_TBL.Add(docModel);
             db.SaveChanges();
             return RedirectToAction("Index",db.DCMNT_TBL.ToList());
         }                
     }
     catch
     {
         return View();
     }
 }
Exemple #19
0
 public ActionResult Create(USER_TBL userModel,FormCollection collection)
 {
     try
     {
         userModel.GNDR = (collection["GNDR"] == "Male") ? 1 : 2;
         using (DMSDbEntities db = new DMSDbEntities())
         {
             db.USER_TBL.Add(userModel);
             db.SaveChanges();
             return RedirectToAction("Index",db.USER_TBL.ToList());
         }
     }
     catch
     {
         return View(userModel);
     }
 }
Exemple #20
0
 public ActionResult Edit(ROLE_TBL roleModel)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             var entry = db.Entry<ROLE_TBL>(roleModel);
             if (entry.State.Equals(EntityState.Detached))
             {
                 db.ROLE_TBL.Attach(roleModel);
             }
             entry.State = EntityState.Modified;
             db.SaveChanges();
             return RedirectToAction("Index", db.ROLE_TBL.ToList());
         }
     }
     catch (Exception ex)
     {
         return View(roleModel);
     }
 }
 public ActionResult Edit(DCMNT_TBL docModel)
 {
     try
     {
         using (DMSDbEntities db = new DMSDbEntities())
         {
             var entry = db.Entry<DCMNT_TBL>(docModel);
             if (entry.State.Equals(EntityState.Detached))
             {
                 db.DCMNT_TBL.Attach(docModel);
             }
             entry.State = EntityState.Modified;
             db.SaveChanges();
             return RedirectToAction("Index",db.DCMNT_TBL.ToList());
         }                
     }
     catch
     {
         return View();
     }
 }
Exemple #22
0
 public ActionResult Edit(USER_TBL userModel, FormCollection collection)
 {
     try
     {
         userModel.GNDR = (collection["GNDR"] == "Male") ? 1 : 2;
         using (DMSDbEntities db = new DMSDbEntities())
         {
             var entry = db.Entry<USER_TBL>(userModel);
             if (entry.State.Equals(EntityState.Detached))
             {
                 db.USER_TBL.Attach(userModel);
             }
             entry.State = EntityState.Modified;
             db.SaveChanges();
             return RedirectToAction("Index",db.USER_TBL.ToList());
         }                
     }
     catch
     {
         return View();
     }
 }
        public ActionResult Edit(int id, FormCollection collection,DCMT_TYPE dcmtTypeModl)
        {
            try
            {
                using (DMSDbEntities db = new DMSDbEntities())
                {
                    var entry = db.Entry<DCMT_TYPE>(dcmtTypeModl);
                    if (entry.State.Equals(EntityState.Detached))
                    {
                        db.DCMT_TYPE.Attach(dcmtTypeModl);
                    }
                    entry.State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index", db.DCMT_TYPE.ToList());
                }


            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(int id, FormCollection collection,EXTN_TBL extnTblModel)
        {
            try
            {
                extnTblModel.EXTN_ID = id;
                using (DMSDbEntities db = new DMSDbEntities())
                {
                    var entry = db.Entry<EXTN_TBL>(extnTblModel);
                    if (entry.State.Equals(EntityState.Detached))
                    {
                        db.EXTN_TBL.Attach(extnTblModel);
                    }
                    entry.State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index", db.EXTN_TBL.ToList());
                }


            }
            catch
            {
                return View();
            }
        }
        public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }
            using (DMSDbEntities db = new DMSDbEntities())
            {
                var result = from user in db.USER_TBL
                    where user.USER_EMAIL == model.Email && user.USER_Password == model.Password
                    select user;
                if (result != null)
                {
                    Session["useremail"] = result.FirstOrDefault().USER_EMAIL;
                    Session["userid"] = result.FirstOrDefault().USER_ID;
                    Session["role"] = db.ROLE_TBL.FirstOrDefault(p => p.ROLE_ID == result.FirstOrDefault().ROLE_ID).ROLE_NME;
                    Session["fname"] = result.FirstOrDefault().FRST_NME;
                    Session["lname"] = result.FirstOrDefault().LAST_NME;
                    return RedirectToAction("../document/documentscan");
                }
            }

            return View(model);
        }
        public ActionResult Edit(int id, FormCollection collection,PRDCT_TYPE prdctTypeModel)
        {
            try
            {
                prdctTypeModel.Product_type_id = id;
                using (DMSDbEntities db = new DMSDbEntities())
                {
                    var entry = db.Entry<PRDCT_TYPE>(prdctTypeModel);
                    if (entry.State.Equals(EntityState.Detached))
                    {
                        db.PRDCT_TYPE.Attach(prdctTypeModel);
                    }
                    entry.State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index", db.PRDCT_TYPE.ToList());
                }


            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(int id,STRG_LOC_TBL storageModel, FormCollection collection)
        {
            try
            {
                using (DMSDbEntities db = new DMSDbEntities())
                {
                    storageModel.STRG_ID = id;
                    var entry = db.Entry<STRG_LOC_TBL>(storageModel);
                    if (entry.State.Equals(EntityState.Detached))
                    {
                        db.STRG_LOC_TBL.Attach(storageModel);
                    }
                    entry.State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index", db.STRG_LOC_TBL.ToList());
                }


            }
            catch
            {
                return View();
            }
        }
Exemple #28
0
        public ActionResult Edit(int id, PLCY_TBL policyModel, FormCollection collection)
        {
            try
            {
                policyModel.Plcy_id = id;
                using (DMSDbEntities db = new DMSDbEntities())
                {
                    var entry = db.Entry<PLCY_TBL>(policyModel);
                    if (entry.State.Equals(EntityState.Detached))
                    {
                        db.PLCY_TBL.Attach(policyModel);
                    }
                    entry.State = EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index",db.PLCY_TBL.ToList());
                }

                
            }
            catch
            {
                return View();
            }
        }
 public ActionResult CreateScan(FormCollection fc, DCMNT_TBL dcmntTblModel)
 {
     if (ModelState.IsValid)
     {
         string path = dcmntTblModel.STRG_LOC.Replace(@"\", "_");
         string[] parts = path.Split('_');
         string[] name = parts[parts.Length - 1].Split('.');
         try
         {
             using (DMSDbEntities db = new DMSDbEntities())
             {
                 dcmntTblModel.FILE_NME = name[0] + "." + name[1];
                 dcmntTblModel.USER_ID = Convert.ToInt32(Session["userid"]);
                 dcmntTblModel.SCAN_DTE = DateTime.Now.Date.ToString().Split(' ')[0];
                 dcmntTblModel.SCAN_TME = DateTime.Now.TimeOfDay.ToString().Split('.')[0];
                 db.DCMNT_TBL.Add(dcmntTblModel);
                 db.SaveChanges();
                 ViewBag.Message = "Saved successfully";
                 return RedirectToAction("DocumentScan");
             }
         }
         catch
         {
             ModelState.AddModelError("", "Values not entered properly");
             return View("DocumentScan", dcmntTblModel);
         }
     }
     else
     {
         ModelState.AddModelError("","Values not entered properly");
         return View("DocumentScan", dcmntTblModel);
     }
 }
 public ActionResult DocumentScan()
 {
     if (Session["userid"] == null){return RedirectToAction("Login", "Account");}
     using (DMSDbEntities db = new DMSDbEntities())
     {
         Session["STRG_LOC"] = db.STRG_LOC_TBL.FirstOrDefault().STRG_LOC;
     }
     return View(new DCMNT_TBL(){FRST_NME = Session["fname"].ToString(),LAST_NME = Session["lname"].ToString()});
 }