/// <summary> /// Delete datas from the server about the file, and send a mail about it. /// </summary> /// <param name="fileName">Name of the file for the delete section</param> /// <param name="ServerOperation">ServerOperationManager object</param> /// <param name="MailSender">MailSender object</param> /// <returns></returns> public bool DeleteFromFile_Process(string fileName, ServerOperationManager ServerOperation, MailSender MailSender) { bool result = ServerOperation.DeleteFromFile(fileName); if (result) { MailSender.SendEmail(ToMailAddress, "Delete From File on the Server", "Delete method ran on the server. File Name: " + fileName, null); } return(result); }
/// <summary> /// Delete datas from the server about the ids, and send a mail about it. /// </summary> /// <param name="ids">List of string ids, what we would like to delete</param> /// <param name="ServerOperation">ServerOperationManager object</param> /// <param name="MailSender">MailSender object</param> /// <returns></returns> public bool DeleteByIds_Process(List <string> ids, ServerOperationManager ServerOperation, MailSender MailSender) { string deletedIds = string.Join(",", ids); bool result = ServerOperation.DeleteByIds(ids); if (result) { MailSender.SendEmail(ToMailAddress, "Delete From Ids on the Server", "Delete method ran on the server. Deleted workItem ids: " + deletedIds, null); } return(result); }
/// <summary> /// Initialize the ServerOperation and ConnectionAdapter /// </summary> /// <returns></returns> public ServerOperationManager Init_ServerOperation(Logger log) { var connection_section = ConfigurationManager.GetSection("Connection") as NameValueCollection; foreach (var part in connection_section.AllKeys) { connection_data.Add(part, connection_section[part]); } ConnectionAdapter ConnectionAdapter = new ConnectionAdapter(connection_data["TfsCollection"], connection_data["TeamProjectName"], log); ServerOperationManager ServerOperationManager = new ServerOperationManager(ConnectionAdapter, connection_data["AreaPath"], connection_data["Iteration"], log); CurrentTfsCollectionName = connection_data["TfsCollection"]; CurrentTeamProjectName = connection_data["TeamProjectName"]; return(ServerOperationManager); }
/// <summary> /// Upload the configuration data to the server. Return True if its done with no problem. /// </summary> /// <param name="ServerOperation">ServerOperationManager object</param> /// <param name="log">Custom Logger object</param> public bool Upload_Process(bool isUIRun, ServerOperationManager ServerOperation, Logger log) { try { ServerOperation.datasForFileModification.Clear(); ServerOperation.Archive(isUIRun, CurrentTeamProjectName); PbisConfigSection myPBISection = ConfigurationManager.GetSection("PBICollectionSection") as PbisConfigSection; for (int i = 0; i < myPBISection.Members.Count; i++) { PBI pbi = myPBISection.Members[i]; ServerOperation.Upload(isUIRun, pbi, ServerOperation.AreaPath); } return(true); } catch (Exception ex) { log.Error(ex); log.Flush(); return(false); } }
/// <summary> /// Comlete server reset (datas). /// </summary> /// <param name="ServerOperation">ServerOperationManager object</param> /// <param name="MailSender">MailSender object</param> public void ServerContentDelete_Process(ServerOperationManager ServerOperation, MailSender MailSender) { ServerOperation.ServerContentDelete(); MailSender.SendEmail(ToMailAddress, "All server data is gone", "Everything has been deleted from the server", null); }