Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblParent tblParent = db.tblParents.Find(id);

            db.tblParents.Remove(tblParent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void AddParentTask(tblParent item)
 {
     using (FinalSBADBEntities db1 = new FinalSBADBEntities())
     {
         db1.tblParents.Add(item);
         db1.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public void UpdateParentTask(tblParent taskitem)
 {
     using (ProjectManagerDBEntities db1 = new ProjectManagerDBEntities())
     {
         tblParent taskupdate = db1.tblParents.SingleOrDefault(x => x.ParentId == taskitem.ParentId);
         taskupdate.parentName = taskitem.parentName;
         db1.SaveChanges();
     }
 }
 public void UpdateParentTask(tblParent taskitem)
 {
     using (FinalSBADBEntities db1 = new FinalSBADBEntities())
     {
         tblParent taskupdate = db1.tblParents.SingleOrDefault(x => x.ParentId == taskitem.ParentId);
         taskupdate.ParentName = taskitem.ParentName;
         db1.SaveChanges();
     }
 }
 public void Deleteparenttask(int Id)
 {
     using (FinalSBADBEntities db1 = new FinalSBADBEntities())
     {
         tblParent par = db1.tblParents.Where(d => d.ParentId == Id).First();
         db1.tblParents.Remove(par);
         db1.SaveChanges();
     }
 }
Ejemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "ParentID,Name,Surname,IDNumber,WorkNo,HomeNo,CellNo,Email")] tblParent tblParent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblParent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblParent));
 }
Ejemplo n.º 7
0
        public JsonResult EditParentDetails(ParentModel TCtable)
        {
            try
            {
                string    result = "Error";
                long      a      = long.Parse(TCtable.ParentId);
                tblParent TModel = Connection.tblParents.SingleOrDefault(x => x.ParentId == a);

                TModel.ParentId       = a;
                TModel.Address1       = TCtable.Address1;
                TModel.Address2       = TCtable.Address2;
                TModel.Address3       = TCtable.Address3;
                TModel.DateofBirth    = TCtable.DateofBirth;
                TModel.OfficeAddress1 = TCtable.OfficeAddress1;
                TModel.OfficeAddress2 = TCtable.OfficeAddress2;
                TModel.OfficeAddress3 = TCtable.OfficeAddress3;
                TModel.HomeTelephone  = TCtable.HomeTelephone;
                TModel.PersonalEmail  = TCtable.PersonalEmail;
                TModel.PersonalMobile = TCtable.PersonalMobile;
                TModel.Occupation     = TCtable.Occupation;
                TModel.OfficePhone    = TCtable.OfficePhone;
                TModel.officeEmail    = TCtable.officeEmail;
                TModel.NIC            = TCtable.NIC;
                TModel.DateofBirth    = TCtable.DateofBirth;
                TModel.RelationshipId = TCtable.RelationshipId;

                TModel.ParentName = TCtable.ParentName;



                Connection.SaveChanges();

                result = TCtable.ParentId.ToString();
                //tblTeacherSchool Tschool = new tblTeacherSchool();

                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
            {
                Exception raise = dbEx;
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        string message = string.Format("{0}:{1}",
                                                       validationErrors.Entry.Entity.ToString(),
                                                       validationError.ErrorMessage);
                        // raise a new exception nesting
                        // the current instance as InnerException
                        raise = new InvalidOperationException(message, raise);
                    }
                }
                throw raise;
            }
        }
Ejemplo n.º 8
0
        public ActionResult Create([Bind(Include = "ParentID,Name,Surname,IDNumber,WorkNo,HomeNo,CellNo,Email")] tblParent tblParent)
        {
            if (ModelState.IsValid)
            {
                db.tblParents.Add(tblParent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblParent));
        }
Ejemplo n.º 9
0
 public void AddParentTask(tblParent item)
 {
     using (ProjectManagerDBEntities db1 = new ProjectManagerDBEntities())
     {
         try
         {
             db1.tblParents.Add(item);
             db1.SaveChanges();
         }
         catch { };
     }
 }
