public AuthorizationRule(Context.AuthorizationRule dbitem)
        {
            Id               = dbitem.Id;
            idProses         = dbitem.idProses;
            keteranganBagian = dbitem.keteranganBagian;
            statusAktif      = dbitem.statusAktif;
            idUserOtoritas1  = dbitem.idUserOtoritas1;
            idUserOtoritas2  = dbitem.idUserOtoritas2;
            frekuensi        = dbitem.frekuensi;
            frekuensiSatuan  = dbitem.frekuensiSatuan;
            AlertPopup       = dbitem.AlertPopup;
            AlertPassword    = dbitem.AlertPassword;
            AlertEmail       = dbitem.AlertEmail;
            AlertFingerPrint = dbitem.AlertFingerPrint;

            #region model custom
            ProsesKet             = new prosesAuthorizationRuleHelper()[dbitem.idProses];
            statusKet             = dbitem.statusAktif == true ? "Aktif" : "Tidak Aktif";
            namaUserGridOtoritas1 = new userAuthorizationRuleHelper()[dbitem.idUserOtoritas1];
            namaUserOtoritas1     = new usernameAuthorizationRuleHelper()[dbitem.idUserOtoritas1];
            namaUserGridOtoritas2 = new userAuthorizationRuleHelper()[dbitem.idUserOtoritas2];
            namaUserOtoritas2     = new usernameAuthorizationRuleHelper()[dbitem.idUserOtoritas2];
            frekuensiKet          = ">= " + dbitem.frekuensi + " " + dbitem.frekuensiSatuan;
            methodAlert           = new alertMthodAuthorizationRuleHelper()[dbitem.AlertPopup, dbitem.AlertFingerPrint, dbitem.AlertPassword, dbitem.AlertEmail];
            #endregion model custom
        }
        public JsonResult Delete(int id)
        {
            ResponeModel response = new ResponeModel(true);

            Context.AuthorizationRule dbItem = RepoAuthorizationRule.FindByPK(id);

            RepoAuthorizationRule.delete(dbItem);

            return(Json(response));
        }
        public JsonResult SaveAuthorizationRule(AuthorizationRule model)
        {
            Context.AuthorizationRule dbitem = RepoAuthorizationRule.FindByPK(model.Id);
            dbitem.idProses         = model.idProses;
            dbitem.statusAktif      = model.statusAktif;
            dbitem.idUserOtoritas1  = model.idUserOtoritas1;
            dbitem.idUserOtoritas2  = model.idUserOtoritas2;
            dbitem.frekuensi        = model.frekuensi;
            dbitem.frekuensiSatuan  = model.frekuensiSatuan;
            dbitem.AlertPopup       = model.AlertPopup;
            dbitem.AlertFingerPrint = model.AlertFingerPrint;
            dbitem.AlertEmail       = model.AlertEmail;
            dbitem.AlertPassword    = model.AlertPassword;

            RepoAuthorizationRule.save(dbitem);
            ResponeModel response = new ResponeModel(true);

            return(Json(response));
        }