Beispiel #1
0
        public void LoadData()
        {
            //BatchId = Convert.ToInt32(id);
            var editQuery = Request.QueryString["edit"];
            var edit      = (editQuery ?? "0").ToString();
            var user      = Page.User as CustomPrincipal;

            if (user != null)
            {
                var fromSession = Request.QueryString["from"];
                if (fromSession == "startSession")
                {
                    lblFromSessionNotice.Visible = true;
                }

                using (var helper = new DbHelper.Batch())
                {
                    var batch = helper.GetBatch(BatchId);
                    if (batch != null)
                    {
                        if (SiteMap.CurrentNode != null)
                        {
                            LoadSiteMap(edit == "1", batch);
                        }
                        lblBatchName.Text = batch.Name;
                        lblSummary.Text   = batch.Description;
                        lblTitle.Text     = batch.Name;
                    }
                    var programs = helper.GetProgramBatchList(BatchId);
                    foreach (var prog in programs)
                    {
                        var no = prog.StudentBatches.Count(x => !(x.Void ?? false));

                        var item = (Batch.BatchDetail.DetailItemUc)
                                   Page.LoadControl("~/Views/Student/Batch/BatchDetail/DetailItemUc.ascx");

                        item.LoadData(prog.Id, prog.BatchId, prog.NameFromBatch, prog.ProgramId
                                      , prog.Program.Name, prog.StartedStudying, prog.StudyCompleted, prog.Void, no, edit);
                        //if (prog.CurrentYear != null)
                        //{
                        //    item.CurrentYear = prog.CurrentYear.Name;
                        //}
                        //if (prog.CurrentSubYear != null)
                        //{
                        //    item.CurrentSubYear = prog.CurrentSubYear.Name;
                        //}

                        item.Enabled = !(prog.Void ?? false);
                        pnlProgramsInTheBatch.Controls.Add(item);
                    }
                }
            }
        }
Beispiel #2
0
        //  // Note :: ├ ==>1 ,    └ ==> 2 .   ┌ ==> 3 ,   │ ==> 4 ,  empty ==> 0
        public void LoadStructure1(int schoolId, List <Academic.ViewModel.Batch.BatchViewModel> progList)
        {
            if (progList != null)
            {
                using (var batchHelper = new DbHelper.Batch())
                    using (var helper = new DbHelper.Structure())
                    {
                        var progBatchList = batchHelper.GetProgramBatchList(BatchId);

                        var programs = helper.ListPrograms(schoolId);
                        var ip       = 1;
                        programs.ForEach(p =>
                        {
                            var puc =
                                (LabelAndCheckBoxUC)
                                Page.LoadControl(
                                    "~/Views/Structure/All/UserControls/StructureView/LabelAndCheckBoxUC.ascx");

                            var pbId = 0;
                            if (progBatchList != null)
                            {
                                var saved = progBatchList.FirstOrDefault(x => x.ProgramId == p.Id);
                                if (saved != null)
                                {
                                    pbId = saved.Id;
                                    progList.Add(new BatchViewModel()
                                    {
                                        ProgramBatchId = saved.Id
                                        ,
                                        ProgramId = saved.ProgramId
                                        ,
                                        Check = true
                                    });
                                    puc.Check = true;
                                }
                            }

                            puc.SetName(p.Id, p.Name, pbId);
                            //puc.CheckedChange += puc_CheckedChange;
                            pnlTree.Controls.Add(puc);
                            ip++;
                        });
                    }
            }
        }
Beispiel #3
0
        //protected void lnkAddPrograms_Click(object sender, EventArgs e)
        //{
        //    Response.Redirect("~/Views/Student/Batch/BatchDetail/AddPrograms.aspx"+"?Id="+BatchId);
        //}

        public void LoadData()
        {
            var editQuery = Request.QueryString["edit"];
            var edit      = (editQuery ?? "0").ToString();

            //BatchId = Convert.ToInt32(id);
            using (var helper = new DbHelper.Batch())
            {
                var batch = helper.GetBatch(BatchId);
                if (batch != null)
                {
                    lblBatchName.Text = batch.Name;
                    lblSummary.Text   = batch.Description;
                }
                var programs = helper.GetProgramBatchList(BatchId);
                foreach (var prog in programs)
                {
                    var no = prog.StudentBatches.Count(x => !(x.Void ?? false));

                    DetailItemUc item = (DetailItemUc)Page.LoadControl("~/Views/Student/Batch/BatchDetail/DetailItemUc.ascx");
                    item.LoadData(prog.Id, prog.BatchId, prog.NameFromBatch, prog.ProgramId
                                  , prog.Program.Name, prog.StartedStudying, prog.StudyCompleted, prog.Void, no, edit);
                    //if (prog.CurrentYear != null)
                    //{
                    //    item.CurrentYear = prog.CurrentYear.Name;
                    //}
                    //if (prog.CurrentSubYear != null)
                    //{
                    //    item.CurrentSubYear = prog.CurrentSubYear.Name;
                    //}

                    item.Enabled = !(prog.Void ?? false);
                    pnlProgramsInTheBatch.Controls.Add(item);
                }
            }
        }