// Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(Employee_Receipt Employee_Receipt)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Employee_Receipt_Data = new FireBase_Employee_Receipt
            {
                Number          = Employee_Receipt.Get_Number(),
                Book            = Employee_Receipt.Get_Book(),
                Owner           = Employee_Receipt.Get_Owner(),
                Date            = Employee_Receipt.Get_Date(),
                Name            = Employee_Receipt.Get_Name(),
                Sallary         = Employee_Receipt.Get_Sallary(),
                Discount        = Employee_Receipt.Get_Discount(),
                Total           = Employee_Receipt.Get_Total(),
                Detail          = Employee_Receipt.Get_Detail(),
                Employee_Number = Employee_Receipt.Get_Employee_Number()
            };

            SetResponse Respose = await Client.SetTaskAsync("Employee_Receipt/" + Employee_Receipt.Get_Number(), Employee_Receipt_Data);

            return;
        }
Пример #2
0
        static void Main(string[] args)
        {
            var data = new Data
            {
                datas = "",
            };
            String line;

            System.IO.StreamReader file   = new System.IO.StreamReader("yourtext.txt");
            IFirebaseConfig        config = new FirebaseConfig
            {
                AuthSecret = "",
                BasePath   = ""
            };
            IFirebaseClient client;

            client = new FireSharp.FirebaseClient(config);
            while ((line = file.ReadLine()) != null)
            {
                Console.WriteLine(line);
                Task.Run(async() =>
                {
                    SetResponse response = await client.SetTaskAsync("Test/" + line, data);
                    Data result          = response.ResultAs <Data>();
                }).GetAwaiter().GetResult();
            }
            file.Close();
            Console.ReadLine();
        }
Пример #3
0
        // Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(Movement_Receipt Movement_Receipt)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Movement_Receipt_Data = new FireBase_Movement_Receipt
            {
                Number = Movement_Receipt.Get_Number(),
                Book   = Movement_Receipt.Get_Book(),
                Type   = Movement_Receipt.Get_Type(),
                Owner  = Movement_Receipt.Get_Owner(),
                Kind   = Movement_Receipt.Get_Kind(),
                Amount = Movement_Receipt.Get_Amount(),
                Date   = Movement_Receipt.Get_Date(),
                Detail = Movement_Receipt.Get_Detail(),
            };

            SetResponse Respose = await Client.SetTaskAsync("Movement_Receipt/" + Movement_Receipt.Get_Number(), Movement_Receipt_Data);

            return;
        }
        public async void Save_Process(string Type, string Department, string Id, string _Owner)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            FirebaseResponse Respose = await Client.GetTaskAsync("Number_Process/" + "Now");

            FireBase_Counter Data = Respose.ResultAs <FireBase_Counter>();

            string Counter = Data.Counter;

            var Process_Data = new FireBase_Process
            {
                Number    = Counter,
                Code      = Get_Process_Code(Type, Department),
                Record_Id = Id,
                Owner     = _Owner
            };

            SetResponse Process_Respose = await Client.SetTaskAsync("Process/" + Counter, Process_Data);

            Update_Counter((int.Parse(Counter) + 1).ToString());

            return;
        }
Пример #5
0
        // Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(Employee Employee)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Employee_Data = new FireBase_Employee
            {
                Number      = Employee.Get_Number(),
                Name        = Employee.Get_Name(),
                Connect1    = Employee.Get_Connect1(),
                Connect2    = Employee.Get_Connect2(),
                Children    = Employee.Get_Children(),
                Type        = Employee.Get_Type(),
                Class       = Employee.Get_Class(),
                Number_Hour = Employee.Get_Number_Hour(),
                Detail      = Employee.Get_Detail()
            };

            SetResponse Respose = await Client.SetTaskAsync("Employee/" + Employee.Get_Number(), Employee_Data);

            return;
        }
        // Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(Receipt Receipt)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Receipt_Data = new FireBase_Receipt
            {
                Number         = Receipt.Get_Number(),
                Book           = Receipt.Get_Book(),
                Branch         = Receipt.Get_Branch(),
                Recipient      = Receipt.Get_Recipient(),
                First_Name     = Receipt.Get_First_Name(),
                Last_Name      = Receipt.Get_Last_Name(),
                Amount_Paid    = Receipt.Get_Amount_Paid(),
                Date           = Receipt.Get_Date(),
                For            = Receipt.Get_For(),
                Account_Number = Receipt.Get_Account_Number()
            };

            SetResponse Respose = await Client.SetTaskAsync("Receipt/" + Receipt.Get_Number(), Receipt_Data);

            return;
        }
