Esempio n. 1
0
        public new ActionResult Profile(int id, int arg)
        {
            int       gender;
            PersonDAL person = new PersonDAL(id);

            if (person.Persons.Gender == "Male")
            {
                gender = 1;
            }
            else
            {
                gender = 2;
            }
            PersonViewModel personViewModel = new PersonViewModel(person);

            FeedCombobox(gender);
            //arg//,  1 profile opened from user so show EDIT botton, 2: profile opened from admin page so hide EDIT button,
            if (arg == 1)
            {
                ViewData["ShowEditBtn"] = true;
            }
            else
            {
                ViewData["ShowEditBtn"] = false;
            }
            return(View(personViewModel));
        }
Esempio n. 2
0
        public ResultBM UpdatePerson(PersonBM personBm)
        {
            try {
                AddressBLL addressBll = new AddressBLL();
                ResultBM   addressResult;
                PersonDAL  personDal = new PersonDAL();
                PersonDTO  personDto;
                ResultBM   validationResult;

                validationResult = IsValid(personBm);
                if (!validationResult.IsValid())
                {
                    return(validationResult);
                }

                addressResult = addressBll.UpdateAddress(personBm.address);
                if (!addressResult.IsValid())
                {
                    return(addressResult);
                }

                personDto = new PersonDTO(personBm.id, personBm.name, personBm.lastName, personBm.Birthdate, personBm.Email, personBm.phone, personBm.gender, personBm.dni, personBm.address.id);
                personDal.UpdatePerson(personDto);

                return(new ResultBM(ResultBM.Type.OK, "Se ha actualizado la persona con el nombre " + personBm.name + " " + personBm.lastName + ".", personBm));
            }
            catch (Exception exception) {
                return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("UPDATING_ERROR") + " " + exception.Message, exception));
            }
        }
Esempio n. 3
0
 private void BindPersonList()
 {
     PersonCollection personList = new PersonCollection();
     personList = PersonDAL.GetCollection();
     rptPersonList.DataSource = personList;
     rptPersonList.DataBind();
 }
Esempio n. 4
0
        public PersonControllerV1(LeaderboardContext context)
        {
            this.context = context;
            this.context.ChangeTracker.QueryTrackingBehavior = Microsoft.EntityFrameworkCore.QueryTrackingBehavior.NoTracking;

            personDAL = new PersonDAL(context);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            var       client    = ConfigurationManagerNeo4J.GetDefaultClient();
            PersonDAL personDAL = new PersonDAL();

            User user1 = new User();

            user1.Login = "******";
            User user2 = new User();

            user2.Login = "******";

            int count = personDAL.GetShortestPath(user1.Login, user2.Login);

            Console.WriteLine(count);

            //personDAL.CreatePerson(user);

            //personDAL.UpdatePerson(user, "ostap");

            //personDAL.DeletePerson(user);

            //personDAL.CreateRelationships(user2, user1);
            //personDAL.DeleteRelationships(user2, user1);
            var people = personDAL.GetWhoCommon(user1.Login, user2.Login, count);

            //var people = client.Cypher.Match("(p:Person)").Return(p => p.As<User>()).Results;

            foreach (var p in people)
            {
                Console.WriteLine(p.Login + "\n");
            }
            Console.ReadKey();
        }
Esempio n. 6
0
 public Person GetPerson(int personID)
 {
     using (PersonDAL pDAL = new PersonDAL())
     {
         return(pDAL.GetPerson(personID));
     }
 }
Esempio n. 7
0
        private void BindPerson()
        {
            int personId = Request.QueryString["PersonId"].ToInt();

            if (personId > 0)
            {
                Person personLookup = PersonDAL.GetItem(personId);

                if (personLookup != null)
                {
                    lblPersonId.Text         = personLookup.PersonId.ToString();
                    lblFirstName.Text        = personLookup.FirstName;
                    lblLastName.Text         = personLookup.LastName;
                    lblDisplayFirstName.Text = personLookup.DisplayFirstName;
                    lblGender.Text           = personLookup.Gender;
                }

                else
                {
                    lblMessage.Text = "Person could not be found.";
                }
            }
            else
            {
                lblMessage.Text = "Invalid ID. Person record could not be found.";
            }
        }
Esempio n. 8
0
        public void save(PersonBO bo)
        {
            bo.Tax = CalculateTax(bo.Salary);
            PersonDAL pdl = new PersonDAL();

            pdl.Save(bo);
        }
        public void UpdatePerson(Person person)
        {
            Validate(person);

            // TODO: Call UpdatePerson from Service -> SavePerson()
            PersonDAL.UpdatePerson(person);
        }
Esempio n. 10
0
        public static List <PersonViewModel> GetPersonList(int Country, int Ages, string Education, int Nationality, string Gender)
        {
            List <PersonViewModel> List = new List <PersonViewModel>();

            PersonDAL.GetPersonsList(Country, Ages, Education, Nationality, Gender).ForEach(r => List.Add(new PersonViewModel(r)));
            return(List);
        }
