public ActionResult Create(FormCollection formCollection)
        {
            string MenuId = formCollection["menu_selector"];
            //int AksesId = Convert.ToInt32(formCollection["access_id"]);
            string NamaAkses = formCollection["access_name"];
            int    IndexPage = Convert.ToInt32(formCollection["indexpage"]);
            int    UserId    = Convert.ToInt32(Session["USER_ID"]);

            int    AksesId             = MixHelper.GetSequence("SYS_ACCESS");
            string logcode             = MixHelper.GetLogCode();
            string query_insert_access = "INSERT INTO SYS_ACCESS (ACCESS_ID,ACCESS_NAME,ACCESS_CREATE_DATE,ACCESS_CREATE_BY,ACCESS_STATUS,ACCESS_DEFAULT_MENU,ACCESS_LOG_CODE) values (" + AksesId + ",'" + NamaAkses + "',SYSDATE,'" + UserId + "', 1, 1,NULL)";

            db.Database.ExecuteSqlCommand(query_insert_access);
            //SYS_ACCESS model2 = new SYS_ACCESS { ACCESS_ID = AksesId, ACCESS_CREATE_DATE = DateTime.Now, ACCESS_CREATE_BY = UserId, ACCESS_STATUS = 1, ACCESS_DEFAULT_MENU = 1, ACCESS_LOG_CODE = logcode };

            if (MenuId != null)
            {
                string[] vals = MenuId.Split(',');
                foreach (String val in vals)
                {
                    string[] valval = val.Split('|');

                    int    y            = Convert.ToInt32(valval[0]);
                    int    z            = Convert.ToInt32(valval[1]);
                    int    lastid       = MixHelper.GetSequence("SYS_ACCESS_DETAIL");
                    string query_insert = "INSERT INTO SYS_ACCESS_DETAIL (ACCESS_DETAIL_ID,ACCESS_DETAIL_ACCESS_ID,ACCESS_DETAIL_MENU_ID,ACCESS_DETAIL_TYPE,ACCESS_DETAIL_CREATE_DATE,ACCESS_CREATE_BY,ACCESS_DETAIL_STATUS) values (" + lastid + "," + AksesId + ", " + y + ", " + z + ", SYSDATE, " + UserId + ", 1)";
                    db.Database.ExecuteSqlCommand(query_insert);
                }
            }
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(MASTER_SNI_STYLE mss)
        {
            var USER_ID = Convert.ToInt32(Session["USER_ID"]);
            var LOGCODE = MixHelper.GetLogCode();
            int LASTID  = MixHelper.GetSequence("MASTER_SNI_STYLE");
            var DATENOW = MixHelper.ConvertDateNow();

            var sort_max = db.Database.SqlQuery <Int32>("SELECT NVL(MAX(SNI_STYLE_SORT), 0) AS SNI_STYLE_SORT FROM MASTER_SNI_STYLE").SingleOrDefault();
            var sort     = Convert.ToInt32(sort_max) + 1;

            var fname  = "SNI_STYLE_ID,SNI_STYLE_NAME,SNI_STYLE_VALUE,SNI_STYLE_SORT,SNI_STYLE_CREATE_BY,SNI_STYLE_CREATE_DATE,SNI_STYLE_STATUS";
            var fvalue = "" + LASTID + ", " +
                         "'" + mss.SNI_STYLE_NAME + "', " +
                         "'" + mss.SNI_STYLE_VALUE + "', " +
                         "'" + sort + "', " +
                         "'" + USER_ID + "', " +
                         DATENOW + "," +
                         "1";

            db.Database.ExecuteSqlCommand("INSERT INTO MASTER_SNI_STYLE (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data SNI Berhasil di Publikasikan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(MASTER_SCOPE dt_form)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("MASTER_SCOPE");
            var datenow = MixHelper.ConvertDateNow();

            var fname  = "SCOPE_ID,SCOPE_CODE,SCOPE_NAME,SCOPE_CREATE_BY,SCOPE_CREATE_DATE,SCOPE_STATUS";
            var fvalue = "'" + lastid + "', " +
                         "'" + dt_form.SCOPE_CODE + "', " +
                         "'" + dt_form.SCOPE_NAME + "', " +
                         "'" + UserId + "'," +
                         datenow + "," +
                         "1";

            db.Database.ExecuteSqlCommand("INSERT INTO MASTER_SCOPE (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

            String objek = fvalue.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";

            return(RedirectToAction("Index"));
        }
        public ActionResult PenugasanKomtek(int PROPOSAL_ID = 0, string PROPOSAL_ST_KOM_NO = "", string PROPOSAL_ST_KOM_LAMPIRAN = "", string PROPOSAL_ST_KOM_DATE = "", string PROPOSAL_ST_KOM_TIME = "")
        {
            var    LOGCODE        = MixHelper.GetLogCode();
            int    LASTID         = MixHelper.GetSequence("TRX_SURAT_TUGAS");
            var    DATENOW        = MixHelper.ConvertDateNow();
            var    join_tgl_surat = (PROPOSAL_ST_KOM_DATE + " " + PROPOSAL_ST_KOM_TIME);
            String ST_DATE        = "TO_DATE('" + join_tgl_surat + "', 'yyyy-mm-dd hh24:mi:ss')";
            var    USER_ID        = Convert.ToInt32(Session["USER_ID"]);
            var    datenow        = MixHelper.ConvertDateNow();
            var    fname          = "ST_ID,ST_PROPOSAL_ID,ST_NO_SURAT,ST_LAMPIRAN,ST_DATE,ST_PROPOSAL_STATUS,ST_VERSI,ST_CREATE_BY,ST_CREATE_DATE,ST_STATUS";
            var    fvalue         = "'" + LASTID + "', " +
                                    "'" + PROPOSAL_ID + "', " +
                                    "'" + PROPOSAL_ST_KOM_NO + "', " +
                                    "'" + PROPOSAL_ST_KOM_LAMPIRAN + "', " +
                                    ST_DATE + ", " +
                                    "'1', " +
                                    "'1', " +
                                    "'" + USER_ID + "', " +
                                    DATENOW + "," +
                                    "'1'";

            db.Database.ExecuteSqlCommand("INSERT INTO TRX_SURAT_TUGAS (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");
            return(Json(new { result = true }, JsonRequestBehavior.AllowGet));
            //return View();
        }
        public ActionResult Create(MASTER_BIBLIOGRAFI mb)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("MASTER_BIBLIOGRAFI");
            var datenow = MixHelper.ConvertDateNow();

            var fname  = "BIBLIOGRAFI_ID,BIBLIOGRAFI_JUDUL,BIBLIOGRAFI_CREATE_BY,BIBLIOGRAFI_CREATE_DATE,BIBLIOGRAFI_STATUS,BIBLIOGRAFI_LOGCODE";
            var fvalue = "'" + lastid + "', " +
                         "'" + mb.BIBLIOGRAFI_JUDUL + "', " +
                         "'" + UserId + "'," +
                         datenow + "," +
                         "1," +
                         "'" + logcode + "'";

            //return Json(new { query = "INSERT INTO MASTER_BIDANG (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("INSERT INTO MASTER_BIBLIOGRAFI (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

            String objek = fvalue.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(MASTER_BIBLIOGRAFI mb)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("MASTER_BIBLIOGRAFI");
            var datenow = MixHelper.ConvertDateNow();
            var status  = "1";

            var update =
                " BIBLIOGRAFI_JUDUL = '" + mb.BIBLIOGRAFI_JUDUL + "'," +
                " BIBLIOGRAFI_UPDATE_BY = " + UserId + "," +
                " BIBLIOGRAFI_UPDATE_DATE = " + datenow + "," +
                " BIBLIOGRAFI_LOGCODE = '" + logcode + "', " +
                " BIBLIOGRAFI_STATUS = " + status + "";


            var clause = "where BIBLIOGRAFI_ID = " + mb.BIBLIOGRAFI_ID;

            //return Json(new { query = "UPDATE MASTER_BIDANG SET " + update.Replace("''", "NULL") + " " + clause }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("UPDATE MASTER_BIBLIOGRAFI SET " + update.Replace("''", "NULL") + " " + clause);

            //var logId = AuditTrails.GetLogId();
            String objek = update.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Beispiel #7
0
        public ActionResult Create(MASTER_REFERENCES references)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("MASTER_REFERENCES");
            var datenow = MixHelper.ConvertDateNow();

            var fname  = "REF_ID, REF_TYPE, REF_CODE, REF_NAME, REF_CREATE_BY, REF_CREATE_DATE, REF_STATUS, REF_LOG_CODE";
            var fvalue = "'" + lastid + "', " +
                         "'2', " +
                         "'" + references.REF_CODE + "', " +
                         "'" + references.REF_NAME + "'," +
                         "'" + UserId + "', " +
                         datenow + "," +
                         "'1'," +
                         "'" + logcode + "'";

            db.Database.ExecuteSqlCommand("INSERT INTO MASTER_REFERENCES (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

            String objek = fvalue.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Beispiel #8
0
        public ActionResult create(TRX_SK_PENETAPAN INPUT, string TANGGAL_SK = "")
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("SK_P_PNPS");
            var datenow = MixHelper.ConvertDateNow();

            string             pathnya    = Server.MapPath("~/Upload/Dokumen/SK_PENETAPAN_PNPS/");
            HttpPostedFileBase file_paten = Request.Files["FILES"];
            var file_name_paten           = "";
            var filePath_paten            = "";
            var fileExtension_paten       = "";

            if (file_paten != null)
            {
                //Check whether Directory (Folder) exists.
                if (!Directory.Exists(pathnya))
                {
                    //If Directory (Folder) does not exists. Create it.
                    Directory.CreateDirectory(pathnya);
                }
                string lampiranregulasipath = file_paten.FileName;
                if (lampiranregulasipath.Trim() != "")
                {
                    lampiranregulasipath = Path.GetFileNameWithoutExtension(file_paten.FileName);
                    fileExtension_paten  = Path.GetExtension(file_paten.FileName);
                    file_name_paten      = "SK_PENETAPAN_PNPS_" + lastid + fileExtension_paten;
                    filePath_paten       = pathnya + file_name_paten.Replace(" ", "_");
                    file_paten.SaveAs(filePath_paten);
                }
            }

            var fname   = "PENETAPAN_ID,PENETAPAN_NO_SK,TANGGAL_SK,JUDUL_SK,SK_LOCATION,FILES,CREATE_DATE,CREATE_BY";
            var fvalueS = "" + lastid + "," +
                          "'" + INPUT.PENETAPAN_NO_SK + "'," +
                          "TO_DATE ('" + TANGGAL_SK + "','yyyy-mm-dd hh24:mi:ss')," +
                          "'" + INPUT.JUDUL_SK + "'," +
                          "'/Upload/Dokumen/SK_PENETAPAN_PNPS/'," +
                          "'" + file_name_paten.Replace(" ", "_") + "'," +
                          "" + datenow + "," +
                          "'" + UserId + "'";

            db.Database.ExecuteSqlCommand("INSERT INTO TRX_SK_PENETAPAN (" + fname + ") VALUES (" + fvalueS.Replace("''", "NULL") + ")");

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";


            return(RedirectToAction("Index"));

            //var TT = ("INSERT INTO TRX_SK_PENETAPAN (" + fname + ") VALUES (" + fvalueS.Replace("''", "NULL") + ")");
            //return Content(TT);
        }
        public ActionResult Create(VIEW_NEWS news)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("PORTAL_NEWS");
            var datenow = MixHelper.ConvertDateNow();

            string             path     = Server.MapPath("~/Upload/Dokumen/LAINNYA/news/");
            HttpPostedFileBase file_att = Request.Files["image"];
            var file_name_att           = "";
            var filePath = "";

            if (file_att != null)
            {
                string imagenews = file_att.FileName;
                if (imagenews.Trim() != "")
                {
                    imagenews = Path.GetFileNameWithoutExtension(file_att.FileName);
                    string fileExtension = Path.GetExtension(file_att.FileName);
                    file_name_att = "IMAGE_NEWS_" + lastid + fileExtension;
                    filePath      = path + file_name_att;
                    file_att.SaveAs(filePath);
                }
            }
            var link = "http://localhost:4878/Upload/Dokumen/LAINNYA/news/";
            var PATS = "Upload/Dokumen/LAINNYA/news/";

            var fname  = "NEWS_ID, NEWS_TITLE,NEWS_CONTENTS,NEWS_SUMBER, NEWS_TAG, NEWS_PATH_IMAGE, NEWS_LINK_IMAGE, NEWS_BRIEF_NEWS, NEWS_CREATE_BY, NEWS_LOG_CODE, NEWS_CREATE_DATE,NEWS_STATUS";
            var fvalue = "'" + lastid + "'," +
                         "'" + news.NEWS_TITLE + "'," +
                         "'" + news.NEWS_CONTENTS + "'," +
                         "'" + news.NEWS_SUMBER + "'," +
                         "'" + news.NEWS_TAG + "'," +
                         "'" + PATS + file_name_att + "'," +
                         "'" + link + file_name_att + "'," +
                         "'" + news.NEWS_BRIEF_NEWS + "'," +
                         "'" + UserId + "'," +
                         "'" + logcode + "'," +
                         datenow + "," +
                         "1";

            //return Json(new { query = "INSERT INTO MASTER_BIDANG (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("INSERT INTO PORTAL_NEWS (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

            String objek = fvalue.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(SYS_USER sys_users, SYS_USER_INTERN sys_users_intern)
        {
            var checkemail = db.SYS_USER.SqlQuery("SELECT * FROM SYS_USER WHERE USER_NAME = '" + sys_users.USER_NAME + "'  and USER_STATUS = 1").Count();

            if (checkemail > 0)
            {
                TempData["Notifikasi"]     = 2;
                TempData["NotifikasiText"] = "Terjadi duplikasi data dengan Uername : " + sys_users.USER_NAME;
                return(RedirectToAction("Create"));
            }
            else
            {
                var UserId   = Session["USER_ID"];
                var logcode  = MixHelper.GetLogCode();
                int idintern = MixHelper.GetSequence("SYS_USER_INTERN");
                int lastid   = MixHelper.GetSequence("SYS_USER");
                var datenow  = MixHelper.ConvertDateNow();
                var fname1   = "USER_INTERN_ID,USER_INTERN_FULLNAME,USER_INTERN_ADDRESS,USER_INTERN_EMAIL,USER_INTERN_PHONE,USER_INTERN_CREATE_BY,USER_INTERN_CREATE_DATE,USER_INTERN_STATUS,USER_INTERN_LOG_CODE ";
                var fvalue1  = "'" + idintern + "', " +
                               "'" + sys_users_intern.USER_INTERN_FULLNAME + "', " +
                               "'" + sys_users_intern.USER_INTERN_ADDRESS + "'," +
                               "'" + sys_users_intern.USER_INTERN_EMAIL + "'," +
                               "'" + sys_users_intern.USER_INTERN_PHONE + "'," +
                               "'" + UserId + "', " +
                               datenow + "," +
                               "1," +
                               "'" + logcode + "'";

                db.Database.ExecuteSqlCommand("INSERT INTO SYS_USER_INTERN (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")");

                var fname  = "USER_ID,USER_NAME,USER_PASSWORD,USER_ACCESS_ID,USER_TYPE_ID,USER_REF_ID,USER_CREATE_BY,USER_CREATE_DATE,USER_LOG_CODE,USER_STATUS";
                var fvalue = "'" + lastid + "', " +
                             "'" + sys_users.USER_NAME + "', " +
                             "'" + GenPassword(sys_users.USER_PASSWORD) + "', " +
                             "'" + sys_users.USER_ACCESS_ID + "'," +
                             "1," +
                             "'" + idintern + "', " +
                             "'" + UserId + "', " +
                             datenow + "," +
                             "'" + logcode + "'," +
                             "1";
                //return Json(new { query = "INSERT INTO SYS_USER (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
                db.Database.ExecuteSqlCommand("INSERT INTO SYS_USER (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

                String objek = fvalue.Replace("'", "-");
                MixHelper.InsertLog(logcode, objek, 1);
                TempData["Notifikasi"]     = 1;
                TempData["NotifikasiText"] = "Data Berhasil Disimpan";
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Create(int[] SNI_STYLE_ID, int[] status, string access_name = "")
        {
            int UserId = Convert.ToInt32(Session["USER_ID"]);

            int    DocAksesId = MixHelper.GetSequence("SYS_DOC_ACCESS");
            string logcode    = MixHelper.GetLogCode();
            var    datenow    = MixHelper.ConvertDateNow();

            if (SNI_STYLE_ID.Count() > 0)
            {
                var fname1  = "DOC_ACCESS_ID,DOC_ACCESS_NAME,DOC_ACCESS_CREATE_BY,DOC_ACCESS_CREATE_DATE,DOC_ACCESS_STATUS";
                var fvalue1 = "'" + DocAksesId + "', " +
                              "'" + access_name + "', " +
                              "'" + UserId + "', " +
                              datenow + "," +
                              "1";

                db.Database.ExecuteSqlCommand("INSERT INTO SYS_DOC_ACCESS (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")");

                int no = 0;
                foreach (var a in SNI_STYLE_ID)
                {
                    int DocAksesDetailId = MixHelper.GetSequence("SYS_DOC_ACCESS_DETAIL");
                    var fname            = "DOC_ACCESS_DETAIL_ID,DOC_ACCESS_DETAIL_ACCESS_ID,DOC_ACCESS_DETAIL_STYLE_ID,DOC_ACCESS_DETAIL_CREATE_BY,DOC_ACCESS_DETAIL_CREATE_DATE,DOC_ACCESS_DETAIL_STYLE_STATUS";
                    var fvalue           = "'" + DocAksesDetailId + "', " +
                                           "'" + DocAksesId + "', " +
                                           "" + SNI_STYLE_ID[no] + ", " +
                                           "'" + UserId + "', " +
                                           datenow + "," +
                                           "" + status[no] + "";
                    no++;
                    //return Json(new
                    //{
                    //    sEcho = "INSERT INTO SYS_DOC_ACCESS_DETAIL (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")"

                    //}, JsonRequestBehavior.AllowGet);
                    db.Database.ExecuteSqlCommand("INSERT INTO SYS_DOC_ACCESS_DETAIL (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");
                }


                TempData["Notifikasi"]     = 1;
                TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            }
            else
            {
                TempData["Notifikasi"]     = 2;
                TempData["NotifikasiText"] = "Data Gagal Disimpan";
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(FormCollection formCollection)
        {
            if (ModelState.IsValid)
            {
                string MenuId    = formCollection["menu_selector"];
                int    AksesId   = Convert.ToInt32(formCollection["access_id"]);
                string NamaAkses = formCollection["access_name"];
                int    IndexPage = Convert.ToInt32(formCollection["indexpage"]);
                int    UserId    = Convert.ToInt32(Session["USER_ID"]);

                string query_reset = "UPDATE SYS_ACCESS_DETAIL SET ACCESS_DETAIL_STATUS = 0 WHERE ACCESS_DETAIL_ACCESS_ID = '" + AksesId + "'";
                db.Database.ExecuteSqlCommand(query_reset);

                string query_update_group = "UPDATE SYS_ACCESS SET ACCESS_NAME = '" + NamaAkses + "', ACCESS_UPDATE_DATE = SYSDATE, ACCESS_UPDATE_BY = " + UserId + " where ACCESS_ID = '" + AksesId + "'";
                db.Database.ExecuteSqlCommand(query_update_group);

                if (MenuId != null)
                {
                    string[] vals = MenuId.Split(',');
                    foreach (String val in vals)
                    {
                        string[] valval = val.Split('|');

                        int y = Convert.ToInt32(valval[0]);
                        int z = Convert.ToInt32(valval[1]);

                        var dataMenuEmployee = db.SYS_ACCESS_DETAIL.SqlQuery("SELECT * FROM SYS_ACCESS_DETAIL WHERE ACCESS_DETAIL_ACCESS_ID = '" + AksesId + "' AND ACCESS_DETAIL_MENU_ID = '" + y + "' AND ACCESS_DETAIL_TYPE = '" + z + "'").FirstOrDefault();
                        if (dataMenuEmployee != null)
                        {
                            string query_update = "UPDATE SYS_ACCESS_DETAIL SET ACCESS_DETAIL_STATUS = 1, ACCESS_DETAIL_UPDATE_DATE = SYSDATE, ACCESS_DETAIL_UPDATE_BY = " + UserId + " where ACCESS_DETAIL_ACCESS_ID = '" + AksesId + "' AND ACCESS_DETAIL_MENU_ID = '" + y + "' AND ACCESS_DETAIL_TYPE = '" + z + "'";
                            db.Database.ExecuteSqlCommand(query_update);
                        }
                        else
                        {
                            int    lastid       = MixHelper.GetSequence("SYS_ACCESS_DETAIL");
                            string query_insert = "INSERT INTO SYS_ACCESS_DETAIL (ACCESS_DETAIL_ID,ACCESS_DETAIL_ACCESS_ID,ACCESS_DETAIL_MENU_ID,ACCESS_DETAIL_TYPE,ACCESS_DETAIL_CREATE_DATE,ACCESS_CREATE_BY,ACCESS_DETAIL_STATUS) values (" + lastid + "," + AksesId + ", " + y + ", " + z + ", SYSDATE, " + UserId + ", 1)";

                            db.Database.ExecuteSqlCommand(query_insert);
                        }
                    }
                }
            }
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Beispiel #13
0
        public ActionResult Republish(int id)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("TRX_DOCUMENTS");
            var datenow = MixHelper.ConvertDateNow();

            var updates = "UPDATE TRX_SNI SET SNI_IS_PUBLISH = 0, SNI_UPDATE_BY = " + UserId + ", SNI_UPDATE_DATE = " + datenow + " WHERE SNI_ID = " + id;

            db.Database.ExecuteSqlCommand(updates);

            String objek = updates.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Berhasil, Data SNI menjadi tidak dipublikasi ";
            return(RedirectToAction("Index"));
        }
        public ActionResult TambahSNI(TRX_REGULASI_TEKNIS trt, FormCollection formCollection)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("TRX_REGULASI_TEKNIS_DETAIL");
            var datenow = MixHelper.ConvertDateNow();

            var sni_id = formCollection["RETEK_DETAIL_SNI_ID"];

            if (sni_id != null)
            {   //int n = 0;
                string[] vals = sni_id.Split(',');
                for (int n = 0; n < vals.Length; n++)
                {
                    int lastid_mki = MixHelper.GetSequence("TRX_REGULASI_TEKNIS_DETAIL");
                    var jml        = db.Database.SqlQuery <int>("SELECT COUNT(*) FROM TRX_REGULASI_TEKNIS_DETAIL MK WHERE RETEK_DETAIL_RETEK_ID = " + trt.RETEK_ID + "AND RETEK_DETAIL_SNI_ID = " + vals[n]);

                    if (Convert.ToInt32(jml) == 0)
                    {
                        //string query_update = "INSERT INTO MASTER_KOMTEK_ICS (KOMTEK_ICS_ID, KOMTEK_ICS_KOMTEK_ID, KOMTEK_ICS_ICS_ID, KOMTEK_ICS_CREATE_BY, KOMTEK_ICS_CREATE_DATE, KOMTEK_ICS_STATUS, KOMTEK_ICS_LOG_CODE) VALUES (" + lastid_mki + "," + lastid + "," + vals[n] + "," + UserId + "," + datenow + ",1,'" + logcode + "')";
                        //db.Database.ExecuteSqlCommand(query_update);
                        //return Json(new { query = query_update, id = komtek_ics_id });
                        var fname1  = "RETEK_DETAIL_ID,RETEK_DETAIL_RETEK_ID,RETEK_DETAIL_SNI_ID,RETEK_DETAIL_CREATE_BY,RETEK_DETAIL_CREATE_DATE,RETEK_DETAIL_STATUS";
                        var fvalue1 = "'" + lastid_mki + "'," +
                                      "'" + trt.RETEK_ID + "'," +
                                      "'" + vals[n] + "'," +
                                      "" + UserId + "," +
                                      datenow + "," +
                                      "1";

                        //return Json(new { query = "INSERT INTO TRX_REGULASI_TEKNIS (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
                        db.Database.ExecuteSqlCommand("INSERT INTO TRX_REGULASI_TEKNIS_DETAIL (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")");

                        String objek1 = fvalue1.Replace("'", "-");
                        MixHelper.InsertLog(logcode, objek1, 1);
                    }
                }
            }
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Beispiel #15
0
        public ActionResult publish(int id = 0)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("TRX_DOCUMENTS");
            var datenow = MixHelper.ConvertDateNow();

            var updates = "UPDATE TRX_SNI_SK SET IS_PUBLISH = 1 WHERE SNI_SK_ID = " + id;

            db.Database.ExecuteSqlCommand(updates);

            var update = "UPDATE TRX_SNI SET SNI_IS_PUBLISH = 1 WHERE SNI_SK_ID = " + id;

            db.Database.ExecuteSqlCommand(update);

            String objek = update.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data SNI Berhasil di Publikasikan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(MASTER_SNI_STYLE mss)
        {
            var USER_ID = Convert.ToInt32(Session["USER_ID"]);
            var LOGCODE = MixHelper.GetLogCode();
            int LASTID  = MixHelper.GetSequence("MASTER_SNI_STYLE");
            var DATENOW = MixHelper.ConvertDateNow();

            if (mss.SNI_STYLE_ID > 0)
            {
                var uPDATE = "UPDATE MASTER_SNI_STYLE SET SNI_STYLE_NAME = '" + mss.SNI_STYLE_NAME + "', SNI_STYLE_VALUE = '" + mss.SNI_STYLE_VALUE + "', SNI_STYLE_UPDATE_BY = " + LASTID + ", SNI_STYLE_UPDATE_DATE = " + DATENOW + " WHERE SNI_STYLE_ID = " + mss.SNI_STYLE_ID;
                db.Database.ExecuteSqlCommand(uPDATE);

                TempData["Notifikasi"]     = 1;
                TempData["NotifikasiText"] = "Data SNI Style Berhasil di Publikasikan";
            }
            else
            {
                TempData["Notifikasi"]     = 2;
                TempData["NotifikasiText"] = "Data SNI Style gagal di Publikasikan";
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Create(MASTER_ICS ics)
        {
            //return Content(ics.ICS_PARENT_CODE);
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("MASTER_ICS");
            var datenow = MixHelper.ConvertDateNow();
            var fname   = "ICS_ID," +
                          "ICS_PARENT_CODE," +
                          "ICS_CODE," +
                          "ICS_NAME," +
                          "ICS_NAME_IND," +
                          //"ICS_YEAR," +
                          "ICS_CREATE_BY," +
                          "ICS_CREATE_DATE," +
                          "ICS_STATUS," +
                          "ICS_LOG_CODE";
            var fvalue = "'" + lastid + "', " +
                         "'" + ics.ICS_PARENT_CODE + "', " +
                         "'" + ics.ICS_PARENT_CODE + "." + ics.ICS_CODE + "'," +
                         "'" + ics.ICS_NAME + "'," +
                         "'" + ics.ICS_NAME_IND + "'," +
                         //"'" + ics.ICS_YEAR + "'," +
                         "'" + UserId + "', " +
                         datenow + "," +
                         "1," +
                         "'" + logcode + "'";

            db.Database.ExecuteSqlCommand("INSERT INTO MASTER_ICS (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

            String objek = fvalue.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Approval(int PROPOSAL_ID = 0, int PROPOSAL_KOMTEK_ID = 0, int[] PROPOSAL_ICS_REF_ICS_ID = null)
        {
            var USER_ID = Session["USER_ID"];
            var logcode = db.Database.SqlQuery <String>("SELECT PROPOSAL_LOG_CODE FROM TRX_PROPOSAL WHERE PROPOSAL_ID = " + PROPOSAL_ID).SingleOrDefault();

            var TANGGAL_SKR = MixHelper.ConvertDateNow();

            var year_now             = DateTime.Now.Year;
            var LOGCODE_POLLING      = MixHelper.GetLogCode();
            int LASTID_POLLING       = MixHelper.GetSequence("TRX_POLLING");
            var LAST_POLLING_VERSION = db.Database.SqlQuery <int>("SELECT NVL(CAST(MAX(POLLING_VERSION) AS INT),1) FROM TRX_POLLING WHERE POLLING_TYPE = 2 AND POLLING_PROPOSAL_ID = " + PROPOSAL_ID).SingleOrDefault();

            var POLLING_IS_EXIST = db.Database.SqlQuery <TRX_POLLING>("SELECT * FROM TRX_POLLING WHERE POLLING_VERSION = " + LAST_POLLING_VERSION + " AND POLLING_TYPE = 2 AND POLLING_PROPOSAL_ID = " + PROPOSAL_ID).SingleOrDefault();
            var JML_HARI         = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 8").SingleOrDefault();

            if (POLLING_IS_EXIST == null)
            {
                var fname  = "POLLING_ID,POLLING_PROPOSAL_ID,POLLING_TYPE,POLLING_START_DATE,POLLING_END_DATE,POLLING_VERSION,POLLING_CREATE_BY,POLLING_CREATE_DATE,POLLING_STATUS,POLLING_LOGCODE";
                var fvalue = "'" + LASTID_POLLING + "', " +
                             "'" + PROPOSAL_ID + "', " +
                             "'" + 2 + "', " +
                             "TO_DATE(SYSDATE), " +
                             "TO_DATE(SYSDATE)+" + ((JML_HARI != null) ? JML_HARI.CONFIG_VALUE : "14") + ", " +
                             "'" + LAST_POLLING_VERSION + "', " +
                             "'" + USER_ID + "'," +
                             TANGGAL_SKR + "," +
                             "'1', " +
                             "'" + LOGCODE_POLLING + "'";
                db.Database.ExecuteSqlCommand("INSERT INTO TRX_POLLING (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

                String objek2 = fvalue.Replace("'", "-");
                MixHelper.InsertLog(logcode, objek2, 1);
            }
            var NEW_LASTID_POLLING = db.Database.SqlQuery <int>("SELECT POLLING_ID FROM TRX_POLLING WHERE POLLING_PROPOSAL_ID =" + PROPOSAL_ID + " AND POLLING_VERSION = " + LAST_POLLING_VERSION).SingleOrDefault();

            var PROPOSAL_PNPS_CODE = db.Database.SqlQuery <string>("SELECT CAST(TO_CHAR (SYSDATE, 'YYYY') || '.' || KOMTEK_CODE || '.' || ( SELECT CAST ( ( CASE WHEN LENGTH (COUNT(PROPOSAL_ID) + 1) = 1 THEN '0' || CAST ( COUNT (PROPOSAL_ID) + 1 AS VARCHAR2 (255) ) ELSE CAST ( COUNT (PROPOSAL_ID) + 1 AS VARCHAR2 (255) ) END ) AS VARCHAR2 (255) ) PNPSCODE FROM TRX_PROPOSAL WHERE PROPOSAL_KOMTEK_ID = KOMTEK_ID ) AS VARCHAR2(255)) AS PNPSCODE FROM MASTER_KOMITE_TEKNIS WHERE KOMTEK_ID = " + PROPOSAL_KOMTEK_ID).SingleOrDefault();

            db.Database.ExecuteSqlCommand("UPDATE TRX_PROPOSAL SET PROPOSAL_PNPS_CODE = (CASE WHEN PROPOSAL_TYPE = 2 THEN '" + PROPOSAL_PNPS_CODE + "' ELSE PROPOSAL_PNPS_CODE END), PROPOSAL_KOMTEK_ID = " + PROPOSAL_KOMTEK_ID + ", PROPOSAL_STATUS = 2, PROPOSAL_IS_POLLING = 1,PROPOSAL_POLLING_ID = " + NEW_LASTID_POLLING + ", PROPOSAL_UPDATE_DATE = " + TANGGAL_SKR + ", PROPOSAL_UPDATE_BY = " + USER_ID + " WHERE PROPOSAL_ID = " + PROPOSAL_ID);

            String objek = "PROPOSAL_KOMTEK_ID = " + PROPOSAL_KOMTEK_ID + ", PROPOSAL_STATUS = 2, PROPOSAL_IS_POLLING = 1, PROPOSAL_POLLING_ID = " + NEW_LASTID_POLLING + ", PROPOSAL_UPDATE_DATE = " + TANGGAL_SKR + ", PROPOSAL_UPDATE_BY = " + USER_ID;

            MixHelper.InsertLog(logcode, objek.Replace("'", "-"), 2);

            if (PROPOSAL_ICS_REF_ICS_ID != null)
            {
                foreach (var i in PROPOSAL_ICS_REF_ICS_ID)
                {
                    int PROPOSAL_ICS_REF_ID = MixHelper.GetSequence("TRX_PROPOSAL_ICS_REF");
                    db.Database.ExecuteSqlCommand("INSERT INTO TRX_PROPOSAL_ICS_REF (PROPOSAL_ICS_REF_ID,PROPOSAL_ICS_REF_PROPOSAL_ID,PROPOSAL_ICS_REF_ICS_ID)VALUES(" + PROPOSAL_ICS_REF_ID + "," + PROPOSAL_ID + "," + i + ")");
                }
            }

            int lastid = MixHelper.GetSequence("TRX_PROPOSAL_APPROVAL");

            db.Database.ExecuteSqlCommand("UPDATE TRX_PROPOSAL_APPROVAL SET APPROVAL_STATUS = 0 WHERE APPROVAL_PROPOSAL_ID = " + PROPOSAL_ID);
            db.Database.ExecuteSqlCommand("INSERT INTO TRX_PROPOSAL_APPROVAL (APPROVAL_ID,APPROVAL_PROPOSAL_ID,APPROVAL_TYPE,APPROVAL_DATE,APPROVAL_BY,APPROVAL_STATUS,APPROVAL_STATUS_PROPOSAL,APPROVAL_STATUS_SESSION) VALUES (" + lastid + "," + PROPOSAL_ID + ",1," + TANGGAL_SKR + "," + USER_ID + ",1,1,1)");

            db.Database.ExecuteSqlCommand("UPDATE TRX_MONITORING SET MONITORING_TGL_MTPS = " + TANGGAL_SKR + " WHERE MONITORING_PROPOSAL_ID = " + PROPOSAL_ID);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(Json(new { result = true }, JsonRequestBehavior.AllowGet));
            //return RedirectToAction("Index");
        }
Beispiel #19
0
        public ActionResult Approval(int PROPOSAL_ID = 0, string PROPOSAL_PNPS_CODEZZ = "", int PROPOSAL_KOMTEK_ID = 0, int[] PROPOSAL_ICS_REF_ICS_ID = null)
        {
            var    DataProposal       = (from proposal in db.VIEW_PROPOSAL where proposal.PROPOSAL_ID == PROPOSAL_ID select proposal).SingleOrDefault();
            var    PROPOSAL_PNPS_CODE = db.Database.SqlQuery <string>("SELECT CAST(TO_CHAR (SYSDATE, 'YYYY') || '.' || KOMTEK_CODE || '.' || ( SELECT CAST ( ( CASE WHEN LENGTH (COUNT(PROPOSAL_ID) + 1) = 1 THEN '0' || CAST ( COUNT (PROPOSAL_ID) + 1 AS VARCHAR2 (255) ) ELSE CAST ( COUNT (PROPOSAL_ID) + 1 AS VARCHAR2 (255) ) END ) AS VARCHAR2 (255) ) PNPSCODE FROM TRX_PROPOSAL WHERE PROPOSAL_KOMTEK_ID = KOMTEK_ID ) AS VARCHAR2(255)) AS PNPSCODE FROM MASTER_KOMITE_TEKNIS WHERE KOMTEK_ID = " + PROPOSAL_KOMTEK_ID).SingleOrDefault();
            string test = "SELECT CAST(TO_CHAR (SYSDATE, 'YYYY') || '.' || KOMTEK_CODE || '.' || ( SELECT CAST ( ( CASE WHEN LENGTH (COUNT(PROPOSAL_ID) + 1) = 1 THEN '0' || CAST ( COUNT (PROPOSAL_ID) + 1 AS VARCHAR2 (255) ) ELSE CAST ( COUNT (PROPOSAL_ID) + 1 AS VARCHAR2 (255) ) END ) AS VARCHAR2 (255) ) PNPSCODE FROM TRX_PROPOSAL WHERE PROPOSAL_KOMTEK_ID = KOMTEK_ID ) AS VARCHAR2(255)) AS PNPSCODE FROM MASTER_KOMITE_TEKNIS WHERE KOMTEK_ID = " + PROPOSAL_KOMTEK_ID;

            var USER_ID = Convert.ToInt32(Session["USER_ID"]);
            var PROPOSAL_PNPS_CODE_FIXER = DataProposal.PROPOSAL_CODE;
            var DATENOW = MixHelper.ConvertDateNow();

            db.Database.ExecuteSqlCommand("UPDATE TRX_PROPOSAL SET PROPOSAL_STATUS = 3, PROPOSAL_STATUS_PROSES = 1,PROPOSAL_KOMTEK_ID = " + PROPOSAL_KOMTEK_ID + ", PROPOSAL_IS_POLLING = 0, PROPOSAL_POLLING_ID = NULL, PROPOSAL_UPDATE_DATE = " + DATENOW + ", PROPOSAL_UPDATE_BY = " + USER_ID + " WHERE PROPOSAL_ID = " + PROPOSAL_ID);
            var    PROPOSAL_LOG_CODE = db.Database.SqlQuery <string>("SELECT PROPOSAL_LOG_CODE FROM TRX_PROPOSAL WHERE PROPOSAL_ID = " + PROPOSAL_ID).SingleOrDefault();
            String objek1            = "UPDATE TRX_PROPOSAL SET PROPOSAL_STATUS = 3,PROPOSAL_KOMTEK_ID = " + PROPOSAL_KOMTEK_ID + ", PROPOSAL_STATUS_PROSES = 1, PROPOSAL_IS_POLLING = 0, PROPOSAL_POLLING_ID = NULL, PROPOSAL_UPDATE_DATE = " + DATENOW + ", PROPOSAL_UPDATE_BY = " + USER_ID + " WHERE PROPOSAL_ID = " + PROPOSAL_ID;

            MixHelper.InsertLog(PROPOSAL_LOG_CODE, objek1.Replace("'", "-"), 2);

            int APPROVAL_ID = MixHelper.GetSequence("TRX_PROPOSAL_APPROVAL");

            db.Database.ExecuteSqlCommand("UPDATE TRX_PROPOSAL_APPROVAL SET APPROVAL_STATUS = 0 WHERE APPROVAL_PROPOSAL_ID = " + PROPOSAL_ID);
            db.Database.ExecuteSqlCommand("INSERT INTO TRX_PROPOSAL_APPROVAL (APPROVAL_ID,APPROVAL_PROPOSAL_ID,APPROVAL_TYPE,APPROVAL_DATE,APPROVAL_BY,APPROVAL_STATUS,APPROVAL_STATUS_PROPOSAL,APPROVAL_STATUS_SESSION) VALUES (" + APPROVAL_ID + "," + PROPOSAL_ID + ",1," + DATENOW + "," + USER_ID + ",1,2,1)");

            db.Database.ExecuteSqlCommand("UPDATE TRX_MONITORING SET MONITORING_TGL_APP_MTPS = " + DATENOW + ", MONITORING_HASIL_APP_MTPS = 1 WHERE MONITORING_PROPOSAL_ID = " + PROPOSAL_ID);

            int    LASTID        = MixHelper.GetSequence("TRX_DOCUMENTS");
            var    TGL_SEKARANG  = DateTime.Now.ToString("yyyyMMddHHmmss");
            var    DataTanggapan = db.Database.SqlQuery <VIEW_POLLING_DETAIL>("SELECT * FROM VIEW_POLLING_DETAIL WHERE POLLING_DETAIL_POLLING_ID = " + DataProposal.PROPOSAL_POLLING_ID + " ORDER BY POLLING_DETAIL_INPUT_TYPE ASC,POLLING_DETAIL_CREATE_DATE DESC").ToList();
            string path          = Server.MapPath("~/Upload/Dokumen/RANCANGAN_SNI/MTPS/" + PROPOSAL_PNPS_CODE_FIXER + "/");
            string dataFormat    = Server.MapPath("~/Format/Laporan/");
            Stream stream        = System.IO.File.OpenRead(dataFormat + "FORMAT_TANGGAPAN_PUBLIKASI_MTPS.docx");

            Aspose.Words.Document Tanggapan = new Aspose.Words.Document(stream);
            ReplaceHelper         helper    = new ReplaceHelper(Tanggapan);

            helper.Replace("JudulPNPS", DataProposal.PROPOSAL_JUDUL_PNPS);
            DateTime dt = Convert.ToDateTime(DataProposal.POLLING_START_DATE);

            helper.Replace("TanggalJP", dt.ToString("dd/MM/yyyy"));
            helper.Replace("RuangLingkupPNPS", DataProposal.PROPOSAL_RUANG_LINGKUP);


            Paragraph paragraph = new Paragraph(Tanggapan);

            DocumentBuilder builder = new DocumentBuilder(Tanggapan);

            Aspose.Words.Font font = builder.Font;
            font.Bold   = false;
            font.Color  = System.Drawing.Color.Black;
            font.Italic = false;
            font.Name   = "Calibri";
            font.Size   = 11;
            builder.MoveToDocumentEnd();

            var    number = 0;
            string html   = "<table width='100%' border='1' bordercolor='#111111' cellpadding='2'  style='border-collapse: collapse' cellpadding='0' cellspacing='0'>" +
                            "<tr>" +
                            "<td width='5%' style='text-align:center'><b>No</b></td>" +
                            "<td width='15%' style='text-align:center'><b>Nama</b></td>" +
                            "<td width='15%' style='text-align:center'><b>Tipe tanggapan</b></td>" +
                            "<td width='65%' style='text-align:center'><b>Tanggapan</b></td>" +
                            "</tr>";

            foreach (var i in DataTanggapan)
            {
                number++;
                html += "<tr>" +
                        "<td>" + number + "</td>" +
                        "<td>" + i.USER_PUBLIC_NAMA + "</td>" +
                        "<td>" + i.POLLING_DETAIL_INPUT_TYPE_NAME + "</td>" +
                        "<td>" + i.POLLING_DETAIL_REASON + "</td>" +
                        "</tr>";
            }
            html += "</table>";
            builder.InsertHtml(html);
            Tanggapan.Save(@"" + path + "DAFTAR_TANGGAPAN_PUBLIKASI_USULAN_PNPS_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + ".docx", Aspose.Words.SaveFormat.Docx);
            Tanggapan.Save(@"" + path + "DAFTAR_TANGGAPAN_PUBLIKASI_USULAN_PNPS_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + ".pdf", Aspose.Words.SaveFormat.Pdf);
            Tanggapan.Save(@"" + path + "DAFTAR_TANGGAPAN_PUBLIKASI_USULAN_PNPS_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + ".xml");

            var LOGCODE_TANGGAPAN_MTPS = MixHelper.GetLogCode();
            var FNAME_TANGGAPAN_MTPS   = "DOC_ID,DOC_FOLDER_ID,DOC_RELATED_TYPE,DOC_RELATED_ID,DOC_NAME,DOC_DESCRIPTION,DOC_FILE_PATH,DOC_FILE_NAME,DOC_FILETYPE,DOC_EDITABLE,DOC_CREATE_BY,DOC_CREATE_DATE,DOC_STATUS,DOC_LOG_CODE";
            var FVALUE_TANGGAPAN_MTPS  = "'" + LASTID + "', " +
                                         "'10', " +
                                         "'1', " +
                                         "'" + PROPOSAL_ID + "', " +
                                         "'" + "(" + PROPOSAL_PNPS_CODE_FIXER + ") Daftar Tanggapan Publikasi Usulan PNPS" + "', " +
                                         "'Daftar Tanggapan Hasil Publikasi Usulan PNPS dengan Judul PNPS : " + DataProposal.PROPOSAL_JUDUL_PNPS + "', " +
                                         "'" + "/Upload/Dokumen/RANCANGAN_SNI/MTPS/" + PROPOSAL_PNPS_CODE_FIXER + "/" + "', " +
                                         "'" + "DAFTAR_TANGGAPAN_PUBLIKASI_USULAN_PNPS_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + "" + "', " +
                                         "'DOCX', " +
                                         "'0', " +
                                         "'" + USER_ID + "', " +
                                         DATENOW + "," +
                                         "'1', " +
                                         "'" + LOGCODE_TANGGAPAN_MTPS + "'";

            db.Database.ExecuteSqlCommand("INSERT INTO TRX_DOCUMENTS (" + FNAME_TANGGAPAN_MTPS + ") VALUES (" + FVALUE_TANGGAPAN_MTPS.Replace("''", "NULL") + ")");
            String objekTanggapan = FVALUE_TANGGAPAN_MTPS.Replace("'", "-");

            MixHelper.InsertLog(LOGCODE_TANGGAPAN_MTPS, objekTanggapan, 1);

            db.Database.ExecuteSqlCommand("UPDATE TRX_POLLING SET POLLING_IS_KUORUM = 1,POLLING_UPDATE_DATE = " + DATENOW + ", POLLING_UPDATE_BY = '" + USER_ID + "' WHERE POLLING_ID = " + DataProposal.PROPOSAL_POLLING_ID);

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Beispiel #20
0
        public ActionResult Comment(TRX_POLLING_DETAILS input, VIEW_POLLING VP, FormCollection form)
        {
            var GetIP        = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 12").FirstOrDefault();
            var GetUser      = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 13").FirstOrDefault();
            var GetPassword  = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 14").FirstOrDefault();
            var GetPath      = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 15").FirstOrDefault();
            var TGL_SEKARANG = DateTime.Now.ToString("yyyyMMddHHmmss");

            string path        = "";
            string filePathpdf = "";

            HttpPostedFileBase file4 = Request.Files["POLLING_FILE"];

            if (file4.ContentLength > 0)
            {
                Directory.CreateDirectory(GetPath.CONFIG_VALUE + "/Upload/DokPolling");
                path = GetPath.CONFIG_VALUE + "/Upload/DokPolling/";
                Stream stremdokumen = file4.InputStream;
                byte[] appData      = new byte[file4.ContentLength + 1];
                stremdokumen.Read(appData, 0, file4.ContentLength);
                string Extension = Path.GetExtension(file4.FileName);
                if (Extension.ToLower() == ".pdf")
                {
                    Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(stremdokumen);
                    //Aspose.Words.Document docx = new Aspose.Words.Document(stremdokumen);
                    filePathpdf = path + "POLLING_" + VP.PROPOSAL_ID + "_" + TGL_SEKARANG + ".pdf";
                    pdf.Save(@"" + filePathpdf, Aspose.Pdf.SaveFormat.Pdf);
                }
            }

            using (OracleConnection con = new OracleConnection("Data Source=" + GetIP.CONFIG_VALUE + ";User ID=" + GetUser.CONFIG_VALUE + ";PASSWORD="******";"))
            {
                con.Open();

                using (OracleCommand cmd = new OracleCommand())
                {
                    var pathnya = "/Upload/DokPolling/POLLING_" + VP.PROPOSAL_ID + "_" + TGL_SEKARANG + ".pdf";

                    var UserId   = Session["USER_ID"];
                    var logcode  = MixHelper.GetLogCode();
                    int lastid   = MixHelper.GetSequence("TRX_POLLING_DETAILS");
                    var datenow  = MixHelper.ConvertDateNow();
                    var year_now = DateTime.Now.Year;
                    var fname    = "POLLING_DETAIL_ID,POLLING_DETAIL_POLLING_ID,POLLING_DETAIL_REASON,POLLING_DETAIL_CREATE_BY,POLLING_DETAIL_CREATE_DATE,POLLING_DETAIL_STATUS,POLLING_DETAIL_FILE_PATH,POLLING_DETAIL_INPUT_TYPE";


                    cmd.Connection  = con;
                    cmd.CommandType = System.Data.CommandType.Text;

                    cmd.CommandText = " INSERT INTO TRX_POLLING_DETAILS (" + fname + ") VALUES ('" + lastid + "','" + input.POLLING_DETAIL_POLLING_ID + "',:parameter," + UserId + "," + datenow + ",1,'" + pathnya + "',1) ";

                    OracleParameter oracleParameterClob = new OracleParameter();
                    oracleParameterClob.OracleDbType = OracleDbType.Clob;
                    //1 million long string
                    oracleParameterClob.Value = input.POLLING_DETAIL_REASON;


                    cmd.Parameters.Add(oracleParameterClob);

                    cmd.ExecuteNonQuery();
                    db.Database.ExecuteSqlCommand("UPDATE TRX_POLLING TP SET TP.POLLING_JML_PARTISIPAN = (TP.POLLING_JML_PARTISIPAN + 1) WHERE TP.POLLING_ID =" + input.POLLING_DETAIL_POLLING_ID);

                    TempData["Notifikasi"]     = 1;
                    TempData["NotifikasiText"] = "Terima kasih, pendapat anda berhasil di simpan.";
                }

                con.Close();

                var proposal_id = Convert.ToInt32(form["PROPOSAL_ID"]);
                return(RedirectToAction("Comment/" + proposal_id));
            }
        }
Beispiel #21
0
        public ActionResult Edit(MASTER_TAS mt, int[] ICS_ID, string[] TAS_EDUCATION_INSTITUSI, string[] TAS_EDUCATION_YEAR, string[] TAS_EDUCATION_PRODI, string[] TAS_RIWAYAT_INSTITUSI_NAME, string[] TAS_RIWAYAT_TAHUN, string[] TAS_RIWAYAT_BIDANG_JABATAN, string[] TAS_RIWAYAT_JENIS_PELATIHAN, string[] TAS_RIWAYAT_TAHUN_PEL, string[] TAS_RIWAYAT_PENYELENGGARA, string[] TAS_RIWAYAT_PENGALAMAN)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            //int lastid = MixHelper.GetSequence("TRX_SNI");
            int last_id = MixHelper.GetSequence("MASTER_TAS");
            var datenow = MixHelper.ConvertDateNow();

            //var fname = "TAS_ID,TAS_NAME,TAS_INSTANSI_ID,TAS_ADDRESS,TAS_PHONE,TAS_FAX,TAS_OFFICE_ADDRESS,TAS_OFFICE_PHONE,TAS_HANDPHONE,TAS_EMAIL,TAS_CREATE_BY,TAS_CREATE_DATE,TAS_STATUS,TAS_LOG_CODE";
            var value = "TAS_NAME = '" + mt.TAS_NAME + "'," +
                        "TAS_INSTANSI_ID = '" + mt.TAS_INSTANSI_ID + "'," +
                        "TAS_ADDRESS = '" + mt.TAS_ADDRESS + "'," +
                        "TAS_PHONE = '" + mt.TAS_PHONE + "'," +
                        "TAS_FAX = '" + mt.TAS_FAX + "'," +
                        "TAS_OFFICE_ADDRESS ='" + mt.TAS_OFFICE_ADDRESS + "'," +
                        "TAS_OFFICE_PHONE ='" + mt.TAS_OFFICE_PHONE + "'," +
                        "TAS_HANDPHONE ='" + mt.TAS_HANDPHONE + "'," +
                        "TAS_EMAIL ='" + mt.TAS_EMAIL + "'," +
                        "TAS_UPDATE_BY ='" + UserId + "'," +
                        "TAS_UPDATE_DATE =" + datenow + "," +
                        "TAS_LOG_CODE =" + logcode + "";
            var clause = " WHERE TAS_ID =" + mt.TAS_ID;

            //db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS (" + fname + ") VALUES (" + value.Replace("''", "NULL") + ")");
            db.Database.ExecuteSqlCommand("UPDATE MASTER_TAS SET " + value.Replace("''", "NULL") + " " + clause);

            //return Json(new
            //{

            //    aaData = "UPDATE MASTER_TAS SET " + value.Replace("''", "NULL") + " " + clause
            //}, JsonRequestBehavior.AllowGet);

            if (ICS_ID != null)
            {
                var updates = "TAS_DETAIL_ICS_STATUS=0";
                var clauses = "WHERE TAS_DETAIL_ICS_TAS_ID = " + mt.TAS_ID;
                db.Database.ExecuteSqlCommand("UPDATE MASTER_TAS_DETAIL_ICS SET " + updates.Replace("''", "NULL") + " " + clauses);
                foreach (var TAS_ICS_ID in ICS_ID)
                {
                    var jml = db.Database.ExecuteSqlCommand("SELECT COUNT(*) FROM MASTER_TAS_DETAIL_ICS WHERE TAS_DETAIL_ICS_ICS_ID =" + TAS_ICS_ID + " AND TAS_DETAIL_ICS_TAS_ID =" + mt.TAS_ID);
                    if (jml == 0)
                    {
                        int    lastid_mTDI  = MixHelper.GetSequence("MASTER_TAS_DETAIL_ICS");
                        string query_create = "INSERT INTO MASTER_TAS_DETAIL_ICS (TAS_DETAIL_ICS_ID,TAS_DETAIL_ICS_TAS_ID,TAS_DETAIL_ICS_ICS_ID,TAS_DETAIL_ICS_STATUS) VALUES (" + lastid_mTDI + "," + mt.TAS_ID + "," + TAS_ICS_ID + ",1)";
                        db.Database.ExecuteSqlCommand(query_create);
                    }
                    else
                    {
                        var query_update = "TAS_DETAIL_ICS_STATUS=1";
                        var query_clause = "WHERE TAS_DETAIL_ICS_TAS_ID = '" + mt.TAS_ID + "' AND TAS_DETAIL_ICS_ICS_ID=" + TAS_ICS_ID;
                        db.Database.ExecuteSqlCommand("UPDATE MASTER_TAS_DETAIL_ICS SET " + query_update.Replace("''", "NULL") + " " + query_clause);
                    }
                }
            }

            if (TAS_EDUCATION_INSTITUSI.Count() > 0)
            {
                db.Database.ExecuteSqlCommand("DELETE FROM MASTER_TAS_EDUCATION WHERE TAS_EDUCATION_TAS_ID = " + mt.TAS_ID);

                var fnameSS = "TAS_EDUCATION_ID," +
                              "TAS_EDUCATION_TAS_ID," +
                              "TAS_EDUCATION_INSTITUSI," +
                              "TAS_EDUCATION_YEAR," +
                              "TAS_EDUCATION_PRODI," +
                              "TAS_EDUCATION_STATUS";

                for (var i = 0; i < TAS_EDUCATION_INSTITUSI.Count(); i++)
                {
                    int lastidxx = MixHelper.GetSequence("MASTER_TAS_EDUCATION");
                    //var jml = db.Database.ExecuteSqlCommand("SELECT COUNT(*) FROM MASTER_TAS_EDUCATION WHERE TAS_EDUCATION_TAS_ID =" + mt.TAS_ID);
                    //var logcodeSS = MixHelper.GetLogCode();
                    //decimal amount = Convert.ToDecimal(Price[i].Replace(",", "")) * Convert.ToDecimal(QtyOpname[i].Replace(",", ""));
                    var fvalueSS = "'" + lastidxx + "'," +
                                   "'" + mt.TAS_ID + "'," +
                                   "'" + TAS_EDUCATION_INSTITUSI[i] + "'," +
                                   "'" + TAS_EDUCATION_YEAR[i] + "'," +
                                   "'" + TAS_EDUCATION_PRODI[i] + "'," +
                                   "1";

                    db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS_EDUCATION (" + fnameSS + ") VALUES (" + fvalueSS.Replace("''", "NULL") + ")");
                }
            }

            if (TAS_RIWAYAT_INSTITUSI_NAME.Count() > 0)
            {
                db.Database.ExecuteSqlCommand("DELETE FROM MASTER_TAS_RIWAYAT WHERE TAS_RIWAYAT_TAS_ID = " + mt.TAS_ID + " AND TAS_RIWAYAT_TYPE = 1");

                var fnameSSS = "TAS_RIWAYAT_ID," +
                               "TAS_RIWAYAT_TAS_ID," +
                               "TAS_RIWAYAT_TYPE," +
                               "TAS_RIWAYAT_INSTITUSI_NAME," +
                               "TAS_RIWAYAT_TAHUN," +
                               "TAS_RIWAYAT_BIDANG_JABATAN," +
                               "TAS_RIWAYAT_STATUS";

                for (var i = 0; i < TAS_RIWAYAT_INSTITUSI_NAME.Count(); i++)
                {
                    int lastidxxx = MixHelper.GetSequence("MASTER_TAS_RIWAYAT");
                    //var logcodeSS = MixHelper.GetLogCode();
                    //decimal amount = Convert.ToDecimal(Price[i].Replace(",", "")) * Convert.ToDecimal(QtyOpname[i].Replace(",", ""));
                    var fvalueSSS = "'" + lastidxxx + "'," +
                                    "'" + mt.TAS_ID + "'," +
                                    "1," +
                                    "'" + TAS_RIWAYAT_INSTITUSI_NAME[i] + "'," +
                                    "'" + TAS_RIWAYAT_TAHUN[i] + "'," +
                                    "'" + TAS_RIWAYAT_BIDANG_JABATAN[i] + "'," +
                                    "1";
                    db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS_RIWAYAT (" + fnameSSS + ") VALUES (" + fvalueSSS.Replace("''", "NULL") + ")");
                }
            }

            if (TAS_RIWAYAT_JENIS_PELATIHAN.Count() > 0)
            {
                db.Database.ExecuteSqlCommand("DELETE FROM MASTER_TAS_RIWAYAT WHERE TAS_RIWAYAT_TAS_ID = " + mt.TAS_ID + " AND TAS_RIWAYAT_TYPE = 2");
                var fnameSSS = "TAS_RIWAYAT_ID," +
                               "TAS_RIWAYAT_TAS_ID," +
                               "TAS_RIWAYAT_TYPE," +
                               "TAS_RIWAYAT_TAHUN," +
                               "TAS_RIWAYAT_JENIS_PELATIHAN," +
                               "TAS_RIWAYAT_PENYELENGGARA," +
                               "TAS_RIWAYAT_STATUS";

                for (var i = 0; i < TAS_RIWAYAT_JENIS_PELATIHAN.Count(); i++)
                {
                    int lastidxxxx = MixHelper.GetSequence("MASTER_TAS_RIWAYAT");
                    //var logcodeSS = MixHelper.GetLogCode();
                    //decimal amount = Convert.ToDecimal(Price[i].Replace(",", "")) * Convert.ToDecimal(QtyOpname[i].Replace(",", ""));
                    var fvalueSSS = "'" + lastidxxxx + "'," +
                                    "'" + mt.TAS_ID + "'," +
                                    "2," +
                                    "'" + TAS_RIWAYAT_TAHUN_PEL[i] + "'," +
                                    "'" + TAS_RIWAYAT_JENIS_PELATIHAN[i] + "'," +
                                    "'" + TAS_RIWAYAT_PENYELENGGARA[i] + "'," +
                                    "1";
                    db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS_RIWAYAT (" + fnameSSS + ") VALUES (" + fvalueSSS.Replace("''", "NULL") + ")");
                }
            }

            if (TAS_RIWAYAT_PENGALAMAN.Count() > 0)
            {
                db.Database.ExecuteSqlCommand("DELETE FROM MASTER_TAS_RIWAYAT WHERE TAS_RIWAYAT_TAS_ID = " + mt.TAS_ID + " AND TAS_RIWAYAT_TYPE = 3");
                var fnameSSS = "TAS_RIWAYAT_ID," +
                               "TAS_RIWAYAT_TAS_ID," +
                               "TAS_RIWAYAT_TYPE," +
                               "TAS_RIWAYAT_PENGALAMAN," +
                               "TAS_RIWAYAT_STATUS";

                for (var i = 0; i < TAS_RIWAYAT_PENGALAMAN.Count(); i++)
                {
                    int lastidxxxxx = MixHelper.GetSequence("MASTER_TAS_RIWAYAT");
                    //var logcodeSS = MixHelper.GetLogCode();
                    //decimal amount = Convert.ToDecimal(Price[i].Replace(",", "")) * Convert.ToDecimal(QtyOpname[i].Replace(",", ""));
                    var fvalueSSS = "'" + lastidxxxxx + "'," +
                                    "'" + mt.TAS_ID + "'," +
                                    "3," +
                                    "'" + TAS_RIWAYAT_PENGALAMAN[i] + "'," +
                                    "1";
                    db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS_RIWAYAT (" + fnameSSS + ") VALUES (" + fvalueSSS.Replace("''", "NULL") + ")");
                }
            }

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Beispiel #22
0
        public ActionResult Create(TRX_MAINTENANCES mtn, TRX_MAINTENANCE_DETAILS mtd, string MAINTENANCE_KOMTEK2 = "")
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("TRX_MAINTENANCES");
            var datenow = MixHelper.ConvertDateNow();
            var id_sni  = Convert.ToString(mtd.MAINTENANCE_DETAIL_SNI_ID);

            var komtek_id = "";

            if (MAINTENANCE_KOMTEK2 != "-")
            {
                komtek_id = MAINTENANCE_KOMTEK2;
            }
            else if (MAINTENANCE_KOMTEK2 == "-")
            {
                komtek_id = mtn.MAINTENANCE_KOMTEK;
            }



            //return Content(komtek_id);

            string             pathnya    = Server.MapPath("~/Upload/Dokumen/FORM_KAJI_ULANG/");
            HttpPostedFileBase file_paten = Request.Files["MAINTENANCE_DETAIL_KJ_ULG_NAME"];
            var file_name_paten           = "";
            var filePath_paten            = "";
            var fileExtension_paten       = "";

            if (file_paten != null)
            {
                //Check whether Directory (Folder) exists.
                if (!Directory.Exists(pathnya))
                {
                    //If Directory (Folder) does not exists. Create it.
                    Directory.CreateDirectory(pathnya);
                }
                string lampiranregulasipath = file_paten.FileName;
                if (lampiranregulasipath.Trim() != "")
                {
                    lampiranregulasipath = Path.GetFileNameWithoutExtension(file_paten.FileName);
                    fileExtension_paten  = Path.GetExtension(file_paten.FileName);
                    file_name_paten      = "FORM_KAJI_ULANG_PEMELIHARAAN_IDM_" + lastid + fileExtension_paten;
                    filePath_paten       = pathnya + file_name_paten.Replace(" ", "_");
                    file_paten.SaveAs(filePath_paten);
                }
            }



            //if (Convert.ToInt32(form["count_rows"]) > 0)
            //{
            DateTime MAINTENANCE_DATE_a = Convert.ToDateTime(mtn.MAINTENANCE_DATE);
            var      MAINTENANCE_DATE   = "TO_DATE('" + MAINTENANCE_DATE_a.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss')";

            //KOMTEK_BIDANG_ID,KOMTEK_INSTANSI_ID,
            var fname  = "MAINTENANCE_ID,MAINTENANCE_DOC_NUMBER,MAINTENANCE_KOMTEK,MAINTENANCE_CREATE_BY,MAINTENANCE_CREATE_DATE,MAINTENANCE_STATUS";
            var fvalue = "'" + lastid + "', " +
                         "'" + mtn.MAINTENANCE_DOC_NUMBER + "'," +
                         "'" + komtek_id + "', " +
                         "'" + UserId + "'," +
                         datenow + "," +
                         "1";

            //return Json(new { query = "INSERT INTO MASTER_KOMITE_TEKNIS (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("INSERT INTO TRX_MAINTENANCES (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");


            String objek = fvalue.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);

            //for (var a = 0; a < Convert.ToInt32(form["count_rows"]); a++)
            //{
            int lastid_detail = MixHelper.GetSequence("TRX_MAINTENANCE_DETAILS");


            DateTime MAINTENANCE_DETAIL_REV_DATE_ = Convert.ToDateTime(mtd.MAINTENANCE_DETAIL_REV_DATE);
            var      MAINTENANCE_DETAIL_REV_DATE  = "TO_DATE('" + MAINTENANCE_DETAIL_REV_DATE_.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss')";

            DateTime MAINTENANCE_DETAIL_REPORT_DATE_ = Convert.ToDateTime(mtd.MAINTENANCE_DETAIL_REPORT_DATE);
            var      MAINTENANCE_DETAIL_REPORT_DATE  = "TO_DATE('" + MAINTENANCE_DETAIL_REPORT_DATE_.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss')";
            var      fnameS  = "";
            var      fvalueS = "";

            if (mtd.MAINTENANCE_DETAIL_KJ_ULG_NAME != null)
            {
                fnameS  = "MAINTENANCE_DETAIL_ID,MAINTENANCE_DETAIL_MTN_ID,MAINTENANCE_DETAIL_SNI_ID,MAINTENANCE_DETAIL_REV_DATE,MAINTENANCE_DETAIL_RESULT,MAINTENANCE_DETAIL_REPORT_DATE,MAINTENANCE_DETAIL_KJ_ULG_LOC,MAINTENANCE_DETAIL_KJ_ULG_NAME,MAINTENANCE_DETAIL_NO_SURAT";
                fvalueS = "'" + lastid_detail + "', " +
                          "'" + lastid + "', " +
                          "'" + mtd.MAINTENANCE_DETAIL_SNI_ID + "', " +
                          MAINTENANCE_DETAIL_REV_DATE + "," +
                          "'" + mtd.MAINTENANCE_DETAIL_RESULT + "', " +
                          MAINTENANCE_DETAIL_REPORT_DATE + "," +
                          "'/Upload/Dokumen/FORM_KAJI_ULANG/'," +
                          "'" + file_name_paten.Replace(" ", "_") + "'," +
                          "'" + mtd.MAINTENANCE_DETAIL_NO_SURAT + "'";
            }
            else
            {
                fnameS  = "MAINTENANCE_DETAIL_ID,MAINTENANCE_DETAIL_MTN_ID,MAINTENANCE_DETAIL_SNI_ID,MAINTENANCE_DETAIL_REV_DATE,MAINTENANCE_DETAIL_RESULT,MAINTENANCE_DETAIL_REPORT_DATE,MAINTENANCE_DETAIL_NO_SURAT";
                fvalueS = "'" + lastid_detail + "', " +
                          "'" + lastid + "', " +
                          "'" + mtd.MAINTENANCE_DETAIL_SNI_ID + "', " +
                          MAINTENANCE_DETAIL_REV_DATE + "," +
                          "'" + mtd.MAINTENANCE_DETAIL_RESULT + "', " +
                          MAINTENANCE_DETAIL_REPORT_DATE + "," +
                          "'" + mtd.MAINTENANCE_DETAIL_NO_SURAT + "'";
            }

            //return Json(new { query = "INSERT INTO MASTER_KOMITE_TEKNIS (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("INSERT INTO TRX_MAINTENANCE_DETAILS (" + fnameS + ") VALUES (" + fvalueS.Replace("''", "NULL") + ")");

            //update trx_sni
            db.Database.ExecuteSqlCommand("UPDATE TRX_SNI SET SNI_MAINTENANCE_STS = '1' WHERE SNI_ID = " + id_sni);

            //}

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            //}
            //else
            //{
            //    TempData["Notifikasi"] = 2;
            //    TempData["NotifikasiText"] = "Data Gagal Disimpan";
            //}


            return(RedirectToAction("Index"));
        }
Beispiel #23
0
        public ActionResult CreateRatek(HttpPostedFileBase NOTULEN, int PROPOSAL_ID = 0, int PROPOSAL_KOMTEK_ID = 0, int APPROVAL_TYPE = 0, string NO_RATEK = "", string TGL_RATEK = "")
        {
            var USER_ID                  = Convert.ToInt32(Session["USER_ID"]);
            var DATENOW                  = MixHelper.ConvertDateNow();
            var DataProposal             = (from proposal in db.VIEW_PROPOSAL where proposal.PROPOSAL_ID == PROPOSAL_ID select proposal).SingleOrDefault();
            var PROPOSAL_PNPS_CODE_FIXER = DataProposal.PROPOSAL_PNPS_CODE;

            Stream STREAM_NOTULEN = NOTULEN.InputStream;

            byte[] APPDATA_NOTULEN = new byte[NOTULEN.ContentLength + 1];
            STREAM_NOTULEN.Read(APPDATA_NOTULEN, 0, NOTULEN.ContentLength);
            string Extension_NOTULEN = Path.GetExtension(NOTULEN.FileName);

            int APPROVAL_ID   = MixHelper.GetSequence("TRX_PROPOSAL_APPROVAL");
            var VERSION_RATEK = db.Database.SqlQuery <decimal>("SELECT CAST(NVL(MAX(T1.PROPOSAL_RAPAT_VERSION),0) AS NUMBER)+1 AS PROPOSAL_RAPAT_VERSION FROM TRX_PROPOSAL_RAPAT T1 WHERE T1.PROPOSAL_RAPAT_PROPOSAL_ID = " + PROPOSAL_ID + " AND T1.PROPOSAL_RAPAT_PROPOSAL_STATUS = 6").SingleOrDefault();

            if (Extension_NOTULEN.ToLower() == ".docx" || Extension_NOTULEN.ToLower() == ".doc")
            {
                Directory.CreateDirectory(Server.MapPath("~/Upload/Dokumen/RANCANGAN_SNI/RSNI3/" + PROPOSAL_PNPS_CODE_FIXER));
                string path = Server.MapPath("~/Upload/Dokumen/RANCANGAN_SNI/RSNI3/" + PROPOSAL_PNPS_CODE_FIXER + "/");
                Aspose.Words.Document doc = new Aspose.Words.Document(STREAM_NOTULEN);
                string filePathdoc        = path + "NOTULEN_TAS_Ver" + VERSION_RATEK + "_" + PROPOSAL_PNPS_CODE_FIXER + ".docx";
                string filePathpdf        = path + "NOTULEN_TAS_Ver" + VERSION_RATEK + "_" + PROPOSAL_PNPS_CODE_FIXER + ".pdf";
                string filePathxml        = path + "NOTULEN_TAS_Ver" + VERSION_RATEK + "_" + PROPOSAL_PNPS_CODE_FIXER + ".xml";
                doc.Save(@"" + filePathdoc, Aspose.Words.SaveFormat.Docx);
                doc.Save(@"" + filePathpdf, Aspose.Words.SaveFormat.Pdf);
                doc.Save(@"" + filePathxml);


                int LASTID_NOTULEN  = MixHelper.GetSequence("TRX_DOCUMENTS");
                var LOGCODE_NOTULEN = MixHelper.GetLogCode();
                var FNAME_NOTULEN   = "DOC_ID,DOC_FOLDER_ID,DOC_RELATED_TYPE,DOC_RELATED_ID,DOC_NAME,DOC_DESCRIPTION,DOC_FILE_PATH,DOC_FILE_NAME,DOC_FILETYPE,DOC_EDITABLE,DOC_CREATE_BY,DOC_CREATE_DATE,DOC_STATUS,DOC_LOG_CODE";
                var FVALUE_NOTULEN  = "'" + LASTID_NOTULEN + "', " +
                                      "'14', " +
                                      "'10', " +
                                      "'" + PROPOSAL_ID + "', " +
                                      "'" + "(" + PROPOSAL_PNPS_CODE_FIXER + ") Notulen TAS Ver " + VERSION_RATEK + "', " +
                                      "'Notulen Tenaga Ahli Standarisasi Ver " + VERSION_RATEK + " " + PROPOSAL_PNPS_CODE_FIXER + "', " +
                                      "'" + "/Upload/Dokumen/RANCANGAN_SNI/RSNI3/" + PROPOSAL_PNPS_CODE_FIXER + "/" + "', " +
                                      "'" + "NOTULEN_TAS_Ver" + VERSION_RATEK + "_" + PROPOSAL_PNPS_CODE_FIXER + "" + "', " +
                                      "'" + Extension_NOTULEN.ToUpper().Replace(".", "") + "', " +
                                      "'0', " +
                                      "'" + USER_ID + "', " +
                                      DATENOW + "," +
                                      "'1', " +
                                      "'" + LOGCODE_NOTULEN + "'";
                db.Database.ExecuteSqlCommand("INSERT INTO TRX_DOCUMENTS (" + FNAME_NOTULEN + ") VALUES (" + FVALUE_NOTULEN.Replace("''", "NULL") + ")");
                String objekTanggapan = FVALUE_NOTULEN.Replace("'", "-");
                MixHelper.InsertLog(LOGCODE_NOTULEN, objekTanggapan, 1);
            }
            else
            {
                Directory.CreateDirectory(Server.MapPath("~/Upload/Dokumen/RANCANGAN_SNI/RSNI3/" + PROPOSAL_PNPS_CODE_FIXER));
                string path = Server.MapPath("~/Upload/Dokumen/RANCANGAN_SNI/RSNI3/" + PROPOSAL_PNPS_CODE_FIXER + "/");
                NOTULEN.SaveAs(path + "BERITA_ACARA_Ver" + VERSION_RATEK + "_" + PROPOSAL_PNPS_CODE_FIXER + Extension_NOTULEN.ToUpper());

                int LASTID_NOTULEN  = MixHelper.GetSequence("TRX_DOCUMENTS");
                var LOGCODE_NOTULEN = MixHelper.GetLogCode();
                var FNAME_NOTULEN   = "DOC_ID,DOC_FOLDER_ID,DOC_RELATED_TYPE,DOC_RELATED_ID,DOC_NAME,DOC_DESCRIPTION,DOC_FILE_PATH,DOC_FILE_NAME,DOC_FILETYPE,DOC_EDITABLE,DOC_CREATE_BY,DOC_CREATE_DATE,DOC_STATUS,DOC_LOG_CODE";
                var FVALUE_NOTULEN  = "'" + LASTID_NOTULEN + "', " +
                                      "'14', " +
                                      "'10', " +
                                      "'" + PROPOSAL_ID + "', " +
                                      "'" + "(" + PROPOSAL_PNPS_CODE_FIXER + ") Notulen TAS Ver " + VERSION_RATEK + "', " +
                                      "'Notulen Tenaga Ahli Standarisasi Ver " + VERSION_RATEK + " " + PROPOSAL_PNPS_CODE_FIXER + "', " +
                                      "'" + "/Upload/Dokumen/RANCANGAN_SNI/RSNI3/" + PROPOSAL_PNPS_CODE_FIXER + "/" + "', " +
                                      "'" + "NOTULEN_TAS_Ver" + VERSION_RATEK + "_" + PROPOSAL_PNPS_CODE_FIXER + "" + "', " +
                                      "'" + Extension_NOTULEN.ToUpper().Replace(".", "") + "', " +
                                      "'0', " +
                                      "'" + USER_ID + "', " +
                                      DATENOW + "," +
                                      "'1', " +
                                      "'" + LOGCODE_NOTULEN + "'";
                db.Database.ExecuteSqlCommand("INSERT INTO TRX_DOCUMENTS (" + FNAME_NOTULEN + ") VALUES (" + FVALUE_NOTULEN.Replace("''", "NULL") + ")");
                String objekTanggapan = FVALUE_NOTULEN.Replace("'", "-");
                MixHelper.InsertLog(LOGCODE_NOTULEN, objekTanggapan, 1);
            }
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Beispiel #24
0
        public ActionResult JajakPendapat(TRX_POLLING_DETAILS input, VIEW_POLLING VP, string jawaban = "")
        {
            if (Session["Captcha"] == null || Session["Captcha"].ToString() != jawaban)
            {
                var MsgError = "Jawaban Captcha Salah / Kosong";
                TempData["isError"]      = 1;
                TempData["MessageError"] = MsgError;
                return(RedirectToAction("JajakPendapat/" + input.POLLING_DETAIL_POLLING_ID));
            }
            else
            {
                var GetIP        = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 12").FirstOrDefault();
                var GetUser      = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 13").FirstOrDefault();
                var GetPassword  = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 14").FirstOrDefault();
                var GetPath      = db.Database.SqlQuery <SYS_CONFIG>("SELECT * FROM SYS_CONFIG WHERE CONFIG_ID = 15").FirstOrDefault();
                var TGL_SEKARANG = DateTime.Now.ToString("yyyyMMddHHmmss");

                string path        = "";
                string filePathpdf = "";
                var    pathnya     = "";

                HttpPostedFileBase file4 = Request.Files["POLLING_FILE"];
                if (file4.ContentLength > 0)
                {
                    Directory.CreateDirectory(GetPath.CONFIG_VALUE + "/Upload/DokPolling");
                    path = GetPath.CONFIG_VALUE + "/Upload/DokPolling/";
                    Stream stremdokumen = file4.InputStream;
                    byte[] appData      = new byte[file4.ContentLength + 1];
                    stremdokumen.Read(appData, 0, file4.ContentLength);
                    string Extension = Path.GetExtension(file4.FileName);
                    if (Extension.ToLower() == ".pdf")
                    {
                        Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(stremdokumen);
                        //Aspose.Words.Document docx = new Aspose.Words.Document(stremdokumen);
                        filePathpdf = path + "POLLING_" + VP.PROPOSAL_ID + "_" + TGL_SEKARANG + ".pdf";
                        pdf.Save(@"" + filePathpdf, Aspose.Pdf.SaveFormat.Pdf);
                    }
                    pathnya = "/Upload/DokPolling/POLLING_" + VP.PROPOSAL_ID + "_" + TGL_SEKARANG + ".pdf";
                }

                using (OracleConnection con = new OracleConnection("Data Source=" + GetIP.CONFIG_VALUE + ";User ID=" + GetUser.CONFIG_VALUE + ";PASSWORD="******";"))
                {
                    con.Open();

                    using (OracleCommand cmd = new OracleCommand())
                    {
                        var UserId  = Session["USER_ID"];
                        var logcode = MixHelper.GetLogCode();
                        int lastid  = MixHelper.GetSequence("TRX_POLLING_DETAILS");
                        var datenow = MixHelper.ConvertDateNow();

                        var fname = "POLLING_DETAIL_ID,POLLING_DETAIL_POLLING_ID,POLLING_DETAIL_OPTION,POLLING_DETAIL_REASON,POLLING_DETAIL_PASAL,POLLING_DETAIL_CREATE_BY,POLLING_DETAIL_CREATE_DATE,POLLING_DETAIL_STATUS,POLLING_DETAIL_FILE_PATH,POLLING_DETAIL_INPUT_TYPE";

                        var fvalue = "'" + lastid + "', " +
                                     "'" + input.POLLING_DETAIL_POLLING_ID + "', " +
                                     "'" + input.POLLING_DETAIL_OPTION + "', " +
                                     ":parameter , " +
                                     "'" + input.POLLING_DETAIL_PASAL + "', " +
                                     "'" + UserId + "', " +
                                     datenow + ", " +
                                     "1," +
                                     "'" + pathnya + "'," +
                                     "2";
                        cmd.Connection  = con;
                        cmd.CommandType = System.Data.CommandType.Text;

                        //return Json(new { query = "INSERT INTO TRX_POLLING_DETAILS (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
                        cmd.CommandText = "INSERT INTO TRX_POLLING_DETAILS (" + fname + ") VALUES ('" + lastid + "','" + input.POLLING_DETAIL_POLLING_ID + "','" + input.POLLING_DETAIL_OPTION + "',:parameter,'" + input.POLLING_DETAIL_PASAL + "','" + UserId + "'," +
                                          datenow + ",1,'" + pathnya + "',2)";

                        OracleParameter oracleParameterClob = new OracleParameter();
                        oracleParameterClob.OracleDbType = OracleDbType.Clob;
                        //1 million long string
                        oracleParameterClob.Value = input.POLLING_DETAIL_REASON;


                        cmd.Parameters.Add(oracleParameterClob);

                        cmd.ExecuteNonQuery();

                        var polling = (from poll in db.TRX_POLLING where poll.POLLING_ID == input.POLLING_DETAIL_POLLING_ID select poll).SingleOrDefault();

                        //var setuju = polling.POLLING_SETUJU;
                        //var setuju_new = setuju + 1;

                        //var tdk_setuju = polling.POLLING_TDK_SETUJU;
                        //var tdk_setuju_new = tdk_setuju + 1;

                        var jml_partisipan = polling.POLLING_JML_PARTISIPAN + 1;

                        //var persen_setuju_new = setuju_new / jml_partisipan * 100;
                        //var persen_tdk_setuju = tdk_setuju_new / jml_partisipan * 100;

                        var update = "";
                        update = "POLLING_JML_PARTISIPAN = " + jml_partisipan + "'";
                        var where_clause = " WHERE  POLLING_ID =" + input.POLLING_DETAIL_POLLING_ID;
                        db.Database.ExecuteSqlCommand("UPDATE TRX_POLLING SET POLLING_JML_PARTISIPAN = " + jml_partisipan + " WHERE POLLING_ID = " + input.POLLING_DETAIL_POLLING_ID);
                        //String objek = fvalue.Replace("'", "-");
                        //MixHelper.InsertLog(logcode, objek, 1);
                        TempData["Notifikasi"]     = 1;
                        TempData["NotifikasiText"] = "Terima kasih, pendapat anda berhasil di simpan.";
                    }

                    con.Close();
                    return(RedirectToAction("JajakPendapat/" + input.POLLING_DETAIL_POLLING_ID));
                }
            }
        }
        public ActionResult Create(TRX_LPK tl, FormCollection formCollection, int[] LPK_DETAIL_SNI_SNI_ID, int[] LPK_SCOPE_SCOPE_ID)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("TRX_LPK");
            var datenow = MixHelper.ConvertDateNow();

            DateTime date1    = Convert.ToDateTime(tl.LPK_PERIODE_AWAL);
            var      dateawal = "TO_DATE('" + date1.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss')";

            DateTime date2     = Convert.ToDateTime(tl.LPK_PERIODE_AKHIR);
            var      dateakhir = "TO_DATE('" + date2.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss')";

            var fname  = "LPK_ID,LPK_NAMA,LPK_NOMOR,LPK_ALAMAT,LPK_TELEPON,LPK_FAX,LPK_KODE_POS,LPK_EMAIL,LPK_WEBSITE,LPK_CONTACT_PERSON,LPK_PERIODE_AWAL,LPK_PERIODE_AKHIR,LPK_KETERANGAN,LPK_KATEGORI,LPK_JENIS,LPK_CREATE_BY,LPK_CREATE_DATE,LPK_PROVINSI,LPK_KABUPATENKOTA,LPK_LOGCODE,LPK_STATUS";
            var fvalue =
                "'" + lastid + "'," +
                "'" + tl.LPK_NAMA + "'," +
                "'" + tl.LPK_NOMOR + "'," +
                "'" + tl.LPK_ALAMAT + "'," +
                "'" + tl.LPK_TELEPON + "'," +
                "'" + tl.LPK_FAX + "'," +
                "'" + tl.LPK_KODE_POS + "'," +
                "'" + tl.LPK_EMAIL + "'," +
                "'" + tl.LPK_WEBSITE + "'," +
                "'" + tl.LPK_CONTACT_PERSON + "'," +
                dateawal + "," +
                dateakhir + "," +
                "'" + tl.LPK_KETERANGAN + "'," +
                "1," +
                "" + tl.LPK_JENIS + "," +
                "'" + UserId + "'," +
                datenow + "," +
                "'" + tl.LPK_PROVINSI + "'," +
                "'" + tl.LPK_KABUPATENKOTA + "'," +
                "'" + logcode + "'," +
                "1";

            //return Json(new { query = "INSERT INTO TRX_LPK (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("INSERT INTO TRX_LPK (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

            String objek = fvalue.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);

            var idk = db.Database.SqlQuery <int>("SELECT MAX(TL.LPK_ID) FROM TRX_LPK TL").SingleOrDefault();


            if (LPK_DETAIL_SNI_SNI_ID != null)
            {
                foreach (var SNI_ID in LPK_DETAIL_SNI_SNI_ID)
                {
                    var logcodeS   = MixHelper.GetLogCode();
                    int lastid_mki = MixHelper.GetSequence("TRX_LPK_DETAIL_SNI");
                    //string query_update = "INSERT INTO MASTER_KOMTEK_ICS (KOMTEK_ICS_ID, KOMTEK_ICS_KOMTEK_ID, KOMTEK_ICS_ICS_ID, KOMTEK_ICS_CREATE_BY, KOMTEK_ICS_CREATE_DATE, KOMTEK_ICS_STATUS, KOMTEK_ICS_LOG_CODE) VALUES (" + lastid_mki + "," + lastid + "," + vals[n] + "," + UserId + "," + datenow + ",1,'" + logcode + "')";
                    //db.Database.ExecuteSqlCommand(query_update);
                    //return Json(new { query = query_update, id = komtek_ics_id });
                    var fname1  = "LPK_DETAIL_SNI_ID,LPK_DETAIL_SNI_LPK_ID,LPK_DETAIL_SNI_SNI_ID,LPK_DETAIL_SNI_CREATE_BY,LPK_DETAIL_SNI_CREATE_DATE,LPK_DETAIL_SNI_STATUS,LPK_DETAIL_SNI_LOGCODE";
                    var fvalue1 = "'" + lastid_mki + "'," +
                                  "'" + idk + "'," +
                                  "'" + SNI_ID + "'," +
                                  "" + UserId + "," +
                                  datenow + "," +
                                  "1," +
                                  logcodeS;

                    //return Json(new { query = "INSERT INTO TRX_REGULASI_TEKNIS (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
                    db.Database.ExecuteSqlCommand("INSERT INTO TRX_LPK_DETAIL_SNI (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")");

                    String objek1 = fvalue1.Replace("'", "-");
                    MixHelper.InsertLog(logcodeS, objek1, 1);
                }
            }

            if (LPK_SCOPE_SCOPE_ID != null)
            {
                foreach (var SCOPE_ID in LPK_SCOPE_SCOPE_ID)
                {
                    var logcodeS   = MixHelper.GetLogCode();
                    int lastid_mki = MixHelper.GetSequence("TRX_LPK_SCOPE");
                    var fname1     = "LPK_SCOPE_ID,LPK_SCOPE_LPK_ID,LPK_SCOPE_SCOPE_ID,LPK_SCOPE_CREATE_BY,LPK_SCOPE_CREATE_DATE,LPK_SCOPE_STATUS,LPK_SCOPE_LOGCODE";
                    var fvalue1    = "'" + lastid_mki + "'," +
                                     "'" + idk + "'," +
                                     "'" + SCOPE_ID + "'," +
                                     "" + UserId + "," +
                                     datenow + "," +
                                     "1," +
                                     logcodeS;

                    //return Json(new { query = "INSERT INTO TRX_REGULASI_TEKNIS (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
                    db.Database.ExecuteSqlCommand("INSERT INTO TRX_LPK_SCOPE (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")");

                    String objek1 = fvalue1.Replace("'", "-");
                    MixHelper.InsertLog(logcodeS, objek1, 1);
                }
            }


            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";

            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(int id, int[] SNI_STYLE_ID, int[] status, string access_name = "")
        {
            int UserId = Convert.ToInt32(Session["USER_ID"]);

            int    DocAksesId = MixHelper.GetSequence("SYS_DOC_ACCESS");
            string logcode    = MixHelper.GetLogCode();
            var    datenow    = MixHelper.ConvertDateNow();

            if (SNI_STYLE_ID.Count() > 0)
            {
                var update_doc_access = "UPDATE SYS_DOC_ACCESS SET DOC_ACCESS_NAME = '" + access_name + "', DOC_ACCESS_UPDATE_BY = " + UserId + ", DOC_ACCESS_UPDATE_DATE = " + datenow + " WHERE DOC_ACCESS_ID = " + id;
                db.Database.ExecuteSqlCommand(update_doc_access);

                //return Json(new
                //{
                //    sEcho = update_doc_access
                //}, JsonRequestBehavior.AllowGet);

                int no = 0;
                foreach (var a in SNI_STYLE_ID)
                {
                    //var updateted = "UPDATE SYS_DOC_ACCESS_DETAIL SET DOC_ACCESS_DETAIL_STYLE_STATUS = " + status[no] + " WHERE DOC_ACCESS_DETAIL_STYLE_ID = " + SNI_STYLE_ID[no] + " AND DOC_ACCESS_DETAIL_ACCESS_ID = " + id;
                    //db.Database.ExecuteSqlCommand(updateted);

                    var dataDocRole = db.SYS_DOC_ACCESS_DETAIL.SqlQuery("SELECT * FROM SYS_DOC_ACCESS_DETAIL WHERE DOC_ACCESS_DETAIL_ACCESS_ID = " + id + " AND DOC_ACCESS_DETAIL_STYLE_ID = " + SNI_STYLE_ID[no]).FirstOrDefault();
                    if (dataDocRole != null)
                    {
                        var updateted = "UPDATE SYS_DOC_ACCESS_DETAIL SET DOC_ACCESS_DETAIL_STYLE_STATUS = " + status[no] + " WHERE DOC_ACCESS_DETAIL_STYLE_ID = " + SNI_STYLE_ID[no] + " AND DOC_ACCESS_DETAIL_ACCESS_ID = " + id;
                        db.Database.ExecuteSqlCommand(updateted);
                        //string query_update = "UPDATE SYS_ACCESS_DETAIL SET ACCESS_DETAIL_STATUS = 1, ACCESS_DETAIL_UPDATE_DATE = SYSDATE, ACCESS_DETAIL_UPDATE_BY = " + UserId + " where ACCESS_DETAIL_ACCESS_ID = '" + AksesId + "' AND ACCESS_DETAIL_MENU_ID = '" + y + "' AND ACCESS_DETAIL_TYPE = '" + z + "'";
                        //db.Database.ExecuteSqlCommand(query_update);
                    }
                    else
                    {
                        //int lastid = MixHelper.GetSequence("SYS_DOC_ACCESS_DETAIL");
                        //string query_insert = "INSERT INTO SYS_DOC_ACCESS_DETAIL (ACCESS_DETAIL_ID,ACCESS_DETAIL_ACCESS_ID,ACCESS_DETAIL_MENU_ID,ACCESS_DETAIL_TYPE,ACCESS_DETAIL_CREATE_DATE,ACCESS_CREATE_BY,ACCESS_DETAIL_STATUS) values (" + lastid + "," + AksesId + ", " + y + ", " + z + ", SYSDATE, " + UserId + ", 1)";

                        //db.Database.ExecuteSqlCommand(query_insert);
                        int DocAksesDetailId = MixHelper.GetSequence("SYS_DOC_ACCESS_DETAIL");
                        var fname            = "DOC_ACCESS_DETAIL_ID,DOC_ACCESS_DETAIL_ACCESS_ID,DOC_ACCESS_DETAIL_STYLE_ID,DOC_ACCESS_DETAIL_CREATE_BY,DOC_ACCESS_DETAIL_CREATE_DATE,DOC_ACCESS_DETAIL_STYLE_STATUS";
                        var fvalue           = "'" + DocAksesDetailId + "', " +
                                               "'" + id + "', " +
                                               "" + SNI_STYLE_ID[no] + ", " +
                                               "'" + UserId + "', " +
                                               datenow + "," +
                                               "" + status[no] + "";

                        db.Database.ExecuteSqlCommand("INSERT INTO SYS_DOC_ACCESS_DETAIL (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");
                    }

                    no++;
                }



                TempData["Notifikasi"]     = 1;
                TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            }
            else
            {
                TempData["Notifikasi"]     = 2;
                TempData["NotifikasiText"] = "Data Gagal Disimpan";
            }


            return(RedirectToAction("Index"));
        }
Beispiel #27
0
        public ActionResult Detil(TRX_SNI ts, TRX_PROPOSAL tp, int PROPOSAL_ID = 0, string DOC_INFO = "")
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("TRX_DOCUMENTS");
            var datenow = MixHelper.ConvertDateNow();

            var update_sni = "UPDATE TRX_SNI SET SNI_IS_PUBLISH = 1, SNI_NOMOR = '" + ts.SNI_NOMOR + "', SNI_JUDUL = '" + ts.SNI_JUDUL + "', SNI_JUDUL_ENG = '" + ts.SNI_JUDUL_ENG + "' WHERE SNI_ID = " + ts.SNI_ID;

            db.Database.ExecuteSqlCommand(update_sni);

            var update_PROPOSAL = "UPDATE TRX_PROPOSAL SET PROPOSAL_ABSTRAK = '" + tp.PROPOSAL_ABSTRAK + "', PROPOSAL_ABSTRAK_ENG = '" + tp.PROPOSAL_ABSTRAK_ENG + "', PROPOSAL_RUANG_LINGKUP = '" + tp.PROPOSAL_RUANG_LINGKUP + "', PROPOSAL_RUANG_LINGKUP_ENG = '" + tp.PROPOSAL_RUANG_LINGKUP_ENG + "' WHERE PROPOSAL_ID = " + ts.SNI_PROPOSAL_ID;

            db.Database.ExecuteSqlCommand(update_PROPOSAL);

            var updates = "UPDATE TRX_SNI_SK SET IS_PUBLISH = 1 WHERE SNI_SK_ID = " + ts.SNI_SK_ID;

            db.Database.ExecuteSqlCommand(updates);

            var DataProposal             = (from proposal in db.VIEW_PROPOSAL where proposal.PROPOSAL_ID == ts.SNI_PROPOSAL_ID select proposal).SingleOrDefault();
            var PROPOSAL_PNPS_CODE_FIXER = DataProposal.PROPOSAL_PNPS_CODE;


            var TGL_SEKARANG = DateTime.Now.ToString("yyyyMMddHHmmss");


            HttpPostedFileBase file4 = Request.Files["file_sni"];

            if (file4.ContentLength > 0)
            {
                var doc = (from b in db.TRX_DOCUMENTS where b.DOC_ID == ts.SNI_DOC_ID && b.DOC_FOLDER_ID == 8 && b.DOC_RELATED_TYPE == 100 select b).SingleOrDefault();

                int LASTID_DOC = MixHelper.GetSequence("TRX_DOCUMENTS");

                Directory.CreateDirectory(Server.MapPath("~/Upload/Dokumen/SNI"));
                string path = Server.MapPath("~/Upload/Dokumen/SNI/");

                Stream stremdokumen = file4.InputStream;
                byte[] appData      = new byte[file4.ContentLength + 1];
                stremdokumen.Read(appData, 0, file4.ContentLength);
                string Extension = Path.GetExtension(file4.FileName);
                if (Extension.ToLower() == ".doc" || Extension.ToLower() == ".docx")
                {
                    //Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(stremdokumen);
                    Aspose.Words.Document docx = new Aspose.Words.Document(stremdokumen);
                    string filePathdoc         = path + "SNI_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + "(publish).docx";
                    string filePathpdf         = path + "SNI_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + "(publish).pdf";
                    string filePathxml         = path + "SNI_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + "(publish).xml";
                    docx.Save(@"" + filePathdoc, Aspose.Words.SaveFormat.Docx);
                    docx.Save(@"" + filePathpdf, Aspose.Words.SaveFormat.Pdf);
                    docx.Save(@"" + filePathxml);
                    string Total_Hal = "";
                    if (DOC_INFO == "" || DOC_INFO == " ")
                    {
                        Total_Hal = (docx.PageCount).ToString();
                    }
                    else
                    {
                        Total_Hal = DOC_INFO;
                    }

                    ////string filePathpdf = path + "SNI_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + "(publish).pdf";
                    //string filePathxml = path + "SNI_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + "(publish).xml";
                    //pdf.Save(@"" + filePathpdf, Aspose.Pdf.SaveFormat.Pdf);
                    //pdf.Save(@"" + filePathxml);
                    var LOGCODE_TANGGAPAN_MTPS = MixHelper.GetLogCode();
                    var fupdate = "UPDATE TRX_DOCUMENTS SET DOC_FILE_NAME = 'SNI_" + PROPOSAL_PNPS_CODE_FIXER + "_" + TGL_SEKARANG + "(publish)'," +
                                  "DOC_UPDATE_BY = " + UserId + "," +
                                  "DOC_INFO = '" + Total_Hal + "'," +
                                  "DOC_FILETYPE = 'DOCX'," +
                                  "DOC_UPDATE_DATE = " + datenow + "" +
                                  "WHERE DOC_RELATED_ID = " + ts.SNI_PROPOSAL_ID + " AND DOC_FOLDER_ID = 8 AND DOC_RELATED_TYPE = 100";

                    db.Database.ExecuteSqlCommand(fupdate);
                }
            }


            String objek = update_sni.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);

            String objeks = update_PROPOSAL.Replace("'", "-");

            MixHelper.InsertLog(logcode, objeks, 1);

            String objekss = updates.Replace("'", "-");

            MixHelper.InsertLog(logcode, objekss, 1);

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data SNI Berhasil di Publikasikan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Detailusulanpublic(T_MASTER_KOMITE_TEKNIS tmkt)
        {
            VIEW_T_KOMTEK vtk = db.VIEW_T_KOMTEK.SingleOrDefault(t => t.T_KOMTEK_ID == tmkt.T_KOMTEK_ID);

            if (vtk == null)
            {
                return(HttpNotFound());
            }

            string query_update_group = "UPDATE T_MASTER_KOMITE_TEKNIS SET T_KOMTEK_STATUS = 1 WHERE T_KOMTEK_ID = '" + tmkt.T_KOMTEK_ID + "'";

            db.Database.ExecuteSqlCommand(query_update_group);

            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("MASTER_KOMITE_TEKNIS");
            var datenow = MixHelper.ConvertDateNow();
            //int t_komtek_code = (db.Database.SqlQuery<int>("SELECT SUBSTR (MAX(MK.KOMTEK_CODE), 1, 2)+1  AS CODE_AWAL FROM MASTER_KOMITE_TEKNIS MK WHERE MK.KOMTEK_PARENT_CODE = '0'").SingleOrDefault()) + 1;

            DateTime dates  = Convert.ToDateTime(tmkt.T_KOMTEK_TANGGAL_PEMBENTUKAN);
            var      date   = "TO_DATE('" + dates.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss')";
            var      fname  = "KOMTEK_ID,KOMTEK_PARENT_CODE,KOMTEK_CODE,KOMTEK_BIDANG_ID,KOMTEK_INSTANSI_ID,KOMTEK_NAME,KOMTEK_SEKRETARIAT,KOMTEK_ADDRESS,KOMTEK_PHONE,KOMTEK_FAX,KOMTEK_EMAIL,KOMTEK_SK_PENETAPAN,KOMTEK_TANGGAL_PEMBENTUKAN,KOMTEK_DESCRIPTION,KOMTEK_CREATE_BY,KOMTEK_CREATE_DATE,KOMTEK_LOG_CODE,KOMTEK_TEMP_ID,KOMTEK_STATUS";
            var      fvalue = "'" + lastid + "', " +
                              "'" + vtk.T_KOMTEK_PARENT_CODE + "', " +
                              "'" + tmkt.T_KOMTEK_CODE + "', " +
                              "'" + vtk.T_KOMTEK_BIDANG_ID + "', " +
                              "'" + vtk.T_KOMTEK_INSTANSI_ID + "'," +
                              "'" + vtk.T_KOMTEK_NAME + "'," +
                              "'" + vtk.T_KOMTEK_SEKRETARIAT + "'," +
                              "'" + vtk.T_KOMTEK_ADDRESS + "'," +
                              "'" + vtk.T_KOMTEK_PHONE + "'," +
                              "'" + vtk.T_KOMTEK_FAX + "'," +
                              "'" + vtk.T_KOMTEK_EMAIL + "'," +
                              "'" + tmkt.T_KOMTEK_SK_PENETAPAN + "'," +
                              date + "," +
                              "'" + vtk.T_KOMTEK_DESCRIPTION + "'," +
                              "'" + UserId + "'," +
                              datenow + "," +
                              "'" + logcode + "'," +
                              "'" + vtk.T_KOMTEK_ID + "'," +
                              "1";

            //return Json(new { query = "INSERT INTO MASTER_KOMITE_TEKNIS (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("INSERT INTO MASTER_KOMITE_TEKNIS (" + fname + ") VALUES (" + fvalue.Replace("''", "NULL") + ")");

            //var logId = AuditTrails.GetLogId();
            String objek = fvalue.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);

            ViewData["komtek_ics"] = (from t in db.VIEW_T_KOMTEK_ICS where t.T_KOMTEK_ICS_KOMTEK_ID == vtk.T_KOMTEK_ID && t.T_KOMTEK_ICS_STATUS == 1 select t).ToList();

            foreach (var a in ViewBag.komtek_ics)
            {
                int    lastid_mki   = MixHelper.GetSequence("MASTER_KOMTEK_ICS");
                string query_update = "INSERT INTO MASTER_KOMTEK_ICS (KOMTEK_ICS_ID, KOMTEK_ICS_KOMTEK_ID, KOMTEK_ICS_ICS_ID, KOMTEK_ICS_CREATE_BY, KOMTEK_ICS_CREATE_DATE, KOMTEK_ICS_STATUS, KOMTEK_ICS_LOG_CODE) VALUES (" + lastid_mki + "," + lastid + "," + a.T_KOMTEK_ICS_ICS_ID + "," + UserId + "," + datenow + ",1,'" + logcode + "')";
                db.Database.ExecuteSqlCommand(query_update);
            }
            var linkend = "";

            if (vtk.T_KOMTEK_PARENT_CODE == "0")
            {
                linkend = "../Komtek/CreateAnggota";
            }
            else
            {
                linkend = "../Subkomtek/CreateAnggota";
            }

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil di setujui";
            return(RedirectToAction(linkend + "/" + lastid));
        }
Beispiel #29
0
        public ActionResult Create(MASTER_TAS mt, int[] ICS_ID, string[] TAS_EDUCATION_INSTITUSI, string[] TAS_EDUCATION_YEAR, string[] TAS_EDUCATION_PRODI, string[] TAS_RIWAYAT_INSTITUSI_NAME, string[] TAS_RIWAYAT_TAHUN, string[] TAS_RIWAYAT_BIDANG_JABATAN, string[] TAS_RIWAYAT_JENIS_PELATIHAN, string[] TAS_RIWAYAT_TAHUN_PEL, string[] TAS_RIWAYAT_PENYELENGGARA, string[] TAS_RIWAYAT_PENGALAMAN)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            //int lastid = MixHelper.GetSequence("TRX_SNI");
            int last_id = MixHelper.GetSequence("MASTER_TAS");
            var datenow = MixHelper.ConvertDateNow();

            var fname = "TAS_ID,TAS_NAME,TAS_INSTANSI_ID,TAS_ADDRESS,TAS_PHONE,TAS_FAX,TAS_OFFICE_ADDRESS,TAS_OFFICE_PHONE,TAS_HANDPHONE,TAS_EMAIL,TAS_CREATE_BY,TAS_CREATE_DATE,TAS_STATUS,TAS_LOG_CODE";
            var value = "'" + last_id + "', " +
                        "'" + mt.TAS_NAME + "'," +
                        "'" + mt.TAS_INSTANSI_ID + "'," +
                        "'" + mt.TAS_ADDRESS + "'," +
                        "'" + mt.TAS_PHONE + "'," +
                        "'" + mt.TAS_FAX + "'," +
                        "'" + mt.TAS_OFFICE_ADDRESS + "'," +
                        "'" + mt.TAS_OFFICE_PHONE + "'," +
                        "'" + mt.TAS_HANDPHONE + "'," +
                        "'" + mt.TAS_EMAIL + "'," +
                        "'" + UserId + "'," +
                        "" + datenow + "," +
                        "1," +
                        "" + logcode + "";

            db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS (" + fname + ") VALUES (" + value.Replace("''", "NULL") + ")");

            if (ICS_ID != null)
            {
                foreach (var TAS_ICS_ID in ICS_ID)
                {
                    var    logcodeS     = MixHelper.GetLogCode();
                    int    lastid_mTDI  = MixHelper.GetSequence("MASTER_TAS_DETAIL_ICS");
                    string query_create = "INSERT INTO MASTER_TAS_DETAIL_ICS (TAS_DETAIL_ICS_ID,TAS_DETAIL_ICS_TAS_ID,TAS_DETAIL_ICS_ICS_ID,TAS_DETAIL_ICS_STATUS) VALUES (" + lastid_mTDI + "," + last_id + "," + TAS_ICS_ID + ",1)";
                    db.Database.ExecuteSqlCommand(query_create);
                }
            }

            if (TAS_EDUCATION_INSTITUSI.Count() > 0)
            {
                var fnameSS = "TAS_EDUCATION_ID," +
                              "TAS_EDUCATION_TAS_ID," +
                              "TAS_EDUCATION_INSTITUSI," +
                              "TAS_EDUCATION_YEAR," +
                              "TAS_EDUCATION_PRODI," +
                              "TAS_EDUCATION_STATUS";

                for (var i = 0; i < TAS_EDUCATION_INSTITUSI.Count(); i++)
                {
                    int lastidxx = MixHelper.GetSequence("MASTER_TAS_EDUCATION");
                    //var logcodeSS = MixHelper.GetLogCode();
                    //decimal amount = Convert.ToDecimal(Price[i].Replace(",", "")) * Convert.ToDecimal(QtyOpname[i].Replace(",", ""));
                    var fvalueSS = "'" + lastidxx + "'," +
                                   "'" + last_id + "'," +
                                   "'" + TAS_EDUCATION_INSTITUSI[i] + "'," +
                                   "'" + TAS_EDUCATION_YEAR[i] + "'," +
                                   "'" + TAS_EDUCATION_PRODI[i] + "'," +
                                   "1";

                    db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS_EDUCATION (" + fnameSS + ") VALUES (" + fvalueSS.Replace("''", "NULL") + ")");
                }
            }

            if (TAS_RIWAYAT_INSTITUSI_NAME.Count() > 0)
            {
                var fnameSSS = "TAS_RIWAYAT_ID," +
                               "TAS_RIWAYAT_TAS_ID," +
                               "TAS_RIWAYAT_TYPE," +
                               "TAS_RIWAYAT_INSTITUSI_NAME," +
                               "TAS_RIWAYAT_TAHUN," +
                               "TAS_RIWAYAT_BIDANG_JABATAN," +
                               "TAS_RIWAYAT_STATUS";

                for (var i = 0; i < TAS_RIWAYAT_INSTITUSI_NAME.Count(); i++)
                {
                    int lastidxxx = MixHelper.GetSequence("MASTER_TAS_RIWAYAT");
                    //var logcodeSS = MixHelper.GetLogCode();
                    //decimal amount = Convert.ToDecimal(Price[i].Replace(",", "")) * Convert.ToDecimal(QtyOpname[i].Replace(",", ""));
                    var fvalueSSS = "'" + lastidxxx + "'," +
                                    "'" + last_id + "'," +
                                    "1," +
                                    "'" + TAS_RIWAYAT_INSTITUSI_NAME[i] + "'," +
                                    "'" + TAS_RIWAYAT_TAHUN[i] + "'," +
                                    "'" + TAS_RIWAYAT_BIDANG_JABATAN[i] + "'," +
                                    "1";
                    db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS_RIWAYAT (" + fnameSSS + ") VALUES (" + fvalueSSS.Replace("''", "NULL") + ")");
                }
            }

            if (TAS_RIWAYAT_JENIS_PELATIHAN.Count() > 0)
            {
                var fnameSSS = "TAS_RIWAYAT_ID," +
                               "TAS_RIWAYAT_TAS_ID," +
                               "TAS_RIWAYAT_TYPE," +
                               "TAS_RIWAYAT_TAHUN," +
                               "TAS_RIWAYAT_JENIS_PELATIHAN," +
                               "TAS_RIWAYAT_PENYELENGGARA," +
                               "TAS_RIWAYAT_STATUS";

                for (var i = 0; i < TAS_RIWAYAT_JENIS_PELATIHAN.Count(); i++)
                {
                    int lastidxxxx = MixHelper.GetSequence("MASTER_TAS_RIWAYAT");
                    //var logcodeSS = MixHelper.GetLogCode();
                    //decimal amount = Convert.ToDecimal(Price[i].Replace(",", "")) * Convert.ToDecimal(QtyOpname[i].Replace(",", ""));
                    var fvalueSSS = "'" + lastidxxxx + "'," +
                                    "'" + last_id + "'," +
                                    "2," +
                                    "'" + TAS_RIWAYAT_TAHUN_PEL[i] + "'," +
                                    "'" + TAS_RIWAYAT_JENIS_PELATIHAN[i] + "'," +
                                    "'" + TAS_RIWAYAT_PENYELENGGARA[i] + "'," +
                                    "1";
                    db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS_RIWAYAT (" + fnameSSS + ") VALUES (" + fvalueSSS.Replace("''", "NULL") + ")");
                }
            }

            if (TAS_RIWAYAT_PENGALAMAN.Count() > 0)
            {
                var fnameSSS = "TAS_RIWAYAT_ID," +
                               "TAS_RIWAYAT_TAS_ID," +
                               "TAS_RIWAYAT_TYPE," +
                               "TAS_RIWAYAT_PENGALAMAN," +
                               "TAS_RIWAYAT_STATUS";

                for (var i = 0; i < TAS_RIWAYAT_PENGALAMAN.Count(); i++)
                {
                    int lastidxxxxx = MixHelper.GetSequence("MASTER_TAS_RIWAYAT");
                    //var logcodeSS = MixHelper.GetLogCode();
                    //decimal amount = Convert.ToDecimal(Price[i].Replace(",", "")) * Convert.ToDecimal(QtyOpname[i].Replace(",", ""));
                    var fvalueSSS = "'" + lastidxxxxx + "'," +
                                    "'" + last_id + "'," +
                                    "3," +
                                    "'" + TAS_RIWAYAT_PENGALAMAN[i] + "'," +
                                    "1";
                    db.Database.ExecuteSqlCommand("INSERT INTO MASTER_TAS_RIWAYAT (" + fnameSSS + ") VALUES (" + fvalueSSS.Replace("''", "NULL") + ")");
                }
            }

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(TRX_LPK tl, FormCollection formCollection, int[] LPK_DETAIL_SNI_SNI_ID, int[] LPK_SCOPE_SCOPE_ID)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("MASTER_BIDANG");
            var datenow = MixHelper.ConvertDateNow();

            DateTime date1    = Convert.ToDateTime(tl.LPK_PERIODE_AWAL);
            var      dateawal = "TO_DATE('" + date1.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss')";

            DateTime date2     = Convert.ToDateTime(tl.LPK_PERIODE_AKHIR);
            var      dateakhir = "TO_DATE('" + date2.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss')";
            var      update    =
                "LPK_NAMA = '" + tl.LPK_NAMA + "'," +
                "LPK_NOMOR = '" + tl.LPK_NOMOR + "'," +
                "LPK_KATEGORI = 1," +
                "LPK_JENIS = " + tl.LPK_JENIS + "," +
                "LPK_ALAMAT = '" + tl.LPK_ALAMAT + "'," +
                "LPK_TELEPON = '" + tl.LPK_TELEPON + "'," +
                "LPK_FAX= '" + tl.LPK_FAX + "'," +
                "LPK_KODE_POS = '" + tl.LPK_KODE_POS + "'," +
                "LPK_WEBSITE = '" + tl.LPK_WEBSITE + "'," +
                "LPK_PROVINSI = '" + tl.LPK_PROVINSI + "'," +
                "LPK_KABUPATENKOTA = '" + tl.LPK_KABUPATENKOTA + "'," +
                "LPK_EMAIL = '" + tl.LPK_EMAIL + "'," +
                "LPK_CONTACT_PERSON = '" + tl.LPK_CONTACT_PERSON + "'," +
                "LPK_PERIODE_AWAL = " + dateawal + "," +
                "LPK_PERIODE_AKHIR = " + dateakhir + "," +
                "LPK_KETERANGAN = '" + tl.LPK_KETERANGAN + "'," +
                "LPK_UPDATE_BY = '" + UserId + "'," +
                "LPK_UPDATE_DATE = " + datenow + "";


            var clause = "where LPK_ID = " + tl.LPK_ID;

            //return Json(new { query = "UPDATE TRX_LPK SET " + update.Replace("''", "NULL") + " " + clause }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("UPDATE TRX_LPK SET " + update.Replace("''", "NULL") + " " + clause);

            var idk = db.Database.SqlQuery <int>("SELECT MAX(TL.LPK_ID) FROM TRX_LPK TL").SingleOrDefault();

            if (LPK_DETAIL_SNI_SNI_ID != null)
            {
                string query_update = "UPDATE TRX_LPK_DETAIL_SNI  SET LPK_DETAIL_SNI_STATUS = 0, LPK_DETAIL_SNI_UPDATE_BY =" + UserId + ", LPK_DETAIL_SNI_UPDATE_DATE=" + datenow + " WHERE LPK_DETAIL_SNI_LPK_ID = " + tl.LPK_ID;
                db.Database.ExecuteSqlCommand(query_update);
                foreach (var SNI_ID in LPK_DETAIL_SNI_SNI_ID)
                {
                    int cek = db.Database.SqlQuery <int>("SELECT COUNT(1) AS JML FROM TRX_LPK_DETAIL_SNI WHERE LPK_DETAIL_SNI_LPK_ID = '" + tl.LPK_ID + "' AND LPK_DETAIL_SNI_SNI_ID = '" + SNI_ID + "'").SingleOrDefault();
                    if (cek == 0)
                    {
                        var logcodeS   = MixHelper.GetLogCode();
                        int lastid_mki = MixHelper.GetSequence("TRX_LPK_DETAIL_SNI");

                        var fname1  = "LPK_DETAIL_SNI_ID,LPK_DETAIL_SNI_LPK_ID,LPK_DETAIL_SNI_SNI_ID,LPK_DETAIL_SNI_CREATE_BY,LPK_DETAIL_SNI_CREATE_DATE,LPK_DETAIL_SNI_STATUS,LPK_DETAIL_SNI_LOGCODE";
                        var fvalue1 = "'" + lastid_mki + "'," +
                                      "'" + tl.LPK_ID + "'," +
                                      "'" + SNI_ID + "'," +
                                      "" + UserId + "," +
                                      datenow + "," +
                                      "1," +
                                      logcodeS;

                        db.Database.ExecuteSqlCommand("INSERT INTO TRX_LPK_DETAIL_SNI (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")");

                        String objek1 = fvalue1.Replace("'", "-");
                        MixHelper.InsertLog(logcodeS, objek1, 1);
                    }
                    else
                    {
                        string query_updatea = "UPDATE TRX_LPK_DETAIL_SNI  SET LPK_DETAIL_SNI_STATUS = 1, LPK_DETAIL_SNI_UPDATE_BY =" + UserId + ", LPK_DETAIL_SNI_UPDATE_DATE=" + datenow + " WHERE LPK_DETAIL_SNI_LPK_ID = " + tl.LPK_ID + " AND LPK_DETAIL_SNI_SNI_ID = '" + SNI_ID + "'";
                        //return Json(new { data = query_updatea }, JsonRequestBehavior.AllowGet);
                        db.Database.ExecuteSqlCommand(query_updatea);
                    }
                }
            }

            if (LPK_SCOPE_SCOPE_ID != null)
            {
                string query_update = "UPDATE TRX_LPK_SCOPE  SET LPK_SCOPE_STATUS = 0, LPK_SCOPE_UPDATE_BY =" + UserId + ", LPK_SCOPE_UPDATE_DATE=" + datenow + " WHERE LPK_SCOPE_LPK_ID = " + tl.LPK_ID;
                db.Database.ExecuteSqlCommand(query_update);
                foreach (var SCOPE_ID in LPK_SCOPE_SCOPE_ID)
                {
                    int cek = db.Database.SqlQuery <int>("SELECT COUNT(1) AS JML FROM TRX_LPK_SCOPE WHERE LPK_SCOPE_LPK_ID = '" + tl.LPK_ID + "' AND LPK_SCOPE_SCOPE_ID = '" + SCOPE_ID + "'").SingleOrDefault();
                    if (cek == 0)
                    {
                        var logcodeS   = MixHelper.GetLogCode();
                        int lastid_mki = MixHelper.GetSequence("TRX_LPK_SCOPE");
                        var fname1     = "LPK_SCOPE_ID,LPK_SCOPE_LPK_ID,LPK_SCOPE_SCOPE_ID,LPK_SCOPE_CREATE_BY,LPK_SCOPE_CREATE_DATE,LPK_SCOPE_STATUS,LPK_SCOPE_LOGCODE";
                        var fvalue1    = "'" + lastid_mki + "'," +
                                         "'" + tl.LPK_ID + "'," +
                                         "'" + SCOPE_ID + "'," +
                                         "" + UserId + "," +
                                         datenow + "," +
                                         "1," +
                                         logcodeS;

                        //return Json(new { query = "INSERT INTO TRX_REGULASI_TEKNIS (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")" }, JsonRequestBehavior.AllowGet);
                        db.Database.ExecuteSqlCommand("INSERT INTO TRX_LPK_SCOPE (" + fname1 + ") VALUES (" + fvalue1.Replace("''", "NULL") + ")");

                        String objek1 = fvalue1.Replace("'", "-");
                        MixHelper.InsertLog(logcodeS, objek1, 1);
                    }
                    else
                    {
                        string query_updatea = "UPDATE TRX_LPK_SCOPE  SET LPK_SCOPE_STATUS = 1, LPK_SCOPE_UPDATE_BY =" + UserId + ", LPK_SCOPE_UPDATE_DATE=" + datenow + " WHERE LPK_SCOPE_LPK_ID = " + tl.LPK_ID + " AND LPK_SCOPE_SCOPE_ID = '" + SCOPE_ID + "'";
                        //return Json(new { data = query_updatea }, JsonRequestBehavior.AllowGet);
                        db.Database.ExecuteSqlCommand(query_updatea);
                    }
                }
            }



            //var logId = AuditTrails.GetLogId();
            String objek = update.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }