예제 #1
0
    /*This button is displayed at the end, when all text boxes are filled and the manager/staff wants to add the
     * all the values in the text boxes into the database */
    protected void DetailsSubmitButton_Click(object sender, EventArgs e)
    {
        bool returnValue;

        string[] Details = { CustomerIdTextBox.Text,
                             AccountTypeTextBox.Text,
                             DateTime.Today.ToString("dd-MM-yyyy"),
                             StatusTextBox.Text,
                             DateTime.Today.ToString("dd-MM-yyyy"),
                             ClosingDateTextBox.Text,
                             AmountTextBox.Text };

        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        returnValue = sc.AddAccount(Details);

        if (returnValue)
        {
            Label2.Text = "Account Added successfully";

            //This is to display updated gridview after insertion
            DataSet ds = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));
            if (ds.Tables[0].Rows.Count == 0)
            {
                Label2.Text          = "No Accounts available";
                GridView1.DataSource = ds;
                GridView1.DataBind();
            }

            else
            {
                Label2.Text          = "Accounts available are";
                GridView1.DataSource = ds;
                GridView1.DataBind();
            }
        }

        else
        {
            Label2.Text = "Account not Added";
        }
    }
예제 #2
0
    /*This button is displayed at the end, when all text boxes are filled and the manager/staff wants to add the
     * all the values in the text boxes into the database */
    protected void DetailsSubmitButton_Click(object sender, EventArgs e)
    {
        bool returnValue;

        string[] Details = { CustomerIdTextBox.Text,
                             AccountTypeTextBox.Text,
                             DateTime.Today.ToString("dd-MM-yyyy"),
                             StatusTextBox.Text,
                             DateTime.Today.ToString("dd-MM-yyyy"),
                             ClosingDateTextBox.Text,
                             AmountTextBox.Text };

        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        returnValue = sc.AddAccount(Details);

        if (returnValue)
        {
            Label2.Text = Resources.Resource.accountAdded;

            //This is to display updated gridview after insertion
            IList <Account> aobj = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));
            if (aobj.Count == 0)
            {
                Label2.Text          = Resources.Resource.accountNotFound;
                GridView1.DataSource = aobj;
                GridView1.DataBind();
            }

            else
            {
                Label2.Text          = Resources.Resource.accountFound;
                GridView1.DataSource = aobj;
                GridView1.DataBind();
            }
        }

        else
        {
            Label2.Text = Resources.Resource.accountNotAdded;
        }
    }