private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            StudentLogged st = new StudentLogged();

            st.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            StudentLogged fm = new StudentLogged();

            fm.Show();
            this.Hide();
        }
        private async void postButton_Click(object sender, EventArgs e)
        {
            SetResponse      res  = null;
            FirebaseResponse res1 = null;

            //newslineCount d = new newslineCount();
            postOnlinedData d = new postOnlinedData();

            d.post = textBox1.Text;
            d.Time = DateTime.Now.ToString("h:mm:ss tt");
            d.Date = DateTime.Now.ToString("yyyy-MM-dd tt");

            // MessageBox.Show(d.Date);

            res1 = await client.GetTaskAsync("NewsLineCnt/cnt");

            newslineCount d1 = res1.ResultAs <newslineCount>();
            //MessageBox.Show(d1.cnt);
            int x = Int32.Parse(d1.cnt);

            x++;
            d1.cnt = x.ToString();
            res    = await client.SetTaskAsync("NewsLine/3rdyear/1stsemester/CSE/post" + x.ToString(), d);

            res = await client.SetTaskAsync("NewsLineCnt/cnt", d1);

            MessageBox.Show("Post Successfull");
            this.Hide();
            StudentLogged st = new StudentLogged();

            st.Show();
        }
Ejemplo n.º 4
0
        private async void Login_Click(object sender, EventArgs e)
        {
            FirebaseResponse res = null;

            if (comboBox1.SelectedIndex == 2)
            {
                res = await client.GetTaskAsync("StudentLogin/" + ch3 + ch1 + textBox1.Text);

                StudentData d;
                if (res != null)
                {
                    try
                    {
                        d = res.ResultAs <StudentData>();
                        if (d.pass.Equals(textBox3.Text.ToString()))
                        {
                            MessageBox.Show("Welcome");
                            StudentLogged fm = new StudentLogged();
                            fm.Show();
                            this.Visible = false;
                        }
                        else
                        {
                            MessageBox.Show("Invalid Login!!");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Invalid Login!!11");
                    }
                }
                else
                {
                    MessageBox.Show("Invalid Login!!");
                }
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                res = await client.GetTaskAsync("TeacherLogin/" + textBox1.Text);
            }
            else if (comboBox1.SelectedIndex == 0)
            {
                res = await client.GetTaskAsync("AdminLogin/" + textBox1.Text);
            }
            else if (comboBox1.SelectedIndex == 3)
            {
                AlumniData d1;
                ch3 = deptBox.SelectedItem.ToString() + "/";
                ch1 = sessionBox.SelectedItem.ToString() + "/";
                res = await client.GetTaskAsync("AlumniLogin/" + ch3 + ch1 + textBox1.Text);

                if (res != null)
                {
                    try
                    {
                        d1 = res.ResultAs <AlumniData>();
                        if (d1.pass.Equals(textBox3.Text.ToString()))
                        {
                            MessageBox.Show("Welcome");
                            StudentLogged fm = new StudentLogged();
                            fm.Show();
                            this.Visible = false;
                        }
                        else
                        {
                            MessageBox.Show("Invalid Login!!1");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Invalid Login!!12");
                    }
                }
                else
                {
                    MessageBox.Show("Invalid Login!!");
                }
            }
        }