Exemplo n.º 1
0
        public static DataSet GetDataPeserta()
        {
            DataSet   data  = new DataSet();
            DataTable table = CatalogFRVN.GetVerifiedPeserta(); //CatalogFRVN.GetPeserta();

            data.Tables.Add("peserta");
            data.Tables["peserta"].Columns.Add("PERNO", typeof(string));
            data.Tables["peserta"].Columns.Add("BEGDA", typeof(string));
            data.Tables["peserta"].Columns.Add("PERNM", typeof(string));
            data.Tables["peserta"].Columns.Add("GENDR", typeof(string));
            data.Tables["peserta"].Columns.Add("INSNM", typeof(string));
            data.Tables["peserta"].Columns.Add("JOBCD", typeof(string));
            data.Tables["peserta"].Columns.Add("JOBNM", typeof(string));
            data.Tables["peserta"].Columns.Add("ADDRS", typeof(string));
            data.Tables["peserta"].Columns.Add("CITY", typeof(string));
            data.Tables["peserta"].Columns.Add("TLFAX", typeof(string));
            data.Tables["peserta"].Columns.Add("HPMAI", typeof(string));
            data.Tables["peserta"].Columns.Add("PARTY", typeof(string));
            data.Tables["peserta"].Columns.Add("WORKG", typeof(string));
            data.Tables["peserta"].Columns.Add("NPWP", typeof(string));
            data.Tables["peserta"].Columns.Add("VISIT", typeof(string));
            data.Tables["peserta"].Columns.Add("STAY", typeof(string));

            for (int i = 0; i < table.Rows.Count; i++)
            {
                data.Tables["peserta"].Rows.Add(new object[] { (i + 1), table.Rows[i]["BEGDA"], GetNameInvited(table.Rows[i]["PERNM"].ToString(), table.Rows[i]["DELFR"].ToString()), table.Rows[i]["JENIS"].ToString(), table.Rows[i]["INSNM"], table.Rows[i]["PRMNM"], table.Rows[i]["JOBNM"], table.Rows[i]["INADD"], table.Rows[i]["KOTNM"], table.Rows[i]["TELNO"] + " / " + table.Rows[i]["FAXNO"], table.Rows[i]["PHONE"] + " / " + table.Rows[i]["EMAIL"], GetParticipantType(table.Rows[i]["PARTY"].ToString()), table.Rows[i]["WORKG"], table.Rows[i]["NPWP"], (table.Rows[i]["ARRCD"].ToString() == "0" ? string.Empty : table.Rows[i]["ARRVL"]), table.Rows[i]["STAY"] });
            }

            data.Tables.Add("footer");
            data.Tables["footer"].Columns.Add("PRINT", typeof(string));
            data.Tables["footer"].Rows.Add(new object[] { "Di-print pada " + DateTimeConverter.GetDateFormat(DateTime.Now.ToString("MM/dd/yyyy")) + " pukul " + DateTime.Now.ToString("HH:mm") });

            return(data);
        }
Exemplo n.º 2
0
        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("Peserta.aspx");
                    }
                    else if (Request.QueryString["conf"] == "2")
                    {
                        CatalogFRVN.ResetDoorprizePeserta();
                        VendorGatheringData.GenerateDataPresensi();
                        Session["info"] = "C2";
                        Response.Redirect("Peserta.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("Peserta.aspx");
                    }
                    else if (Request.QueryString["act"] == "3")
                    {
                        string kodeRegistrasi = Cryptography.Blowfish.DecryptCBC(Request.QueryString["regcd"]);

                        DataTable peserta      = VendorGatheringData.GetPeserta(kodeRegistrasi);
                        DataTable perusahaan   = VendorGatheringData.GetPerusahaan(peserta.Rows[0]["KodePerusahaan"].ToString());
                        string    jenisKelamin = peserta.Rows[0]["JenisKelamin"].ToString() == "1" ? "Laki-laki" : "Perempuan";


                        //Deleting old ticket
                        FileManager.DeleteFile(Server.MapPath("../Gallery/Ticket/" + kodeRegistrasi + ".PNG"));

                        CreateImageFileWithBarcode(CreateTicketDesignWithBarcode(kodeRegistrasi, peserta.Rows[0]["NamaPeserta"].ToString(), perusahaan.Rows[0]["NamaPerusahaan"].ToString(), string.Empty, string.Empty), kodeRegistrasi, kodeRegistrasi);

                        //sending new ticket same code
                        try
                        {
                            string _namaPeserta2 = peserta.Rows[0]["NamaPeserta2"].ToString();
                            string _email2       = peserta.Rows[0]["Email2"].ToString();
                            string _namaJabatan2 = peserta.Rows[0]["NamaJabatan2"].ToString();
                            string _phone2       = peserta.Rows[0]["Phone2"].ToString();

                            FRLNBus.Notification.Email.SendRegistrationNotification(peserta.Rows[0]["Email"].ToString(), kodeRegistrasi, peserta.Rows[0]["NamaPeserta"].ToString(),
                                                                                    jenisKelamin, peserta.Rows[0]["NamaJabatan"].ToString(), peserta.Rows[0]["Email"].ToString(), peserta.Rows[0]["Phone"].ToString(),
                                                                                    peserta.Rows[0]["Catatan"].ToString(), perusahaan.Rows[0]["NamaPerusahaan"].ToString(), perusahaan.Rows[0]["Email"].ToString(),
                                                                                    perusahaan.Rows[0]["Alamat"].ToString(), perusahaan.Rows[0]["NamaKota"].ToString(), perusahaan.Rows[0]["KodePos"].ToString(),
                                                                                    perusahaan.Rows[0]["Telpon"].ToString(), perusahaan.Rows[0]["Fax"].ToString(), _namaPeserta2, _email2, _namaJabatan2,
                                                                                    _phone2, Server.MapPath("../Gallery/Ticket/" + kodeRegistrasi + ".PNG"));
                        }
                        catch (Exception ex)
                        {
                            ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal({title: 'Terjadi kegagalan pengiriman email!', type: 'warning'});", true);
                        }

                        Session["info"] = "A6";
                        Response.Redirect("Peserta.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 berhasil!', type: 'success'});", true);
                }
                else
                {
                }

                Session["info"] = null;
            }
        }
        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;
            }
        }