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"));
        }
Exemplo n.º 2
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"));
        }
        public ActionResult Index(PORTAL_PROFILE pp)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            var datenow = MixHelper.ConvertDateNow();
            var idk     = db.Database.SqlQuery <int>("SELECT MAX(MK.PROFILE_ID) FROM PORTAL_PROFILE MK").SingleOrDefault();

            var update =
                "PROFILE_TENTANG_KAMI = '" + pp.PROFILE_TENTANG_KAMI + "'," +
                "PROFILE_KONTAK_KAMI = '" + pp.PROFILE_KONTAK_KAMI + "'," +
                "PROFILE_UPDATE_DATE = " + datenow + "," +
                "PROFILE_UPDATE_BY = '" + UserId + "'";

            var clause = "where PROFILE_ID = " + idk;

            //return Json(new { query = "UPDATE PORTAL_PROFILE SET " + update.Replace("''", "NULL") + " " + clause }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("UPDATE PORTAL_PROFILE 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"));
        }
        public ActionResult Edit(MASTER_SCOPE dt_form)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            var datenow = MixHelper.ConvertDateNow();
            var status  = "1";

            var update =
                " SCOPE_CODE = '" + dt_form.SCOPE_CODE + "'," +
                " SCOPE_NAME = '" + dt_form.SCOPE_NAME + "'," +
                " SCOPE_UPDATE_BY = '" + UserId + "'," +
                " SCOPE_UPDATE_DATE = " + datenow + "," +
                " SCOPE_STATUS = '" + status + "'";

            var clause = "where SCOPE_ID = " + dt_form.SCOPE_ID;

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

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

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
        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"));
        }
        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"));
            }
        }
Exemplo n.º 9
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"));
        }
        public ActionResult Edit(SYS_CONFIG config)
        {
            var UserId  = Session["USER_ID"];
            var datenow = MixHelper.ConvertDateNow();
            var logcode = config.CONFIG_LOG_CODE;
            var fupdate = "CONFIG_NAME = '" + config.CONFIG_NAME + "'," +
                          "CONFIG_VALUE = '" + config.CONFIG_VALUE + "'," +
                          "CONFIG_UPDATE_BY = '" + UserId + "'," +
                          "CONFIG_UPDATE_DATE = " + datenow;

            db.Database.ExecuteSqlCommand("UPDATE SYS_CONFIG SET " + fupdate + " WHERE CONFIG_ID = " + config.CONFIG_ID);

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

            MixHelper.InsertLog(logcode, objek, 1);

            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Exemplo n.º 12
0
        public ActionResult Edit(MASTER_ICS ics)
        {
            var UserId  = Session["USER_ID"];
            var logcode = ics.ICS_LOG_CODE;
            var datenow = MixHelper.ConvertDateNow();
            var fupdate = "ICS_PARENT_CODE = '" + ics.ICS_PARENT_CODE + "'," +
                          "ICS_CODE = '" + ics.ICS_CODE + "'," +
                          "ICS_NAME = '" + ics.ICS_NAME + "'," +
                          "ICS_NAME_IND = '" + ics.ICS_NAME_IND + "'," +
                          //"ICS_YEAR = '" + ics.ICS_YEAR + "'," +
                          "ICS_UPDATE_BY = '" + UserId + "'," +
                          "ICS_UPDATE_DATE = " + datenow;

            db.Database.ExecuteSqlCommand("UPDATE MASTER_ICS SET " + fupdate + " WHERE ICS_ID = '" + ics.ICS_ID + "'");

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

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
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"));
        }
Exemplo n.º 14
0
        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"));
        }
