コード例 #1
0
        private void submitRespon()
        {
            t.Stop();
            IRestRequest reqRespon = new RestRequest("/php/desktopSiswa/pushResponDesktop.php", Method.POST);

            reqRespon.AddJsonBody(new
            {
                nis    = siswa.nis,
                idTest = testOpen.idTest,
                nilai  = scores.Sum(),
                jenis  = testOpen.jenisTest
            });
            IRestResponse <ResponGeneral> resFinish = client.Execute <ResponGeneral>(reqRespon);
            ResponGeneral respon = JsonConvert.DeserializeObject <ResponGeneral>(resFinish.Content);

            if (respon.status == 1)
            {
                SiswaDashBoard dasboard = new SiswaDashBoard(siswa, listAngkatan, listKompi, listPleton);
                dasboard.Show();
                MessageBox.Show("nilai berhasil di upload");
                if (this.InvokeRequired)
                {
                    this.Invoke((Action) delegate { this.Close(); });
                }
            }
        }
コード例 #2
0
        private void btn_close_Click(object sender, EventArgs e)
        {
            t.Stop();
            SiswaDashBoard dash = new SiswaDashBoard(siswa, listAngkatan, listKompi, listPleton);

            dash.Show();
            this.Close();
        }
コード例 #3
0
 private void btn_login_Click(object sender, EventArgs e)
 {
     if (isPleton && isKompi && isAngkatan)
     {
         btn_login.Enabled = false;
         abx1.Visible      = true;
         var          client   = new RestClient(RootUrl.rootUrl);
         IRestRequest reqLogin = new RestRequest("/php/desktopSiswa/desktopLogin.php", Method.POST);
         reqLogin.AddJsonBody(new
         {
             nis      = tb_nis.Text,
             password = tb_pass.Text
         });
         resLogin = client.Execute <ResponGeneral>(reqLogin);
         ResponGeneral resp = JsonConvert.DeserializeObject <ResponGeneral>(resLogin.Content);
         if (resp.status == 1)
         {
             Siswa siswa = resp.data;
             btn_login.Enabled = true;
             abx1.Visible      = false;
             SiswaDashBoard dasboard = new SiswaDashBoard(siswa, listAngkatan, listKompi, listPleton);
             dasboard.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("login gagal");
             btn_login.Enabled = true;
             abx1.Visible      = false;
         }
     }
     else
     {
         abx1.Visible = true;
     }
 }
コード例 #4
0
        private void submitRespon()
        {
            t.Stop();
            var          client    = new RestClient(RootUrl.rootUrl);
            IRestRequest reqRespon = new RestRequest("/php/desktopSiswa/pushResponDesktop.php", Method.POST);

            reqRespon.AddJsonBody(new
            {
                nis    = siswa.nis,
                idTest = testOpen.idTest,
                nilai  = scores.Sum(),
                jenis  = testOpen.jenisTest
            });
            resReg = client.Execute <ResponGeneral>(reqRespon);
            Debug.WriteLine(resReg.Content);
            ResponGeneral resp = JsonConvert.DeserializeObject <ResponGeneral>(resReg.Content);

            if (resp.status == 1)
            {
                Debug.WriteLine("idRespon test : " + resp.messege);
                long[] idSoals  = new long[this.listSoal.Count];
                int[]  crosscek = new int[this.listSoal.Count];
                for (int a = 0; a < this.listSoal.Count; a++)
                {
                    idSoals[a]  = this.listSoal[a].idSoal;
                    crosscek[a] = this.listSoal[a].crosscek;
                }
                IRestRequest reqDetRespon = new RestRequest("/php/desktopSiswa/pushDetailResponDesktop.php", Method.POST);
                reqDetRespon.AddJsonBody(new {
                    idResponTest = resp.messege,
                    idSoals      = idSoals,
                    crosceks     = crosscek
                });
                resDetRes = client.Execute <ResponGeneral>(reqDetRespon);
                Debug.WriteLine(resDetRes.Content);

                ResponGeneral respDet = JsonConvert.DeserializeObject <ResponGeneral>(resDetRes.Content);
                if (respDet.status == 1)
                {
                    SiswaDashBoard dasboard = new SiswaDashBoard(siswa, listAngkatan, listKompi, listPleton);
                    dasboard.Show();
                    MessageBox.Show("nilai berhasil di upload");
                    if (this.InvokeRequired)
                    {
                        this.Invoke(
                            (Action) delegate
                        {
                            this.Close();
                        }
                            );
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("input detail respon gagal");
                }
            }
            else
            {
                MessageBox.Show("input respon gagal");
            }
        }