Esempio n. 11
0
        public static List <PersonViewModel> GetPersonList()
        {
            List <PersonViewModel> List = new List <PersonViewModel>();

            PersonDAL.GetPersonsList().ForEach(r => List.Add(new PersonViewModel(r)));
            return(List);
        }
Esempio n. 12
0
 /// <see cref="PersonDAL.GetPersonByClinicalAdministratorID(Clinical_Administrator)"/>
 public Person GetPersonByClinicalAdministratorID(Clinical_Administrator admin)
 {
     if (admin == null || admin.ID == null)
     {
         throw new ArgumentNullException("admin and its id cannot be null");
     }
     return(PersonDAL.GetPersonByClinicalAdministratorID(admin));
 }
Esempio n. 13
0
 /// <see cref="PersonDAL.GetPersonByPatientID(Patient)"/>
 public Person GetPersonByPatientID(Patient patient)
 {
     if (patient == null || patient.ID == null)
     {
         throw new ArgumentNullException("patient and its id cannot be null");
     }
     return(PersonDAL.GetPersonByPatientID(patient));
 }
Esempio n. 14
0
 /// <see cref="PersonDAL.GetPersonByDoctorID(Doctor)"/>
 public Person GetPersonByDoctorID(Doctor doctor)
 {
     if (doctor == null || doctor.ID == null)
     {
         throw new ArgumentNullException("doctor and its id cannot be null");
     }
     return(PersonDAL.GetPersonByDoctorID(doctor));
 }
Esempio n. 15
0
 /// <see cref="PersonDAL.GetPersonByNurseID(Nurse)"/>
 public Person GetPersonByNurseID(Nurse nurse)
 {
     if (nurse == null || nurse.ID == null)
     {
         throw new ArgumentNullException("nurse and its id cannot be null");
     }
     return(PersonDAL.GetPersonByNurseID(nurse));
 }
Esempio n. 16
0
        /// <summary>
        /// GetPerson By User Id
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static PersonViewModel GetPersonByUser(int userId)
        {
            PersonDAL P = PersonDAL.GetPersonByUser(userId);

            PersonViewModel Person = new PersonViewModel(P);

            return(Person);
        }
Esempio n. 17
0
 /// <see cref="PersonDAL.GetPersonOfNurseByVisit(Visit)"/>
 public Person GetNurseByVisitID(Visit visit)
 {
     if (visit == null || visit.ID == null)
     {
         throw new ArgumentNullException("visit and its id cannot be null");
     }
     return(PersonDAL.GetPersonOfNurseByVisit(visit));
 }
Esempio n. 18
0
        public static int Save(Person personToSave)
        {
            int returnValue;

            returnValue = PersonDAL.Save(personToSave);

            return(returnValue);
        }
        public int SavePerson(PersonModel person)
        {
            int       personId = 0;
            PersonDAL dal      = new PersonDAL();

            personId = dal.SavePerson(person);
            return(personId);
        }
        public PersonModel GetPersonDetail(int id)
        {
            PersonModel p   = null;
            PersonDAL   dal = new PersonDAL();
            DataSet     ds  = dal.getPersonDetail(id);

            p = ConvertDsintoObject(ds);
            return(p);
        }
Esempio n. 21
0
    public DataSet Find_Emp(String str)
    {
        PersonDAL PFDAL = new PersonDAL();
        DataSet   data  = null;

        data = PFDAL.Find_Emp(str);

        return(data);
    }
Esempio n. 22
0
        public IActionResult EditPerson()
        {
            InitView();

            var id        = HttpContext.Session.GetString(personIdKey);
            var personDal = new PersonDAL(_configuration);
            var person    = personDal.GetPerson(id);

            return(View(person));
        }
Esempio n. 23
0
        public DataSet ReadPerson()
        {
            DataSet   set   = new DataSet();
            PersonDAL dAL   = new PersonDAL();
            var       table = dAL.GetPerson();


            set.Tables.Add(table);
            return(set);
        }
Esempio n. 24
0
 /// <summary>
 /// Updates the given Nurse and their information in the db
 /// </summary>
 /// <param name="person">The Person of the Nurse to update</param>
 /// <param name="address">The Address of the Nurse to update</param>
 /// <param name="nurse">The Nurse to update</param>
 /// <returns>Whether or not the update succeeded</returns>
 public bool UpdateNurse(Person person, Address address, Nurse nurse)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         AddressDAL.UpdateAddress(address);
         PersonDAL.UpdatePerson(person);
         NurseDAL.UpdateNurse(nurse);
         scope.Complete();
     }
     return(true);
 }
Esempio n. 25
0
        public IActionResult Page2(PersonModel person)
        {
            var personDal = new PersonDAL(_configuration);
            int personId  = personDal.InsertPerson(person);

            HttpContext.Session.SetString(personIdKey, personId.ToString());
            HttpContext.Session.SetString(firstNameKey, person.FirstName);
            InitView();

            return(View(person));
        }
