protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService"); int ID = (int)e.Keys["userId"]; RestaurantServiceReference.Customer customer = new RestaurantServiceReference.Customer(); string username = (string)e.NewValues["username"]; string email = (string)e.NewValues["email"]; string password = (string)e.NewValues["password"]; string contactno = (string)e.NewValues["contactno"]; customer.UserId = ID; customer.Username = username; customer.Email = email; customer.Password = password; customer.ContactNo = contactno; client.UpdateUser(customer); GridView1.EditIndex = -1; lblStatus.Text = "Customer Updated Successfully..."; lblStatus.ForeColor = System.Drawing.Color.Green; BindData(); }
protected void Btn_Register_Click(object sender, EventArgs e) { try { if (Page.IsValid) { client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService"); RestaurantServiceReference.Customer user = new RestaurantServiceReference.Customer(); user.Username = txtUsername.Text; user.Password = txtPassword.Text; user.Email = txtEmail.Text; user.ContactNo = txtContactNo.Text; try { client.RegisterUser(user); } catch (FaultException ex) { // lblStatus.Text = ex.Message.ToString(); //lblStatus.ForeColor = System.Drawing.Color.Red; Console.Write(ex.Message.ToString()); } Session["username"] = txtUsername.Text; Response.Redirect("Customer_Home.aspx"); } } catch (Exception ex) { Console.Write(ex.Message.ToString()); } }
protected void Btn_Add_Restaurant_Click(object sender, EventArgs e) { RestaurantServiceReference.RestaurantServiceClient client = new RestaurantServiceReference.RestaurantServiceClient("BasicHttpBinding_IRestaurantService"); RestaurantServiceReference.Customer customer = new RestaurantServiceReference.Customer(); customer.Username = txtUsername.Text; customer.Email = txtEmail.Text; customer.ContactNo = txtContactNo.Text; client.UpdateUser(customer); lblStatus.Text = "Profile Updated Successffully"; lblStatus.ForeColor = System.Drawing.Color.Green; }