protected void Page_Load(object sender, EventArgs e) { var client = new CustomerManagementServiceClient(); GridView1.DataSource = client.ListCustomer(); GridView1.DataBind(); }
protected void ButtonUpdate_Click(object sender, EventArgs e) { var accountId = Convert.ToInt32(TextBoxAccountId.Text); var client = new CustomerManagementServiceClient(); var customer = new Customer() { Email = TextBoxEmail.Text, FirstName = TextBoxFirstName.Text, LastName = TextBoxLastName.Text, PhoneNo = TextBoxPhoneNo.Text, DateOfBirth = TextBoxDateOfBirth.Text, HouseNo = TextBoxHouseNo.Text, StreetName = TextBoxStreetName.Text, Town = TextBoxTown.Text, PostCode = TextBoxPostCode.Text }; string message = client.UpdateCustomerDetails(accountId, customer); LabelReturnMessage.Text = message; TextBoxEmail.Text = ""; TextBoxFirstName.Text = ""; TextBoxLastName.Text = ""; TextBoxPhoneNo.Text = ""; TextBoxDateOfBirth.Text = ""; TextBoxHouseNo.Text = ""; TextBoxStreetName.Text = ""; TextBoxTown.Text = ""; TextBoxPostCode.Text = ""; }
private CustomerManagementServiceClient Check() { if (cs == null) { cs = new CustomerManagementServiceClient("BasicHttpBinding_ICustomerManagementService"); } else if (cs.State != CommunicationState.Opened && cs.State != CommunicationState.Opening) { try { cs.Open(); } catch { } } return(cs); }
protected void ButtonDelete_Click(object sender, EventArgs e) { var client = new CustomerManagementServiceClient(); int accountId = Convert.ToInt32(TextBoxAccountId.Text); string deleteMessage = client.DeleteDetails(accountId); LabelReturnMessage.Text = deleteMessage; TextBoxEmail.Text = ""; TextBoxFirstName.Text = ""; TextBoxLastName.Text = ""; TextBoxPhoneNo.Text = ""; TextBoxDateOfBirth.Text = ""; TextBoxHouseNo.Text = ""; TextBoxStreetName.Text = ""; TextBoxTown.Text = ""; TextBoxPostCode.Text = ""; }
protected void BTNSearch_Click(object sender, EventArgs e) { var client = new CustomerManagementServiceClient(); int accountId = Convert.ToInt32(TextBoxAccountId.Text); var customer = new Customer(); customer = client.RetrieveCustomerDetails(accountId); TextBoxEmail.Text = customer.Email; TextBoxFirstName.Text = customer.FirstName; TextBoxLastName.Text = customer.LastName; TextBoxPhoneNo.Text = customer.PhoneNo; TextBoxDateOfBirth.Text = customer.DateOfBirth; TextBoxHouseNo.Text = customer.HouseNo; TextBoxStreetName.Text = customer.StreetName; TextBoxTown.Text = customer.Town; TextBoxPostCode.Text = customer.PostCode; }
/// <summary> /// Begins an authenticated session, populating the <see cref="Data"/> /// and <see cref="Management"/> properties. /// </summary> /// <param name="authToken">the authentication token provided by <see cref="Auth"/></param> public void BeginSession(AuthToken authToken) { Data = new SalesEntities(new Uri(BaseEndpoint, "Data.svc")) { MergeOption = MergeOption.OverwriteChanges // needed to expand properties }; Data.SendingRequest2 += (sender, args) => { args.RequestMessage.SetHeader(AuthTokenHeaderName, authToken.Hash); }; var management = new CustomerManagementServiceClient( new BasicHttpBinding(), new EndpointAddress(new Uri(BaseEndpoint, "CustomerManagement.svc"))); management.Endpoint.Behaviors.Add(new AddHttpHeaderEndpointBehavior(AuthTokenHeaderName, authToken.Hash)); Management = management; }
protected void ButtonSearch_Click(object sender, EventArgs e) { var today = DateTime.Now; TextBoxBookingDate.Text = today.ToString("dd-MMM-yyyy"); var client = new CustomerManagementServiceClient(); DataSet ds = new DataSet(); int data = Convert.ToInt32(TextBoxAccountID.Text); ds = client.GetCusomterInfo(data); TextBoxEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString(); TextBoxFirstName.Text = ds.Tables[0].Rows[0]["FirstName"].ToString(); TextBoxLastName.Text = ds.Tables[0].Rows[0]["LastName"].ToString(); TextBoxPhoneNo.Text = ds.Tables[0].Rows[0]["PhoneNo"].ToString(); TextBoxAge.Text = ds.Tables[0].Rows[0]["Column1"].ToString(); TextBoxHouseNo.Text = ds.Tables[1].Rows[0]["HouseNo"].ToString(); TextBoxStreetName.Text = ds.Tables[1].Rows[0]["StreetName"].ToString(); TextBoxTown.Text = ds.Tables[1].Rows[0]["Town"].ToString(); TextBoxPostCode.Text = ds.Tables[1].Rows[0]["PostCode"].ToString(); }
public CustomerMHelper(EventHandler <LogEventArgs> handler = null) : base(handler) { cs = new CustomerManagementServiceClient("BasicHttpBinding_ICustomerManagementService"); }