Esempio n. 26
0
 public ChatRoomMessageViewModel(ChatRoomMessageDAL U)
 {
     _Id                 = U.ChatRoomMessages.Id;
     _Message            = U.ChatRoomMessages.Message;
     _MsgDate            = U.ChatRoomMessages.MsgDate;
     _SenderUser_Id      = U.ChatRoomMessages.SenderUser_Id;
     _RelationRequest_Id = U.ChatRoomMessages.RelationRequest_Id;
     _Entity_Order       = U.ChatRoomMessages.Entity_Order;
     _IMG                = PersonDAL.GetPersonPhotoByUserId(U.ChatRoomMessages.SenderUser_Id).Persons.Photo1;
     _SenderFullName     = PersonDAL.GetPersonPhotoByUserId(U.ChatRoomMessages.SenderUser_Id).Persons.FullName;
 }
Esempio n. 27
0
 /// <summary>
 /// Updates a Patient's various records in the db
 /// </summary>
 /// <param name="person">Person of the patient to update</param>
 /// <param name="address">Address of the patient to update</param>
 /// <param name="patient">Patient to update</param>
 /// <returns></returns>
 public bool UpdatePatient(Person person, Address address, Patient patient)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         AddressDAL.UpdateAddress(address);
         PersonDAL.UpdatePerson(person);
         PatientDAL.UpdatePatient(patient);
         scope.Complete();
     }
     return(true);
 }
Esempio n. 28
0
 public void UpdateGrid(String sGrid)
 {
     try
     {
         PersonDAL objdal = new PersonDAL();
         objdal.Update(sGrid);
     }
     catch
     {
         throw;
     }
 }
Esempio n. 29
0
 public DataTable GetPersons()
 {
     try
     {
         PersonDAL objdal = new PersonDAL();
         return(objdal.Read());
     }
     catch
     {
         throw;
     }
 }
Esempio n. 30
0
        /// <summary>
        /// Deletes the given Patient and their Person from the db
        /// </summary>
        /// <param name="patient">Patient to delete</param>
        /// <returns>Whether or not the Patient was deleted</returns>
        public bool DeletePatient(Patient patient)
        {
            Person person = PersonDAL.GetPersonByPatientID(patient);

            using (TransactionScope scope = new TransactionScope())
            {
                PatientDAL.DeletePatient(patient);
                PersonDAL.DeletePerson(person);
                scope.Complete();
            }
            return(true);
        }
 /// <summary>
 /// Load records from database
 /// </summary>
 /// <returns></returns>
 public DataTable Load()
 {
     PersonDAL pDAL = new PersonDAL();
     try
     {
         return pDAL.Load();
     }
     catch
     {
         throw;
     }
     finally
     {
         pDAL = null;
     }
 }
 /// <summary>
 /// insert records into database
 /// </summary>
 /// <param name="person"></param>
 /// <returns></returns>
 public int Insert(Person person)
 {
     PersonDAL pDAL = new PersonDAL();
     try
     {
         return pDAL.Insert(person);
     }
     catch
     {
         throw;
     }
     finally
     {
         pDAL = null;
     }
 }
 /// <summary>
 /// Delete record from database
 /// </summary>
 /// <param name="person"></param>
 /// <returns></returns>
 public int Delete(Person person)
 {
     PersonDAL pDAL = new PersonDAL();
     try
     {
         return pDAL.Delete(person);
     }
     catch
     {
         throw;
     }
     finally
     {
         pDAL = null;
     }
 }
Esempio n. 34
0
    public static void Main(string[] args)
    {
        //在更新数据前显示对象信息
        PersonDAL personDAL = new PersonDAL();
        var beforeObj = personDAL.GetPerson(24);
        personDAL.Display("Before", beforeObj);

        //更新Person的SecondName,Age两个属性
        Person person1 = new Person();
        person1.Id = 24;
        person1.FirstName = "Leslie";
        person1.SecondName = "Wang";
        person1.Age = 32;
        person1.Address = "Tianhe";
        person1.Telephone = "13660123456";
        person1.EMail = "*****@*****.**";

        //更新Person的FirstName属性
        Person person2 = new Person();
        person2.Id = 24;
        person2.FirstName = "Rose";
        person2.SecondName = "Lee";
        person2.Age = 34;
        person2.Address = "Tianhe";
        person2.Telephone = "13660123456";
        person2.EMail = "*****@*****.**";

        //使用异步方式同时更新数据
        MyDelegate myDelegate = new MyDelegate(personDAL.Update);
        myDelegate.BeginInvoke(person1, null, null);
        myDelegate.BeginInvoke(person2, null, null);

        Thread.Sleep(300);
        //在更新数据后显示对象信息
        var afterObj = personDAL.GetPerson(24);
        personDAL.Display("After", afterObj);
        Console.ReadKey();
    }
Esempio n. 35
0
 public void SavePerson(Person person)
 {
     PersonDAL personDal = new PersonDAL();
     personDal.Save(person);
 }
Esempio n. 36
0
 public List<Person> GetListOfAllPersons()
 {
     PersonDAL personDal = new PersonDAL();
     return personDal.Persons.ToList();
 }