void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Warning = ((CrowdUserManager.DialogBox)(target)); return; case 2: this.messageTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 3: this.image = ((System.Windows.Controls.Image)(target)); return; case 4: this.cancelButton = ((System.Windows.Controls.Button)(target)); #line 12 "..\..\DialogBox.xaml" this.cancelButton.Click += new System.Windows.RoutedEventHandler(this.buttonCancel_Click); #line default #line hidden return; case 5: this.OKbutton = ((System.Windows.Controls.Button)(target)); #line 13 "..\..\DialogBox.xaml" this.OKbutton.Click += new System.Windows.RoutedEventHandler(this.OKbutton_Click); #line default #line hidden return; } this._contentLoaded = true; }
private void recreateButton_Click(object sender, RoutedEventArgs e) { newDomain = targetDomainComboBox.Text; getCredentials(domain); if (userNameLabel.Content.ToString() == "") { MessageBox1("'User Name' field is empty"); return; } DialogBox DialogBox1 = new DialogBox(); DialogBox1.Show("User '" + userName + "' will be recreated in " + targetDomainComboBox.Text + " derictory. Would you like to continue?"); if (DialogBox1.DialogResult == true) { string removeUserURL = "/user?username="******""; retrive.DELETE(serverURL + removeUserURL, auth, out data); getCredentials(newDomain); try { //create string pass = "******" + DateTime.Now.Millisecond.ToString() + "Epam"; string url = serverURL + "/user"; string XmlDocument = "<user name=\"" + userName + "\" expand=\"attributes\"><first-name>" + firstName + "</first-name><last-name>" + lastName + "</last-name><display-name>" + firstName + " " + lastName + "</display-name><email>" + email + "</email><active>true</active><attributes><link rel=\"self\" href=\"/user/attribute?username="******"\"/></attributes><password><link rel=\"edit\" href=\"/user/password?username="******"\"/><value>" + pass + "</value></password></user>"; retrive = new getResponse(); data = ""; retrive.POST(url, XmlDocument, auth, out data); //set group foreach (string group in userGroupsList) { string addToGroupURL = "/user/group/direct?username="******"<group name=\"" + group + "\"/>"; retrive = new getResponse(); data = ""; retrive.POST(serverURL + addToGroupURL + userName, XmlDocument, auth, out data); } sendPassword(); MessageBox1(userNameLabel.Content + " was successfully recreated in " + targetDomainComboBox.Text + " directory"); this.DialogResult = true; log("Recreate - " + userNameLabel.Content + " was successfully recreated in " + targetDomainComboBox.Text + " directory"); Close(); } catch (Exception ex) { MessageBox1(ex.Message); } } }