Exemplo n.º 1
0
 public Section GetBookSection(BookInfo bookInfo)
 {
     using (var sectionRepo = new SectionRepository())
     {
         return(sectionRepo.GetBookSection(bookInfo));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// obtains the idea detail
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="id">identifier of section</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int mod, int id)
        {
            QuestionRepository   objquestion   = new QuestionRepository(SessionCustom);
            ContentManagement    objcontentman = new ContentManagement(SessionCustom, HttpContext);
            ContentRepository    objcontent    = new ContentRepository(SessionCustom);
            IdeaRepository       objidea       = new IdeaRepository(SessionCustom);
            FileattachRepository objfiles      = new FileattachRepository(SessionCustom);
            TagRepository        objtag        = new TagRepository(SessionCustom);
            SectionRepository    objsection    = new SectionRepository(SessionCustom);
            TemplateRepository   objtemplate   = new TemplateRepository(SessionCustom);
            CommentRepository    objcomment    = new CommentRepository(SessionCustom);

            objtemplate.Entity.Type = 0;

            objidea.Entity.IdeaId        =
                objcomment.Entity.IdeaId = id;
            objidea.LoadByKey();

            objquestion.Entity.ContentId    =
                objcontent.Entity.ContentId = objidea.Entity.ContentId;
            objcontent.LoadByKey();
            objquestion.LoadByKey();

            if (objquestion.Entity != null && objquestion.Entity.Type.Equals(Domain.Entities.Question.TypeQuestion.Ubicacion))
            {
                ViewBag.Location = true;
            }
            else
            {
                ViewBag.Location = false;
            }

            int totalComments = 0;
            List <CommentsPaging> comments = objcomment.CommentsPaging(0, 50, out totalComments, id);

            ViewBag.TotalComments = totalComments;

            IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id);

            this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId));
            this.ViewBag.NewsTags     = string.Empty;

            return(this.View(
                       "Detail",
                       new IdeaModel()
            {
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = this.Module,
                ListFiles = objfiles.GetAllReadOnly(),
                Idea = objidea.Entity,
                IContent = objcontent.Entity,
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value),
                ListTags = SelectedTags,
                DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value),
                CurrentLanguage = this.CurrentLanguage,
                ListComments = comments
            }));
        }
Exemplo n.º 3
0
        public void TestInitialize()
        {
            IConfig config = new Config();

            dbContext         = new QuizEngineDataContext(config.ConnectionString);
            sectionRepository = new SectionRepository(dbContext);
        }
Exemplo n.º 4
0
 public PersonalController()
 {
     dbContext    = new GovernmentDbContext();
     personalRepo = new PersonalRepository(dbContext);
     divisionRepo = new DivisionRepository(dbContext);
     sectionRepo  = new SectionRepository(dbContext);
 }
