Exemple #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     DataAccess dAccess = new DataAccess();
     var date1 = date_from;
     var date2 = date_to;
     var type = reportType_cmb.SelectedIndex;
     var timestamp = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString();
     if(type > -1)
     {
         switch(type)
         {
             case 0:
                 dAccess.GetRecords("Count_Hours", "ReporteTotales" + Global.appUser + "-" + timestamp, date1.Value.ToShortDateString(), date2.Value.ToShortDateString(), Global.appUserId);
                 break;
             case 1:
                 dAccess.GetRecords("Raw_Report", "ReporteDetallado" + Global.appUser + "-" + timestamp, date1.Value.ToShortDateString(), date2.Value.ToShortDateString(), Global.appUserId);
                 break;
             case 2:
                 dAccess.GetRecords("Count_Hours", "ReporteTotalesGeneral-" + timestamp, date1.Value.ToShortDateString(), date2.Value.ToShortDateString());
                 break;
             case 3:
                 dAccess.GetRecords("Raw_Report", "ReporteDetalladoGeneral-" + timestamp, date1.Value.ToShortDateString(), date2.Value.ToShortDateString());
                 break;
         }           
     MessageBox.Show("El reporte ha sigo generado exitosamente");
     this.Close();
     }
     else
         MessageBox.Show("Seleccione un tipo de reporte");
     
 }
Exemple #2
0
 private void ok_Button_Click(object sender, EventArgs e)
 {
     DataAccess dAccess = new DataAccess();
     var result = dAccess.GetUser("select * from Users where UserName = @userName and Password = HASHBYTES('sha2_256', @password)", user_txtBox.Text, pass_txtBox.Text);
     if (!result)
     {
         ClearTextBoxes();
         MessageBox.Show("Usuario o contraseña incorrectos... vuelva a intentar");
     }
     else            
         this.Close();
 }
Exemple #3
0
        private void ok_Button_Click(object sender, EventArgs e)
        {
            string user = user_txtBox.Text;
            DataAccess dAccess = new DataAccess();

            string command = "Update Users set password = HASHBYTES('sha2_256', @password)";
            command += " where userName = @userName";

            dAccess.RegisterUser(command, user, pass_txtBox.Text);

            this.Close();            
        }
Exemple #4
0
        private void in_button_click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Confirma que desea registrar el ingreso?", "Confirmacion de Ingreso", MessageBoxButtons.YesNo);
            if (dialogResult == DialogResult.Yes)
            {
                DataAccess dAccess = new DataAccess();

                string command = "INSERT INTO Activity (userId, fecha, hora, actionId)";
                command += " VALUES (@userId, @fecha, @hora, @actionId)";

                dAccess.SaveAction(command, Global.appUserId, Enums.Actions.IN, currentTime.Text);

                GetStatus();
            }
            else if (dialogResult == DialogResult.No)
            {
                GetStatus();
            }
            
        }
        private void button3_Click(object sender, EventArgs e)
        {
            if(Validate())
            {
                var srcDirectoryName = @"C:\Reportes";
                var destDirectoryName = @"C:\Reportes\Merge\ReporteConsolidado" + mes_cmb.SelectedItem.ToString() + ".csv";


                var allCsv = Directory.EnumerateFiles(srcDirectoryName, "*", System.IO.SearchOption.TopDirectoryOnly);
                string[] header = { File.ReadLines(allCsv.First()).First(l => !string.IsNullOrWhiteSpace(l)) };
                var mergedData = allCsv
                    .SelectMany(csv => File.ReadLines(csv)
                        .SkipWhile(l => string.IsNullOrWhiteSpace(l)).Skip(1)); // skip header of each file
                File.WriteAllLines(destDirectoryName, header.Concat(mergedData));
                MessageBox.Show("El reporte consolidado se ha generado exitosamente...");
                IO io = new IO();
                var dataTable = io.GetDataTabletFromCSVFile(destDirectoryName);
                //var dataTable = GetDataTabletFromCSVFile(destDirectoryName);
                DataAccess da = new DataAccess();
                da.InsertDataIntoSQLServerUsingSQLBulkCopy(dataTable);                
                this.Close();
            }            
        }
Exemple #6
0
 private int GetLastActivity()
 {
     DataAccess dAccess = new DataAccess();
     var result = dAccess.ReadLastActivity("select top 1 actionId from activity where userId = " + Global.appUserId + " order by id desc");  
     return result;        
 }
Exemple #7
0
 private void button1_Click(object sender, EventArgs e)
 {
     DataAccess data = new DataAccess();
     var result = data.connectMySql();
     MessageBox.Show(result.ToString());
 }