Ejemplo n.º 10
0
 public void Deleteparenttask(int Id)
 {
     try
     {
         using (ProjectManagerDBEntities db1 = new ProjectManagerDBEntities())
         {
             tblParent par = db1.tblParents.Where(d => d.ParentId == Id).First();
             db1.tblParents.Remove(par);
             db1.SaveChanges();
         }
     }
     catch { }
 }
Ejemplo n.º 11
0
        // GET: tblParents/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblParent tblParent = db.tblParents.Find(id);

            if (tblParent == null)
            {
                return(HttpNotFound());
            }
            return(View(tblParent));
        }
Ejemplo n.º 12
0
        public void benchmarkmethod(BenchmarkContext context)
        {
            var bytes = new byte[1024];

            _opcounter.Increment();
            tblTask T    = (new tblTask {
                TaskId = 1, TaskName = "taskname", TStartDate = DateTime.Now, TEndDate = DateTime.Now, TPriority = 10, TStatus = false, ParentTaskName = "parenttask", UserId = 0
            });
            tblProject P = (new tblProject {
                ProjectId = 1, ProjectName = "ProjectName", PStartDate = DateTime.Now, PEndDate = DateTime.Now, PPriority = 10, Pstatus = false, ManagerId = 0, completed = 0, Nooftasks = 0
            });
            tblUser U    = (new tblUser {
                UserId = 1, FirstName = "FirstName", LastName = "LastName", EmployeeId = "Emp01"
            });
            tblParent Pa = (new tblParent {
                ParentId = 1, ParentName = "ParentTask"
            });

            TaskBAL.GetProject();
            TaskBAL.GetTask();
            TaskBAL.GetUser();
            TaskBAL.GetParentTask();

            TaskBAL.AddTask(T);
            TaskBAL.UpdateTask(T);
            TaskBAL.DeleteTask(T.TaskId);
            TaskBAL.GetTaskbyId(T.TaskId);
            TaskBAL.Suspendtask(T.TaskId);
            TaskBAL.Endtask(T.TaskId);

            TaskBAL.AddProject(P);
            TaskBAL.DeleteProject(P.ProjectId);
            TaskBAL.GetProjectbyId(P.ProjectId);
            TaskBAL.Updateproject(P);

            TaskBAL.AddUser(U);
            TaskBAL.DeleteUser(U.UserId);
            TaskBAL.UpdateUser(U);
            TaskBAL.GetUserbyId(U.UserId);

            TaskBAL.AddParentTask(Pa);
            TaskBAL.Deleteparenttask(Pa.ParentId);
            TaskBAL.UpdateParentTask(Pa);
            TaskBAL.GetparenttaskbyId(Pa.ParentId);
        }
        public void benchmarkmethod(BenchmarkContext context)
        {
            var bytes = new byte[1024];

            _opcounter.Increment();
            tblTask Task       = (new tblTask {
                TaskName = "Cooking", TStartDate = DateTime.Now, TEndDate = DateTime.Now, TPriority = 10, TStatus = false, ParentTaskName = "Buying vegetables", UserId = 1
            });
            tblParent Parent   = (new tblParent {
                ParentId = 1, parentName = "Washing"
            });
            tblProject Project = (new tblProject {
                ProjectId = 1, ProjectName = "Buying Vegetables", PStartDate = DateTime.Now, PEndDate = DateTime.Now, PPriority = 10, PStatus = false, ManagerId = 1
            });
            tblUser user       = (new tblUser {
                UserId = 1, FirstName = "FirstName", LastName = "LastName", EmployeeId = "Emp011"
            });

            TaskBL.GetProject();
            TaskBL.GetTask();
            TaskBL.GetUser();
            TaskBL.GetParentTask();

            TaskBL.DeleteUser(user.UserId);
            TaskBL.DeleteTask(Task.TaskId);
            TaskBL.DeleteProject(Project.ProjectId);
            TaskBL.Deleteparenttask(Parent.ParentId);

            TaskBL.UpdateUser(user);
            TaskBL.UpdateTask(Task);
            TaskBL.Updateproject(Project);
            TaskBL.UpdateParentTask(Parent);

            TaskBL.GetUserbyId(user.UserId);
            TaskBL.GetTaskbyId(Task.TaskId);
            TaskBL.GetProjectbyId(Project.ProjectId);
            TaskBL.GetparenttaskbyId(Parent.ParentId);

            TaskBL.AddUser(user);
            TaskBL.AddTask(Task);
            TaskBL.AddProject(Project);
            TaskBL.AddParentTask(Parent);
        }
