Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Adding New Employee Records

            if ((txtCusID.Text != "") || (txtName.Text != "") || (txtEmail.Text != "") || (txtPhone.Text != ""))
            {
                try
                {
                    MyService.Customer customer = new MyService.Customer();
                    customer.CusID = txtCusID.Text;
                    customer.Name  = txtName.Text;
                    customer.Email = txtEmail.Text;
                    customer.Phone = txtPhone.Text;
                    customer.Type  = rbtnGender.SelectedItem.Text;

                    MyService.CustomerServiceClient client = new MyService.CustomerServiceClient();
                    lblMsg.Text = "Employee ID: " + customer.CusID + ", " + client.AddCustomerRecord(customer);
                }
                catch (Exception ex)
                {
                    lblMsg.Text = "Employee ID must be unique! " + ex;
                }
            }
            else
            {
                lblMsg.Text      = "All fields are mandatory! ";
                lblMsg.ForeColor = System.Drawing.Color.Red;
            }
        }
Esempio n. 2
0
        //Bind Grid
        public void BindGridData()
        {
            DataSet ds = new DataSet();

            MyService.CustomerServiceClient client = new MyService.CustomerServiceClient();
            ds = client.GetCustomerRecords();
            grdEmployees.DataSource = ds;
            grdEmployees.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DataSet ds = new DataSet();
         MyService.CustomerServiceClient client = new MyService.CustomerServiceClient();
         ds = client.GetCustomerRecords();
         grdEmployees.DataSource = ds;
         grdEmployees.DataBind();
     }
 }
Esempio n. 4
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            MyService.CustomerServiceClient client = new MyService.CustomerServiceClient();

            MyService.Customer employee = new MyService.Customer();
            employee.CusID = txtSearch.Text.Trim();
            string result = client.DeleteRecords(employee);

            if (result == "Record Deleted Successfully!")
            {
                BindGridData();
                lblSearchResult.Text = "Employee ID: " + txtSearch.Text.Trim() + "Deleted Successfully!";
            }
            else
            {
                lblSearchResult.Text = "Employee ID: " + txtSearch.Text.Trim() + "Not Found!";
            }
        }