Class to copy the Console output to log File
Наследование: IDisposable
Пример #1
0
 /// <summary>
 /// Staic main method
 /// </summary>
 /// <param name="args">Command line arguement</param>
 public static void Main(string[] args)
 {
     if (2 == args.Length && !ExcelOperations.IsNullOrEmptyCredential(args[0], args[1]))
     {
         try
         {
             using (ConsoleCopy console_copy = new ConsoleCopy(logfileLocation))
             {
                 string termGroupName            = ConfigurationManager.AppSettings["termGroupName"];
                 string termSetNameClient        = ConfigurationManager.AppSettings["termSetNameClient"];
                 string termSetNamePracticeGroup = ConfigurationManager.AppSettings["termSetNamePracticeGroup"];
                 string practiceGroupFieldName   = ConfigurationManager.AppSettings["practiceGroupFieldName"];
                 string areaOfLawFieldName       = ConfigurationManager.AppSettings["areaOfLawFieldName"];
                 string subareaOfLawColumnName   = ConfigurationManager.AppSettings["subareaOfLawColumnName"];
                 string userName = args[0].Trim();
                 string password = args[1].Trim();
                 List <PracticeGroup> practiceGroups  = new List <PracticeGroup>();
                 List <Client>        clients         = new List <Client>();
                 ClientContext        clientContext   = GetClientContext(userName, password);
                 TaxonomySession      taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
                 TermGroup            termGroup       = Utility.LoadTermGroup(clientContext, taxonomySession, termGroupName);
                 clients        = Utility.IntializeClientObject(clientContext, termGroup, termSetNameClient);
                 practiceGroups = Utility.IntializePracticeGroupObject(clientContext, termGroup, termSetNamePracticeGroup);
                 foreach (Client client in clients)
                 {
                     UpdateAllClients(practiceGroupFieldName, areaOfLawFieldName, subareaOfLawColumnName, practiceGroups, client);
                 }
             }
         }
         catch (Exception exception)
         {
             ErrorMessage.ShowMessage(exception.Message, ErrorMessage.MessageType.Error);
         }
     }
     else
     {
         ErrorMessage.ShowMessage("Please enter the username and password", ErrorMessage.MessageType.Error);
     }
 }
Пример #2
0
 /// <summary>
 /// Staic main method
 /// </summary>
 /// <param name="args">Command line arguement</param>
 public static void Main(string[] args)
 {
     if (2 == args.Length && !ExcelOperations.IsNullOrEmptyCredential(args[0], args[1]))
     {
         try
         {
             using (ConsoleCopy console_copy = new ConsoleCopy(logfileLocation))
             {
                 string termGroupName = ConfigurationManager.AppSettings["termGroupName"];
                 string termSetNameClient = ConfigurationManager.AppSettings["termSetNameClient"];
                 string termSetNamePracticeGroup = ConfigurationManager.AppSettings["termSetNamePracticeGroup"];
                 string practiceGroupFieldName = ConfigurationManager.AppSettings["practiceGroupFieldName"];
                 string areaOfLawFieldName = ConfigurationManager.AppSettings["areaOfLawFieldName"];
                 string subareaOfLawColumnName = ConfigurationManager.AppSettings["subareaOfLawColumnName"];
                 string userName = args[0].Trim();
                 string password = args[1].Trim();
                 List<PracticeGroup> practiceGroups = new List<PracticeGroup>();
                 List<Client> clients = new List<Client>();
                 ClientContext clientContext = GetClientContext(userName, password);
                 TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
                 TermGroup termGroup = Utility.LoadTermGroup(clientContext, taxonomySession, termGroupName);
                 clients = Utility.IntializeClientObject(clientContext, termGroup, termSetNameClient);
                 practiceGroups = Utility.IntializePracticeGroupObject(clientContext, termGroup, termSetNamePracticeGroup);
                 foreach (Client client in clients)
                 {
                     UpdateAllClients(practiceGroupFieldName, areaOfLawFieldName, subareaOfLawColumnName, practiceGroups, client);
                 }
             }
         }
         catch (Exception exception)
         {
             ErrorMessage.ShowMessage(exception.Message, ErrorMessage.MessageType.Error);
         }
     }
     else
     {
         ErrorMessage.ShowMessage("Please enter the username and password", ErrorMessage.MessageType.Error);
     }
 }