public IActionResult OpenFile(IFormFile file)
 {
     if (file != null)
     {
         string path = Path.GetFullPath(file.FileName);
         foreach (var employee in ReadCSVFile.ReadCSV(path))
         {
             _repository.CreateItem(employee);
         }
     }
     return(RedirectToAction("Index", "Home"));
 }
Exemplo n.º 2
0
        public List <CompleteJobsEmp> Read(string filename)
        {
            var assignSignalsList = new List <CompleteJobsEmp>();
            List <List <string> > listOfData;
            var         result      = new List <CompleteJobsEmp>();
            ReadCSVFile readCSVFile = new ReadCSVFile();

            listOfData = readCSVFile.Read(filename);
            listOfData.RemoveAt(0);
            listOfData.RemoveAt(0);
            listOfData.RemoveAt(listOfData.Count - 1);
            result = Load(listOfData);
            return(result);
        }
Exemplo n.º 3
0
        public List <Store_emp> Read(string filename)
        {
            List <Store_emp>      assignSignalsList = new List <Store_emp>();
            List <List <string> > listOfData;
            List <Store_emp>      result      = new List <Store_emp>();
            ReadCSVFile           readCSVFile = new ReadCSVFile();

            listOfData = readCSVFile.Read(filename);
            listOfData.RemoveAt(0);
            listOfData.RemoveAt(0);
            listOfData.RemoveAt(listOfData.Count - 1);
            result = Load(listOfData);
            return(result);
        }
Exemplo n.º 4
0
        public List <Not_CompleteJobs_emp> Read(string inputFilename)
        {
            //var assignSignalsList = new List<Not_CompleteJobs_emp>();
            List <List <string> > listOfData;
            //var result = new List<Not_CompleteJobs_emp>();
            ReadCSVFile readCSVFile = new ReadCSVFile();

            listOfData = readCSVFile.Read(inputFilename);
            listOfData.RemoveAt(0);
            listOfData.RemoveAt(0);
            listOfData.RemoveAt(listOfData.Count - 1);
            assignSignalsList = Load(listOfData);
            return(assignSignalsList);
        }
Exemplo n.º 5
0
        private void ReadFile()
        {
            try
            {
                var fileDialog = new System.Windows.Forms.OpenFileDialog();
                var result     = fileDialog.ShowDialog();
                switch (result)
                {
                case System.Windows.Forms.DialogResult.OK:
                    if (fileDialog.FileName.Contains(".csv"))
                    {
                        if (int.TryParse(Day.Text, out var day) && int.TryParse(Hours.Text, out var hours))
                        {
                            var timeSet  = ReadCSVFile.GetTimesPerDay(fileDialog.OpenFile(), day - 1, hours - 1);
                            var times    = new List <TimeObject>();
                            var project  = (Project)Projects.SelectedItem;
                            var module   = (Projectmodule)Modules.SelectedItem;
                            var worktype = (Projectworktype)WorkTypes.SelectedItem;

                            times.AddRange(timeSet.Select(time => new TimeObject
                            {
                                personid   = _primaryInformation != null ? _primaryInformation.Me.personid.ToString() : _userData.PersonId,
                                time       = Math.Round(time.Value, 2).ToString(CultureInfo.InvariantCulture),
                                billable   = "t",
                                date       = DateTime.Parse(time.Key).ToString("yyyy-MM-dd"),
                                projectid  = int.Parse(project.id).ToString(),
                                moduleid   = int.Parse(module.moduleid).ToString(),
                                worktypeid = int.Parse(worktype.worktypeid).ToString()
                            }));
                            _userTimes       = new UserTimes(_timeTaskService, times);
                            Submit.IsEnabled = true;
                        }
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Exemplo n.º 6
0
        private void FileImportProcess_Click(object sender, RoutedEventArgs e)
        {
            if (File.Exists(FileImportLocation.Text) == false)
            {
                GlobalVariables.Logger.Log("Could not open file to import");
                return;
            }

            GlobalVariables.Logger.Log("File import started");

            string ThreadParam = FileImportLocation.Text;

            if (FIG1.IsChecked == true)
            {
                Task.Factory.StartNew(() => ReadCSVFile.ReadInvenotryCSVFile(ThreadParam));
            }
            else if (FIG2.IsChecked == true)
            {
                Task.Factory.StartNew(() => ReadCSVFile.ReadVATCSVFile(ThreadParam));
            }
            else if (FIG3.IsChecked == true)
            {
                Task.Factory.StartNew(() => ReadCSVFile.ReadAmazonOrdersCSVFile(ThreadParam, "Amazon_Orders", "AMAZON-ORDERS", true));
            }
            else if (FIG4.IsChecked == true)
            {
                Task.Factory.StartNew(() => ReadCSVFile.ReadAmazonOrdersCSVFile(ThreadParam, "Amazon_Refunds", "AMAZON-REFUNDS", false));
            }
            else if (FIG5.IsChecked == true)
            {
                Task.Factory.StartNew(() => ReadCSVFile.ReadPaypalSalesCSVFile(ThreadParam));
            }
            else if (FIG6.IsChecked == true)
            {
                Task.Factory.StartNew(() => ReadCSVFile.ReadAmazonDeleteCSVFile(ThreadParam));
            }
        }