Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            lblOutput.Text = "";
            if (MessageBox.Show("Adding row to the database discards changes\nDo you wish to proceed?",
                "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                return;
            try
            {
                //refresh connection to client
                client = new EFlatsServiceReference.WcfEFlatsServiceClient("WSHttpBinding_IWcfEFlatsService");
                int profileScore = client.GetStudentData(tbStudentEmail.Text.Trim()).Score;
                bool output = client.AddToWishlist(tbStudentEmail.Text.Trim(),
                    Convert.ToInt32(tbFlatId.Text.Trim()), profileScore);

                if (output)
                    lblOutput.Text = "Application was successfully added";
                else
                    lblOutput.Text = "An Error has accured - Unable to add application";
                RefreshTable();
            }
            catch(Exception e2)
            {
                lblOutput.Text = "Unable to connect to the Database";
            }
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            lblOutput.Text = "";
            if (MessageBox.Show("Adding row to the database discards changes\nDo you wish to proceed?",
                                "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            try
            {
                //refresh connection to client
                client = new EFlatsServiceReference.WcfEFlatsServiceClient("WSHttpBinding_IWcfEFlatsService");
                int  profileScore = client.GetStudentData(tbStudentEmail.Text.Trim()).Score;
                bool output       = client.AddToWishlist(tbStudentEmail.Text.Trim(),
                                                         Convert.ToInt32(tbFlatId.Text.Trim()), profileScore);

                if (output)
                {
                    lblOutput.Text = "Application was successfully added";
                }
                else
                {
                    lblOutput.Text = "An Error has accured - Unable to add application";
                }
                RefreshTable();
            }
            catch (Exception e2)
            {
                lblOutput.Text = "Unable to connect to the Database";
            }
        }