Exemple #1
0
        public MasterArea GetDetail(int id)
        {
            MasterArea result = _tsicsContext.MasterArea
                                .Where(s => s.Status != 2)
                                .SingleOrDefault(s => s.MasterAreaId.Equals(id));

            return(result);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            MasterArea masterArea = db.MasterAreas.Find(id);

            db.MasterAreas.Remove(masterArea);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ActionResult Edit(int id)
        {
            Context.MasterArea dbitem = RepoArea.FindByPK(id);
            MasterArea         model  = new MasterArea(dbitem);

            ViewBag.name = model.Kode;
            return(View("Form", model));
        }
Exemple #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            MasterArea masterArea = store.AdminMgr.GetMasterArea((int)id);

            if (store.AdminMgr.RemoveMasterArea(masterArea))
            {
                return(RedirectToAction("Index"));
            }
            return(View(masterArea));
        }
Exemple #5
0
        public void delete(MasterArea dbitem)
        {
            context.MasterArea.Remove(dbitem);
            var auditrail = new Auditrail {
                Actionnya = "Delete", EventDate = DateTime.Now, Modulenya = "Area", QueryDetail = "Delete " + dbitem.Nama, RemoteAddress = AppHelper.GetIPAddress(), IdUser = 1
            };

            context.Auditrail.Add(auditrail);
            context.SaveChanges();
        }
