protected void check_Click(object sender, EventArgs e)
 {
     ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
     if (custId.Text == "")
     {
         Label2.Text = "Please Enter Customer ID";
     }
     else
     {
         DataSet ds = sc.getSpecificCustomer(int.Parse(custId.Text));
         if (ds.Tables[0].Rows.Count == 0)
         {
             Label2.Text       = "No Customers :(";
             result.DataSource = ds;
             result.DataBind();
             add.Visible    = true;
             edit.Visible   = false;
             delete.Visible = false;
         }
         else
         {
             Label2.Text       = "Customer Already Exists!";
             result.DataSource = ds;
             result.DataBind();
             add.Visible    = false;
             edit.Visible   = true;
             delete.Visible = true;
         }
     }
 }
Example #2
0
    /*This function takes customer Id entered in the text box and on clicking the button all available accounts for
     * the corresponding customer Id is displayed by recieving a DataSet and filling the GridView*/
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        IList <Account> aobj = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));
        int             rows = aobj.Count;

        if (rows == 0)
        {
            Label2.Text          = Resources.Resource.customerNotExists;
            GridView1.DataSource = aobj;
            GridView1.DataBind();
            AddButton.Visible    = false;
            EditButton.Visible   = false;
            DeleteButton.Visible = false;
        }
        else if (int.Parse(aobj[0].customerId.ToString()) == int.Parse(CustomerIdTextBox.Text.ToString()) && aobj[0].accountNo != 0)
        {
            Label2.Text          = Resources.Resource.accountFound;
            GridView1.DataSource = aobj;
            GridView1.DataBind();
            AddButton.Visible    = true;
            EditButton.Visible   = true;
            DeleteButton.Visible = true;
        }
        else
        {
            Label2.Text          = Resources.Resource.customerExists;
            AddButton.Visible    = true;
            EditButton.Visible   = false;
            DeleteButton.Visible = false;
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["role"].ToString() != "Customer")
        {
            Response.Redirect("LoginPageMaster.aspx");
        }
        else
        {
            try
            {
                ServiceReference1.Service1Client obj = new ServiceReference1.Service1Client();
                int      acc   = int.Parse(Session["accountNo"].ToString());
                DateTime start = DateTime.Parse(Session["startdate"].ToString());
                DateTime end   = DateTime.Parse(Session["enddate"].ToString());

                IList <Transaction> sobj = obj.customstatement(acc, start, end);

                GridView1.DataSource = sobj;
                GridView1.DataBind();
            }

            catch (Exception exe)
            {
                Label1.Text = System.Configuration.ConfigurationManager.AppSettings["invalidDetails"];
            }
        }
    }
Example #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["role"].ToString() == "Customer")
        {
            Role.Text = Session["role"].ToString();
            ServiceReference1.Service1Client obj = new ServiceReference1.Service1Client();
            string id = Session["userId"].ToString();
            //var v = obj.accountFromCustomer(id);
            //obj.
            //SqlDataReader dr = v;
            IList <Account> aobj = obj.accountFromCustomer(id);


            if (aobj.Count != 0)
            {
                GridView1.DataSource = aobj;
                GridView1.DataBind();
            }
            else
            {
                submit.Visible = false;
                ErrorMsg.Text  = System.Configuration.ConfigurationManager.AppSettings["accountNotFound"];
            }
        }
        else
        {
            Response.Redirect("LoginPageMaster.aspx");
        }
    }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["role"].ToString() != "Customer")
        {
            Response.Redirect("LoginPageMaster.aspx");
        }
        else
        {
            //try
            //{
            ServiceReference1.Service1Client obj = new ServiceReference1.Service1Client();
            int acc = int.Parse(Session["accountNo"].ToString());
            Master.HeaderAccountLabel.Text = Session["accountNo"].ToString();
            DateTime start = DateTime.Parse(Session["startdate"].ToString());
            DateTime end   = DateTime.Parse(Session["enddate"].ToString());

            IList <Transaction> transactionList = obj.customstatement(acc, start, end);

            if (transactionList.Count == 0)
            {
                Label1.Text = "No Transactions Available";
            }
            else
            {
                GridView1.DataSource = transactionList;
                GridView1.DataBind();
            }
            //}

            //catch (Exception exe)
            //{
            //    Label1.Text = Resources.Resource.invalidDetails;
            //}
        }
    }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["role"] != "Manager")
            {
                Response.Redirect("LoginPageMaster.aspx");
            }
            else
            {
                ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
                IList <customer> ulist = sc.getSpecificCustomer(int.Parse((Session["custId"]).ToString()));
                if (ulist.Count == 0)
                {
                    Label2.Text = ConfigurationManager.AppSettings["noCustomersMessage"];
                }
                else
                {
                    custName1.Text = ulist[0].CustomerName.ToString();

                    address.Text     = ulist[0].Address.ToString();
                    pinCode.Text     = ulist[0].Pincode.ToString();
                    phoneNumber.Text = ulist[0].PhoneNo.ToString();
                    email2.Text      = ulist[0].Email.ToString();
                    //oldEmailId = ulist[0].Email.ToString();
                }
            }
        }
    }
        public async void GetOffices()
        {
            try
            {
                IsBusy = true;
                InternalControlOfficeResult off;

                Dbcontext  = new ServiceReference1.Service1Client(ServiceReference1.Service1Client.EndpointConfiguration.BasicHttpBinding_IService1);
                AllOffices = new ObservableCollection <InternalControlOfficeResult>();
                var result = Dbcontext.GetOfficeInternalControlsGoalVsResult(Application.Current.Properties["UN"].ToString(),
                                                                             Application.Current.Properties["PW"].ToString(), Application.Current.Properties["Ucid"].ToString(),
                                                                             Convert.ToInt32(Application.Current.Properties["CompanyId"].ToString()));

                foreach (InternalControlOfficeResultsData data in result)
                {
                    off = new InternalControlOfficeResult
                    {
                        Id         = data.OfficeData.Id,
                        OfficeName = data.OfficeData.Name
                    };

                    AllOffices.Add(off);
                }

                IsBusy = false;
            }
            catch (Exception e)
            {
                IsBusy = false;
                await Application.Current.MainPage.DisplayAlert("Fel", e.Message, "Stäng");
            }
        }
Example #8
0
    /*This is the confirm deletion button which actually deletes the row in the database and displays
     * the updated table*/
    protected void DeleteAccountButton_Click(object sender, EventArgs e)
    {
        bool returnValue;
        long accountToBeDeleted = GetSelectedRecord();

        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        returnValue = sc.DeleteAccount(accountToBeDeleted);
        if (returnValue)
        {
            Label2.Text = "Account deleted successfully";
            DataSet ds = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));

            //This if-else displays the updated table after deletion

            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 deleted!!";
        }
    }
        public async void GetOffices()
        {
            try
            {
                IsBusy    = true;
                Dbcontext = new ServiceReference1.Service1Client(ServiceReference1.Service1Client.EndpointConfiguration.BasicHttpBinding_IService1);
                Office off;

                //await Dbcontext.OpenAsync();


                var result = Dbcontext.GetOfficesByCompanyId(Application.Current.Properties["UN"].ToString(),
                                                             Application.Current.Properties["PW"].ToString(), Application.Current.Properties["Ucid"].ToString(),
                                                             Convert.ToInt32(Application.Current.Properties["CompanyId"].ToString()));
                AllOffices = new ObservableCollection <Office>();
                foreach (ServiceReference1.OfficeData data in result)
                {
                    off      = new Office();
                    off.Name = data.Name;
                    off.Id   = data.Id;


                    AllOffices.Add(off);
                }

                IsBusy = false;
            }
            catch (Exception e)
            {
                IsBusy = false;
                await Application.Current.MainPage.DisplayAlert("", e.Message, "Stäng");
            }
        }
Example #10
0
    /*This is the confirm deletion button which actually deletes the row in the database and displays
     * the updated table*/
    protected void DeleteAccountButton_Click(object sender, EventArgs e)
    {
        bool returnValue;
        long accountToBeDeleted = GetSelectedRecord();

        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        returnValue = sc.DeleteAccount(accountToBeDeleted);
        if (returnValue)
        {
            Label2.Text = Resources.Resource.accountDeleted;
            IList <Account> aobj = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));

            //This if-else displays the updated table after deletion

            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.accountNotDeleted;
        }
    }
Example #11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        Employee emp = sc.GetEmployeeById(int.Parse(TextBox4.Text));

        TextBox2.Text = emp.Name;
        TextBox3.Text = emp.Salary;
    }
Example #12
0
        static void Main(string[] args)
        {
            var client = new ServiceReference1.Service1Client(
                Service1Client.EndpointConfiguration.NetTcpEndpoint,
                new EndpointAddress(new Uri("net.tcp://tpainvwaxpxy02.corp.temp.lcl/Service1.svc/netTcpTest"),
                                    new UpnEndpointIdentity("*****@*****.**")));
            var result = client.GetDataAsync(1).Result;

            Console.WriteLine(result);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["role"] != "Customer")
        {
            Response.Redirect("LoginPageMaster.aspx");
        }
        else
        {
            ServiceReference1.Service1Client obj = new ServiceReference1.Service1Client();
            Ministate.DataSource = obj.ministatement(long.Parse(Session["accountNo"].ToString()));


            Ministate.DataBind();
        }
    }
    protected void deleteCustomerBtn_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        int customerID    = int.Parse(custId.Text);
        int rows_affected = sc.deleteCustomer(customerID);

        if (rows_affected == 0)
        {
            Label2.Text = Resources.Resource.customerNotDeleted;
        }
        else
        {
            Label2.Text = Resources.Resource.customerDeleted;
        }
    }
