public static Section FromDTO(this SectionDTO section) => section is null ? null : new Section
 {
     Id       = section.Id,
     Name     = section.Name,
     Order    = section.Order,
     ParentId = section.ParentId,
 };
Beispiel #2
0
 public List <SectionDTO> Section()
 {
     using (IDbSvc dbSvc = new DbSvc(_configSvc))
     {
         try
         {
             dbSvc.OpenConnection();
             MySqlCommand command = new MySqlCommand();
             command.CommandText = "select SectionId,SectionName from section where Active=1";
             command.Connection  = dbSvc.GetConnection() as MySqlConnection;
             _dtData             = new DataTable();
             MySqlDataAdapter msDa = new MySqlDataAdapter(command);
             msDa.Fill(_dtData);
             List <SectionDTO> lstSection = new List <SectionDTO>();
             if (_dtData != null && _dtData.Rows.Count > 0)
             {
                 SectionDTO sectionDTO = null;
                 foreach (DataRow dr in _dtData.Rows)
                 {
                     sectionDTO             = new SectionDTO();
                     sectionDTO.SectionId   = (int)dr["SectionId"];
                     sectionDTO.SectionName = dr["SectionName"].ToString();
                     lstSection.Add(sectionDTO);
                 }
             }
             return(lstSection);
         }
         catch (Exception exp)
         {
             throw exp;
         }
     }
 }
Beispiel #3
0
        public static Section CreateSection(this SectionDTO dto)
        {
            var section = new Section();

            dto.CopyToSection(section);
            return(section);
        }
Beispiel #4
0
 public static Section FromDTO(this SectionDTO model) => model is null ? null : new Section
 {
     Id       = model.Id,
     Name     = model.Name,
     Order    = model.Order,
     ParentId = model.ParentId
 };
Beispiel #5
0
        public SectionDTO Get(int id)
        {
            SectionDTO section = db.Sections.Find(id);

            section.Questions = GetQuestionsBySection(section);
            return(section);
        }
