Esempio n. 1
0
        protected void UpdateDataIntoDatabase(string _kodeRegistrasi)
        {
            string _jenisKelamin = rbtLaki.Checked ? rbtLaki.Attributes["Value"] : rbtPerempuan.Attributes["Value"];

            VendorGatheringData.UpdatePerusahaan(ddlPerusahaan.SelectedValue, txtAlamat.Text, ddlKota.SelectedValue, ddlKota.SelectedItem.Text, txtKodePos.Text, txtEmailPerusahaan.Text, txtTelp.Text, txtFax.Text, _kodeRegistrasi);
            VendorGatheringData.UpdatePeserta(_kodeRegistrasi, ddlPerusahaan.SelectedValue, txtNamaPeserta.Text,
                                              _jenisKelamin, txtNamaJabatan.Text, txtEmail.Text, txtMobile.Text, string.Empty, txtNamaPeserta2.Text,
                                              txtNamaJabatan2.Text, txtEmail2.Text, txtMobile2.Text, txtNotes.Text, _kodeRegistrasi);
        }
        protected String GenerateData()
        {
            StringBuilder _tableelement = new StringBuilder();

            DataTable table = VendorGatheringData.GetPresensiPeserta(string.Empty);
            bool      isAny = true;

            var rows = table.Select("Atten = 'True'");

            if (rows.Any())
            {
                table = rows.CopyToDataTable();
            }
            else
            {
                isAny = false;
            }

            if (Session["groupFilter"] != null)
            {
                if (Session["groupFilter"].ToString() != "9")
                {
                    rows = table.Select("StatsSKT = " + Session["groupFilter"].ToString());

                    if (rows.Any())
                    {
                        table = rows.CopyToDataTable();
                    }
                    else
                    {
                        isAny = false;
                    }
                }
            }

            if (isAny)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    _tableelement.Append("<tr class=''>");
                    _tableelement.Append("<td>" + GetStatus(table.Rows[i]["StatsSKT"].ToString()) + "</td>");
                    _tableelement.Append("<td>" + table.Rows[i]["KodeRegistrasi"].ToString() + "</td>");
                    _tableelement.Append("<td>" + table.Rows[i]["NamaPeserta"].ToString() + "</td>");
                    _tableelement.Append("<td>" + table.Rows[i]["NamaJabatan"].ToString() + "</td>");
                    _tableelement.Append("<td>" + table.Rows[i]["EmailPeserta"].ToString() + "</td>");
                    _tableelement.Append("<td>" + table.Rows[i]["Phone"].ToString() + "</td>");
                    _tableelement.Append("<td>" + table.Rows[i]["NamaPerusahaan"].ToString() + "</td>");
                    _tableelement.Append("<td>" + table.Rows[i]["Email"].ToString() + "</td>");
                    _tableelement.Append("<td>" + table.Rows[i]["NamaKota"].ToString() + "</td>");
                    _tableelement.Append("<td width='15%' align='center'>" + GetAction(table.Rows[i]["KodeRegistrasi"].ToString(), table.Rows[i]["StatsSKT"].ToString()) + "</td>");
                    _tableelement.Append("</tr>");
                }
            }

            return(_tableelement.ToString());
        }
Esempio n. 3
0
        protected void SetPerusahaan()
        {
            ddlPerusahaan.Items.Clear();
            DataTable data = VendorGatheringData.GetPerusahaan(string.Empty);

            for (int i = 0; i < data.Rows.Count; i++)
            {
                ddlPerusahaan.Items.Add(new ListItem(data.Rows[i]["NamaPerusahaan"].ToString(), data.Rows[i]["KodePerusahaan"].ToString()));
            }
        }
Esempio n. 4
0
        protected string GenerateCode()
        {
            string regCode = Code.CreateVerificationCode(6);

            while (Convert.ToInt16(VendorGatheringData.IsRegistrationCodeExist(regCode).Rows[0]["COUNT"]) > 0)
            {
                regCode = Code.CreateAlternateVerificationCode(6, 128);
            }

            Session["regCode"] = regCode;

            return(regCode);
        }
Esempio n. 5
0
        protected void SetDataToForm(string kodeRegistrasi)
        {
            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";

            if (peserta.Rows.Count > 0)
            {
                ddlPerusahaan.SelectedValue = perusahaan.Rows[0]["KodePerusahaan"].ToString();
                txtEmailPerusahaan.Text     = perusahaan.Rows[0]["Email"].ToString();
                txtAlamat.Text        = perusahaan.Rows[0]["Alamat"].ToString();
                ddlKota.SelectedValue = perusahaan.Rows[0]["KodeKota"].ToString();
                txtTelp.Text          = perusahaan.Rows[0]["Telpon"].ToString();
                txtFax.Text           = perusahaan.Rows[0]["Fax"].ToString();
                txtKodePos.Text       = perusahaan.Rows[0]["KodePos"].ToString();
                txtStatusSKT.Text     = perusahaan.Rows[0]["TypeSKT"].ToString() == "1" ? "Wajib" : "Tidak Wajib";

                txtNamaPeserta.Text = peserta.Rows[0]["NamaPeserta"].ToString();
                txtNamaJabatan.Text = peserta.Rows[0]["NamaJabatan"].ToString();
                txtEmail.Text       = peserta.Rows[0]["Email"].ToString();
                txtMobile.Text      = peserta.Rows[0]["Phone"].ToString();

                txtNamaPeserta2.Text = peserta.Rows[0]["NamaPeserta2"].ToString();
                txtNamaJabatan2.Text = peserta.Rows[0]["NamaJabatan2"].ToString();
                txtEmail2.Text       = peserta.Rows[0]["Email2"].ToString();
                txtMobile2.Text      = peserta.Rows[0]["Phone2"].ToString();

                txtNotes.Text = peserta.Rows[0]["Catatan"].ToString();

                if (peserta.Rows[0]["JenisKelamin"].ToString() == "1")
                {
                    rbtLaki.Checked = true;
                }
                else
                {
                    rbtPerempuan.Checked = true;
                }
            }
        }
        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;
            }
        }