Example #15
0
    protected void deleteCustomerBtn_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        int customerID    = int.Parse(custId.Text);
        int rows_affected = sc.deleteCustomer(customerID);

        if (rows_affected == 0)
        {
            Label2.Text = "Error while deleting customer";
        }
        else
        {
            Label2.Text = "Customer Deleted!";
        }
    }
Example #16
0
    protected void showAllCustomersBtn_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        IList <customer> slist = sc.showAll();

        if (slist.Count == 0)
        {
            Label2.Text       = ConfigurationManager.AppSettings["noCustomersMessage"];
            result.DataSource = slist;
            result.DataBind();
        }
        else
        {
            result.DataSource = slist;
            result.DataBind();
        }
    }
    protected void addCustomerBtn_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc       = new ServiceReference1.Service1Client();
        ServiceReference1.customer       customer = new ServiceReference1.customer();
        addCustomerDetails(customer);
        sc.addLogin(customer.Email, "123456", "Customer");
        int rows_affected = sc.addCustomer(customer);

        if (rows_affected == 0)
        {
            Label2.Text = System.Configuration.ConfigurationManager.AppSettings["customerAddingError"];
        }
        else
        {
            Label2.Text = System.Configuration.ConfigurationManager.AppSettings["customerAdded"];
        }
    }
Example #18
0
    protected void addCustomerBtn_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc       = new ServiceReference1.Service1Client();
        ServiceReference1.customer       customer = new ServiceReference1.customer();
        addCustomerDetails(customer);
        sc.addLogin(customer.Email, "123456", "Customer");
        int rows_affected = sc.addCustomer(customer);

        if (rows_affected == 0)
        {
            Label2.Text = Resources.Resource.customerAddingError;
        }
        else
        {
            Label2.Text = Resources.Resource.customerAdded;
        }
    }
Example #19
0
    protected void showAllCustomersBtn_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        DataSet ds = sc.showAll();

        if (ds.Tables[0].Rows.Count == 0)
        {
            Label2.Text       = "No Customers :(";
            result.DataSource = ds;
            result.DataBind();
        }
        else
        {
            result.DataSource = ds;
            result.DataBind();
        }
    }
    protected void showAllCustomersBtn_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        IList <customer> customersList      = sc.showAll();

        if (customersList.Count == 0)
        {
            Label2.Text = Resources.Resource.noCustomersMessage;
            //result.DataSource = customersList;
            //result.DataBind();
        }
        else
        {
            //ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Odisha-City: " + customersList[1].City + "');", true);
            result.DataSource = customersList;
            result.DataBind();
        }
    }
Example #21
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!!";
        }
    }
Example #22
0
    /*This button is clicked after selecting one of the radio buttons. It checks which radio button is selected and
     * then displays the corresponding text boxes forthe managers/staff to enter edited values. This function popualtes
     * the previous values first into the text boxes and then the manager/staff can change those values */
    protected void EditButton_Click(object sender, EventArgs e)
    {
        long selectedRecord;

        selectedRecord = GetSelectedRecord();

        if (selectedRecord == 0)
        {
            Label2.Text = "Please select an account to edit!!";
        }

        //Making all fields visible
        else
        {
            Label2.Text = selectedRecord + "";

            AccountTypeLabel.Visible          = true;
            AccountTypeTextBox.Visible        = true;
            DateOfOpeneningLabel.Visible      = true;
            DateOfOpeneningTextBox.Visible    = true;
            StatusLabel.Visible               = true;
            StatusTextBox.Visible             = true;
            DateOfEditedLabel.Visible         = true;
            DateOfEditedTextBox.Visible       = true;
            ClosingDateLabel.Visible          = true;
            ClosingDateTextBox.Visible        = true;
            AmountLabel.Visible               = true;
            AmountTextBox.Visible             = true;
            EditedDetailsSubmitButton.Visible = true;


            ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
            DataSet ds = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));


            //This is to populate existing values into text boxes
            AccountTypeTextBox.Text     = ds.Tables[0].Rows[i]["accountType"].ToString();
            DateOfOpeneningTextBox.Text = ds.Tables[0].Rows[i]["DateOfOpen"].ToString();
            StatusTextBox.Text          = ds.Tables[0].Rows[i]["status"].ToString();
            DateOfEditedTextBox.Text    = ds.Tables[0].Rows[i]["dateOfEdited"].ToString();
            ClosingDateTextBox.Text     = ds.Tables[0].Rows[i]["ClosingDate"].ToString();
            AmountTextBox.Text          = ds.Tables[0].Rows[i]["amount"].ToString();
        }
    }
