Beispiel #1
0
    /*This button is pressed after all the edited values are entered and then they are updated in the database.
     * The updated table is displayed again*/
    protected void EditedDetailsSubmitButton_Click(object sender, EventArgs e)
    {
        bool    returnValue;
        Account editedAccount = new Account();

        editedAccount.customerId   = int.Parse(CustomerIdTextBox.Text);
        editedAccount.accountType  = AccountTypeTextBox.Text;
        editedAccount.DateOfOpen   = DateOfOpeneningTextBox.Text;
        editedAccount.status       = StatusTextBox.Text;
        editedAccount.dateOfEdited = DateTime.Today.ToString("dd-MM-yyyy");
        editedAccount.ClosingDate  = ClosingDateTextBox.Text;
        editedAccount.amount       = int.Parse(AmountTextBox.Text);
        editedAccount.accountNo    = GetSelectedRecord();

        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();

        returnValue = sc.EditAccount(editedAccount);

        if (returnValue)
        {
            Label2.Text = "Account Edited successfully";
            DataSet ds = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));

            //This if-else is to display the updated table to the manager/staff
            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 edited!!";
        }
    }
Beispiel #2
0
    /*This button is pressed after all the edited values are entered and then they are updated in the database.
     * The updated table is displayed again*/
    protected void EditedDetailsSubmitButton_Click(object sender, EventArgs e)
    {
        bool    returnValue;
        Account editedAccount = new Account();

        editedAccount.customerId   = int.Parse(CustomerIdTextBox.Text);
        editedAccount.accountType  = AccountTypeTextBox.Text;
        editedAccount.DateOfOpen   = DateOfOpeneningTextBox.Text;
        editedAccount.status       = StatusTextBox.Text;
        editedAccount.dateOfEdited = DateTime.Today.ToString("dd-MM-yyyy");
        editedAccount.ClosingDate  = ClosingDateTextBox.Text;
        editedAccount.amount       = int.Parse(AmountTextBox.Text);
        editedAccount.accountNo    = GetSelectedRecord();

        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();

        returnValue = sc.EditAccount(editedAccount);

        if (returnValue)
        {
            Label2.Text = Resources.Resource.accountEdited;
            IList <Account> aobj = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));

            //This if-else is to display the updated table to the manager/staff
            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.accountNotEdited;
        }
    }