Exemplo n.º 15
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 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("MASTER_KOMITE_TEKNIS");
            var datenow    = MixHelper.ConvertDateNow();
            int lastid_doc = MixHelper.GetSequence("TRX_DOCUMENTS");

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

            if (file_att != null)
            {
                string lampiranregulasipath = file_att.FileName;
                if (lampiranregulasipath.Trim() != "")
                {
                    lampiranregulasipath = Path.GetFileNameWithoutExtension(file_att.FileName);
                    fileExtension        = Path.GetExtension(file_att.FileName);
                    file_name_att        = "LPK_" + tl.LPK_NOMOR.Replace(' ', '-') + "_" + lastid + fileExtension;
                    filePath             = path + file_name_att;
                    file_att.SaveAs(filePath);
                }
            }

            //var logcodeDOC = MixHelper.GetLogCode();
            //var FNAME_DOC = "DOC_ID,DOC_FOLDER_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_DOC = "'" + lastid_doc + "', " +
            //            "'4', " +
            //            "'" + "" + trt..RETEK_NO_SK.ToUpper() + "', " +
            //            "'Regulasi Teknis dengan Nomor " + trt.RETEK_NO_SK.ToUpper() + "', " +
            //            "'" + "/Upload/Dokumen/SK_REGULASI/', " +
            //            "'" + "RegulasiTeknis_" + trt.RETEK_NO_SK.Replace('/', '-') + "_" + lastid + "', " +
            //            "'" + fileExtension.Remove('.').ToUpper() + "', " +
            //            "'0', " +
            //            "'" + UserId + "', " +
            //            datenow + "," +
            //            "'1', " +
            //            "'" + logcodeDOC + "'";
            //db.Database.ExecuteSqlCommand("INSERT INTO TRX_DOCUMENTS (" + FNAME_DOC + ") VALUES (" + FVALUE_DOC.Replace("''", "NULL") + ")");
            //String objekDOC = FVALUE_DOC.Replace("'", "-");
            //MixHelper.InsertLog(logcodeDOC, objekDOC, 1);

            var pathss = "/Upload/Dokumen/LAINNYA/LPK/";

            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_JENIS,LPK_NAMA,LPK_NOMOR,LPK_ALAMAT,LPK_LAMPIRAN,LPK_TELEPON,LPK_FAX,LPK_KODE_POS,LPK_EMAIL,LPK_WEBSITE,LPK_CONTACT_PERSON,LPK_PERIODE_AKHIR,LPK_KETERANGAN,LPK_KATEGORI,LPK_CREATE_BY,LPK_CREATE_DATE,LPK_PROVINSI,LPK_KABUPATENKOTA,LPK_LOGCODE,LPK_STATUS";
            var fvalue =
                "'" + lastid + "'," +
                "" + tl.LPK_JENIS + "," +
                "'" + tl.LPK_NAMA + "'," +
                "'" + tl.LPK_NOMOR + "'," +
                "'" + tl.LPK_ALAMAT + "'," +
                "'" + pathss + "" + file_name_att + "'," +
                "'" + tl.LPK_TELEPON + "'," +
                "'" + tl.LPK_FAX + "'," +
                "'" + tl.LPK_KODE_POS + "'," +
                "'" + tl.LPK_EMAIL + "'," +
                "'" + tl.LPK_WEBSITE + "'," +
                "'" + tl.LPK_CONTACT_PERSON + "'," +
                "" + dateakhir + "," +
                "'" + tl.LPK_KETERANGAN + "'," +
                "2," +
                "'" + 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");
                    //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_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(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();
            var      update    = "";
            var      pathss    = "/Upload/Dokumen/LAINNYA/LPK/";
            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')";

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

            string lampiranregulasipath = file_att.FileName;

            if (lampiranregulasipath.Trim() != "")
            {
                lampiranregulasipath = Path.GetFileNameWithoutExtension(file_att.FileName);
                fileExtension        = Path.GetExtension(file_att.FileName);
                file_name_att        = "LPK_" + tl.LPK_NOMOR.Replace(' ', '-') + "_" + lastid + fileExtension;
                filePath             = path + file_name_att;
                file_att.SaveAs(filePath);

                update =
                    "LPK_NAMA = '" + tl.LPK_NAMA + "'," +
                    "LPK_JENIS = " + tl.LPK_JENIS + "," +
                    "LPK_NOMOR = '" + tl.LPK_NOMOR + "'," +
                    "LPK_ALAMAT = '" + tl.LPK_ALAMAT + "'," +
                    "LPK_LAMPIRAN = '" + pathss + "" + file_name_att + "'," +
                    "LPK_TELEPON = '" + tl.LPK_TELEPON + "'," +
                    "LPK_EMAIL = '" + tl.LPK_EMAIL + "'," +
                    "LPK_WEBSITE = '" + tl.LPK_WEBSITE + "'," +
                    "LPK_CONTACT_PERSON = '" + tl.LPK_CONTACT_PERSON + "'," +
                    "LPK_PERIODE_AKHIR = " + dateakhir + "," +
                    "LPK_KETERANGAN = '" + tl.LPK_KETERANGAN + "'," +
                    "LPK_UPDATE_BY = '" + UserId + "'," +
                    "LPK_UPDATE_DATE = " + datenow + "";
            }
            else
            {
                update =
                    "LPK_NAMA = '" + tl.LPK_NAMA + "'," +
                    "LPK_JENIS = " + tl.LPK_JENIS + "," +
                    "LPK_NOMOR = '" + tl.LPK_NOMOR + "'," +
                    "LPK_ALAMAT = '" + tl.LPK_ALAMAT + "'," +
                    "LPK_TELEPON = '" + tl.LPK_TELEPON + "'," +
                    "LPK_EMAIL = '" + tl.LPK_EMAIL + "'," +
                    "LPK_WEBSITE = '" + tl.LPK_WEBSITE + "'," +
                    "LPK_CONTACT_PERSON = '" + tl.LPK_CONTACT_PERSON + "'," +
                    "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"));
        }
