示例#1
0
        public void Modify(Person person)
        {
            try
            {
                PERSON personEntity = _da.GetSingleBy <PERSON>(p => p.Person_Id == person.Id);
                if (personEntity != null)
                {
                    personEntity.First_Name      = person.FirstName;
                    personEntity.Last_Name       = person.LastName;
                    personEntity.Person_Type_Id  = person.Type.Id;
                    personEntity.Other_Name      = person.OtherName;
                    personEntity.Contact_Address = person.ContactAddress;
                    personEntity.Email           = person.Email;
                    personEntity.Mobile_Phone    = person.MobilePhone;
                    personEntity.State_Id        = person.State.Id;
                    personEntity.Lga_Id          = person.Lga.Id;
                    personEntity.Country_Id      = person.Country.Id;

                    _da.Save();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#2
0
        public void UnFollowing(PERSON followingPerson, PERSON followerPerson)
        {
            using (TweetContext db = new TweetContext())
            {
                //PERSON obj = db.persons.Find(person.user_id);

                PERSON        objFollowing  = db.persons.Include("followers").Include("following").Single(i => i.user_id == followingPerson.user_id);
                PERSON        objFollowers  = db.persons.Include("followers").Include("following").Single(i => i.user_id == followerPerson.user_id);
                List <PERSON> followingList = new List <PERSON>();
                foreach (var item in objFollowers.following)
                {
                    if (item == objFollowing)
                    {
                        objFollowers.following.Remove(objFollowing);
                        break;
                    }
                }
                //followingList.Add(objFollowing);
                ////followerList.Add(followerPerson);

                //objFollowers.followers = followingList;


                db.SaveChanges();
            }
        }
示例#3
0
        public JsonResult DeleteProfile(string userid)
        {
            PERSON p = obj.GetByID(userid);

            obj.DeleteProfile(p.user_id);
            return(Json("", JsonRequestBehavior.AllowGet));
        }
示例#4
0
 public string AddUser(PersonEntity personDetails)
 {
     try
     {
         var person = new PERSON()
         {
             user_id  = personDetails.user_id,
             password = personDetails.password,
             fullName = personDetails.fullName,
             email    = personDetails.email,
             joined   = personDetails.joined,
             active   = personDetails.active
         };
         using (var Connection = new  TwitterApplicationEntities())
         {
             Connection.People.Add(person);
             Connection.SaveChanges();
         }
         return("Person Added Successfully");
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message.ToString(), exception);
     }
 }
示例#5
0
        //FormCollection collection
        public ActionResult Create(PERSON obj)
        {
            try
            {
                // TODO: Add insert logic here
                Person p = new Person();
                p.FirstName       = obj.FirstName;
                p.LastName        = obj.LastName;
                p.MiddleName      = obj.MiddleName;
                p.DateOfBirth     = obj.DateOfBirth;
                p.AddOn           = obj.AddedOn;
                p.AddedBy         = obj.AddedBy;
                p.HomeAddress     = obj.HomeAddress;
                p.HomeCity        = obj.HomeCity;
                p.FaceBookAccount = obj.FaceBookAccount;
                p.LinkedInId      = obj.LinkedInId;
                p.UpdateOn        = obj.UpdatedOn;
                p.TwitterId       = obj.TwitterId;
                p.EmailId         = obj.EmailId;

                Entities db = new Entities();

                db.People.Add(p);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#6
0
        private StudentModel AddStudentQuery(StudentModel studentModel)
        {
            PERSON person = new PERSON
            {
                personId              = studentModel.personId,
                personFirstName       = studentModel.personFirstName,
                personLastName        = studentModel.personLastName,
                personBeforeTelephone = studentModel.personBeforeTelephone,
                personTelephone       = studentModel.personTelephone,
                personBeforeCellphone = studentModel.personBeforeCellphone,
                personCellphone       = studentModel.personCellphone,
                personCode            = studentModel.personCode
            };

            STUDENT student = new STUDENT
            {
                studentId          = studentModel.studentId,
                studentType        = studentModel.studentType,
                studentYear        = studentModel.studentYear,
                studentFacultyCode = studentModel.studentFacultyCode
            };

            DB.PERSONS.Add(person);
            DB.STUDENTS.Add(student);
            DB.SaveChanges();
            return(GetOneStudentById(student.studentId));
        }
示例#7
0
        // GET: Person
        public ActionResult Index()
        {
            Entities      db       = new Entities();
            List <Person> list     = db.People.ToList();
            List <PERSON> viewlist = new List <PERSON>();

            foreach (Person p in list)
            {
                PERSON obj = new PERSON();
                obj.FirstName  = p.FirstName;
                obj.FirstName  = p.FirstName;
                obj.LastName   = p.LastName;
                obj.MiddleName = p.MiddleName;



                //ob  j.DateOfBirth = p.DateOfBirth;
                // obj.AddedOn = p.AddOn;
                obj.AddedBy         = p.AddedBy;
                obj.HomeAddress     = p.HomeAddress;
                obj.HomeCity        = p.HomeCity;
                obj.FaceBookAccount = p.FaceBookAccount;
                obj.LinkedInId      = p.LinkedInId;
                //obj.UpdatedOn = p.UpdateOn;
                obj.TwitterId = p.TwitterId;
                obj.EmailId   = p.EmailId;

                viewlist.Add(obj);
            }
            return(View(viewlist));
        }
 public PersonMasterSearchView(PERSON person)
 {
     this.PERSONID  = person.PERSONID;
     this.LASTNAME  = person.LASTNAME;
     this.FIRSTNAME = person.FIRSTNAME;
     this.BIRTHDATE = person.BIRTHDATE;
 }
        public async Task <IHttpActionResult> Post(PERSON person)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PERSON.Add(person);
            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (PersonExists(person.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("PersonalFinanceApi", new { id = person.ID }, person));
        }
示例#10
0
        private StudentModel UpdateStudentQuery(StudentModel studentModel)
        {
            PERSON person = DB.PERSONS.Where(p => p.personId.Equals(studentModel.personId)).SingleOrDefault();

            if (person == null)
            {
                return(null);
            }
            person.personId              = studentModel.personId;
            person.personFirstName       = studentModel.personFirstName;
            person.personLastName        = studentModel.personLastName;
            person.personBeforeTelephone = studentModel.personBeforeTelephone;
            person.personTelephone       = studentModel.personTelephone;
            person.personBeforeCellphone = studentModel.personBeforeCellphone;
            person.personCellphone       = studentModel.personCellphone;
            person.personCode            = studentModel.personCode;

            STUDENT student = DB.STUDENTS.Where(s => s.studentId.Equals(studentModel.studentId)).SingleOrDefault();

            if (person == null)
            {
                return(null);
            }
            student.studentId          = studentModel.studentId;
            student.studentType        = studentModel.studentType;
            student.studentYear        = studentModel.studentYear;
            student.studentFacultyCode = studentModel.studentFacultyCode;
            DB.SaveChanges();
            return(GetOneStudentById(student.studentId));
        }
示例#11
0
        public bool UpdateAccount(PERSON person)
        {
            try
            {
                var result = GetAccountById(person.PERSON_ID);
                if (result == null)
                {
                    return(false);
                }
                else
                {
                    result.CURRENT_FIRST_NAME  = person.CURRENT_FIRST_NAME;
                    result.CURRENT_LAST_NAME   = person.CURRENT_LAST_NAME;
                    result.CURRENT_MIDDLE_NAME = person.CURRENT_MIDDLE_NAME;
                    result.CURRENT_EMAIL       = person.CURRENT_PERSONAL_EMAIL;
                    result.CURRENT_PHONE       = person.CURRENT_PHONE_NUMBER;
                    result.CURRENT_GENDER      = person.CURRENT_GENDER;
                    result.UPDATED_DATETIME    = person.UPDATED_DATETIME;
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#12
0
 public void DeletePerson(PERSON _person)
 {
     //            _databaseHelper.DeletePerson(ID);
     _person.LastModified = System.DateTime.UtcNow;
     _person.IsDeleted    = "Y";
     _databaseHelper.UpdatePerson(_person);
 }
示例#13
0
        private TeacherModel UpdateTeacherQuery(TeacherModel teacherModel)
        {
            PERSON person = DB.PERSONS.Where(p => p.personId.Equals(teacherModel.personId)).SingleOrDefault();

            if (person == null)
            {
                return(null);
            }
            person.personId              = teacherModel.personId;
            person.personFirstName       = teacherModel.personFirstName;
            person.personLastName        = teacherModel.personLastName;
            person.personBeforeTelephone = teacherModel.personBeforeTelephone;
            person.personTelephone       = teacherModel.personTelephone;
            person.personBeforeCellphone = teacherModel.personBeforeCellphone;
            person.personCellphone       = teacherModel.personCellphone;
            person.personCode            = teacherModel.personCode;

            TEACHER teacher = DB.TEACHERS.Where(t => t.teacherId.Equals(teacherModel.teacherId)).SingleOrDefault();

            if (teacher == null)
            {
                return(null);
            }
            teacher.teacherId          = teacherModel.teacherId;
            teacher.teacherFacultyCode = teacherModel.teacherFacultyCode;
            teacher.teacherStage       = teacherModel.teacherStage;
            DB.SaveChanges();
            return(GetOneTeacherById(teacher.teacherId));
        }
示例#14
0
        public void Signup(PERSON pObj)
        {
            TwitterDBContext twitterDBContext = new TwitterDBContext();

            twitterDBContext.People.Add(pObj);
            twitterDBContext.SaveChanges();
        }
示例#15
0
        // PUT: api/People/5
        public IHttpActionResult  PutPerson(int id, PERSON person)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != person.ID)
            {
                return(BadRequest());
            }

            db.Entry(person).State = EntityState.Modified;
            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {
                if (!ModelState.IsValid)
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#16
0
        private TeacherModel AddTeacherQuery(TeacherModel teacherModel)
        {
            PERSON person = new PERSON
            {
                personId              = teacherModel.personId,
                personFirstName       = teacherModel.personFirstName,
                personLastName        = teacherModel.personLastName,
                personBeforeTelephone = teacherModel.personBeforeTelephone,
                personTelephone       = teacherModel.personTelephone,
                personBeforeCellphone = teacherModel.personBeforeCellphone,
                personCellphone       = teacherModel.personCellphone,
                personCode            = teacherModel.personCode
            };

            TEACHER teacher = new TEACHER
            {
                teacherId          = teacherModel.teacherId,
                teacherFacultyCode = teacherModel.teacherFacultyCode,
                teacherStage       = teacherModel.teacherStage
            };

            DB.PERSONS.Add(person);
            DB.TEACHERS.Add(teacher);
            DB.SaveChanges();
            return(GetOneTeacherById(teacher.teacherId));
        }
示例#17
0
 public ActionResult PrescribeTextbook()
 {
     ViewBag.existence = existence;
     if (existence.Length > 2)
     {
         ViewBag.existence = existence;
     }
     if (Session["User"] != null)
     {
         PERSON currentUser = Session["User"] as PERSON;
         if (currentUser.PersonType.Equals("Lecturer"))
         {
             List <Module> modules = new List <Module>();
             foreach (var module in model.Modules)
             {
                 modules.Add(module);
             }
             ViewBag.module  = currentModuleName;
             ViewBag.modules = modules;
             ViewBag.books   = model.BOOKs;
             return(View());
         }
         else
         {
             return(RedirectToAction("LogIn", "Home"));
         }
     }
     else
     {
         return(RedirectToAction("LogIn", "Home"));
     }
 }
示例#18
0
 public ActionResult AddModule()
 {
     if (Session["User"] != null)
     {
         PERSON currentUser = Session["User"] as PERSON;
         if (currentUser.PersonType.Equals("Admin"))
         {
             List <PERSON> people = new List <PERSON>();
             foreach (var user in model.People)
             {
                 if (user.PersonType.Equals("Lecturer"))
                 {
                     people.Add(user);
                 }
             }
             ViewBag.lecturers = people;
             return(View());
         }
         else
         {
             return(RedirectToAction("LogIn", "Home"));
         }
     }
     else
     {
         return(RedirectToAction("LogIn", "Home"));
     }
 }
        public async Task <IHttpActionResult> Put(decimal id, PERSON person)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != person.ID)
            {
                return(BadRequest());
            }

            db.Entry(person).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (!PersonExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#20
0
 public ActionResult signup(PersonVM item)
 {
     if (ModelState.IsValid)
     {
         PERSON p = new PERSON()
         {
             user_id  = item.Username,
             password = item.Pwd,
             email    = item.Email,
             fullName = item.Name,
             active   = true,
             joined   = DateTime.Now
         };
         List <string> listAllUsers = obj.GetAllUserId(p.user_id);
         if (listAllUsers.Count > 0)
         {
             Session["ExistingUser"] = "******";
             return(View());
         }
         else
         {
             obj.AddUser(p);
             return(RedirectToAction("Login"));
         }
     }
     else
     {
         return(View());
     }
 }
示例#21
0
        public bool BindTaskComplete(TASK_STATUS task, string helpInfo)
        {
            pnlStatusComplete.Visible = true;

            bool isComplete = false;

            if (task != null)
            {
                if (task.STATUS == Convert.ToInt32(TaskStatus.Complete).ToString())
                {
                    cbStatusComplete.Checked = isComplete = true;
                    cbStatusComplete.Enabled = false;
                    PERSON person = SQMModelMgr.LookupPerson((decimal)task.COMPLETE_ID, "");
                    if (person != null)
                    {
                        cbStatusComplete.Text = "Completed by " + person.FIRST_NAME + " " + person.LAST_NAME;
                    }
                }

                if (!string.IsNullOrEmpty(helpInfo))
                {
                    AddToolTip(task.TASK_STEP, helpInfo);
                }
            }

            return(isComplete);
        }
示例#22
0
        public IHttpActionResult PutPERSON(int id, PERSON pERSON)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pERSON.PERSON_ID)
            {
                return(BadRequest());
            }

            db.Entry(pERSON).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PERSONExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#23
0
        public ViewResult profile(string Username)
        {
            Username = Session["UserId"].ToString();
            if (Username != null)
            {
                if (ModelState.IsValid)
                {
                    PERSON p = new PERSON()
                    {
                        user_id = Username,
                    };
                    PERSON per = obj.GetByID(p.user_id);
                    Session["joinDate"] = per.joined;
                    PersonVM Pvm = new PersonVM()
                    {
                        Username = per.user_id,
                        Pwd      = per.password,
                        Name     = per.fullName,
                        Email    = per.email
                    };
                    return(View(Pvm));
                }

                else
                {
                    return(View());
                }
            }
            else
            {
                return(View("Login"));
            }
        }
示例#24
0
 public bool UpdatePerson(PERSON person)
 {
     try
     {
         var result = GetPersonById(person.PERSON_ID);
         if (result == null)
         {
             return(false);
         }
         else
         {
             result.CURRENT_FIRST_NAME     = person.CURRENT_FIRST_NAME;
             result.CURRENT_LAST_NAME      = person.CURRENT_LAST_NAME;
             result.CURRENT_MIDDLE_NAME    = person.CURRENT_MIDDLE_NAME;
             result.CURRENT_PERSONAL_EMAIL = person.CURRENT_PERSONAL_EMAIL;
             result.CURRENT_PHONE_NUMBER   = person.CURRENT_PHONE_NUMBER;
             result.BIRTH_DATE             = person.BIRTH_DATE;
             result.CURRENT_GENDER         = person.CURRENT_GENDER;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#25
0
 public PERSON GetByID(string id)
 {
     using (TweetContext db = new TweetContext())
     {
         PERSON obj = db.persons.Find(id);
         return(obj);
     }
 }
示例#26
0
 public CoachSearchView(PERSON person)
 {
     this.PERSONID   = person.PERSONID;
     this.LASTNAME   = person.LASTNAME;
     this.FIRSTNAME  = person.FIRSTNAME;
     this.BIRTHDATE  = person.BIRTHDATE;
     this.HOURLYRATE = person.HOURLYRATE;
 }
示例#27
0
        public ActionResult following(string Search)
        {
            PERSON following = obj.GetByID(Search);
            PERSON person    = obj.GetByID(Session["UserId"].ToString());

            obj.Following(person, following);
            return(RedirectToAction("home"));
        }
示例#28
0
        public ActionResult UnFollowing(string Search)
        {
            PERSON following = obj.GetByID(Search);
            PERSON follower  = obj.GetByID(Session["UserId"].ToString());

            obj.UnFollowing(following, follower);
            return(RedirectToAction("home"));
        }
        public ActionResult DeleteConfirmed(string id)
        {
            PERSON pERSON = db.People.Find(id);

            db.People.Remove(pERSON);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#30
0
 public static void CreateUser(PERSON pERSON)
 {
     using (var context = new TwitterCloneDataContext())
     {
         context.PERSON.Add(pERSON);
         context.SaveChanges();
     }
 }
示例#31
0
 private static PERSON person(DataSet ds)
 {
     PERSON p = new PERSON();
     p.setId(Convert.ToInt32(ds.Tables[0].Rows[0]["id"]));
     p.setName(ds.Tables[0].Rows[0]["name"].ToString());
     p.setSurname(ds.Tables[0].Rows[0]["surname"].ToString());
     p.setAge(Convert.ToInt32(ds.Tables[0].Rows[0]["age"]));
     p.setShortDescription(ds.Tables[0].Rows[0]["short_description"].ToString());
     p.setDescription(ds.Tables[0].Rows[0]["description"].ToString());
     p.setLatitude(Convert.ToDecimal(ds.Tables[0].Rows[0]["latitude"]));
     p.setLongtitude(Convert.ToDecimal(ds.Tables[0].Rows[0]["longtitude"]));
     p.setDonates(Convert.ToDecimal(ds.Tables[0].Rows[0]["donates"]));
     p.setNeed(Convert.ToInt32(ds.Tables[0].Rows[0]["need"]));
     p.setActive(1);
     p.setDate(ds.Tables[0].Rows[0]["date"].ToString());
     return p;
 }