Ejemplo n.º 14
0
        public ActionResult ShowEditParent(string ParentId)
        {
            long pid = long.Parse(ParentId);
            List <tblRelashionship> SRlist = Connection.tblRelashionships.Where(X => X.IsActive == "Y").ToList();

            ViewBag.RelationshipList = new SelectList(SRlist, "RelashionshipId", "RelashionshipName");



            ParentModel TModel = new ParentModel();

            tblParent TCtable = Connection.tblParents.SingleOrDefault(x => x.ParentId == pid);

            //  TModel.IsActive = TCtable.IsActive;
            TModel.ParentId       = TCtable.ParentId.ToString();
            TModel.Address1       = TCtable.Address1;
            TModel.Address2       = TCtable.Address2;
            TModel.Address3       = TCtable.Address3;
            TModel.DateofBirth    = TCtable.DateofBirth;
            TModel.OfficeAddress1 = TCtable.OfficeAddress1;
            TModel.OfficeAddress2 = TCtable.OfficeAddress2;
            TModel.OfficeAddress3 = TCtable.OfficeAddress3;
            TModel.HomeTelephone  = TCtable.HomeTelephone;
            TModel.PersonalEmail  = TCtable.PersonalEmail;
            TModel.PersonalMobile = TCtable.PersonalMobile;
            TModel.Occupation     = TCtable.Occupation;
            TModel.OfficePhone    = TCtable.OfficePhone;
            TModel.officeEmail    = TCtable.officeEmail;
            TModel.NIC            = TCtable.NIC;
            TModel.DateofBirth    = TCtable.DateofBirth;
            TModel.RelationshipId = TCtable.RelationshipId;

            TModel.ParentName = TCtable.ParentName;



            return(PartialView("EditParentDetailsView", TModel));
        }
Ejemplo n.º 15
0
        public ActionResult Details(long ParentId)
        {
            // Authentication("PCF");


            ParentModel TModel = new ParentModel();

            tblParent TCtable = Connection.tblParents.SingleOrDefault(x => x.ParentId == ParentId);

            tblRelashionship TCtable2 = Connection.tblRelashionships.SingleOrDefault(x => x.RelashionshipId == TCtable.RelationshipId);

            // var varstudents  = Connection.tblParentStudents.SingleOrDefault(x => x.ParentId == TCtable.ParentId);

            TModel.RelationshipId   = TCtable.RelationshipId;
            TModel.RelationshipName = TCtable2.RelashionshipName;
            //  TModel.IsActive = TCtable.IsActive;
            TModel.ParentId       = TCtable.ParentId.ToString();
            TModel.Address1       = TCtable.Address1;
            TModel.Address2       = TCtable.Address2;
            TModel.Address3       = TCtable.Address3;
            TModel.DateofBirth    = TCtable.DateofBirth;
            TModel.OfficeAddress1 = TCtable.OfficeAddress1;
            TModel.OfficeAddress2 = TCtable.OfficeAddress2;
            TModel.OfficeAddress3 = TCtable.OfficeAddress3;
            TModel.HomeTelephone  = TCtable.HomeTelephone;
            TModel.PersonalEmail  = TCtable.PersonalEmail;
            TModel.PersonalMobile = TCtable.PersonalMobile;
            TModel.Occupation     = TCtable.Occupation;
            TModel.OfficePhone    = TCtable.OfficePhone;
            TModel.officeEmail    = TCtable.officeEmail;
            TModel.NIC            = TCtable.NIC;

            if (TCtable.ImgUrl == null)
            {
                TModel.ImagePath = "~/Uploads/Parent/Photo/no_image.jpg";
            }
            else
            {
                TModel.ImagePath = TCtable.ImgUrl;
            }

            if (TCtable.DateofBirth == null)
            {
            }
            else
            {
                string   a = TCtable.DateofBirth.ToString();
                DateTime b = DateTime.Parse(a);
                TModel.datetimestring = b.ToShortDateString();
            }

            //TModel.DateofBirth = TCtable.DateofBirth;
            // TModel.DateofBirth = DateTime.ParseExact(TCtable.DateofBirth.GetValueOrDefault().ToShortDateString(), "yyyy/MM/DD");
            //   DateTime A= DateTime.ParseExact(TCtable.DateofBirth.GetValueOrDefault().ToShortDateString()

            string parent = TCtable.ParentId.ToString();



            var STQlist = Connection.SMGTgetParentStudentadd(parent, "%").ToList();

            List <ParentModel> List2 = STQlist.Select(x => new ParentModel
            {
                StudentId   = x.StudentId,
                ParentName  = x.ParentName,
                ParentId    = x.ParentId.ToString(),
                StudentName = x.studentName
            }).ToList();
            string s = "";


            for (int i = 1; i < List2.Count; i++)
            {
                s = s + "," + List2[i].StudentName;
            }
            if (List2.Count > 1)
            {
                TModel.Children = "" + List2[0].StudentName + s;
            }

            else
            {
                if (List2.Count == 1)
                {
                    TModel.Children = "" + List2[0].StudentName;
                }
                else
                {
                    TModel.Children = "";
                }
            }

            TModel.ParentName = TCtable.ParentName;


            return(View(TModel));
        }
Ejemplo n.º 16
0
        public void InsertParent()
        {
            try
            {
                using (KungFuEntities2 entities = new KungFuEntities2())
                {
                    var studentID = (from obj in entities.tblStudents
                                     where obj.STU_NUM == txtStudentNumber.Text
                                     select obj.STU_ID).FirstOrDefault();


                    //var query = entities.tblStudents.AsEnumerable().Where(s => s.STU_NUM.Contains(txtStudentNumber.Text)).Select(s => s.STU_ID).Distinct();
                    if (studentID != 0)
                    {
                        int ihdnPKID  = int.Parse(hdnPKId.Value);
                        var objParent = entities.tblParents.Where(s => s.PARENT_ID == ihdnPKID).OrderByDescending(s => s.PARENT_ID).FirstOrDefault();
                        if (objParent == null)
                        {
                            objParent = new tblParent();
                        }
                        objParent.PARENT_FNAME        = txtFName.Text;
                        objParent.PARENT_MNAME        = txtMName.Text;
                        objParent.PARENT_LNAME        = txtLName.Text;
                        objParent.PARENT_MNUM         = txtMobileNumber.Text;
                        objParent.PARENT_EMAIL        = txtEmail.Text;
                        objParent.PARENT_CREATED_BY   = entities.tblInstructors.AsEnumerable().FirstOrDefault().INSTRUCTOR_ID;
                        objParent.PARENT_CREATED_DATE = DateTime.Now;
                        objParent.STU_ID = Convert.ToInt32(studentID);
                        if (rbtnMale.Checked)
                        {
                            objParent.PARENT_GENDER = true;
                        }
                        else
                        {
                            objParent.PARENT_GENDER = false;
                        }
                        objParent.PARENT_IS_STUDENT = chkIsStudent.Checked;
                        objParent.PARENT_STATUS     = chkIsApprove.Checked;

                        if (objParent.PARENT_ID == 0)
                        {
                            entities.tblParents.Add(objParent);
                        }
                        else
                        {
                            objParent.PARENT_MODIFY_BY      = entities.tblInstructors.Select(x => x.INSTRUCTOR_ID).FirstOrDefault();
                            objParent.PARENT_MODIFIED_DATE  = DateTime.Now;
                            entities.Entry(objParent).State = System.Data.Entity.EntityState.Modified;
                        }
                        entities.SaveChanges();

                        objParent = null;
                        if (hdnPKId.Value != "0")
                        {
                            Response.Redirect("ParentList.aspx");
                        }
                        ResetControls();
                        divMessage.Visible  = true;
                        divErrorMsg.Visible = false;
                    }
                    else
                    {
                        divErrorMsg.Visible = true;
                        divMessage.Visible  = false;
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }