示例#1
0
        private async void button2_Click(object sender, EventArgs e)
        {
            dt2.Rows.Clear();
            int              i        = 0;
            IFirebaseClient  client   = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetTaskAsync("Counter");

            counter ctn = response.ResultAs <counter>();

            while (true)
            {
                i++;
                if (i > ctn.M)
                {
                    break;
                }

                FirebaseResponse responseNilai = await client.GetTaskAsync("Penilaian/" + i);

                Penilaian obj = responseNilai.ResultAs <Penilaian>();
                DataRow   dr  = dt2.NewRow();
                dr["Nama"] = obj.nama;
                dr["NIP"]  = obj.nip;
                dr["Dokumen Portofolio"]       = obj.C5;
                dr["Kinerja Guru"]             = obj.C2;
                dr["Presentasi Best Practice"] = obj.C3;
                dr["Wawancara"]  = obj.C4;
                dr["Test Tulis"] = obj.C1;
                dt2.Rows.Add(dr);
            }
        }
示例#2
0
        //Refresh Button
        private async void button3_Click(object sender, EventArgs e)
        {
            dt.Rows.Clear();
            int              i        = 0;
            IFirebaseClient  client   = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetTaskAsync("Counter/");

            counter ctn = response.ResultAs <counter>();

            while (true)
            {
                i++;
                if (i > ctn.M)
                {
                    break;
                }
                FirebaseResponse responAkun = await client.GetTaskAsync("User_Account/" + i);

                Data    data = responAkun.ResultAs <Data>();
                DataRow dr   = dt.NewRow();
                dr["Nama Depan"]       = data.namaDepan;
                dr["Nama Belakang"]    = data.namaBelakang;
                dr["NIP"]              = data.nip;
                dr["Tempat TglLahir"]  = data.tglLahir;
                dr["Pangkat/Golongan"] = data.pangkatGol;
                dr["Sekolah Mengajar"] = data.sekolah;
                dr["Mata Pelajaran"]   = data.mapel;
                dr["Username"]         = data.username;
                dr["Password"]         = data.pwd;
                dt.Rows.Add(dr);
            }
        }
示例#3
0
        private async void UserControl1_Load(object sender, EventArgs e)
        {
            label1.Text = "";
            int              z       = 0;
            int              b       = 0;
            IFirebaseClient  client  = new FireSharp.FirebaseClient(config);
            FirebaseResponse resAkun = await client.GetTaskAsync("Counter");

            counter ctn = resAkun.ResultAs <counter>();

            while (true)
            {
                z++;
                if (z > ctn.M)
                {
                    break;
                }
                FirebaseResponse response = await client.GetTaskAsync("User_Account/" + z);

                Data obj = response.ResultAs <Data>();
                if (Menu.username == obj.username)
                {
                    label1.Text = obj.nip;
                    label3.Text = obj.namaDepan + " " + obj.namaBelakang;
                    label4.Text = obj.mapel;
                    label5.Text = obj.sekolah;
                }
            }
        }