Exemplo n.º 18
0
        public ActionResult Upload(PORTAL_SLIDER ps, FormCollection fc)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            int lastid  = MixHelper.GetSequence("PORTAL_SLIDER");
            var datenow = MixHelper.ConvertDateNow();

            string             path     = Server.MapPath("~/Upload/IMAGE_SLIDER/GAMBAR_BESAR/");
            HttpPostedFileBase file_att = Request.Files["ImageBesar"];
            var file_name_att           = "";
            var filePath      = "";
            var fileExtension = "";

            if (file_att != null)
            {
                //// Create a bitmap of the content of the fileUpload control in memory
                //Bitmap originalBMP = new Bitmap(fc.);

                //// Calculate the new image dimensions
                //int origWidth = originalBMP.Width;
                //int origHeight = originalBMP.Height;
                //int sngRatio = origWidth / origHeight;
                //int newWidth = 100;
                //int newHeight = newWidth / sngRatio;

                string IMAGE_BESAR_PATH = file_att.FileName;
                if (IMAGE_BESAR_PATH.Trim() != "")
                {
                    IMAGE_BESAR_PATH = Path.GetFileNameWithoutExtension(file_att.FileName);
                    fileExtension    = Path.GetExtension(file_att.FileName);
                    file_name_att    = "Image_Besar_" + lastid + fileExtension;
                    filePath         = path + file_name_att;
                    //WebImage image = new WebImage(file_att.InputStream);
                    //int width = 500;
                    //int height = (int)Math.Round(((width * 1.0) / image.Width) * image.Height);
                    //image.Resize(width, height, false, true);
                    //img.Resize(500, 256);
                    file_att.SaveAs(filePath);
                }
            }

            string             path_     = Server.MapPath("~/Upload/IMAGE_SLIDER/GAMBAR_KECIL/");
            HttpPostedFileBase file_att_ = Request.Files["ImageKecil"];
            var file_name_att_           = "";
            var filePath_      = "";
            var fileExtension_ = "";

            if (file_att_ != null)
            {
                string IMAGE_KECIL_PATH = file_att_.FileName;
                if (IMAGE_KECIL_PATH.Trim() != "")
                {
                    IMAGE_KECIL_PATH = Path.GetFileNameWithoutExtension(file_att_.FileName);
                    fileExtension_   = Path.GetExtension(file_att_.FileName);
                    file_name_att_   = "Image_Kecil_" + lastid + fileExtension;
                    filePath_        = path_ + file_name_att_;
                    //WebImage image = new WebImage(file_att.InputStream);
                    //int width = 420;
                    //int height = 404;
                    //image.Resize(width, height, false, false);
                    //img.Resize(420, 404);
                    file_att_.SaveAs(filePath_);

                    //ResizeSettings resizeCropSettings = new ResizeSettings("width=420&height=404&format=jpeg&crop=auto");
                    //string fileName = Path.Combine(path_, System.Guid.NewGuid().ToString());
                    //fileName = ImageBuilder.Current.Build(filePath_, file_name_att_, resizeCropSettings, false, true);
                }
            }
            var link_      = "http://localhost:4878/Upload/IMAGE_SLIDER/GAMBAR_KECIL/";
            var links      = "http://localhost:4878/Upload/IMAGE_SLIDER/GAMBAR_BESAR/";
            var link       = "http://localhost:4878/";
            var PATST      = "Upload/IMAGE_SLIDER/GAMBAR_BESAR/";
            var PATSTS     = "Upload/IMAGE_SLIDER/GAMBAR_KECIL/";
            var logcodeDOC = MixHelper.GetLogCode();
            var FNAME_DOC  = "SLIDER_ID,SLIDER_JUDUL,SLIDER_IMAGE_BIG_PATH,SLIDER_IMAGE_SMALL_PATH,SLIDER_IMAGE_LINK,SLIDER_IMAGE_BIG_LINK,SLIDER_IMAGE_SMALL_LINK,SLIDER_IMAGE_IS_USE,SLIDER_STATUS";
            var FVALUE_DOC = "'" + lastid + "', " +
                             "'" + ps.SLIDER_JUDUL + "', " +
                             "'" + PATST + file_name_att + "', " +
                             "'" + PATSTS + file_name_att_ + "', " +
                             "'" + link + "', " +
                             "'" + links + file_name_att + "', " +
                             "'" + link_ + file_name_att_ + "', " +
                             "1, " +
                             "1";

            db.Database.ExecuteSqlCommand("INSERT INTO PORTAL_SLIDER (" + FNAME_DOC + ") VALUES (" + FVALUE_DOC.Replace("''", "NULL") + ")");
            String objekDOC = FVALUE_DOC.Replace("'", "-");

            MixHelper.InsertLog(logcodeDOC, objekDOC, 1);


            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(TRX_REGULASI_TEKNIS trt, FormCollection formCollection)
        {
            var UserId        = Session["USER_ID"];
            var logcode       = MixHelper.GetLogCode();
            int lastid        = MixHelper.GetSequence("TRX_REGULASI_TEKNIS");
            int lastid_detail = MixHelper.GetSequence("TRX_REGULASI_TEKNIS_DETAIL");
            int lastid_doc    = MixHelper.GetSequence("TRX_DOCUMENTS");
            var datenow       = MixHelper.ConvertDateNow();

            string             path     = Server.MapPath("~/Upload/Dokumen/SK_REGULASI/");
            HttpPostedFileBase file_att = Request.Files["file_regtek"];
            var file_name_att           = "";
            var filePath      = "";
            var fileExtension = "";

            if (file_att != null)
            {
                string lampiranregulasipath = file_att.FileName;
                if (lampiranregulasipath.Trim() != "")
                {
                    lampiranregulasipath = Path.GetFileNameWithoutExtension(file_att.FileName);
                    fileExtension        = Path.GetExtension(file_att.FileName);
                    file_name_att        = "RegulasiTeknis_" + trt.RETEK_NO_SK.Replace('/', '-') + "_" + lastid + fileExtension;
                    filePath             = path + file_name_att;
                    file_att.SaveAs(filePath);
                }
            }

            var logcodeDOC = MixHelper.GetLogCode();
            var FNAME_DOC  = "DOC_ID,DOC_FOLDER_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_DOC = lastid_doc + ", " +
                             "'4', " +
                             "'" + trt.RETEK_NO_SK.ToUpper() + "', " +
                             "'Regulasi Teknis dengan Nomor " + trt.RETEK_NO_SK.ToUpper() + "', " +
                             "'" + "/Upload/Dokumen/SK_REGULASI/', " +
                             "'" + "RegulasiTeknis_" + trt.RETEK_NO_SK.Replace('/', '-') + "_" + lastid + "', " +
                             "'" + fileExtension.Replace(".", "").ToUpper() + "', " +
                             "'0', " +
                             "'" + UserId + "', " +
                             datenow + "," +
                             "'1', " +
                             "'" + logcodeDOC + "'";

            db.Database.ExecuteSqlCommand("INSERT INTO TRX_DOCUMENTS (" + FNAME_DOC + ") VALUES (" + FVALUE_DOC.Replace("''", "NULL") + ")");
            String objekDOC = FVALUE_DOC.Replace("'", "-");

            MixHelper.InsertLog(logcodeDOC, objekDOC, 1);

            var fname  = "RETEK_ID,RETEK_NO_SK,RETEK_TENTANG,RETEK_REGULATOR,RETEK_KETERANGAN,RETEK_FILE,RETEK_CREATE_BY,RETEK_CREATE_DATE,RETEK_STATUS";
            var fvalue = "'" + lastid + "'," +
                         "'" + trt.RETEK_NO_SK + "'," +
                         "'" + trt.RETEK_TENTANG + "'," +
                         "'" + trt.RETEK_REGULATOR + "'," +
                         "'" + trt.RETEK_KETERANGAN + "'," +
                         "" + lastid_doc + "," +
                         "" + UserId + "," +
                         datenow + "," +
                         "1";

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

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

            MixHelper.InsertLog(logcode, objek, 1);

            var idk = db.Database.SqlQuery <int>("SELECT MAX(MK.RETEK_ID) FROM TRX_REGULASI_TEKNIS MK").SingleOrDefault();

            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");
                    //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 + "'," +
                                  "'" + idk + "'," +
                                  "'" + 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"));
        }
Exemplo n.º 20
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"));
        }
        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"));
        }
Exemplo n.º 22
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"));
        }
        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");
        }
        public ActionResult Edit(PORTAL_NEWS news)
        {
            var UserId  = Session["USER_ID"];
            var logcode = MixHelper.GetLogCode();
            var datenow = MixHelper.ConvertDateNow();
            var status  = "1";
            var link    = "http://localhost:4878/Upload/Dokumen/LAINNYA/news/";

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

            string lampirananggotapath = file_att.FileName;

            if (lampirananggotapath.Trim() != "")
            {
                lampirananggotapath = Path.GetFileNameWithoutExtension(file_att.FileName);
                string fileExtension = Path.GetExtension(file_att.FileName);
                file_name_att = "IMAGE_NEWS_" + news.NEWS_ID + fileExtension;
                filePath      = path + file_name_att;
                file_att.SaveAs(filePath);

                update =
                    " NEWS_TITLE = '" + news.NEWS_TITLE + "'," +
                    " NEWS_CONTENTS = '" + news.NEWS_CONTENTS + "'," +
                    " NEWS_SUMBER = '" + news.NEWS_SUMBER + "'," +
                    " NEWS_BRIEF_NEWS = '" + news.NEWS_BRIEF_NEWS + "'," +
                    " NEWS_TAG = '" + news.NEWS_TAG + "'," +
                    " NEWS_PATH_IMAGE = '" + location + file_name_att + "'," +
                    " NEWS_LINK_IMAGE = '" + link + file_name_att + "'," +
                    " NEWS_UPDATE_BY = '" + UserId + "'," +
                    " NEWS_UPDATE_DATE = " + datenow + "," +
                    " NEWS_LOG_CODE = '" + logcode + "', " +
                    " NEWS_STATUS = '" + status + "'";
            }

            else
            {
                update =
                    " NEWS_TITLE = '" + news.NEWS_TITLE + "'," +
                    " NEWS_CONTENTS = '" + news.NEWS_CONTENTS + "'," +
                    " NEWS_SUMBER = '" + news.NEWS_SUMBER + "'," +
                    " NEWS_BRIEF_NEWS = '" + news.NEWS_BRIEF_NEWS + "'," +
                    " NEWS_TAG = '" + news.NEWS_TAG + "'," +
                    " NEWS_UPDATE_BY = '" + UserId + "'," +
                    " NEWS_UPDATE_DATE = " + datenow + "," +
                    " NEWS_LOG_CODE = '" + logcode + "', " +
                    " NEWS_STATUS = '" + status + "'";
            }
            var clause = "where NEWS_ID = " + news.NEWS_ID;

            //return Json(new { query = "UPDATE PORTAL_NEWS SET " + update.Replace("''", "NULL") + " " + clause }, JsonRequestBehavior.AllowGet);
            db.Database.ExecuteSqlCommand("UPDATE PORTAL_NEWS 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"));
        }
        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"));
        }
        public ActionResult Edit(TRX_REGULASI_TEKNIS trt, FormCollection formCollection)
        {
            var UserId     = Session["USER_ID"];
            var logcode    = MixHelper.GetLogCode();
            int lastid     = MixHelper.GetSequence("TRX_REGULASI_TEKNIS");
            var datenow    = MixHelper.ConvertDateNow();
            int lastid_doc = MixHelper.GetSequence("TRX_DOCUMENTS");
            var status     = "1";
            var update     = "";

            string             path     = Server.MapPath("~/Upload/Dokumen/SK_REGULASI/");
            HttpPostedFileBase file_att = Request.Files["file_regtek"];
            var file_name_att           = "";
            var filePath      = "";
            var fileExtension = "";

            string lampiranregulasipath = file_att.FileName;

            if (lampiranregulasipath.Trim() != "")
            {
                lampiranregulasipath = Path.GetFileNameWithoutExtension(file_att.FileName);
                fileExtension        = Path.GetExtension(file_att.FileName);
                file_name_att        = "RegulasiTeknis_" + trt.RETEK_NO_SK.Replace('/', '-') + "_" + lastid + fileExtension;
                filePath             = path + file_name_att;
                file_att.SaveAs(filePath);


                var logcodeDOC1 = MixHelper.GetLogCode();
                var id          = trt.RETEK_ID;
                var qupdate     = "UPDATE TRX_DOCUMENTS SET DOC_STATUS = 0 WHERE DOC_ID = " + id;
                db.Database.ExecuteSqlCommand(qupdate);
                String objekDOC1 = qupdate.Replace("'", "-");
                MixHelper.InsertLog(logcodeDOC1, objekDOC1, 1);

                var logcodeDOC = MixHelper.GetLogCode();
                var FNAME_DOC  = "DOC_ID,DOC_FOLDER_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_DOC = lastid_doc + ", " +
                                 "'4', " +
                                 "'" + trt.RETEK_NO_SK.ToUpper() + "', " +
                                 "'Regulasi Teknis dengan Nomor " + trt.RETEK_NO_SK.ToUpper() + "', " +
                                 "'" + "/Upload/Dokumen/SK_REGULASI/', " +
                                 "'" + "RegulasiTeknis_" + trt.RETEK_NO_SK.Replace('/', '-') + "_" + lastid + "', " +
                                 "'" + fileExtension.Replace(".", "").ToUpper() + "', " +
                                 "'0', " +
                                 "'" + UserId + "', " +
                                 datenow + "," +
                                 "'1', " +
                                 "'" + logcodeDOC + "'";
                db.Database.ExecuteSqlCommand("INSERT INTO TRX_DOCUMENTS (" + FNAME_DOC + ") VALUES (" + FVALUE_DOC.Replace("''", "NULL") + ")");
                String objekDOC = FVALUE_DOC.Replace("'", "-");
                MixHelper.InsertLog(logcodeDOC, objekDOC, 1);

                update =
                    "RETEK_NO_SK = '" + trt.RETEK_NO_SK + "'," +
                    "RETEK_TENTANG = '" + trt.RETEK_TENTANG + "'," +
                    "RETEK_REGULATOR = '" + trt.RETEK_REGULATOR + "'," +
                    "RETEK_KETERANGAN = '" + trt.RETEK_KETERANGAN + "'," +
                    "RETEK_FILE = '" + trt.RETEK_FILE + "'," +
                    "RETEK_UPDATE_BY = " + UserId + "," +
                    "RETEK_UPDATE_DATE = " + datenow + "," +
                    "RETEK_STATUS = '" + status + "'";
            }
            else
            {
                update =
                    "RETEK_NO_SK = '" + trt.RETEK_NO_SK + "'," +
                    "RETEK_TENTANG = '" + trt.RETEK_TENTANG + "'," +
                    "RETEK_REGULATOR = '" + trt.RETEK_REGULATOR + "'," +
                    "RETEK_KETERANGAN = '" + trt.RETEK_KETERANGAN + "'," +
                    "RETEK_UPDATE_BY = " + UserId + "," +
                    "RETEK_UPDATE_DATE = " + datenow + "," +
                    "RETEK_STATUS = '" + status + "'";
            }



            var clause = "where RETEK_ID = " + trt.RETEK_ID;

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

            var idk = db.Database.SqlQuery <int>("SELECT MAX(MK.RETEK_ID) FROM TRX_REGULASI_TEKNIS MK").SingleOrDefault();

            var sni_id = formCollection["RETEK_DETAIL_SNI_ID"];

            if (sni_id != null)
            {   //int n = 0;
                var sni_list = (from t in db.VIEW_REGTEK_DETAIL where t.RETEK_DETAIL_ID == trt.RETEK_ID select t).ToList();

                string[] vals         = sni_id.Split(',');
                string   query_update = "UPDATE TRX_REGULASI_TEKNIS_DETAIL  SET RETEK_DETAIL_STATUS = 0, RETEK_DETAIL_UPDATE_BY =" + UserId + ", RETEK_DETAIL_UPDATE_DATE=" + datenow + " WHERE RETEK_DETAIL_RETEK_ID = " + trt.RETEK_ID;
                db.Database.ExecuteSqlCommand(query_update);

                for (int n = 0; n < vals.Length; n++)
                {
                    //int lastid_mki = MixHelper.GetSequence("TRX_REGULASI_TEKNIS_DETAIL");

                    int cek = db.Database.SqlQuery <int>("SELECT COUNT(1) AS JML FROM TRX_REGULASI_TEKNIS_DETAIL WHERE RETEK_DETAIL_RETEK_ID = '" + trt.RETEK_ID + "' AND RETEK_DETAIL_SNI_ID = '" + vals[n] + "'").SingleOrDefault();
                    if (cek == 0)
                    {
                        int    lastid_mki   = MixHelper.GetSequence("TRX_REGULASI_TEKNIS_DETAIL");
                        string query_insert = "INSERT INTO TRX_REGULASI_TEKNIS_DETAIL (RETEK_DETAIL_ID,RETEK_DETAIL_RETEK_ID,RETEK_DETAIL_SNI_ID,RETEK_DETAIL_UPDATE_BY,RETEK_DETAIL_UPDATE_DATE,RETEK_DETAIL_STATUS) VALUES (" + lastid_mki + "," + trt.RETEK_ID + "," + vals[n] + "," + UserId + "," + datenow + ",1)";
                        db.Database.ExecuteSqlCommand(query_insert);
                    }
                    else
                    {
                        string query_updatea = "UPDATE TRX_REGULASI_TEKNIS_DETAIL  SET RETEK_DETAIL_STATUS = 1, RETEK_DETAIL_UPDATE_BY =" + UserId + ", RETEK_DETAIL_UPDATE_DATE=" + datenow + " WHERE RETEK_DETAIL_RETEK_ID = " + trt.RETEK_ID + " AND RETEK_DETAIL_SNI_ID = '" + vals[n] + "'";
                        //return Json(new { data = query_updatea }, JsonRequestBehavior.AllowGet);
                        db.Database.ExecuteSqlCommand(query_updatea);
                    }
                }
            }
            else
            {
                string query_updates = "UPDATE TRX_REGULASI_TEKNIS_DETAIL  SET RETEK_DETAIL_STATUS = 0, RETEK_DETAIL_UPDATE_BY =" + UserId + ", RETEK_DETAIL_UPDATE_DATE=" + datenow + " WHERE RETEK_DETAIL_RETEK_ID = " + trt.RETEK_ID;
                db.Database.ExecuteSqlCommand(query_updates);
            }
            //var logId = AuditTrails.GetLogId();
            String objek = update.Replace("'", "-");

            MixHelper.InsertLog(logcode, objek, 1);
            TempData["Notifikasi"]     = 1;
            TempData["NotifikasiText"] = "Data Berhasil Disimpan";
            return(RedirectToAction("Index"));
        }
Exemplo n.º 27
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"));
        }
        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));
        }