private void btnSave_Click(object sender, RoutedEventArgs e) { if (Validation.GetHasError(txtUserName) || Validation.GetHasError(txtPassword) || Validation.GetHasError(txtPhone) || Validation.GetHasError(txtMobile) || Validation.GetHasError(txtEmailId) || Validation.GetHasError(txtAddress) || Validation.GetHasError(txtPinCode)) { MessageBox.Show("Enter Valid Data"); } if (id == 0) { AdminService.AddEditOperator obj1 = new AdminService.AddEditOperator(); obj1.UserName = txtUserName.Text; obj1.Password = txtPassword.Password; obj1.ConfirmPassword = txtConfirmPassword.Password; obj1.Name = txtName.Text; obj1.Initials = (ddlInitials.SelectedItem as ComboBoxItem).Content.ToString(); obj1.DateOfBirth = Convert.ToDateTime(dtDOB.SelectedDate); obj1.Gender = rbtnMale.IsChecked == true ? "Male" : "Female"; obj1.Phone = txtPhone.Text; obj1.Mobile = txtMobile.Text; obj1.EmailId = txtEmailId.Text; obj1.Address = txtAddress.Text; obj1.PinCode = txtPinCode.Text; obj1.Country = ((MemoriesEdge.AdminService.CountryStateCity)(ddlCountry.SelectedItem)).Country.ToString(); obj1.State = ((MemoriesEdge.AdminService.CountryStateCity)(ddlState.SelectedItem)).State.ToString(); obj1.City = ((MemoriesEdge.AdminService.CountryStateCity)(ddlCity.SelectedItem)).City.ToString(); AdminService.IwcfAdminClient objss = new AdminService.IwcfAdminClient(); objss.AddNewUserCompleted += new EventHandler <AdminService.AddNewUserCompletedEventArgs>(objss_AddNewUserCompleted); objss.AddNewUserAsync(obj1); } else { } }
private void Page_Loaded(object sender, RoutedEventArgs e) { BindAllCountries(); if (id != 0) { obje = new AdminService.AddEditOperator(); obje.UserId = id; AdminService.IwcfAdminClient obj = new AdminService.IwcfAdminClient(); obj.GetDetailCompleted += new EventHandler <AdminService.GetDetailCompletedEventArgs>(obj_GetDetailCompleted); obj.GetDetailAsync(obje); } else { } }
void obj_GetDetailCompleted(object sender, AdminService.GetDetailCompletedEventArgs e) { obje = e.Result as MemoriesEdge.AdminService.AddEditOperator; txtUserName.Text = obje.UserName; txtPassword.Password = obje.Password; txtConfirmPassword.Password = obje.Password; ddlInitials.SelectedValue = obje.Initials; txtName.Text = obje.Name; dtDOB.Text = (obje.DateOfBirth).ToString(); if (obje.Gender == "Male") { rbtnMale.IsChecked = true; rbtnFemale.IsChecked = false; } else { rbtnMale.IsChecked = false; rbtnFemale.IsChecked = true; } txtPhone.Text = obje.Phone; txtMobile.Text = obje.Mobile; txtEmailId.Text = obje.EmailId; txtPinCode.Text = obje.PinCode; CountryId = obje.CountryId; StateId = obje.StateId; CityId = obje.CityId; //BindAllStates(CountryId); //BindAllCity(StateId); ((MemoriesEdge.AdminService.CountryStateCity)(ddlCountry.SelectedItem)).Country = obje.Country; ddlCountry_SelectionChanged(null, null); obj_GetAllCountryCompleted(null, null); // // objs_GetAllStateCompleted(null, null); // //(ddlCountry.SelectedItem as ComboBoxItem).Content = obje.Country; // //(ddlState.SelectedItem as ComboBoxItem).Content = obje.State; // //(ddlCity.SelectedItem as ComboBoxItem).Content = obje.City; ////' ddlCity.SelectedValue = obje.City; // // ddlState.SelectedValue = obje.State; txtAddress.Text = obje.Address; txtPinCode.Text = obje.PinCode; }