private void btExport_Click(object sender, EventArgs e)
        {
            try
            {
                imputationBusiness = new ImputationBL();

                textLog.Clear();
                this.tbLog.Text = textLog.ToString();

                // Llamada api para comprobar autenticacion y status de la conexion
                this.tbLog.Text = textLog.AppendLine(WinFormResources.ConnectionChecking).ToString();
                imputationBusiness.CheckAndStartConnection(this.tbUser.Text, this.tbPassword.Text);
                this.tbLog.Text = textLog.AppendLine(WinFormResources.ConnectionOk).ToString();

                // Obtenemos los datos de imputaciones
                imputationBusiness.ImportImputations(this.tbImputaciones.Text);

                this.tbLog.Text = textLog.AppendLine(WinFormResources.ImputacionesImport).ToString();

                // Calculamos contractors
                imputationBusiness.CalculateContractors(this.tbContracts.Text);

                this.tbLog.Text = textLog.AppendLine(WinFormResources.ContractsImport).ToString();

                // Calculamos billing concepts
                imputationBusiness.CalculateAllBillingConcepts(this.tbUser.Text, this.tbPassword.Text); // (usuarioJira, contraseñaJira)

                this.tbLog.Text = textLog.AppendLine(WinFormResources.BillingCalculate).ToString();

                // Calculamos assets
                imputationBusiness.CalculateAssets(this.tbAssets.Text);

                this.tbLog.Text = textLog.AppendLine(WinFormResources.AssetsImport).ToString();

                // Exportamos a CSV
                imputationBusiness.ExportImputations(this.tbExportTo.Text);

                //this.tbLog.Text = textLog.Append(WinFormResources.ApiCalls).AppendLine(imputationBusiness.Counter.ToString()).ToString();
                this.tbLog.Text = textLog.AppendLine(WinFormResources.ExportEnded).ToString();
            }
            catch (Exception ex)
            {
                if (ex.Message.Equals(WinFormResources.ExceptionDaoNoAutorizado) ||
                    ex.Message.Equals(WinFormResources.ExceptionDaoProhibido))
                {
                    this.tbLog.Text = textLog.AppendLine(WinFormResources.ConnectionFail).ToString();
                }
                else
                {
                    this.tbLog.Text = textLog.AppendLine(ex.Message).ToString();
                }
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            ImputationBL imputationBusiness = new ImputationBL();
            string       usuario            = string.Empty;
            string       contraseña         = string.Empty;

            Console.WriteLine("Introduzca usuario de Jira");
            usuario = Console.ReadLine();
            Console.Clear();
            Console.WriteLine("Introduzca contraseña de Jira");
            contraseña = Console.ReadLine();
            Console.Clear();

            // Obtenemos los datos de imputaciones
            Console.WriteLine("Importando imputaciones");
            imputationBusiness.ImportImputations(PresentationResources.TimesheetPathCsvDiego);

            // Calculamos contractors
            Console.WriteLine("Calculando Contractors");
            imputationBusiness.CalculateContractors(PresentationResources.ContractorsPathCsvDiego);

            // Calculamos billing concepts
            Console.WriteLine("Calculando Billing Concepts");
            imputationBusiness.CalculateAllBillingConcepts(usuario, contraseña); // (usuarioJira, contraseñaJira)

            // Calculamos assets
            Console.WriteLine("Calculando Assets");
            imputationBusiness.CalculateAssets(PresentationResources.AssetsPathCsvDiego);

            // Exportamos a CSV
            Console.WriteLine("Exportando a Csv");
            //imputationBusiness.ExportImputations();

            Console.WriteLine("Llamadas a la API realizadas: " + imputationBusiness.Counter);
            Console.WriteLine("Presiona Enter para terminar");
            Console.ReadLine();
        }