Пример #7
0
        public async void updatePending(String orderNo, String tbleNo)
        {
            Console.WriteLine("pending called");
            IFirebaseClient client = new FireSharp.FirebaseClient(config);

            var DataPending = new DataPending
            {
                orderNo = orderNo,
                //tbleNo = tbleNo
            };
            SetResponse response = await client.SetTaskAsync("pending/" + orderNo, DataPending);

            DataPending result = response.ResultAs <DataPending>();
        }
        public async void Account_Detail_Counter_Defult()
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Number_Account_Detail = new FireBase_Account_Detail_Counter
            {
                Counter = "1"
            };

            SetResponse Respose = await Client.SetTaskAsync("Number_Account_Detail/" + "Now", Number_Account_Detail);
        }
        public async void Update_Counter(string Value)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Number_Process_Data = new FireBase_Counter
            {
                Counter = Value
            };

            SetResponse Respose = await Client.SetTaskAsync("Number_Process/" + "Now", Number_Process_Data);

            Update_Process_Number((int.Parse(Value) - 1).ToString());
        }
        // Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(List <Account_Detail> Detail)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            int Number_Detail = Detail.Count;

            FirebaseResponse CounterRespose = await Client.GetTaskAsync("Number_Account_Detail/" + "Now");

            FireBase_Account_Detail_Counter Data = CounterRespose.ResultAs <FireBase_Account_Detail_Counter>();

            string Counter_Value = Data.Counter;

            for (int i = 0; i < Number_Detail; i++)
            {
                var Account_Detail = new FireBase_Account_Detail
                {
                    Account_Id        = Detail[i].Get_Account_Id(),
                    Student_Name      = Detail[i].Get_Student_Name(),
                    Class             = Detail[i].Get_Class(),
                    Study_Fee         = Detail[i].Get_Study_Fee(),
                    Registration_Fee  = Detail[i].Get_Registration_Fee(),
                    Transportaion_Fee = Detail[i].Get_Transportaion_Fee(),
                    Extra_Fee         = Detail[i].Get_Extra_Fee(),
                    Total             = Detail[i].Get_Total()
                };

                SetResponse Respose = await Client.SetTaskAsync("Account_Detail/" + Counter_Value, Account_Detail);

                Counter_Value = (int.Parse(Counter_Value) + 1).ToString();
            }

            Update_Counter(Counter_Value);

            return;
        }
Пример #11
0
        //
        #endregion

        #region POST - Maquina dados
        //
        //public JsonResult mpd(string m, int p)
        //{
        //    string sret = string.Empty;
        //    string horala = string.Empty;
        //    List<string> lista = new List<string>();
        //    try
        //    {
        //        Medidor medidor = db.Medidor.Where(a => a.MAC == m).FirstOrDefault();
        //        //
        //        if (medidor != null)
        //        {
        //            MedidorHistorico medidor_hist = new MedidorHistorico();
        //            //
        //            //foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
        //            //{
        //            //    if (z != null)
        //            //    {
        //            //        lista.Add(z.Id);
        //            //    }
        //            //}
        //            //
        //            DateTime timeUtc = DateTime.UtcNow;
        //            var brasilia = TimeZoneInfo.FindSystemTimeZoneById("Central Brazilian Standard Time");
        //            horala = String.Format("Hora Brasilia: {0}", TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).ToString());
        //            //
        //            int ano = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Year;
        //            int mes = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Month;
        //            int dia = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Day;
        //            int hora = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Hour;
        //            int min = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Minute;
        //            int seg = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Second;
        //            //
        //            medidor_hist.Id_Mac = medidor.Id;
        //            medidor_hist.DataHora = new DateTime(ano, mes, dia, hora, min, seg).AddHours(1);
        //            //medidor_hist.DataHora = DateTime.Now;
        //            medidor_hist.Potencia = p.ToString();
        //            //
        //            db.MedidorHistorico.Add(medidor_hist);
        //            db.SaveChanges();
        //            //
        //            sret = "ok";
        //        }
        //        else
        //        {
        //            sret = "Medidor não encontrado!";
        //        }
        //    }
        //    catch (Exception exc)
        //    {
        //        sret = exc.Message;
        //    }
        //    //
        //    return Json(new { data = sret, results = 1, success = true }, JsonRequestBehavior.AllowGet);
        //}
        ////
        //public async Task<JsonResult> mpd_teste(string m, int p)
        //{
        //    string sret = string.Empty;
        //    string horala = string.Empty;
        //    List<string> lista = new List<string>();
        //    try
        //    {
        //        Medidor medidor = db.Medidor.Where(a => a.MAC == m).FirstOrDefault();
        //        //
        //        if (medidor != null)
        //        {
        //            MedidorHistorico medidor_hist = new MedidorHistorico();
        //            //
        //            DateTime timeUtc = DateTime.UtcNow;
        //            var brasilia = TimeZoneInfo.FindSystemTimeZoneById("Central Brazilian Standard Time");
        //            horala = String.Format("Hora Brasilia: {0}", TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).ToString());
        //            //
        //            int ano = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Year;
        //            int mes = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Month;
        //            int dia = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Day;
        //            int hora = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Hour;
        //            int min = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Minute;
        //            int seg = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, brasilia).Second;
        //            //
        //            medidor_hist.Id_Mac = medidor.Id;
        //            medidor_hist.DataHora = new DateTime(ano, mes, dia, hora, min, seg).AddHours(1);
        //            medidor_hist.Potencia = p.ToString();
        //            //
        //            db.MedidorHistorico.Add(medidor_hist);
        //            db.SaveChanges();
        //            db.Entry(medidor_hist).Reload();
        //            //
        //            sret = await teste_firebase(medidor_hist.Id.ToString(), medidor.Id.ToString(), m, medidor.Descricao, p.ToString(), medidor_hist.DataHora);
        //        }
        //        else
        //        {
        //            sret = "Medidor não encontrado!";
        //        }
        //    }
        //    catch (Exception exc)
        //    {
        //        sret = exc.Message;
        //    }
        //    //
        //    return Json(new { data = sret, results = 1, success = true }, JsonRequestBehavior.AllowGet);
        //}
        //
        public async Task <string> teste_firebase(string id, string id_medidor, string mac_radiobase, string desc_medidor, string potencia, Nullable <System.DateTime> DataHora) // pega programação máquina
        {
            string sret = string.Empty;
            string pamb = string.Empty;

            IFirebaseClient client;
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "MCPZ3qTPh8YdCQxk8aFvM59tWGoLuZUQb3fakIqJ",
                BasePath   = "https://notificacaohahaha.firebaseio.com/"
            };
            //
            var data = new Data
            {
                Id                = id,
                Medidor           = mac_radiobase,
                Descricao_Medidor = desc_medidor,
                Id_Medidor        = id_medidor,
                Potencia          = potencia,
                DataHora          = DataHora.Value.ToShortDateString() + " " + DataHora.Value.ToShortTimeString()
            };

            client = new FireSharp.FirebaseClient(config);
            SetResponse response = await client.SetTaskAsync("Alertas/" + id, data);

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

            //
            if (!string.IsNullOrEmpty(result.Id))
            {
                sret = "ok";
            }
            else
            {
                sret = "nok";
            }
            //
            return(sret);
        }
Пример #12
0
        //
        public async Task <JsonResult> Cha() // pega programação máquina
        {
            string pama = string.Empty;
            string pamb = string.Empty;

            IFirebaseClient client;
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "MCPZ3qTPh8YdCQxk8aFvM59tWGoLuZUQb3fakIqJ",
                BasePath   = "https://notificacaohahaha.firebaseio.com/"
            };
            //
            var data = new Data
            {
                Id       = "4",
                Medidor  = "efefefef",
                Potencia = "44"
            };

            client = new FireSharp.FirebaseClient(config);
            SetResponse response = await client.SetTaskAsync("Information/" + "1", data);

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

            if (!string.IsNullOrEmpty(result.Id))
            {
            }
            //object[] arrayObj = new object[] { pama, pamb };
            //FireConector fire_class = new FireConector();
            ////
            //new FireConector().GetType().GetMethod("InsertData").Invoke(fire_class, arrayObj);

            //if (arrayObj != null)
            //{

            //}

            return(Json(new { data = "", results = 0, success = true }, JsonRequestBehavior.AllowGet));
        }
        // Insert Data In FireBase DataBase ...
        //

        public async void FireBase_Insert(Student Student)
        {
            IFirebaseConfig Config = new FirebaseConfig
            {
                AuthSecret = "VH1rdiDgj2hzD0WN5JZ67BSXTN7OdOeM0fnry50G",
                BasePath   = "https://ctm-db.firebaseio.com/"
            };

            IFirebaseClient Client = new FireSharp.FirebaseClient(Config);

            var Student_Data = new FireBase_Student
            {
                Id             = Student.Get_Id(),
                First_Name     = Student.Get_First_Name(),
                Last_Name      = Student.Get_Last_Name(),
                Father_Name    = Student.Get_Father_Name(),
                Connect1       = Student.Get_Connect1(),
                Connect2       = Student.Get_Connect2(),
                Birth          = Student.Get_Birth(),
                Class          = Student.Get_Class(),
                Type           = Student.Get_Type(),
                Registration   = Student.Get_Registration(),
                School_Name    = Student.Get_School_Name(),
                Transportation = Student.Get_Transportation(),
                City           = Student.Get_City(),
                Block          = Student.Get_Block(),
                Street         = Student.Get_Street(),
                Detail         = Student.Get_Detail(),
                Account_Number = Student.Get_Account_Number(),
                File_Number    = Student.Get_File_Number(),
                Note           = Student.Get_Note(),
                File_Stutus    = Student.Get_File_Stutus(),
                Picture        = Student.Get_Picture()
            };

            SetResponse Respose = await Client.SetTaskAsync("Student/" + Student.Get_Id(), Student_Data);

            return;
        }
Пример #14
0
        public async void sendToFirebase(String tblNo, String itemCode, String qty, String orderNo, String size, String item)
        {
            //sendToFirebase(tbleNo, itemCode, qty, orderNo, size);


            Console.WriteLine("in firebase item" + item);
            Console.WriteLine("in firbase tble no " + tblNo);
            IFirebaseClient client = new FireSharp.FirebaseClient(config);

            var data = new Data
            {
                tblNo    = tblNo,
                itemCode = itemCode,
                qty      = qty,
                status   = "pending",
                size     = size
            };
            SetResponse response = await client.SetTaskAsync("Orders/" + item, data);

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

            updatePending(item, tblNo);
        }
Пример #15
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);
                    }
                }
            }
        }
Пример #16
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);
            }
        }