예제 #1
0
        public ActionResult WelcomeParent()
        {
            IParentRepo repo   = new ParentRepo();
            Parent      parent = repo.Get(Session["UserEmail"].ToString());

            return(View(parent));
        }
예제 #2
0
        public ActionResult DeleteParent(int id)
        {
            IParentRepo repo = new ParentRepo();

            repo.Delete(id);
            Session["parent"]   = "False";
            TempData["welcome"] = "Yor Account has been deleted Successfully";
            return(RedirectToAction("Index", "Home"));
        }
 private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
 {
     if (FormMode == FormModes.Edit || FormMode == FormModes.View)
     {
         StudentDetail = StudentRepo.FindByID(SelectedStudenID);
         ParentDetail  = ParentRepo.FindByID(StudentDetail.ParentID);
         var _tempClass = ClassStudentRepo.FindByUserID(StudentDetail.StudentID);
         SelectedClassID = _tempClass != null ? _tempClass.ClassID : 0;
     }
     ViewModeGenericWork();
 }
예제 #4
0
 public ActionResult UpdateParent(Parent parent)
 {
     if (ModelState.IsValid)
     {
         IParentRepo repo = new ParentRepo();
         repo.Update(parent);
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(View(parent));
     }
 }
 public ActionResult ParentSignUp(Parent parent)
 {
     if (ModelState.IsValid)
     {
         IParentRepo repo = new ParentRepo();
         repo.Insert(parent);
         TempData["welcome"] = "Your registration is completed succesfully!";
         return(RedirectToAction("Index", "Login"));
     }
     else
     {
         return(View(parent));
     }
 }
        private void btnStudentSave_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (FormMode == FormModes.View)
            {
                this.ActualParent.Close();
                return;
            }

            if (isValidate())
            {
                int _studentID = 0;

                if (FormMode == FormModes.New)
                {
                    int parentid = 0;
                    StudentDetail.created_by = StudentDetail.updated_by = ParentDetail.updated_by = ParentDetail.created_by = Utilities.UserSession.UserID;
                    StudentDetail.ClassID    = SelectedClassID;
                    if (ParentDetail.isNew)
                    {
                        parentid = ParentRepo.Insert(ParentDetail);
                    }
                    else
                    {
                        ParentRepo.Update(ParentDetail);
                        parentid = ParentDetail.ParentID;
                    }
                    StudentDetail.ParentID           = parentid;
                    StudentDetail.RegistrationNumber = "123123";
                    _studentID = StudentRepo.Insert(StudentDetail);
                    ClassStudentRepo.Insert(new ClassStudent {
                        ClassID = SelectedClassID, StudentID = _studentID, created_by = StudentDetail.created_by, updated_by = StudentDetail.updated_by
                    });
                }
                else if (FormMode == FormModes.Edit)
                {
                    StudentDetail.ParentID   = ParentDetail.ParentID;
                    StudentDetail.updated_by = ParentDetail.updated_by = Utilities.UserSession.UserID;
                    StudentDetail.ClassID    = SelectedClassID;
                    StudentRepo.Update(StudentDetail);
                    ParentRepo.Update(ParentDetail);
                    ClassStudentRepo.Update(new ClassStudent {
                        ClassID = SelectedClassID, StudentID = _studentID, updated_by = StudentDetail.updated_by
                    });
                }
                this.ActualParent.Close();
            }
        }
예제 #7
0
        internal async Task DownloadFileAsync()
        {
            try
            {
                var baseTsk = ParentRepo.HttpGetAsync($@"https://github.com/{ParentRepo.Owner}/{ParentRepo.RepoName}/raw/{ParentPullRequst.Base.Sha}/{Filename}");
                var headTsk = ParentRepo.HttpGetAsync($@"https://github.com/{ParentRepo.Owner}/{ParentRepo.RepoName}/raw/{ParentPullRequst.Head.Sha}/{Filename}");

                var text = await Task.WhenAll(baseTsk, headTsk);

                var baseText = text[0];
                var headText = text[1];

                if (ParentRepo.LineEndings == LineEndingType.crlf)
                {
                    //Area for speed improvement
                    baseText = baseText.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
                    headText = headText.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
                }
                else
                {
                    //Area for speed improvement
                    baseText = baseText.Replace("\r\n", "\n").Replace("\r", "\n");
                    headText = headText.Replace("\r\n", "\n").Replace("\r", "\n");
                }

                BaseTree = CSharpSyntaxTree.ParseText(baseText);
                HeadTree = CSharpSyntaxTree.ParseText(headText);

                Directory.CreateDirectory(Path.GetDirectoryName(CachePathBase));
                File.WriteAllText(CachePathBase, baseText);
                File.WriteAllText(CachePathHead, headText);
            }
            catch (GitHubUnknownErrorException ex) when(ex.Message == "Not Found")
            {
                //See #82
                IsInvalid = true;
            }
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     ParentList = ParentRepo.GetAll();
 }
예제 #9
0
        public ActionResult UpdateParent(int id)
        {
            IParentRepo repo = new ParentRepo();

            return(View(repo.Get(id)));
        }