예제 #1
0
 public ActionResult Add(MEmployeeVM model)
 {
     ViewBag.ListCompany = new SelectList(MCompanyRepo.get(), "id", "name");
     if (ModelState.IsValid)
     {
         if (MEmployeeRepo.HitungEmplo(model) == true)
         {
             var result = new
             {
                 success      = true,
                 alertType    = "warning",
                 alertStrong  = "Error!",
                 alertMessage = "Employee number already used"
             };
             return(Json(result, JsonRequestBehavior.AllowGet));
         }
         else if (MEmployeeRepo.HitungEmplo(model) == false)
         {
             MEmployeeRepo.insert(model);
             var result = new
             {
                 success      = false,
                 alertType    = "success",
                 alertStrong  = "Data Saved !",
                 alertMessage = "New Employee has been add with employee ID number" + model.employee_number
             };
             return(Json(result, JsonRequestBehavior.AllowGet));
         }
     }
     return(PartialView("_Add", model));
 }
예제 #2
0
 public ActionResult Add()
 {
     ViewBag.Title        = "Add User";
     ViewBag.ListRole     = new SelectList(MRoleRepo.get(), "id", "name");
     ViewBag.ListEmployee = new SelectList(MEmployeeRepo.getDataNonUser(), "id", "FullName");
     return(PartialView("_Add"));
 }
예제 #3
0
        public ActionResult Delete(int id)
        {
            MCompanyVM model = MCompanyRepo.getbyid(id);

            if (MEmployeeRepo.Hitung(model.id) == true)
            {
                var result = new
                {
                    success      = true,
                    alertType    = "warning",
                    alertStrong  = "Error!",
                    alertMessage = "Company still has employees"
                };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else if (MEmployeeRepo.Hitung(model.id) == false)
            {
                MCompanyRepo.Delete(model);
                var result = new
                {
                    success      = false,
                    alertType    = "success",
                    alertStrong  = "Data Deleted !",
                    alertMessage = "Data Deleted! Data Company With Code" + model.code + "Has been delete"
                };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            return(PartialView("_Delete", model));
        }
예제 #4
0
        public ActionResult List()
        {
            ViewBag.Title = "List Employee";
            List <MEmployeeVM> item = MEmployeeRepo.get();

            return(PartialView("_List", item));
        }
예제 #5
0
 public ActionResult Edit(MEmployeeVM model)
 {
     ViewBag.ListCompany = new SelectList(MEmployeeRepo.get(), "id", "name");
     if (MEmployeeRepo.HitungEmplo(model) == true)
     {
         var result = new
         {
             success      = true,
             alertType    = "warning",
             alertStrong  = "Error!",
             alertMessage = "Employee number already used"
         };
         return(Json(result, JsonRequestBehavior.AllowGet));
     }
     else if (MEmployeeRepo.HitungEmplo(model) == false)
     {
         MEmployeeRepo.update(model);
         var result = new
         {
             success      = false,
             alertType    = "success",
             alertStrong  = "Data Updated !",
             alertMessage = "Data Updated! Data employee has been Updated"
         };
         return(Json(result, JsonRequestBehavior.AllowGet));
     }
     return(PartialView(model));
 }
예제 #6
0
 // GET: MUser
 public ActionResult Index()
 {
     ViewBag.Title        = "List User";
     ViewBag.ListRole     = new SelectList(MRoleRepo.get(), "name", "name");
     ViewBag.ListEmployee = new SelectList(MEmployeeRepo.get(), "FullName", "FullName");
     ViewBag.ListCompany  = new SelectList(MCompanyRepo.get(), "name", "name");
     return(View(MUserRepo.get()));
 }
예제 #7
0
        public ActionResult Edit(int id)
        {
            ViewBag.ListCompany = new SelectList(MCompanyRepo.get(), "id", "name");
            MEmployeeVM model = MEmployeeRepo.getbyid(id);

            ViewBag.Title = "Edit Company-" + model.first_name + model.last_name + "(" + model.employee_number + ")";
            return(PartialView(model));
        }
예제 #8
0
        public ActionResult Edit(int id)
        {
            var data = MUserRepo.getById(id);

            ViewBag.Title        = "Edit User - " + data.firtsName + " " + data.lastName + "(" + data.username + ")";
            ViewBag.ListRole     = new SelectList(MRoleRepo.get(), "id", "name");
            ViewBag.ListEmployee = new SelectList(MEmployeeRepo.getDataNonUser(), "id", "FullName");
            return(PartialView("_Edit", data));
        }
예제 #9
0
        public ActionResult Details(int id)
        {
            var data = MUserRepo.getById(id);

            ViewBag.Title        = "View User - " + data.firtsName + " " + data.lastName + "(" + data.username + ")";
            ViewBag.ListRole     = new SelectList(MRoleRepo.get(), "id", "name");
            ViewBag.ListEmployee = new SelectList(MEmployeeRepo.get(), "id", "fullName");
            return(PartialView("_Details", data));
        }
예제 #10
0
        public ActionResult GetById2(int id)
        {
            var data = new
            {
                obj = MEmployeeRepo.getbyid(id)
            };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
예제 #11
0
        public ActionResult Detail(int id)
        {
            MEmployeeVM model = MEmployeeRepo.GetDetail(id);

            ViewBag.Title = "View Company-" + model.first_name + model.last_name + "(" + model.employee_number + ")";


            return(PartialView(model));
        }
예제 #12
0
        // GET: m_employee
        public ActionResult Index()
        {
            ViewBag.Title = "List Employee";

            ViewBag.ListCompanyName = new SelectList(MEmployeeRepo.get(), "NmCompany", "NmCompany");

            List <MEmployeeVM> item = MEmployeeRepo.get();

            return(View(item));
        }
예제 #13
0
        public JsonResult CheckNama(string nama)
        {
            var result = new
            {
                success      = true,
                data         = MEmployeeRepo.CheckNama(nama),
                alertType    = "error",
                alertStrong  = "Error !",
                alertMessage = "Your Data with name </strong>(" + nama + ")</strong>Has been created"
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #14
0
        public ActionResult Delete(int id)
        {
            MEmployeeVM model = MEmployeeRepo.getbyid(id);

            MEmployeeRepo.Delete(id);
            var result = new
            {
                success      = true,
                alertType    = "info",
                alertStrong  = "Data Deleted !",
                alertMessage = "Data Deleted! Data Company With Employee ID Number" + model.employee_number + "Has been deleted"
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #15
0
        public ActionResult Add(MUserVM model)
        {
            if (ModelState.IsValid && MUserRepo.insert(model))
            {
                var result = new
                {
                    success = true,
                    message = "Data Saved! New User has been add with username " + model.username,
                    vclass  = "alert alert-info"
                };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            ViewBag.Title        = "Add User";
            ViewBag.ListRole     = new SelectList(MRoleRepo.get(), "id", "name");
            ViewBag.ListEmployee = new SelectList(MEmployeeRepo.getDataNonUser(), "id", "FullName");
            return(PartialView("_Add", model));
        }
예제 #16
0
        public ActionResult Edit(MUserVM model)
        {
            var data = MUserRepo.getById(model.id);

            if (ModelState.IsValid && MUserRepo.update(model))
            {
                var result = new
                {
                    success = true,
                    message = "Data Updated! Data User has been updated !",
                    vclass  = "alert alert-info"
                };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            ViewBag.Title        = "Edit User - " + data.firtsName + " " + data.lastName + "(" + data.username + ")";
            ViewBag.ListRole     = new SelectList(MRoleRepo.get(), "id", "name");
            ViewBag.ListEmployee = new SelectList(MEmployeeRepo.getDataNonUser(), "id", "FullName");
            return(PartialView("_Edit", model));
        }