Example #23
0
    /*This button is clicked after selecting one of the radio buttons. It checks which radio button is selected and
     * then displays the corresponding text boxes forthe managers/staff to enter edited values. This function popualtes
     * the previous values first into the text boxes and then the manager/staff can change those values */
    protected void EditButton_Click(object sender, EventArgs e)
    {
        long selectedRecord;

        selectedRecord = GetSelectedRecord();

        if (selectedRecord == 0)
        {
            Label2.Text = Resources.Resource.accountError;
        }

        //Making all fields visible
        else
        {
            Label2.Text = selectedRecord + "";

            AccountTypeLabel.Visible       = true;
            AccountTypeTextBox.Visible     = true;
            DateOfOpeneningLabel.Visible   = true;
            DateOfOpeneningTextBox.Visible = true;
            StatusLabel.Visible            = true;
            StatusTextBox.Visible          = true;
            DateOfEditedLabel.Visible      = true;
            DateOfEditedTextBox.Visible    = true;
            ClosingDateLabel.Visible       = true;
            ClosingDateTextBox.Visible     = true;
            AmountLabel.Visible            = true;
            AmountTextBox.Visible          = true;
            //EditedDetailsSubmitButton.Visible = true;
            DetailsSubmitButton.Visible = false;

            ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
            IList <Account> aobj = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));


            //This is to populate existing values into text boxes
            AccountTypeTextBox.Text     = aobj[0].accountType.ToString();
            DateOfOpeneningTextBox.Text = aobj[0].DateOfOpen.ToString();
            StatusTextBox.SelectedValue = aobj[0].status;
            DateOfEditedTextBox.Text    = aobj[0].dateOfEdited.ToString();
            ClosingDateTextBox.Text     = aobj[0].ClosingDate.ToString();
            AmountTextBox.Text          = aobj[0].amount.ToString();
        }
    }
Example #24
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;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        DataSet ds = sc.getSpecificCustomer(int.Parse((Session["custId"]).ToString()));

        if (ds.Tables[0].Rows.Count == 0)
        {
            Label2.Text = "No Customer exists, please check the customer ID";
        }
        else
        {
            custName.Text    = ds.Tables[0].Rows[0]["customerName"].ToString();
            address.Text     = ds.Tables[0].Rows[0]["address"].ToString();
            pinCode.Text     = ds.Tables[0].Rows[0]["pincode"].ToString();
            phoneNumber.Text = ds.Tables[0].Rows[0]["phoneNo"].ToString();
            email.Text       = ds.Tables[0].Rows[0]["email"].ToString();
            oldEmailId       = ds.Tables[0].Rows[0]["email"].ToString();
        }
    }
Example #26
0
    /*This function takes customer Id entered in the text box and on clicking the button all available accounts for
     * the corresponding customer Id is displayed by recieving a DataSet and filling the GridView*/
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
        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();
        }
    }
Example #27
0
    //string oldEmailId; // REPRESENTS THE OLD EMAIL ID, USED TO UPDATE CUSTOMER LOGIN DETAILS

    protected void editCustomerBtn_Click(object sender, EventArgs e)
    {
        ServiceReference1.Service1Client sc       = new ServiceReference1.Service1Client();
        ServiceReference1.customer       customer = new ServiceReference1.customer();
        customer = addCustomerDetails(customer);
        //fillData();
        /*if (customer.Email != oldEmailId) *///oldEmailId is global variable
        //sc.updateUserId(customer.Email, oldEmailId);
        int rows_affected = sc.updateCustomer(customer);

        if (rows_affected == 0)
        {
            Label2.Text = "Error while updating customer";
        }
        else
        {
            Label2.Text = "Customer Updated!";
        }
    }
Example #28
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";
        }
    }
Example #29
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;
        }
    }
Example #30
0
    /*This method is called whenever we need to check which radio button is selected and returns the account number
     * of the selected row */
    private long GetSelectedRecord()
    {
        ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();

        for (i = 0; i < GridView1.Rows.Count; i++)
        {
            RadioButton rb = (RadioButton)GridView1.Rows[i].Cells[0].FindControl("RadioButton1");
            if (rb != null)
            {
                if (rb.Checked)
                {
                    DataSet ds = sc.GetCustomerId(int.Parse(CustomerIdTextBox.Text));

                    //Returning the account number of selected row
                    return((long)ds.Tables[0].Rows[i]["accountNo"]);
                }
            }
        }

        return(0);
    }