示例#4
0
        private async void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "admin" && textBox2.Text == "admin")
            {
                var admin = new Admin();
                this.Hide();
                admin.Show();
            }
            else
            {
                int i = 0;
                int b = 0;
                circularProgressBar1.Minimum = 0;
                label4.Visible = true;
                FirebaseResponse responsecounter = await client.GetTaskAsync("Counter");

                counter ctn = responsecounter.ResultAs <counter>();
                circularProgressBar1.Maximum = ctn.M;
                while (true)
                {
                    circularProgressBar1.Value = i;
                    i++;

                    if (i > ctn.M)
                    {
                        label4.Visible = false;
                        circularProgressBar1.Visible = false;
                        break;
                    }
                    FirebaseResponse response = await client.GetTaskAsync("User_Account/" + i);

                    Data obj = response.ResultAs <Data>();
                    if (textBox1.Text == obj.username && textBox2.Text == obj.pwd)
                    {
                        b = 1;
                    }
                }

                if (b == 1)
                {
                    var data = new Data();
                    data.username = textBox1.Text;
                    Menu1 mn = new Menu1(data);
                    this.Hide();
                    mn.Show();
                }
                else
                {
                    MessageBox.Show("Harap Periksa Username dan Password", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
示例#5
0
        private async void user_Load(object sender, EventArgs e)
        {
            int              i        = 0;
            IFirebaseClient  client   = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetTaskAsync("Counter/");

            counter ctn = response.ResultAs <counter>();

            dt.Columns.Add("Nama Depan");
            dt.Columns.Add("Nama Belakang");
            dt.Columns.Add("NIP");
            dt.Columns.Add("Tempat TglLahir");
            dt.Columns.Add("Pangkat/Golongan");
            dt.Columns.Add("Sekolah Mengajar");
            dt.Columns.Add("Mata Pelajaran");
            dt.Columns.Add("Username");
            dt.Columns.Add("Password");
            dataGridView1.DataSource = dt;
            dataGridView1.Columns["Nama Depan"].Width       = 90;
            dataGridView1.Columns["Nama Belakang"].Width    = 90;
            dataGridView1.Columns["NIP"].Width              = 150;
            dataGridView1.Columns["Tempat TglLahir"].Width  = 150;
            dataGridView1.Columns["Pangkat/Golongan"].Width = 180;
            dataGridView1.Columns["Sekolah Mengajar"].Width = 150;
            dataGridView1.Columns["Mata Pelajaran"].Width   = 150;
            dataGridView1.Columns["Username"].Width         = 150;


            while (true)
            {
                i++;
                if (i > ctn.M)
                {
                    break;
                }
                FirebaseResponse responAkun = await client.GetTaskAsync("User_Account/" + i);

                Data    data = responAkun.ResultAs <Data>();
                DataRow dr   = dt.NewRow();
                dr["Nama Depan"]       = data.namaDepan;
                dr["Nama Belakang"]    = data.namaBelakang;
                dr["NIP"]              = data.nip;
                dr["Tempat TglLahir"]  = data.tglLahir;
                dr["Pangkat/Golongan"] = data.pangkatGol;
                dr["Sekolah Mengajar"] = data.sekolah;
                dr["Mata Pelajaran"]   = data.mapel;
                dr["Username"]         = data.username;
                dr["Password"]         = data.pwd;
                dt.Rows.Add(dr);
            }
        }
示例#6
0
        private async void WaktuHabis_Load(object sender, EventArgs e)
        {
            circularProgressBar1.Minimum = 0;
            circularProgressBar1.Value   = 0;
            client = new FireSharp.FirebaseClient(config);
            int              i         = 0;
            double           nilai2    = (nilai * 10) / 3;
            FirebaseResponse responseM = await client.GetTaskAsync("Counter");

            counter ctn = responseM.ResultAs <counter>();

            circularProgressBar1.Maximum = ctn.M;
            while (true)
            {
                circularProgressBar1.Value = i;
                i++;
                if (i > ctn.M)
                {
                    break;
                }

                FirebaseResponse response = await client.GetTaskAsync("User_Account/" + i);

                Data data = response.ResultAs <Data>();
                if (username == data.username)
                {
                    var penilaian = new Penilaian
                    {
                        nama     = data.namaDepan + data.namaBelakang,
                        nip      = data.nip,
                        C1       = Convert.ToSingle(string.Format("{0:0.##}", nilai2)),
                        C2       = 0,
                        C3       = 0,
                        C4       = 0,
                        C5       = 0,
                        username = data.username
                    };
                    FirebaseResponse updt = await client.UpdateTaskAsync("Penilaian/" + i, penilaian);

                    Penilaian pn = updt.ResultAs <Penilaian>();
                }
            }
            var   ss  = new SoalSelesai();
            Soal1 obj = (Soal1)Application.OpenForms["Soal1"];

            obj.Close();
            this.Close();
            ss.Show();
        }
示例#7
0
        private async void Admin_Load(object sender, EventArgs e)
        {
            if (!panel8.Controls.Contains(panel9))
            {
                panel8.Controls.Add(panel9);
                panel9.BringToFront();
            }
            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetTaskAsync("Counter");

            counter ctn = response.ResultAs <counter>();

            label3.Text = ctn.M.ToString();
            grafik();
        }
示例#8
0
        private async void button2_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                int              i         = 0;
                double           nilai2    = (nilai * 10) / 3;
                FirebaseResponse responseM = await client.GetTaskAsync("Counter");

                counter ctn = responseM.ResultAs <counter>();
                while (true)
                {
                    i++;
                    if (i > ctn.M)
                    {
                        break;
                    }

                    FirebaseResponse response = await client.GetTaskAsync("User_Account/" + i);

                    Data data = response.ResultAs <Data>();
                    if (username == data.username)
                    {
                        var penilaian = new Penilaian
                        {
                            nama     = data.namaDepan + data.namaBelakang,
                            nip      = data.nip,
                            C1       = Convert.ToSingle(string.Format("{0:0.##}", nilai2)),
                            C2       = 0,
                            C3       = 0,
                            C4       = 0,
                            C5       = 0,
                            username = data.username
                        };
                        FirebaseResponse updt = await client.UpdateTaskAsync("Penilaian/" + i, penilaian);

                        Penilaian pn = updt.ResultAs <Penilaian>();
                    }
                }
                var   ss  = new SoalSelesai();
                Soal1 obj = (Soal1)Application.OpenForms["Soal1"];
                obj.Close();
                this.Close();
                ss.Show();
            }
        }
示例#9
0
        public async void koneksi()
        {
            int i = 0;
            FirebaseResponse resAkun = await client.GetTaskAsync("Counter");

            counter ctn = resAkun.ResultAs <counter>();

            circularProgressBar1.Maximum = ctn.M;
            while (true)
            {
                circularProgressBar1.Visible = true;
                label22.Visible            = true;
                circularProgressBar1.Value = i;
                i++;
                if (i > ctn.M)
                {
                    circularProgressBar1.Visible = false;
                    label22.Visible = false;
                    break;
                }
                FirebaseResponse response = await client.GetTaskAsync("User_Account/" + i);

                Data             obj    = response.ResultAs <Data>();
                FirebaseResponse resPen = await client.GetTaskAsync("Penilaian/" + i);

                Penilaian pen = resPen.ResultAs <Penilaian>();
                if (username == obj.username)
                {
                    label10.Text = obj.nip;
                    label11.Text = obj.namaDepan + " " + obj.namaBelakang;
                    label12.Text = obj.mapel;
                    label13.Text = obj.sekolah;
                }
                if (pen.username == username && pen.C1 == 0)
                {
                    label19.Text = "Belum Mengikuti";
                }
                else if (pen.username == username && pen.C1 != 0)
                {
                    label19.Text    = "Sudah Mengikuti";
                    button3.Enabled = false;
                }
            }
        }
示例#10
0
        private async void ranking_Load(object sender, EventArgs e)
        {
            foreach (DataGridViewColumn column in dataGridView2.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            int i = 0;

            loadgrid2();
            loadgrid1();
            IFirebaseClient client = new FireSharp.FirebaseClient(config);

            this.dataGridView1.Sort(this.dataGridView1.Columns["Nilai Akhir"], ListSortDirection.Descending);


            FirebaseResponse response = await client.GetTaskAsync("Counter");

            counter ctn = response.ResultAs <counter>();

            while (true)
            {
                i++;
                if (i > ctn.M)
                {
                    break;
                }

                FirebaseResponse responseNilai = await client.GetTaskAsync("Penilaian/" + i);

                Penilaian obj = responseNilai.ResultAs <Penilaian>();
                DataRow   dr  = dt2.NewRow();
                dr["Nama"] = obj.nama;
                dr["NIP"]  = obj.nip;
                dr["Dokumen Portofolio"]       = obj.C5;
                dr["Kinerja Guru"]             = obj.C2;
                dr["Presentasi Best Practice"] = obj.C3;
                dr["Wawancara"]  = obj.C4;
                dr["Test Tulis"] = obj.C1;
                dt2.Rows.Add(dr);
            }
        }
示例#11
0
        private async void UserControl2_Load(object sender, EventArgs e)
        {
            label7.Text = string.Empty;
            circularProgressBar1.Value   = 0;
            circularProgressBar1.Minimum = 0;
            client = new FireSharp.FirebaseClient(config);
            int i = 0;
            FirebaseResponse resAkun = await client.GetTaskAsync("Counter");

            counter ctn = resAkun.ResultAs <counter>();

            circularProgressBar1.Maximum = ctn.M;
            while (true)
            {
                label8.Visible             = true;
                panel3.Visible             = true;
                circularProgressBar1.Value = i;
                i++;
                if (i > ctn.M)
                {
                    circularProgressBar1.Visible = false;
                    label8.Visible = false;
                    panel3.Visible = false;
                    break;
                }
                FirebaseResponse resPen = await client.GetTaskAsync("Penilaian/" + i);

                Penilaian pen = resPen.ResultAs <Penilaian>();
                if (pen.username == Menu.username && pen.C1 == 0)
                {
                    label7.Text = "Belum Mengikuti";
                    Menu.cek    = 0;
                }
                else if (pen.username == Menu.username && pen.C1 != 0)
                {
                    label7.Text = "Sudah Mengikuti";
                    Menu.cek    = 1;
                }
            }
        }
示例#12
0
        //Delete Button
        private async void button1_Click(object sender, EventArgs e)
        {
            IFirebaseClient client = new FireSharp.FirebaseClient(config);
            DialogResult    result = MessageBox.Show("Apakah Anda Yakin?", "Smart Teacher", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                FirebaseResponse resCtn = await client.GetTaskAsync("Counter");

                counter ctn = resCtn.ResultAs <counter>();
                var     con = new counter
                {
                    M = ctn.M - 1
                };
                DataGridViewRow  dgv = dataGridView1.CurrentRow;
                int              i   = dgv.Index + 1;
                FirebaseResponse del = await client.DeleteTaskAsync("User_Account/" + i);

                FirebaseResponse delNilai = await client.DeleteTaskAsync("Penilaian/" + i);

                FirebaseResponse resUpdate = await client.UpdateTaskAsync("Counter", con);

                counter update = resUpdate.ResultAs <counter>();
                while (true)
                {
                    i++;
                    if (i > ctn.M)
                    {
                        break;
                    }
                    FirebaseResponse resNilai = await client.GetTaskAsync("Penilaian/" + i);

                    Penilaian        penNilai = resNilai.ResultAs <Penilaian>();
                    FirebaseResponse resData  = await client.GetTaskAsync("User_Account/" + i);

                    Data ambilData = resData.ResultAs <Data>();
                    var  nilai     = new Penilaian
                    {
                        nama     = penNilai.nama,
                        nip      = penNilai.nip,
                        username = penNilai.username,
                        C1       = penNilai.C1,
                        C2       = penNilai.C2,
                        C3       = penNilai.C3,
                        C4       = penNilai.C4,
                        C5       = penNilai.C5
                    };
                    var data = new Data
                    {
                        namaDepan    = ambilData.namaDepan,
                        namaBelakang = ambilData.namaBelakang,
                        nip          = ambilData.nip,
                        tglLahir     = ambilData.tglLahir,
                        pangkatGol   = ambilData.pangkatGol,
                        sekolah      = ambilData.sekolah,
                        mapel        = ambilData.mapel,
                        username     = ambilData.username,
                        pwd          = ambilData.pwd
                    };

                    SetResponse updateNilai = await client.SetTaskAsync("Penilaian/" + Convert.ToInt32(i - 1), nilai);

                    Penilaian   gantiNilai = updateNilai.ResultAs <Penilaian>();
                    SetResponse updateAkun = await client.SetTaskAsync("User_Account/" + Convert.ToInt32(i - 1), data);

                    Data gantiAkun = updateAkun.ResultAs <Data>();
                    if (i == ctn.M)
                    {
                        FirebaseResponse del1 = await client.DeleteTaskAsync("User_Account/" + i);

                        FirebaseResponse del2 = await client.DeleteTaskAsync("Penilaian/" + i);
                    }
                }
            }
        }
示例#13
0
        private async void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var data = new Data
                {
                    namaDepan    = textBox10.Text,
                    namaBelakang = textBox9.Text,
                    nip          = textBox8.Text,
                    pangkatGol   = comboBox2.Text,
                    tglLahir     = textBox7.Text,
                    sekolah      = textBox6.Text,
                    mapel        = comboBox3.Text,
                    username     = textBox1.Text,
                    pwd          = textBox2.Text
                };

                if (textBox2.Text == textBox3.Text)
                {
                    circularProgressBar1.Visible = true;
                    FirebaseResponse responseakun = await client.GetTaskAsync("Counter");

                    counter ctn = responseakun.ResultAs <counter>();
                    int     i   = 0;
                    int     b   = 1;
                    while (true)
                    {
                        circularProgressBar1.Visible = true;
                        circularProgressBar1.Maximum = ctn.M;
                        circularProgressBar1.Minimum = 0;
                        circularProgressBar1.Value   = i;
                        i++;
                        if (i > ctn.M)
                        {
                            break;
                        }
                        FirebaseResponse responseambil = await client.GetTaskAsync("User_Account/" + i);

                        Data obj = responseambil.ResultAs <Data>();
                        if (textBox1.Text == obj.username)
                        {
                            MessageBox.Show("Maaf, Username Sudah Terpakai", "Registrasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            b = 2;
                            circularProgressBar1.Visible = false;
                            circularProgressBar1.Value   = 0;
                        }
                        else if (textBox8.Text == obj.nip)
                        {
                            MessageBox.Show("Maaf, Tidak Dapat menggunakan NIP Yang Anda Masukkan", "Registrasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            b = 2;
                            circularProgressBar1.Visible = false;
                            circularProgressBar1.Value   = 0;
                        }
                    }

                    if (b == 1)
                    {
                        circularProgressBar1.Visible = false;
                        var Counter = new counter
                        {
                            M = Convert.ToInt32(ctn.M + 1)
                        };
                        FirebaseResponse rsp = await client.UpdateTaskAsync("Counter", Counter);

                        counter     ctn1     = rsp.ResultAs <counter>();
                        SetResponse response = await client.SetTaskAsync("User_Account/" + i, data);

                        Data result = response.ResultAs <Data>();

                        var nilai = new Penilaian
                        {
                            nama     = result.namaDepan + " " + result.namaBelakang,
                            nip      = result.nip,
                            C1       = 0,
                            C2       = 0,
                            C3       = 0,
                            C4       = 0,
                            C5       = 0,
                            username = result.username
                        };

                        SetResponse pushNilai = await client.SetTaskAsync("Penilaian/" + i, nilai);

                        Penilaian pen = pushNilai.ResultAs <Penilaian>();
                    }

                    if (MessageBox.Show("Registrasi Berhasil", "Registrasi", MessageBoxButtons.OK) == DialogResult.OK)
                    {
                        var lgn = new Login();
                        this.Close();
                        lgn.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Password Tidak Sama", "Register", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#14
0
        private async void button1_MouseUp(object sender, MouseEventArgs e)
        {
            label3.Text = "";
            client      = new FireSharp.FirebaseClient(config);
            FirebaseResponse response = await client.GetTaskAsync("Counter");

            counter ctn1 = response.ResultAs <counter>();

            label3.Text = ctn1.M.ToString();

            int i = 0;
            int a = 0; int h = 0;
            int b = 0; int n = 0;
            int c = 0; int j = 0;
            int d = 0; int k = 0;
            int p = 0; int l = 0;
            int f = 0; int m = 0;
            int g = 0; int o = 0;

            client = new FireSharp.FirebaseClient(config);
            FirebaseResponse resCtn = await client.GetTaskAsync("Count");

            RankCount ctn           = resCtn.ResultAs <RankCount>();

            chart1.Series["Series1"].Label = "#PERCENT";
            chart1.Series["Series1"].Points[0].SetValueY(0);
            chart1.Series["Series1"].Points[1].SetValueY(0);
            chart1.Series["Series1"].Points[2].SetValueY(0);
            chart1.Series["Series1"].Points[3].SetValueY(0);
            chart1.Series["Series1"].Points[4].SetValueY(0);
            chart1.Series["Series1"].Points[5].SetValueY(0);
            chart1.Series["Series1"].Points[6].SetValueY(0);
            chart1.Series["Series1"].Points[7].SetValueY(0);
            chart1.Series["Series1"].Points[8].SetValueY(0);
            chart1.Series["Series1"].Points[9].SetValueY(0);
            chart1.Series["Series1"].Points[10].SetValueY(0);
            chart1.Series["Series1"].Points[11].SetValueY(0);
            chart1.Series["Series1"].Points[12].SetValueY(0);
            chart1.Series["Series1"].Points[13].SetValueY(0);

            while (true)
            {
                i++;
                if (i > 10)
                {
                    break;
                }
                FirebaseResponse response1 = await client.GetTaskAsync("Ranking/" + i);

                Ranked rank = response1.ResultAs <Ranked>();
                if (rank.mapel == "Matematika")
                {
                    a += 1;
                }
                else if (rank.mapel == "Biologi")
                {
                    b += 1;
                }
                else if (rank.mapel == "Bahasa Inggris")
                {
                    c += 1;
                }
                else if (rank.mapel == "Fisika")
                {
                    d += 1;
                }
                else if (rank.mapel == "Kimia")
                {
                    p += 1;
                }
                else if (rank.mapel == "Bahasa Indonesia")
                {
                    f += 1;
                }
                else if (rank.mapel == "Sejarah")
                {
                    g += 1;
                }
                else if (rank.mapel == "Geografi")
                {
                    h += 1;
                }
                else if (rank.mapel == "Sosiologi dan Anthropologi")
                {
                    j += 1;
                }
                else if (rank.mapel == "Ekonomi")
                {
                    k += 1;
                }
                else if (rank.mapel == "Agama Islam")
                {
                    l += 1;
                }
                else if (rank.mapel == "Pendidikan Pancasila dan Kewarganegaraan")
                {
                    m += 1;
                }
                else if (rank.mapel == "Seni Budaya")
                {
                    n += 1;
                }
                else if (rank.mapel == "Pendidikan Jasmani, Olahraga dan Kebugaran")
                {
                    o += 1;
                }
            }

            chart1.Series["Series1"].Points[0].SetValueY(a);
            chart1.Series["Series1"].Points[1].SetValueY(b);
            chart1.Series["Series1"].Points[2].SetValueY(c);
            chart1.Series["Series1"].Points[3].SetValueY(d);
            chart1.Series["Series1"].Points[4].SetValueY(p);
            chart1.Series["Series1"].Points[5].SetValueY(f);
            chart1.Series["Series1"].Points[6].SetValueY(g);
            chart1.Series["Series1"].Points[7].SetValueY(h);
            chart1.Series["Series1"].Points[8].SetValueY(j);
            chart1.Series["Series1"].Points[9].SetValueY(k);
            chart1.Series["Series1"].Points[10].SetValueY(l);
            chart1.Series["Series1"].Points[11].SetValueY(m);
            chart1.Series["Series1"].Points[12].SetValueY(n);
            chart1.Series["Series1"].Points[13].SetValueY(o);

            foreach (DataPoint dp in chart1.Series["Series1"].Points)
            {
                if (dp.YValues.Length > 0 && (double)dp.YValues.GetValue(0) == 0)
                {
                    dp.IsValueShownAsLabel = false;
                    dp.Label = "";
                }
                else
                {
                    dp.IsValueShownAsLabel = true;
                }
            }
        }
示例#15
0
        private async void button1_Click(object sender, EventArgs e)
        {
            dt.Rows.Clear();
            label3.Visible      = true;
            pictureBox1.Visible = true;
            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }
            try
            {
                int c = 0;
                int k = 0;
                int i, j;
                double[,] result = new double[99, 99];
                double[,] salin  = new double[99, 99];
                double[,] temp   = new double[99, 99];
                double[,] temp2  = new double[99, 99];
                double[,] fix    = new double[99, 99];
                double[,] a      = new double[99, 99];
                double[] temporary        = new double[99];

                IFirebaseClient  client   = new FireSharp.FirebaseClient(config);
                FirebaseResponse delete   = await client.DeleteTaskAsync("Ranking");

                FirebaseResponse response = await client.GetTaskAsync("Counter/");

                counter bts               = response.ResultAs <counter>();
                //cetak matriks
                for (i = 1; i <= bts.M; i++)
                {
                    for (j = 1; j <= 5; j++)
                    {
                        FirebaseResponse responNilai = await client.GetTaskAsync("Penilaian/" + i);

                        Penilaian obj = responNilai.ResultAs <Penilaian>();
                        if (j == 1)
                        {
                            a[i, j]     = obj.C1;
                            salin[i, j] = obj.C1;
                        }
                        else if (j == 2)
                        {
                            a[i, j]     = obj.C2;
                            salin[i, j] = obj.C2;
                        }
                        else if (j == 3)
                        {
                            a[i, j]     = obj.C3;
                            salin[i, j] = obj.C3;
                        }
                        else if (j == 4)
                        {
                            a[i, j]     = obj.C4;
                            salin[i, j] = obj.C4;
                        }
                        else if (j == 5)
                        {
                            a[i, j]     = obj.C5;
                            salin[i, j] = obj.C5;
                        }
                        ////Debug.Write(string.Format("{0:N2} ", salin[i, j]));
                    }
                    ////Debug.WriteLine("");
                }
                //end cetak matriks

                //cetak hasil akar
                for (j = 1; j <= 5; j++)
                {
                    for (i = 1; i <= bts.M; i++)
                    {
                        if (i == 1)
                        {
                            salin[i + 1, j] = Math.Pow(salin[i + 1, j], 2) + Math.Pow(salin[i, j], 2);
                        }
                        else if (i > 1)
                        {
                            salin[i + 1, j] = Math.Pow(salin[i + 1, j], 2) + salin[i, j];
                        }
                        result[i, j] = Math.Sqrt(salin[i, j]);
                        //if (i % 2 == 0)
                        //{
                        Debug.WriteLine(result[i, j]);
                        // }
                    }
                }
                //end cetak hasil akar

                //cetak Xij + perkalian bobot
                Debug.WriteLine("");
                for (j = 1; j <= 5; j++)
                {
                    for (i = 1; i <= bts.M; i++)
                    {
                        temp[i, j] = a[i, j] / result[bts.M, j];
                        if (j == 1)
                        {
                            temp2[i, j] = temp[i, j] * 0.25;
                        }
                        else if (j == 2)
                        {
                            temp2[i, j] = temp[i, j] * 0.15;
                        }
                        else if (j == 3)
                        {
                            temp2[i, j] = temp[i, j] * 0.1;
                        }
                        else if (j == 4)
                        {
                            temp2[i, j] = temp[i, j] * 0.25;
                        }
                        else if (j == 5)
                        {
                            temp2[i, j] = temp[i, j] * 0.25;
                        }

                        Debug.Write(" " + temp2[i, j]);
                    }

                    Debug.WriteLine("");
                }

                Debug.WriteLine("");

                //penjumlahan kriteria beserta bobot
                for (i = 1; i <= bts.M; i++)
                {
                    for (j = 1; j <= 5; j++)
                    {
                        temp2[i, j + 1] = temp2[i, j + 1] + temp2[i, j];
                    }
                    temporary[i] = temp2[i, 5];
                    Debug.WriteLine(" " + temp2[i, 5]);
                }
                Debug.WriteLine("");


                while (true)
                {
                    DataRow dr = dt.NewRow();
                    k++;
                    if (k > bts.M)
                    {
                        c = 1;
                        break;
                    }
                    FirebaseResponse resAkun = await client.GetTaskAsync("User_Account/" + k);

                    Data data = resAkun.ResultAs <Data>();
                    dr["Nama"]             = data.namaDepan + " " + data.namaBelakang;
                    dr["NIP"]              = data.nip;
                    dr["Pangkat/Gol"]      = data.pangkatGol;
                    dr["Sekolah Mengajar"] = data.sekolah;
                    dr["Mapel"]            = data.mapel;
                    dr["Nilai Akhir"]      = temporary[k];
                    dt.Rows.Add(dr);
                    c = 1;
                }
                if (c == 1)
                {
                    k = 0;
                    while (true)
                    {
                        k++;
                        if (k > bts.M)
                        {
                            break;
                        }
                        FirebaseResponse resAkun = await client.GetTaskAsync("User_Account/" + k);

                        Data            data = resAkun.ResultAs <Data>();
                        DataGridViewRow dgv  = dataGridView1.Rows[k - 1];
                        if (dgv.Index < 3)
                        {
                            dgv.DefaultCellStyle.BackColor = Color.Green;
                        }
                        var nilaiFix = new Ranked
                        {
                            nama       = dgv.Cells[0].Value.ToString(),
                            nip        = dgv.Cells[1].Value.ToString(),
                            PangkatGol = dgv.Cells[2].Value.ToString(),
                            sekolah    = dgv.Cells[3].Value.ToString(),
                            mapel      = dgv.Cells[4].Value.ToString(),
                            nilaiAkhir = Convert.ToSingle(dgv.Cells[5].Value)
                        };
                        var hit = new RankCount
                        {
                            count = bts.M
                        };
                        SetResponse pushNilai = await client.SetTaskAsync("Ranking/" + k, nilaiFix);

                        Ranked           push        = pushNilai.ResultAs <Ranked>();
                        FirebaseResponse countUpdate = await client.UpdateTaskAsync("Count", hit);

                        RankCount hitUpdate = countUpdate.ResultAs <RankCount>();
                    }
                    FirebaseResponse realTime = await client.GetTaskAsync("Ranking/" + bts.M);

                    if (realTime.ResultAs <Ranked>() == null)
                    {
                        pictureBox1.Visible = true;
                        label3.Visible      = true;
                    }
                    pictureBox1.Visible = false;
                    label3.Visible      = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }