protected void Page_Load(object sender, EventArgs e) { //SessionCreator(); if (Session["username"] == null && Session["password"] == null) { Response.Redirect("SignIn.aspx"); } if (Session["username"].ToString() != "admin") { Response.Redirect("SignIn.aspx"); } if (!IsPostBack) { SetFilterValue(); if (Request.QueryString["conf"] != null) { if (Request.QueryString["conf"] == "1") { CatalogFRVN.GenerateDataPresensiWgCs(); Session["info"] = "C1"; Response.Redirect("Certificate.aspx"); } else if (Request.QueryString["conf"] == "2") { CatalogFRVN.ResetDoorprizePeserta(); VendorGatheringData.GenerateDataPresensi(); Session["info"] = "C2"; Response.Redirect("Certificate.aspx"); } } if (Request.QueryString["act"] != null) { if (Request.QueryString["act"] == "1") { string recordID = Cryptography.Blowfish.DecryptCBC(Request.QueryString["recid"]); CatalogFRVN.DelimitPesertaFRVNByRecid(recordID, "admin"); Session["info"] = "A1"; Response.Redirect("Certificate.aspx"); } else if (Request.QueryString["act"] == "3") { string regCode = Cryptography.Blowfish.DecryptCBC(Request.QueryString["regcd"]); DataTable data = VendorGatheringData.GetPresensiPeserta(regCode); string _namaPerusahaan = data.Rows[0]["NamaPerusahaan"].ToString(); string _alamat = data.Rows[0]["Alamat"].ToString(); string _email = data.Rows[0]["Email"].ToString(); try { //Delete last certificate FileManager.DeleteFile(Server.MapPath("../Gallery/Certificate/" + regCode + ".PNG")); //Create new certificate CreateCertificate(CreateName(_namaPerusahaan, _alamat), regCode); if (!VendorGatheringData.IsDownloadedSKT(Filtering.FilterValidSqlQuery(regCode))) { VendorGatheringData.InsertDownloadedSKT(regCode, "admin"); } FRLNBus.Notification.Email.SendEmailAsAttachedCertificate(_email, _namaPerusahaan, Server.MapPath("../Gallery/Certificate/" + regCode + ".PNG")); Session["info"] = "A6"; } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal({title: 'Terjadi kegagalan pengiriman email!', type: 'warning'});", true); } Response.Redirect("Certificate.aspx"); } } } if (Session["info"] != null) { if (Session["info"].ToString() == "C2") { ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal({title: 'Update peserta ke sistem presensi berhasil!', type: 'success'});", true); } else if (Session["info"].ToString() == "A1") { ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal({title: 'Peserta berhasil dihapus dari sistem', type: 'warning'});", true); } else if (Session["info"].ToString() == "A3") { ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal({title: 'Update data peserta berhasil!', type: 'success'});", true); } else if (Session["info"].ToString() == "A6") { ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal({title: 'Pengiriman email notifikasi unduh sertifikat berhasil!', type: 'success'});", true); } else if (Session["info"].ToString() == "A7") { ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal({title: 'Terjadi kegagalan pengiriman email!', type: 'warning'});", true); } Session["info"] = null; } }