Exemplo n.º 5
0
        public DataField AddNewToSection(int sectionId, string fieldDescription)
        {
            Section section = new SectionRepository().GetById(sectionId);
            if (section == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            DataField newDataField = new DataField();

            newDataField.section = section;

            if (fieldDescription!=null)
            {
                newDataField.description = fieldDescription;
            }

            if (section.dataFields.Any(x => x.description==newDataField.description))
            {
                HttpResponseMessage mss = new HttpResponseMessage();
                mss.StatusCode = HttpStatusCode.BadRequest;
                mss.ReasonPhrase = "Duplicate field description";
                throw new HttpResponseException(mss);
            }

            repo.Create(newDataField);

            return newDataField;
        }
Exemplo n.º 6
0
        /// <summary>
        /// delete a section
        /// </summary>
        /// <param name="sectionId">identifier of section</param>
        /// <returns>returns true if operation successful</returns>
        public bool DeleteSection(int sectionId)
        {
            try
            {
                FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);
                SectionRepository     objsection   = new SectionRepository(this.session);
                objsection.Entity.SectionId = sectionId;
                objsection.Delete();

                friendlyrepo.Entity.Id   = sectionId;
                friendlyrepo.Entity.Type = Friendlyurl.FriendlyType.Section;
                friendlyrepo.Delete();

                Utils.InsertAudit(
                    this.session,
                    new Audit()
                {
                    Auditaction = "Delete",
                    Description = "Section -> " + sectionId.ToString(),
                    Joindate    = DateTime.Now,
                    Username    = (this.context.User as CustomPrincipal).UserId
                });

                return(true);
            }
            catch (Exception ex)
            {
                Utils.InsertLog(
                    this.session,
                    "Delete Section",
                    ex.Message + " - " + ex.StackTrace);
                return(false);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// gets the home of challenge module
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="sectionId">identifier of section</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Index(int mod, int?sectionId)
        {
            ContentManagement  objcontentman = new ContentManagement(this.SessionCustom, HttpContext);
            SectionRepository  objsection    = new SectionRepository(this.SessionCustom);
            TemplateRepository objtemplate   = new TemplateRepository(this.SessionCustom);
            ContentRepository  objcontent    = new ContentRepository(SessionCustom);
            TagFacade          tagFacade     = new TagFacade();

            objtemplate.Entity.Type = 0;

            return(this.View(new ChallengeModel()
            {
                UserPrincipal = this.CustomUser,
                Module = this.Module,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                DeepFollower = sectionId != null ? Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId.Value) : null,
                IContent = new Domain.Entities.Content()
                {
                    ModulId = mod,
                    SectionId = sectionId
                },
                CurrentLanguage = this.CurrentLanguage,
                Categories = objcontent.Categories(),
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }
Exemplo n.º 8
0
 //Find one Section by the ID
 public Section findOneSection(int id)
 {
     using (SectionRepository sectionRepository = new SectionRepository("DefaultConnection"))
     {
         return(sectionRepository.findOneSection(id));
     }
 }
Exemplo n.º 9
0
 //Getting a list of sections.
 public List <Section> getSections()
 {
     using (SectionRepository sectionRepository = new SectionRepository("DefaultConnection"))
     {
         return(sectionRepository.getSections());
     }
 }
Exemplo n.º 10
0
        public SaleController GetController()
        {
            ISaleRepository       saleRepository       = new SaleRepository();
            ISaleRemarkRepository saleRemarkRepository = new SaleRemarkRepository();
            IAccountRepository    accountRepository    = new AccountRepository();
            IOrgInfoRepository    orgInfoRepository    = new OrgInfoRepository();
            IRoleUserRepository   roleUserRepository   = new RoleUserRepository();
            ISectionRepository    sectionRepository    = new SectionRepository();
            IStoreRepository      storeRepository      = new StoreRepository();
            IAccountService       accountService       = new AccountService(accountRepository, orgInfoRepository, roleUserRepository, sectionRepository, storeRepository);
            ISaleService          saleService          = new SaleService(saleRepository, saleRemarkRepository, accountService);
            //IBrandRepository brandRepository = new BrandRepository();

            IShippingSaleRepository shippingSaleRepository = new ShippingSaleRepository();
            IOrderRepository        orderRepository        = new OrderRepository();
            //IOrderRemarkRepository orderRemarkRepository = new OrderRemarkRepository();
            //IOrderItemRepository orderItemRepository = new OrderItemRepository();
            //ISaleDetailRepository saleDetailRepository = new SaleDetailRepository();
            ISaleRMARepository saleRmaRepository = new SaleRMARepository();
            // IOrderService orderService = new OrderService(orderRepository, orderRemarkRepository, orderItemRepository, brandRepository, accountService, saleDetailRepository, saleRmaRepository);
            IShippingSaleService shippingSaleService = new ShippingSaleService(shippingSaleRepository, orderRepository, saleRmaRepository, accountService);
            ISaleRepository      saleOrderRepository = new SaleRepository();
            ISalesOrderService   saleOrderService    = new SalesOrderService(saleOrderRepository);

            _controller = new SaleController(saleService, shippingSaleService, saleOrderService);

            _controller.Request = new HttpRequestMessage();
            _controller.Request.SetConfiguration(new HttpConfiguration());

            return(_controller);
        }
Exemplo n.º 11
0
        public void GetEntityWithNotExistingID()
        {
            SectionRepository repository    = new SectionRepository();
            Section           resultSection = repository.GetEntity <Section>(NotExistindID);

            Assert.IsNull(resultSection);
        }
Exemplo n.º 12
0
        public void GetAllEntitiesCount()
        {
            SectionRepository repository = new SectionRepository();
            var sections = repository.GetAllEntities <Section>();

            Assert.AreEqual(repository.Sections.Count, sections.Count);
        }
Exemplo n.º 13
0
        /// <summary>
        /// gets the home of report module
        /// </summary>
        /// <returns>returns the result to action</returns>
        public ActionResult Index()
        {
            ContentManagement  objcontentman = new ContentManagement(this.SessionCustom, HttpContext);
            SectionRepository  objsection    = new SectionRepository(this.SessionCustom);
            TemplateRepository objtemplate   = new TemplateRepository(this.SessionCustom);

            objtemplate.Entity.Type = 0;

            ContentRepository     content     = new ContentRepository(SessionCustom);
            DataTable             pulsesTable = content.ReportPulses();
            List <SelectListItem> pulses      = new List <SelectListItem>();

            foreach (DataRow dr in pulsesTable.Rows)
            {
                pulses.Add(new SelectListItem()
                {
                    Value = dr["ContentId"].ToString(), Text = dr["Nombre"].ToString()
                });
            }

            pulsesTable.Dispose();
            ViewBag.Pulses = pulses;

            return(this.View(new NotificationSettingsModel()
            {
                UserPrincipal = this.CustomUser,
                Module = this.Module,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),

                CurrentLanguage = this.CurrentLanguage
            }));
        }
Exemplo n.º 14
0
        /// <summary>
        /// gets the home of BlogEntry module
        /// </summary>
        /// <returns>returns the result to action</returns>
        public ActionResult Index()
        {
            SetLabel();
            Business.Services.CustomPrincipal currentUserInfo = (Business.Services.CustomPrincipal)User;
            if (Utils.IsBlogAdmin(currentUserInfo.UserId))
            {
                int mod       = 54;
                int sectionId = 34;

                ContentManagement  objcontentman = new ContentManagement(this.SessionCustom, HttpContext);
                SectionRepository  objsection    = new SectionRepository(this.SessionCustom);
                TemplateRepository objtemplate   = new TemplateRepository(this.SessionCustom);
                objtemplate.Entity.Type = 0;

                return(this.View(new BlogEntryModel()
                {
                    UserPrincipal = this.CustomUser,
                    Module = this.Module,
                    ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                    Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                    DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId),
                    IContent = new Domain.Entities.Content()
                    {
                        ModulId = mod,
                        SectionId = sectionId
                    },
                    CurrentLanguage = this.CurrentLanguage
                }));
            }

            return(null);
        }
Exemplo n.º 15
0
        public void Get_staff_returns_staff()
        {
            using (var context = new FIFContext(ContextOptions))
            {
                var repository = new SectionRepository(context);
                var result     = repository.All().Result;

                result.Count.ShouldBe(3);

                result.ShouldSatisfyAllConditions(
                    () => result.ElementAt(0).SectionKey.ShouldBe("1"),
                    () => result.ElementAt(0).SchoolKey.ShouldBe("1"),
                    () => result.ElementAt(0).LocalCourseCode.ShouldBe("ACER08"),
                    () => result.ElementAt(0).SessionName.ShouldBe("Traditional"),
                    () => result.ElementAt(0).SectionIdentifier.ShouldBe("21855"),
                    () => result.ElementAt(0).SchoolYear.ShouldBe <Int16>(2012));

                result.ShouldSatisfyAllConditions(
                    () => result.ElementAt(1).SectionKey.ShouldBe("2"),
                    () => result.ElementAt(1).SchoolKey.ShouldBe("1"),
                    () => result.ElementAt(1).LocalCourseCode.ShouldBe("ACER08"),
                    () => result.ElementAt(1).SessionName.ShouldBe("Traditional-Spring Semester"),
                    () => result.ElementAt(1).SectionIdentifier.ShouldBe("21856"),
                    () => result.ElementAt(1).SchoolYear.ShouldBe <Int16>(2012));

                result.ShouldSatisfyAllConditions(
                    () => result.ElementAt(2).SectionKey.ShouldBe("3"),
                    () => result.ElementAt(2).SchoolKey.ShouldBe("2"),
                    () => result.ElementAt(2).LocalCourseCode.ShouldBe("ACER09"),
                    () => result.ElementAt(2).SessionName.ShouldBe("Traditional"),
                    () => result.ElementAt(2).SectionIdentifier.ShouldBe("21857"),
                    () => result.ElementAt(2).SchoolYear.ShouldBe <Int16>(2012));
            }
        }
Exemplo n.º 16
0
        public JsonResult GetChild(int id)
        {
            UrlHelper         url        = new UrlHelper(Request.RequestContext);
            SectionRepository objsection = new SectionRepository(SessionCustom);

            objsection.Entity.ParentId   = id;
            objsection.Entity.LanguageId = CurrentLanguage.LanguageId;

            IList <Section> coll = objsection.GetAllReadOnly();

            if (coll.Count > 0)
            {
                StringBuilder strb = new StringBuilder();
                strb.AppendLine("<ul style=\"display:none;\">");
                foreach (Section item in coll)
                {
                    strb.AppendLine("<li><div id='" + item.SectionId + "'><nobr><img onclick=\"expand(this, " + item.SectionId + ")\" height=\"15px\" width=\"15px\" src=\"" + url.Content("~/resources/images/25add.gif") + "\" />");
                    strb.AppendLine("<span onclick=\"ctnback.binddetail(" + item.SectionId + ")\">" + item.Name + "</span></nobr></div></li>");
                }

                strb.AppendLine("</ul>");
                return(this.Json(new { Iscontain = true, html = strb.ToString() }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(this.Json(new { Iscontain = false }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 17
0
        public UnitOfWork(global::SQLite.Net.Interop.ISQLitePlatform platform, string pathToDatabase)
        {
            var connection = new SQLiteConnection(platform, pathToDatabase);
            CreateTables(connection);

            Words = new WordRepository(connection);
            Sections = new SectionRepository(connection);
        }
Exemplo n.º 18
0
 public WikiSarvice(ILogger logger)
 {
     _logger      = logger;
     _pageRepo    = new PageRepository(_logger);
     _sectionRepo = new SectionRepository(_logger);
     _commentRepo = new CommentRepository(_logger);
     _markRepo    = new MarkRepository(_logger);
 }
Exemplo n.º 19
0
        public void GetEntityEqualsToOriginal()
        {
            SectionRepository repository    = new SectionRepository();
            List <Section>    sections      = repository.Sections;
            Section           resultSection = repository.GetEntity <Section>(ExistingID);

            Assert.AreEqual(repository.Sections.Where(u => u.ID == ExistingID).FirstOrDefault(), resultSection);
        }
Exemplo n.º 20
0
        public JsonResult Section(int?draw, int?start, int?length, List <Dictionary <string, string> > order, List <Dictionary <string, string> > columns)
        {
            var search        = Request["search[value]"];
            var dir           = order[0]["dir"].ToLower();
            var column        = columns[int.Parse(order[0]["column"])]["data"];
            var dataTableData = new SectionRepository().GetPage(search, draw, start, length, dir, column);

            return(Json(dataTableData, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 21
0
        public void SectionRepository_CanStore()
        {
            var repo       = new SectionRepository();
            var section    = new Section("секция 1");
            var subsection = new Subsection("первый подраздел");

            section.Add(subsection);
            repo.Store(section); // without error
        }
Exemplo n.º 22
0
        public void Get_staff_by_key_returns_null_when_it_does_not_exist()
        {
            using (var context = new FIFContext(ContextOptions))
            {
                var repository = new SectionRepository(context);
                var result     = repository.Get("999").Result;

                result.ShouldBeNull();
            }
        }
Exemplo n.º 23
0
 public UnitOfWork(DbContextOptions <ElearnerAppContext> optionsBuilder)
 {
     _context        = new ElearnerAppContext(optionsBuilder);
     UserRepo        = new UserRepository(_context);
     CourseRepo      = new CourseRepository(_context);
     SectionRepo     = new SectionRepository(_context);
     LessonRepo      = new LessonRepository(_context);
     CategoryRepo    = new CategoryRepository(_context);
     ApplicationRepo = new ApplicationRepository(_context);
 }
Exemplo n.º 24
0
        public void SaveContainsEntity()
        {
            SectionRepository repository = new SectionRepository();
            Section           section    = repository.Sections[0];
            Section           newSection = new Section();

            newSection.ID = section.ID;
            newSection.Reinitialization(section);
            Assert.IsFalse(repository.SaveEntity(newSection));
        }
Exemplo n.º 25
0
        public IngredientFormViewModel(GroceriesContext context)
        {
            UnitRepository unitRepo = new UnitRepository(context);

            UnitsSelectList = new SelectList(unitRepo.GetUnits(), "Id", "PluralDescriptor");

            SectionRepository sectionRepo = new SectionRepository(context);

            SectionsSelectList = new SelectList(sectionRepo.GetSections(), "Id", "Name");
        }
Exemplo n.º 26
0
 public UnitOfWork(LibarysystemDBcontext libarysystemDBcontext)
 {
     _context   = libarysystemDBcontext;
     activities = new ActivitiesRepository(_context);
     alumnus    = new AlumnusRepository(_context);
     program    = new ProgramRepository(_context);
     section    = new SectionRepository(_context);
     employee   = new EmployeeRepository(_context);
     person     = new PersonRepository(_context);
 }
Exemplo n.º 27
0
        public SectionController GetController()
        {
            var sectionRepository = new SectionRepository();

            _controller = new SectionController(sectionRepository);

            _controller.Request = new HttpRequestMessage();
            _controller.Request.SetConfiguration(new HttpConfiguration());

            return(_controller);
        }
Exemplo n.º 28
0
        public UnitOfWorkFakeDB()
        {
            _db         = FakeDB.GetInstance();
            _rollbackDb = new StaticDbRollback(_db);

            UserRepo        = new UserRepository(_db);
            CourseRepo      = new CourseRepository(_db);
            SectionRepo     = new SectionRepository(_db);
            LessonRepo      = new LessonRepository(_db);
            CategoryRepo    = new CategoryRepository(_db);
            ApplicationRepo = new ApplicationRepository(_db);
        }
 public StudentBusinessLogic()
 {
     _StudentRepository                = S360RepositoryFactory.GetRepository("STUDENT") as StudentRepository;
     _SectionRepository                = S360RepositoryFactory.GetRepository("SECTION") as SectionRepository;
     _Standardpository                 = S360RepositoryFactory.GetRepository("STANDARD") as StandardRepository;
     _LanguageRepository               = S360RepositoryFactory.GetRepository("LANGUAGE") as LanguageRepository;
     _StudentCategoryRepository        = S360RepositoryFactory.GetRepository("STUDENTCATEGORY") as StudentCategoryRepository;
     _ReligionRepository               = S360RepositoryFactory.GetRepository("RELIGION") as ReligionRepository;
     _StudentAcademicRepository        = S360RepositoryFactory.GetRepository("STUDENTACADEMIC") as StudentAcademicRepository;
     _studentDetainPromotionRepository = S360RepositoryFactory.GetRepository("DETAINORPROMOTION") as StudentDetainPromotionRepository;
     _studentTCRepository              = S360RepositoryFactory.GetRepository("STUDENTTC") as StudentTCRepository;
 }
Exemplo n.º 30
0
        /// <summary>
        /// obtains the challenge detail
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="id">identifier of section</param>
        /// <param name="sectionId">seccion del molulo</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Detail(int mod, int id, int?sectionId)
        {
            ContentManagement      objcontentman   = new ContentManagement(SessionCustom, HttpContext);
            ContentRepository      objcontent      = new ContentRepository(SessionCustom);
            SuccessStoryRepository objSuccessStory = new SuccessStoryRepository(SessionCustom);
            FileattachRepository   objfiles        = new FileattachRepository(SessionCustom);
            TagRepository          objtag          = new TagRepository(SessionCustom);
            SectionRepository      objsection      = new SectionRepository(SessionCustom);
            TemplateRepository     objtemplate     = new TemplateRepository(SessionCustom);
            CommentRepository      objcomment      = new CommentRepository(SessionCustom);
            TagFacade tagFacade = new TagFacade();

            objtemplate.Entity.Type = 0;

            objSuccessStory.Entity.ContentId        =
                objfiles.Entity.ContentId           =
                    objcomment.Entity.ContentId     =
                        objcontent.Entity.ContentId = id;

            objSuccessStory.LoadByKey();
            objcontent.LoadByKey();

            int totalComments = 0;
            List <CommentsPaging> comments = objcomment.CommentsPagingContent(0, 50, out totalComments, id);

            ViewBag.TotalComments = totalComments;

            IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id);

            this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId));
            this.ViewBag.NewsTags     = string.Empty;

            return(this.View(
                       "Index",
                       new SuccessStoryModel()
            {
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = this.Module,
                ListFiles = objfiles.GetAllReadOnly(),
                SuccessStory = objSuccessStory.Entity,
                IContent = objcontent.Entity,
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value),
                ListTags = SelectedTags,
                DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value),
                CurrentLanguage = this.CurrentLanguage,
                ListComments = comments,
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }
Exemplo n.º 31
0
        public ActionResult SectionDetail(int?id)
        {
            SectionViewModel model = new SectionViewModel();

            if (id.HasValue)
            {
                model = new SectionRepository().GetByID((int)id);
            }
            ViewBag.Division   = DropDownList.GetDivision(model.DivID, false);
            ViewBag.Department = DropDownList.GetDepartment(model.DivID, model.DepID, false);
            return(PartialView("_Section", model));
        }
Exemplo n.º 32
0
        public IActionResult GetVenueSections(int venueId)
        {
            SectionRepository sectionRepo = new SectionRepository(_context);
            var venue = _context.Venue.FirstOrDefault(v => v.VenueId == venueId);

            if (venue == null)
            {
                return(NotFound($"Venue '{venueId}' Not Found"));
            }

            return(Ok(sectionRepo.GetVenueSections(venue)));
        }
Exemplo n.º 33
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            ISectionRepository sectionRepo = new SectionRepository();
            await sectionRepo.Insert(new Section()
            {
                SectionName = "Section1",
                Students = new List<Student>() { new Student() { Name = "Student1" }, new Student() { Name = "Student2" } }
            });

            var sections = await sectionRepo.GetAll();

            base.OnNavigatedTo(e);
        }
Exemplo n.º 34
0
 public UnitOfWork(FypDbContext db)
 {
     _context = db;
     Campus = new CampusRepository(_context);
     Department = new DepartmentRepository(_context);
     Batch = new BatchRepository(_context);
     Section = new SectionRepository(_context);
     Student = new StudentRepository(_context);
     File = new FileRepository(_context);
     Teacher = new TeacherRepository(_context);
     EnrollDep = new EnrollDepartmentRepository(_context);
     EnrollBatch = new EnrollBatchRepository(_context);
     EnrollSection = new EnrollSectionRepository(_context);
     Course = new CourseRepository(_context);
     CourseToDep = new CourseToDepRepository(_context);
     StudentRegistration = new StudentRegistrationRepository(_context);
     subjectallocate = new SubjectAllocatRepository(_context);
 }
Exemplo n.º 35
0
        public static Section cloneSectionFromTemplate(SectionTemplate t, Document d)
        {
            using (ISession session = NHibernateHelper.OpenSession())
            {
                IAuditReader reader = AuditReaderFactory.Get(session);
                var revision = reader.CreateQuery()
                                .ForRevisionsOfEntity(typeof(SectionTemplate), false, true)
                                .AddProjection(AuditEntity.RevisionNumber().Max())
                                .Add(AuditEntity.Id().Eq(t.id))
                                .GetSingleResult();

                Section s = new Section();
                s.template = t;
                s.templateRevisionId = (int)revision;
                s.documentIndex = t.documentIndex;
                s.headline = t.headline;
                s.htmlContent = t.htmlContent;
                s.document = d;

                SectionRepository repo = new SectionRepository();

                repo.Create(s);

                foreach (DataFieldTemplate item in t.dataFields)
                {
                    DataField df = cloneDataFieldFromTemplate(item, s);

                    string toReplace = "{dataField=" + item.id + "}";
                    string replaceWith = "{dataField=" + df.id + "}";

                    s.htmlContent = s.htmlContent.Replace(toReplace, replaceWith);
                }

                repo.Update(s);

                return s;
            }
        }
Exemplo n.º 36
0
    protected void btnImport_Click(object sender, EventArgs e)
    {
        btnImport.Enabled = false;
        fuImport.Enabled = false;
        btnImport.Text = "Processing...";
        if (!fuImport.HasFile)
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Chọn file để nhập');", true);
        else
        {
            string ext = fuImport.FileName.Substring(fuImport.FileName.LastIndexOf('.') + 1).ToLower();
            if (!ext.Equals("xls") && !ext.Equals("xlsx"))
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Định dạng file nhập ko đúng');", true);
            else
            {
                string newFileName = Guid.NewGuid().ToString("N") + "." + ext;
                string pathToFile = Server.MapPath("~\\Import") + "\\" + newFileName;
                fuImport.SaveAs(pathToFile);
                try
                {
                    ObjLogin adm = (ObjLogin)Session["objLogin"];

                    int smsquota = int.Parse(ConfigurationManager.AppSettings["SMSQuota"]);
                    double expiredDateConfig = Convert.ToDouble(ConfigurationManager.AppSettings["ExpiredDate"]);
                    DateTime expiredDate = Convert.ToDateTime(DateTime.Now.AddDays(expiredDateConfig));

                    var GRepo = new GroupsRepository();
                    var RegionRepo = new RegionsRepository();
                    var AreaRepo = new AreasRepository();
                    var LocalRepo = new LocalsRepository();
                    var ChRepo = new ChannelRepository();
                    var SaleRepo = new SalesmanRepository();
                    var CLogRepo = new CustomersLogRepository();
                    var CRepo = new CustomersRepository();
                    var CTRepo = new CustomerTypeRepository();
                    var DisRepo = new DistrictsRepository();
                    var proviceRepo = new ProvincesRepository();
                    var sectionRepo = new SectionRepository();

                    SpreadsheetInfo.SetLicense("E24D-D739-F65A-4E00");
                    ExcelFile ef = new ExcelFile();
                    ef.LoadXls(pathToFile);
                    ExcelWorksheet ws = ef.Worksheets[0];

                    for (int i = 2; i < ws.Rows.Count; i++)
                    {
                        try
                        {
                            vwMasterList vmMasterItem = new vwMasterList(ws.Rows[i].Cells[4].Value.ToString(),
                                                                ws.Rows[i].Cells[5].Value.ToString(),
                                                                ws.Rows[i].Cells[6].Value.ToString(),
                                                                ws.Rows[i].Cells[7].Value.ToString(),
                                                                ws.Rows[i].Cells[8].Value.ToString(),
                                                                ws.Rows[i].Cells[9].Value.ToString(),
                                                                ws.Rows[i].Cells[10].Value.ToString(),
                                                                ws.Rows[i].Cells[11].Value.ToString(),
                                                                ws.Rows[i].Cells[12].Value.ToString(),
                                                                ws.Rows[i].Cells[13].Value.ToString(),
                                                                ws.Rows[i].Cells[14].Value.ToString(),
                                                                ws.Rows[i].Cells[15].Value.ToString(),
                                                                ws.Rows[i].Cells[17].Value.ToString(),
                                                                ws.Rows[i].Cells[18].Value.ToString(),
                                                                ws.Rows[i].Cells[19].Value.ToString(),
                                                                ws.Rows[i].Cells[20].Value.ToString(),
                                                                ws.Rows[i].Cells[22].Value.ToString(),
                                                                ws.Rows[i].Cells[23].Value.ToString(),
                                                                ws.Rows[i].Cells[24].Value.ToString());

                            // Add Group - Region - Area - Local
                            var groupId = GRepo.Import("", vmMasterItem.Group, "");
                            var regionId = RegionRepo.Import("", vmMasterItem.Region, "", groupId);
                            var areaId = AreaRepo.Import("", vmMasterItem.Area, "", regionId);
                            var localId = LocalRepo.Import("", vmMasterItem.Local, "", areaId);

                            // Add section
                            var sectionId = sectionRepo.Import(vmMasterItem.Area);

                            // Add Province
                            var provinceId = proviceRepo.Import(vmMasterItem.Local, sectionId);

                            // Add District
                            var districtId = DisRepo.Import(vmMasterItem.Local, provinceId);

                            // Add Channel
                            ChRepo.Insert("", vmMasterItem.Channel1, 0);
                            ChRepo.Insert("", vmMasterItem.Channel2, ChRepo.GetChannelIdByName(vmMasterItem.Channel1));
                            ChRepo.Insert("", vmMasterItem.Channel3, ChRepo.GetChannelIdByName(vmMasterItem.Channel2));

                            // Add Customer Type
                            CTRepo.Add("", vmMasterItem.Channel3);

                            // Add Salesmen
                            var tromId = SaleRepo.ImportSalesmen("", vmMasterItem.TROM, "", (int)SalesmenRole.TROM, smsquota, expiredDate, -1);
                            var tpsId = SaleRepo.ImportSalesmen("", vmMasterItem.TPS, "", (int)SalesmenRole.TPS, smsquota, expiredDate, tromId);
                            var tprId = SaleRepo.ImportSalesmen("", vmMasterItem.TPR, "", (int)SalesmenRole.TPR, smsquota, expiredDate, tpsId);

                            var eromId = SaleRepo.ImportSalesmen("", vmMasterItem.EROM, "", (int)SalesmenRole.EROM, smsquota, expiredDate, -1);
                            var pss1Id = SaleRepo.ImportSalesmen("", vmMasterItem.PSS1, "", (int)SalesmenRole.PSS1, smsquota, expiredDate, eromId);
                            var psr1Id = SaleRepo.ImportSalesmen("", vmMasterItem.PSR1, "", (int)SalesmenRole.PSR1, smsquota, expiredDate, pss1Id);

                            var erom2Id = SaleRepo.ImportSalesmen("", vmMasterItem.EROM2, "", (int)SalesmenRole.EROM2, smsquota, expiredDate, -1);
                            var pss2Id = SaleRepo.ImportSalesmen("", vmMasterItem.PSS2, "", (int)SalesmenRole.PSS2, smsquota, expiredDate, erom2Id);
                            var psr2Id = SaleRepo.ImportSalesmen("", vmMasterItem.PSR2, "", (int)SalesmenRole.PSR2, smsquota, expiredDate, pss2Id);

                            // Add Salesgroup - salesregion - salesarea - saleslocal
                            ImportSalesGroup(tromId, tpsId, tprId, eromId, pss1Id, psr1Id, erom2Id, pss2Id, psr2Id, GRepo, groupId);
                            ImportSalesRegion(tromId, tpsId, tprId, eromId, pss1Id, psr1Id, erom2Id, pss2Id, psr2Id, RegionRepo, regionId);
                            ImportSalesArea(tromId, tpsId, tprId, eromId, pss1Id, psr1Id, erom2Id, pss2Id, psr2Id, AreaRepo, areaId);
                            ImportSalesLocal(tromId, tpsId, tprId, eromId, pss1Id, psr1Id, erom2Id, pss2Id, psr2Id, LocalRepo, localId);

                            // Add Customer - Customer Log
                            int CustomerId = CRepo.InsertCustomer(vmMasterItem.CustomerCode, vmMasterItem.Customername, vmMasterItem.Customeraddress, "", "", "", "",
                                CTRepo.GetCustomerTypeIdByName(vmMasterItem.Channel3),
                                ChRepo.GetChannelIdByName(vmMasterItem.Channel3), districtId, localId, DateTime.Now, DateTime.Now,
                                true, false);
                            CLogRepo.InsertCustomer(vmMasterItem.CustomerCode, vmMasterItem.Customername, vmMasterItem.Customeraddress, "", "", "", "",
                                CTRepo.GetCustomerTypeIdByName(vmMasterItem.Channel3),
                                ChRepo.GetChannelIdByName(vmMasterItem.Channel3), districtId, localId, DateTime.Now, DateTime.Now,
                                true, CustomerId, false, 0, adm.Id, string.Empty);

                            lstCustomer.Add(vmMasterItem);
                        }
                        catch (Exception ex)
                        {
                            // write log here => TBD
                        }
                    }

                    CustomerList.DataSource = lstCustomer;
                    CustomerList.DataBind();
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('" + ex.Message + "');", true);
                }
                finally
                {

                }

            }
        }
        btnImport.Enabled = true;
        fuImport.Enabled = true;
        btnImport.Text = "Import";
    }