Example #1
0
        private void getNumberToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (conn.GetConnectionStatus())
            {
                bool    success = false;
                string  number  = "";
                GetForm getForm = new GetForm();
                getForm.SetHeader("Enter Number:");
                if (getForm.ShowDialog() == DialogResult.OK)
                {
                    success = true;
                    number  = getForm.GetValue();
                }
                else
                {
                    success = false;
                }
                getForm.Dispose();

                if (success)
                {
                    string finalRequest = "search_rows_by_number";
                    if (number != "")
                    {
                        finalRequest += "," + number;
                        Networking.SendMessage(conn.GetNetworkStream(), finalRequest.ToString());
                        string result = Networking.ReadMessage(conn.GetNetworkStream());
                        richTextBox1.Text = "Fetch result:";
                        if (result != "null")
                        {
                            richTextBox1.Text += Environment.NewLine + result;
                        }
                        else
                        {
                            richTextBox1.Text += Environment.NewLine + "No results found!";
                        }
                    }
                    else
                    {
                        richTextBox1.Text = "Invalid input!";
                    }
                }
            }
            else
            {
                richTextBox1.Text = "Cannot perform action because of no connection to the server!";
            }
        }
Example #2
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (conn.GetConnectionStatus())
            {
                bool    success = false;
                int     id      = -1;
                GetForm getForm = new GetForm();
                getForm.SetFormHeader("Delete");
                getForm.SetHeader("Enter Index:");
                getForm.SetAcceptOnlyNumbers(true);
                if (getForm.ShowDialog() == DialogResult.OK)
                {
                    Int32.TryParse(getForm.GetValue(), out id);
                    success = true;
                }
                else
                {
                    success = false;
                }
                getForm.Dispose();

                if (success)
                {
                    string finalRequest = "delete_rows";
                    if (id != -1)
                    {
                        finalRequest += "," + id;
                        Networking.SendMessage(conn.GetNetworkStream(), finalRequest.ToString());
                        string result = Networking.ReadMessage(conn.GetNetworkStream());
                        richTextBox1.Text = result;
                    }
                    else
                    {
                        richTextBox1.Text = "Invalid input!";
                    }
                }
            }
            else
            {
                richTextBox1.Text = "Cannot perform action because of no connection to the server!";
            }
        }
Example #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            GetForm getForm = new GetForm();

            getForm.ShowDialog();
        }