Beispiel #1
0
        private void ButtonExportar_Click(object sender, RoutedEventArgs e)
        {
            ClassScheduleServices services = new ClassScheduleServices();

            if (_excelFile != null)
            {
                int _message = 0, _cont = 0;

                GRDialogConsultation _var = new GRDialogConsultation();
                _var.Message = "Desea crear las Clases?";
                if (_var.ShowDialog() == true)
                {
                    foreach (var item in _excelFile)
                    {
                        var _item = new ClassScheduleModel();

                        _item.IdBranchOffice = int.Parse(item.CodigoSucursal);
                        _item.IdWorkout      = int.Parse(item.CodigoDisciplina);
                        _item.WeekDay        = item.NumeroDia;
                        _item.StarTime       = TimeSpan.Parse(item.HoraInicio);
                        _item.EndTime        = TimeSpan.Parse(item.HoraFin);
                        _item.IdTrainer      = item.IdTrainer;
                        _item.StartDate      = DateTime.Parse(item.FechaInicio);
                        _item.EndDate        = DateTime.Parse(item.FechaFin);

                        if (item.MensajeFila == "OK")
                        {
                            _message = services.Add(_item);
                            if (_message > 0)
                            {
                                _cont += 1;
                            }
                        }
                    }
                    GRDialogInformation _var0 = new GRDialogInformation();
                    _var0.Message = "Total Regisros Exportados : " + _cont.ToString();
                    _var0.ShowDialog();

                    DataGridExportFile.ItemsSource = new ObservableCollection <ExcelFileModel>(new List <ExcelFileModel>());
                    TxtPath.Text = "";
                }
            }
            else
            {
                GRDialogInformation _var = new GRDialogInformation();
                _var.Message = "Debe Seleccionar un Registro";
                _var.ShowDialog();
            }
        }