private void LogBox_DoubleClick(object sender, EventArgs e) { if (LogBox.SelectedItem != null) { SquadronContext.Info(LogBox.SelectedItem.ToString()); } }
private void EnsureUsers() { foreach (string user in UsersText.Lines) { if (string.IsNullOrEmpty(user)) { continue; } foreach (int i in WebList.CheckedIndices) { SPWeb web = WebList.Items[i] as SPWeb; try { web.EnsureUser(user.Trim()); SquadronContext.WriteMessage("Success: " + web.ToString() + " " + user); } catch (Exception ex) { SquadronContext.WriteMessage("Failure: " + web.ToString() + " " + user + " " + ex.ToString()); } } } SquadronContext.Info("Operation Completed.. Please check the log for details."); }
public override void Perform(object o, IExplorer explorer) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "*.cmp|*.cmp"; if (dialog.ShowDialog() == DialogResult.OK) { SquadronHelper.Instance.StartAnimation(); try { ImportExportUtility utility = new ImportExportUtility(); if (utility.Import(o as SPWeb, dialog.FileName)) { SquadronContext.Info("Imported succesfully!" + Environment.NewLine + Environment.NewLine + "Please ensure home page, list contents, features, sub sites, user permissions in the new site."); } } finally { SquadronHelper.Instance.StopAnimation(); } } }
public override void Perform(object o, IExplorer explorer) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "*.cmp|*.cmp"; if (dialog.ShowDialog() == DialogResult.OK) { SquadronHelper.Instance.StartAnimation(); SquadronContext.WriteMessage("Starting Export to file(s): " + dialog.FileName); try { ImportExportUtility utility = new ImportExportUtility(); if (utility.Export(o as SPWeb, dialog.FileName)) { string message = "Exported succesfully!" + Environment.NewLine + Environment.NewLine + "Following are the files:" + Environment.NewLine; foreach (string file in Directory.GetFiles(Helper.Instance.ExtractFolder(dialog.FileName), Helper.Instance.ExtractFileName(dialog.FileName).Replace(".cmp", "*.cmp"))) { message += file + Environment.NewLine; } SquadronContext.Info(message); } } finally { SquadronHelper.Instance.StopAnimation(); } } }
private bool InputsValid() { if ((_connection1 == null) || (_connection2 == null) || (_connection1.State != ConnectionState.Open) || (_connection2.State != ConnectionState.Open)) { SquadronContext.Info("Please ensure source/destination connections!"); return(false); } if (lst1.CheckedIndices.Count == 0) { SquadronContext.Info("Please select atleast one source table!"); return(false); } foreach (string table in lst1.CheckedItems) { bool found = false; foreach (DataRow row in _connection2.GetSchema("Tables").Rows) { if (row["TABLE_NAME"].ToString() == table) { found = true; break; } } if (!found) { SquadronContext.Info(string.Format("Table {0} do not exists in destination server. Copy cannot continue!", table)); return(false); } } return(true); }
private bool AreInputsValid() { if ((SelectedColumns.CheckedItems.Count == 0) && (AddinList.SelectedIndex != 0) && !IsListBoxSelected()) { SquadronContext.Info("Please check atleast one column!"); return(false); } return(true); }
private void LoadButton_Click(object sender, EventArgs e) { if (SquadronContext.HasCanvasData(true)) { DataTable dataTable = SquadronContext.GetCanvasDataTable(); grid.DataSource = dataTable; } else { SquadronContext.Info("No Canvas Data!"); } }
private void OkButton_Click(object sender, EventArgs e) { if (SelectedColumns.CheckedItems.Count > 0) { DataGrid = this.grid; this.DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } else { SquadronContext.Info("Please check atleast one column!"); } }
private void DoAction(List <SPListItemVersion> selectedList, bool delete) { string message = "Operation completed successfully!" + Environment.NewLine + selectedList.Count.ToString() + " version(s) "; if (delete) { message += " Deleted!"; } else { message += " Recycled!"; } bool hasErrors = false; int count = selectedList.Count; while (count > 0) { try { var v = selectedList[count - 1]; if (delete) { v.Delete(); } else { v.Recycle(); } selectedList.RemoveAt(count - 1); } catch (Exception ex) { SquadronContext.WriteMessage(ex.ToString()); hasErrors = true; } count--; } if (!hasErrors) { _versions.Clear(); grid.DataSource = _versions; SquadronContext.Info(message); } }
private void grid_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (grid.DataSource != null) { if (grid.DataSource is List <TestResultEntity> ) { List <TestResultEntity> list = grid.DataSource as List <TestResultEntity>; if (e.RowIndex < list.Count) { if (list[e.RowIndex].Exception != null) { SquadronContext.Info(list[e.RowIndex].Exception.ToString()); } } } } }
private void EmptyButton_Click(object sender, EventArgs e) { if (NameList.CheckedItems.Count == 0) { SquadronContext.Info("Please check atleast one item!"); } if (NameList.CheckedItems.Count > 0) { if (SquadronContext.Confirm("Are you sure you wanted to Clear the selected list/library?" + Environment.NewLine + "List: " + GetSelectedTitles() + Environment.NewLine + Environment.NewLine + "(If this is a Production Server, Please ensure you have Sufficient Backups)")) { PerformEmpty(); } } }
private void DeleteButton_Click(object sender, EventArgs e) { if (ItemsList.CheckedItems.Count == 0) { SquadronContext.Info("Please check atleast one item!"); } else if (ConfirmDelete()) { if (_mode == DialogMode.PermissionDelete) { Delete(); } else if (_mode == DialogMode.DeadAccountDelete) { RemoveDeadAccounts(); } } }
private void FindFileLock() { SquadronHelper.Instance.StartAnimation(); try { var processes = _fileUtility.GetProcessesLockingFile(FileText.Text); if (processes.Count > 0) { SquadronContext.Info(string.Format("Process '{0}' is using the file." + Environment.NewLine + processes.First().MainModule.FileName, processes.First().ProcessName)); } else { SquadronContext.Info("No process is currently using the file."); } } finally { SquadronHelper.Instance.StopAnimation(); } }
private void Delete() { var checkedItems = new List <NameEntity>(); foreach (NameEntity o in ItemsList.CheckedItems) { checkedItems.Add(o); } int errorCount = 0; SPSecurity.RunWithElevatedPrivileges(delegate() { foreach (NameEntity ne in checkedItems) { SPSecurableObject spso = ne.SecurableObject.InternalObject as SPSecurableObject; ne.Deleted = false; try { if (string.IsNullOrEmpty(ne.ContainerSPGroup)) { spso.RoleAssignments.Remove(ne.Principal); } else { RemoveUserFromSharePointGroup(ne, spso); } ne.Deleted = true; } catch (Exception ex) { SquadronContext.WriteMessage(ex.ToString()); errorCount++; ne.Deleted = false; } // Remove from Groups if (ne.Principal is SPGroup) { if (spso is SPWeb) { try { if (string.IsNullOrEmpty(ne.ContainerSPGroup)) { bool old = (spso as SPWeb).AllowUnsafeUpdates; (spso as SPWeb).AllowUnsafeUpdates = true; (spso as SPWeb).Update(); (spso as SPWeb).SiteGroups.Remove(ne.Principal.Name); (spso as SPWeb).AllowUnsafeUpdates = old; (spso as SPWeb).Update(); } ne.Deleted = true; } catch (Exception ex) { SquadronContext.HandleException(spso, ex); errorCount++; ne.Deleted = false; } } } if (ne.Deleted) { ItemsList.Items.Remove(ne); } } }); // Display if (errorCount > 0) { SquadronContext.Info("Error(s) occured. Please see the master log for details!"); } }
private void Success() { SquadronContext.Info("Copied successfully."); }