Exemple #6
0
        // GET: Admin/MasterArea/Edit/5
        public ActionResult Edit(int id)
        {
            MasterArea masterArea = _masterAreaService.GetDetail(id);

            if (masterArea == null)
            {
                return(HttpNotFound());
            }
            return(View(masterArea));
        }
 public ActionResult Edit([Bind(Include = "Id,Name,MasterCityId")] MasterArea masterArea)
 {
     if (ModelState.IsValid)
     {
         db.Entry(masterArea).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MasterCityId = new SelectList(db.MasterCities, "Id", "Name", masterArea.MasterCityId);
     return(View(masterArea));
 }
Exemple #8
0
 public bool EditMasterArea(MasterArea masterArea)
 {
     try
     {
         return(adminDb.EditMasterArea(masterArea));
     }
     catch
     {
         return(false);
     }
 }
Exemple #9
0
 public bool RemoveMasterArea(MasterArea masterArea)
 {
     try
     {
         return(adminDb.RemoveMasterArea(masterArea));
     }
     catch
     {
         return(false);
     }
 }
        public ActionResult Create([Bind(Include = "Id,Name,MasterCityId")] MasterArea masterArea)
        {
            if (ModelState.IsValid)
            {
                db.MasterAreas.Add(masterArea);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MasterCityId = new SelectList(db.MasterCities, "Id", "Name", masterArea.MasterCityId);
            return(View(masterArea));
        }
 public bool RemoveMasterArea(MasterArea masterArea)
 {
     try
     {
         db.MasterAreas.Remove(masterArea);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public bool EditMasterArea(MasterArea masterArea)
 {
     try
     {
         db.Entry(masterArea).State = EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public bool AddMasterArea(MasterArea masterArea)
 {
     try
     {
         db.MasterAreas.Add(masterArea);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #14
0
        // GET: Admin/MasterBranch/Details/5
        public ActionResult Details(int id)
        {
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }

            MasterBranch masterBranch = _masterBranchService.GetDetail(id);
            MasterArea   masterArea   = _masterAreaService.GetDetail(Convert.ToInt32(masterBranch.MasterAreaId));

            ViewBag.MasterAreaMapping = masterArea.Name;
            return(View(masterBranch));
        }
Exemple #15
0
 public ActionResult Edit([Bind(Include = "Id,Name,MasterCityId")] MasterArea masterArea)
 {
     if (ModelState.IsValid)
     {
         if (store.AdminMgr.EditMasterArea(masterArea))
         {
             return(RedirectToAction("Index"));
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.MasterCityId = new SelectList(store.RefDbLayer.GetMasterCities(), "Id", "Name", masterArea.MasterCityId);
     return(View(masterArea));
 }
Exemple #16
0
        public ActionResult Edit(MasterArea model)
        {
            if (ModelState.IsValid)
            {
                Context.MasterArea dbitem = RepoArea.FindByPK(model.Id);
                model.setDb(dbitem);
                RepoArea.save(dbitem);

                return(RedirectToAction("Index"));
            }
            LocationArea[] result = JsonConvert.DeserializeObject <LocationArea[]>(model.strArea);
            model.listArea = result.ToList();
            return(View("Form", model));
        }
        // GET: Admin/MasterAreas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MasterArea masterArea = db.MasterAreas.Find(id);

            if (masterArea == null)
            {
                return(HttpNotFound());
            }
            return(View(masterArea));
        }
Exemple #18
0
        // GET: Admin/MasterArea/Delete/5
        public ActionResult Delete(int id)
        {
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }
            MasterArea masterArea = _masterAreaService.GetDetail(id);

            if (masterArea == null)
            {
                return(HttpNotFound());
            }
            return(View(masterArea));
        }
Exemple #19
0
        // GET: Admin/MasterAreas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MasterArea masterArea = store.AdminMgr.GetMasterArea((int)id);

            if (masterArea == null)
            {
                return(HttpNotFound());
            }
            return(View(masterArea));
        }
Exemple #20
0
        // GET: Admin/MasterAreas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MasterArea masterArea = store.AdminMgr.GetMasterArea((int)id);

            if (masterArea == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MasterCityId = new SelectList(store.RefDbLayer.GetMasterCities(), "Id", "Name", masterArea.MasterCityId);
            return(View(masterArea));
        }
        // GET: Admin/MasterAreas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MasterArea masterArea = db.MasterAreas.Find(id);

            if (masterArea == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MasterCityId = new SelectList(db.MasterCities, "Id", "Name", masterArea.MasterCityId);
            return(View(masterArea));
        }
Exemple #22
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }

            ViewBag.alertMessage = "Master Area Has Been Deleted";
            MasterArea masterArea = _masterAreaService.GetDetail(id);

            masterArea.Status = 2;
            _masterAreaService.Edit(masterArea);
            _masterAreaService.DeleteBranchInvolved(id);
            return(RedirectToAction("Index"));
        }
Exemple #23
0
        public ActionResult Create(MasterArea masterArea)
        {
            ViewBag.alertMessage = "Master Area Created";
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }

            if (ModelState.IsValid)
            {
                _masterAreaService.Add(masterArea);
                return(RedirectToAction("Index"));
            }
            return(View());
            //return View(masterArea);
        }
Exemple #24
0
        public ActionResult Add(MasterArea model)
        {
            if (ModelState.IsValid)
            {
                Context.MasterArea dbitem = new Context.MasterArea();
                model.setDb(dbitem);
                //generate code
                dbitem.Urutan = RepoArea.getUrutan() + 1;
                dbitem.Kode   = RepoArea.generateCode(dbitem.Urutan);

                RepoArea.save(dbitem);

                return(RedirectToAction("Index"));
            }
            LocationArea[] result = JsonConvert.DeserializeObject <LocationArea[]>(model.strArea);
            model.listArea = result.ToList();
            return(View("Form", model));
        }
Exemple #25
0
 public ActionResult Edit(MasterArea masterArea)
 {
     if (Common.CheckAdmin())
     {
         return(RedirectToAction("Login", "Default"));
     }
     ViewBag.alertMessage = "Master Area Upgraded";
     if (ModelState.IsValid)
     {
         MasterArea resultUpdate = _masterAreaService.Edit(masterArea);
         if (resultUpdate.Status == 0)
         {
             _masterAreaService.setIncativeBranchInvolved(resultUpdate.MasterAreaId);
         }
         else if (resultUpdate.Status == 1)
         {
             _masterAreaService.setActiveBranchInvolved(resultUpdate.MasterAreaId);
         }
         return(RedirectToAction("Index"));
     }
     return(View(masterArea));
 }
Exemple #26
0
 public void save(MasterArea dbitem)
 {
     if (dbitem.Id == 0) //create
     {
         context.MasterArea.Add(dbitem);
         var auditrail = new Auditrail {
             Actionnya = "Add", EventDate = DateTime.Now, Modulenya = "Area", QueryDetail = "Add " + dbitem.Nama, RemoteAddress = AppHelper.GetIPAddress(), IdUser = 1
         };
         context.Auditrail.Add(auditrail);
     }
     else //edit
     {
         context.MasterArea.Attach(dbitem);
         var auditrail = new Auditrail {
             Actionnya = "Edit", EventDate = DateTime.Now, Modulenya = "Area", QueryDetail = "Edit " + dbitem.Nama, RemoteAddress = AppHelper.GetIPAddress(), IdUser = 1
         };
         context.Auditrail.Add(auditrail);
         var entry = context.Entry(dbitem);
         entry.State = EntityState.Modified;
     }
     context.SaveChanges();
 }
Exemple #27
0
 public MasterArea Add(MasterArea masterArea)
 {
     _tsicsContext.MasterArea.Add(masterArea);
     _tsicsContext.SaveChanges();
     return(masterArea);
 }
Exemple #28
0
 public MasterArea Edit(MasterArea masterArea)
 {
     _tsicsContext.Entry(masterArea).State = EntityState.Modified;
     _tsicsContext.SaveChanges();
     return(masterArea);
 }
Exemple #29
0
        public ActionResult Add()
        {
            MasterArea model = new MasterArea();

            return(View("Form", model));
        }