Beispiel #6
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            string title   = textBoxTitle.Text;
            string start   = dateTimePickerStart.Text;
            string end     = dateTimePickerEnd.Text;
            string chair   = comboBoxChair.Text;
            int    chiarId = ctrl.findByUsername(chair);
            var    section = new SectionDTO {
                Title = title, StartDate = start, EndDate = end, ChairId = chiarId, ConferenceId = conferenceId
            };

            try
            {
                if (sectionToUpdate == null)
                {
                    ctrl.addsection(section);
                    MessageBox.Show("Section added successfully");
                    this.Close();
                }
                else
                {
                    section.Id = sectionToUpdate.Id;
                    ctrl.updateSection(section);
                    MessageBox.Show("Section updated successfully");
                    this.Close();
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Beispiel #7
0
 public SectionVM(SectionDTO row)
 {
     Id      = row.Id;
     Name    = row.Name;
     Slug    = row.Slug;
     Sorting = row.Sorting;
 }
Beispiel #8
0
        public List <QuestionResponseTO> GetResponsesBySection(SectionDTO section)
        {
            SectionDataProvider       provider = SectionDataFactory.CreateProvider(section.Type);
            List <QuestionResponseTO> list     = provider.GetQuestionsResponsesByID(section.SectionId);

            return(list);
        }
Beispiel #9
0
 public static Section FromDTO(this SectionDTO Section) => Section is null
     ? null
     : new Section
 {
     Id   = Section.Id,
     Name = Section.Name,
 };
        private IEnumerable <SectionDTO> GetSectionsList()
        {
            var all = AppArgs.MarketState.Sections.GetAll();

            all.Insert(0, SectionDTO.Named("All Sections"));
            return(all);
        }
Beispiel #11
0
        private async void AddSectionButton_Click(object sender, RoutedEventArgs e)
        {
            if (await AddSectionDialog.ShowAsync() != ContentDialogResult.Primary)
            {
                return;
            }

            try
            {
                var model = new SectionDTO()
                {
                    Name        = CreateSectionName.Text,
                    SectionType = CreateSectionType.SelectedItem.ToString()
                };

                await _service.AddTripSection(_trip.Id, model);

                _sections.Add(model.MapToSection());

                Frame.Navigate(GetType(), _navigationParams, new SuppressNavigationTransitionInfo()); //on add, frame just does not want to load...
            }
            catch
            {
                //TODO: Exception handling
            }
        }
Beispiel #12
0
        private async void EditSection_Click(object sender, RoutedEventArgs e)
        {
            var selectedSection = (sender as MenuFlyoutItem).DataContext as Section;

            EditSectionName.Text = selectedSection.Name;

            if (await EditSectionDialog.ShowAsync() != ContentDialogResult.Primary)
            {
                return;
            }

            var editedSection = new SectionDTO
            {
                Name        = EditSectionName.Text,
                SectionType = selectedSection.SectionType
            };

            var updated = await _service.UpdateTripSection(_trip.Id, selectedSection.Id, editedSection);

            var index = _sections.IndexOf(selectedSection);

            if (index != -1)
            {
                _sections[index] = updated;
            }
        }
        private void AddSubRows(CollectorDTO collector, SectionDTO sec, ICollectionsDB db, IStallsRepo stalls)
        {
            var savedCollectr = db.GetCollector(sec)
                                ?? new CollectorDTO {
                Id = 1
            };

            if (savedCollectr.Id != collector.Id)
            {
                return;
            }
            if (!db.IntendedColxns.TryGetValue(sec.Id, out IIntendedColxnsRepo repo))
            {
                return;
            }
            if (!repo.Any())
            {
                return;
            }

            foreach (var colxn in repo.GetAll())
            {
                if (colxn.StallSnapshot == null)
                {
                    colxn.StallSnapshot = stalls.Find(colxn.Lease.Stall.Id, true);
                }

                this.Add(new CollectorPerfSubRow(colxn, sec));
            }
        }
 public SectionDTO CreateSection(SectionDTO sectionDTO, string token)
 {
     try
     {
         var repo     = _unitOfWork.GetRepository <Section>();
         var newvalue = Mapper.Map <Section>(sectionDTO);
         newvalue.CreationDate = DateTime.Now;
         newvalue.SectionGUID  = Guid.NewGuid();
         if (newvalue.SectionCode == null)
         {
             newvalue.SectionCode = newvalue.SectionId;
         }
         if (newvalue.SectionSymbol == null)
         {
             newvalue.SectionSymbol = newvalue.SectionId;
         }
         //newvalue.CreatedBy = _appUserService.GetUserId(token);
         repo.Add(newvalue);
         repo.SaveChanges();
         return(Mapper.Map <SectionDTO>(newvalue));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #15
0
        public SectionColxnsRow(SectionDTO sec, DateTime date, ITenantDBsDir dir)
        {
            Section   = sec;
            ColxnDate = date;
            var db = dir.Collections.For(date);

            Collector = GetSectionCollector(sec, db);
            var colxns = GetLeaseColxns(sec, date, db, dir);

            Rent     = colxns.Sum(_ => _.Rent ?? 0);
            Rights   = colxns.Sum(_ => _.Rights ?? 0);
            Electric = colxns.Sum(_ => _.Electric ?? 0);
            Water    = colxns.Sum(_ => _.Water ?? 0);
            Ambulant = colxns.Sum(_ => _.Ambulant ?? 0);

            Details.SetItems(colxns);
            Details.SetSummary(new LeaseColxnRow()
            {
                Rent     = Rent,
                Rights   = Rights,
                Electric = Electric,
                Water    = Water,
                Ambulant = Ambulant,
            });
        }
Beispiel #16
0
        public static SectionDTO CreateSectionDTO(this Section section)
        {
            var dto = new SectionDTO();

            section.CopyToSectionDTO(dto);
            return(dto);
        }
Beispiel #17
0
        public int UpdateSectionById(SectionDTO data)
        {
            Section dataToUpdate = SectionRequestFormatter.ConvertRespondentInfoFromDTO(data);
            var     response     = _unitOfWork.SectionRepository.Update(dataToUpdate);

            return(response);
        }
Beispiel #18
0
        public static void UpdateCanvasData(int?idEntidad, SectionDTO newSection, int?canvasGroupId)
        {
            logger.Info("SectionDAL/SectionsToSync - Task 'Get a list with the sections to sync' STARTED");
            if (newSection != null)
            {
                using (var context = new CANVAS_Model_Entities())
                {
                    uniCanvasCursosSeccione newCanvasCourseSection = context.uniCanvasCursosSecciones.Where(x => x.IDAcademico == idEntidad).FirstOrDefault();
                    if (newSection.error_message == null)
                    {
                        newCanvasCourseSection.Estado        = CanvasWebApi.Common.ConfigEnum.CanvasState.Sincronizado.GetHashCode();
                        newCanvasCourseSection.Fecha         = DateTime.Now;
                        newCanvasCourseSection.IDCanvas      = Int32.Parse(newSection.id);
                        newCanvasCourseSection.IDCanvasGrupo = canvasGroupId;
                    }
                    else
                    {
                        newCanvasCourseSection.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Error.GetHashCode();
                        newCanvasCourseSection.Fecha  = DateTime.Now;
                    }

                    newCanvasCourseSection.Error = newSection.error_message;
                    context.SaveChanges();
                }
            }
        }
 public CollectorPerfSubRow(IntendedColxnDTO colxn, SectionDTO sectionDTO)
 {
     _colxn  = colxn;
     Section = sectionDTO;
     Rent    = CreateRentCell(colxn);
     Rights  = CreateRightsCell(colxn);
 }
Beispiel #20
0
 public bool HasVacantsTable(SectionDTO sec)
 {
     if (!VacantStalls.TryGetValue(sec.Id, out IVacantStallsRepo repo))
     {
         return(false);
     }
     return(repo.TableExists());
 }
Beispiel #21
0
 private void FillSectionsList()
 {
     Sections.Add(SectionDTO.Named("All Sections"));
     foreach (var sec in AppArgs.MarketState.Sections.GetAll())
     {
         Sections.Add(sec);
     }
 }
Beispiel #22
0
        public async ThreadTask.Task <List <SectionDTO> > GetTasksForPlanAsync(int planId)
        {
            var plan = await db.Plans.Get(planId);

            if (plan == null)
            {
                return(null);
            }

            var sections = await db.PlanTasks.GetAll();

            var section = sections
                          .Where(pt => pt.Plan_Id == planId)
                          .GroupBy(s => s.Sections)
                          .Select(p => new
            {
                Id    = p.Key.Id,
                Name  = p.Key.Name,
                Tasks = p.Key.PlanTasks
                        .Where(pt => pt.Plan_Id == planId)
                        .Select(pt => pt.Tasks)
            }).ToList();

            List <SectionDTO> sectionDTOs = new List <SectionDTO>();

            foreach (var sec in section)
            {
                List <TaskDTO> taskDTOs   = new List <TaskDTO>();
                ContentDTO     contentDTO = new ContentDTO();
                foreach (var task in sec.Tasks)
                {
                    var toAdd = new TaskDTO(task.Id,
                                            task.Name,
                                            task.Description,
                                            task.Private,
                                            task.Create_Id,
                                            await db.Users.ExtractFullNameAsync(task.Create_Id),
                                            task.Mod_Id,
                                            await db.Users.ExtractFullNameAsync(task.Mod_Id),
                                            task.Create_Date,
                                            task.Mod_Date,
                                            await db.PlanTasks.GetTaskPriorityInPlanAsync(task.Id, planId),
                                            await db.PlanTasks.GetTaskSectionIdInPlanAsync(task.Id, planId),
                                            await db.PlanTasks.GetIdByTaskAndPlanAsync(task.Id, planId),
                                            task.Youtube_Url);
                    taskDTOs.Add(toAdd);
                }
                contentDTO.Tasks = taskDTOs;
                SectionDTO sectionDTO = new SectionDTO()
                {
                    Id      = sec.Id,
                    Name    = sec.Name,
                    Content = contentDTO
                };
                sectionDTOs.Add(sectionDTO);
            }
            return(sectionDTOs);
        }
Beispiel #23
0
 public static Section FromDTO(this SectionDTO Section) => Section is null
     ? null
     : new Section()
 {
     Id       = Section.Id,
     Name     = Section.Name,
     Order    = Section.Order,
     ParentId = Section.ParentId
 };
        public SectionDTO CreateSection()
        {
            var section = new SectionDTO
            {
                SectionId = _sectionService.GetNewSectionId()
            };

            return(section);
        }
Beispiel #25
0
 protected override StallDTO GetNewDraft()
 {
     if (!PopUpInput.TryGetString("Section Name", out string name, "Section"))
     {
         return(null);
     }
     Section = SectionDTO.Named(name);
     return(GetDefaultStallTemplate(name));
 }
Beispiel #26
0
 public static Section FromDTO(this SectionDTO SectionDTO) => SectionDTO is null
     ? null
     : new Section
 {
     Id       = SectionDTO.Id,
     Name     = SectionDTO.Name,
     Order    = SectionDTO.Order,
     ParentId = SectionDTO.ParentId
 };
Beispiel #27
0
 private static void CopyToSection(this SectionDTO dto, Section section)
 {
     section.Id            = dto.Id;
     section.Name          = dto.Name;
     section.Order         = dto.Order;
     section.ParentId      = dto.ParentId;
     section.ParentSection = dto.ParentSection?.CreateSection();
     section.Products      = dto.Products?.Select(product => product.CreateProduct()).ToList();
 }
Beispiel #28
0
 public static Section FromDTO(this SectionDTO sectionDTO)
 {
     return(sectionDTO == null ? null : new Section {
         Id = sectionDTO.Id,
         Name = sectionDTO.Name,
         Order = sectionDTO.Order,
         ParentId = sectionDTO.ParentId
     });
 }
Beispiel #29
0
 private static void CopyToSectionDTO(this Section section, SectionDTO dto)
 {
     dto.Id            = section.Id;
     dto.Name          = section.Name;
     dto.Order         = section.Order;
     dto.ParentId      = section.ParentId;
     dto.ParentSection = section.ParentSection?.CreateSectionDTO();
     dto.Products      = section.Products?.Select(product => product.CreateProductDTO()).ToList();
 }
Beispiel #30
0
 public SectionDTO addSection(SectionDTO section)
 {
     using (var uow = new UnitOfWork())
     {
         var repo  = uow.getRepository <Section>();
         var saved = repo.save(converter.convertToPOCOModel(section));
         uow.saveChanges();
         return(converter.convertToDTOModel(saved));
     }
 }