예제 #1
1
        public IList<Patient> RetrievePatients(Doctor doctor)
        {
            IList<Patient> patients = new List<Patient>();

            int i = _cart.Count;

            if (doctor.Name == "NO")
            {
                Patient patient = new Patient();
                patient.Name = "James Bond";
                patient.Address = "Jamaica";
                patients.Add(patient);

                patient = new Patient();
                patient.Name = "Felix Leiter";
                patient.Address = "New York";
                patients.Add(patient);

                patient = new Patient();
                patient.Name = "Miss Moneypenny";
                patient.Address = "London";
                patients.Add(patient);
            }

            return patients;
        }
        public bool AddDoctor(Doctor instance)
        {
            dataBase.Doctor.InsertOnSubmit(instance);
            dataBase.Doctor.Context.SubmitChanges();
            return true;

        }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if(!String.IsNullOrWhiteSpace(textBox1.Text) &&
                    !String.IsNullOrWhiteSpace(textBox2.Text) &&
                    !String.IsNullOrWhiteSpace(textBox3.Text))
                {
                    DataClasses1DataContext doctorContext= new DataClasses1DataContext();
                    Doctor doctor = new Doctor();
                    doctor.doctorName = textBox1.Text;
                    doctor.doctorID = textBox2.Text;
                    doctor.gloveSize = Decimal.Parse(textBox3.Text);
                    doctorContext.Doctors.InsertOnSubmit(doctor);

                    doctorContext.SubmitChanges();
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox3.Text = "";
                    Form1.GetDoctors();
                    loadDoctors();
                }
                else
                {
                    MessageBox.Show("Cannot be empty...", "Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

            }
            catch
            {
                MessageBox.Show("Something went wrong, does the doctor already exist? Please try again...", "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void AddDoctor(Doctor doctor)
        {
            using (var conn = CreateConnection())
            {
                try
                {
                    var cmd = new SqlCommand("appSchema.usp_adddoctor", conn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("@Fnamn", SqlDbType.VarChar, 50).Value = doctor.FirstName;
                    cmd.Parameters.Add("@Enamn", SqlDbType.VarChar, 50).Value = doctor.LastName;
                    cmd.Parameters.Add("@Läkartyp", SqlDbType.Int, 4).Value = int.Parse(doctor.DoctorTypes);

                    cmd.Parameters.Add("@LäkareID", SqlDbType.Int, 4).Direction = ParameterDirection.Output;

                    conn.Open();

                    cmd.ExecuteNonQuery();

                    doctor.DoctorID = (int)cmd.Parameters["@LäkareID"].Value;
                }
                catch
                {
                    throw new ApplicationException("Ett fell uppstod");
                }
            }
        }
        public async Task<IHttpActionResult> PutDoctor(int id, Doctor doctor)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }
예제 #6
0
파일: Doctor.cs 프로젝트: Helixanon/labs
 ////////////////////////////////////////////////////////////////////////
 // Name:       Doctor::Doctor(const Doctor& oldDoctor)
 // Purpose:    Implementation of Doctor::Doctor()
 // Parameters:
 // - oldDoctor
 // Return:
 ////////////////////////////////////////////////////////////////////////
 public Doctor(Doctor oldDoctor)
 {
     name = oldDoctor.name;
       professionalism = oldDoctor.professionalism;
       isBusy = oldDoctor.isBusy;
       Console.Write("Copying constructor for Doctor has been launched.");
       Console.Write("\n");
 }
예제 #7
0
 public bool DoctorWouldExceedMaxConsecutiveShifts(Slot slot, Doctor doctor)
 {
     if (MaxConsecutiveShifts == 0)
         return false;
     var list = GetSlotsByDoctorAndRotation(doctor, slot).ToList();
     list.Add(slot);
     return CalcMaxConsecutiveShifts(list.OrderBy(x => x.week)) > MaxConsecutiveShifts;
 }
예제 #8
0
 /// <summary>
 /// Registers a user.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="login">The login.</param>
 /// <param name="passwd">The passwd.</param>
 public void Register(string name, string login, string passwd)
 {
     Doctor doctor = new Doctor();
     doctor.Name = name.ToUpper();
     doctor.Login = login.ToLower();
     doctor.Password = passwd;
     doctors.Add(doctor.Login, doctor);
 }
예제 #9
0
파일: hospital.cs 프로젝트: Helixanon/labs
 ////////////////////////////////////////////////////////////////////////
 // Name:       Hospital::Hospital()
 // Purpose:    Implementation of Hospital::Hospital()
 // Return:
 ////////////////////////////////////////////////////////////////////////
 public Hospital()
 {
     Console.Write("Default constructor for Hospital has been launched.");
        Console.Write("\n");
       Patient patient = new Patient();
       Doctor doctor = new Doctor();
       Diag_center diag_center = new Diag_center();
       Clock clock = new Clock();
 }
예제 #10
0
        public frmTurno()
        {
            InitializeComponent();
            this.calendar1.TimeUnitsOffset = -16;
            Doctor objDoctor = new Doctor();
            ArrayList colDoctor = new ArrayList();

            colDoctor = objDoctor.coleccion();

            if (Usuario.getFlag())
            {
                // EL USUARIO ES SECRETARIA

                for (int i = 0; i < colDoctor.Count; i++)
                {
                    objDoctor = (Doctor)colDoctor[i];
                    vOutlookItem tab = new vOutlookItem();
                    tab.Text = objDoctor.getMatricula();
                    tab.HeaderText = objDoctor.getApellido();
                    tab.Click += new EventHandler(this.tab_Click);
                    this.vOutlookNavPane1.Items.Add(tab);
                }
            }
            else if (Usuario.getAdmin())
            {
                // EL USUARIO ES ADMINISTRADOR
                for (int i = 0; i < colDoctor.Count; i++)
                {
                    objDoctor = (Doctor)colDoctor[i];
                    vOutlookItem tab = new vOutlookItem();
                    tab.Text = objDoctor.getMatricula();
                    tab.HeaderText = objDoctor.getApellido();
                    tab.Click += new EventHandler(this.tab_Click);
                    this.vOutlookNavPane1.Items.Add(tab);
                }
            }
            else
            {
                // EL USUARIO ES DOCTOR

                for (int i = 0; i < colDoctor.Count; i++)
                {
                    objDoctor = (Doctor)colDoctor[i];
                    if (objDoctor.getMatricula() == Usuario.getMatricula())
                    {
                        vOutlookItem tab = new vOutlookItem();
                        tab.Text = objDoctor.getMatricula();
                        tab.HeaderText = objDoctor.getApellido();
                        tab.Click += new EventHandler(this.tab_Click);
                        this.vOutlookNavPane1.Items.Add(tab);
                        break;
                    }
                }

            }
        }
예제 #11
0
        public void FalseWhenDoctorDoesnotExceedMaxShiftsForDoctor()
        {
            var doctor = new Doctor();
            doctor.Name = "House";
            doctor.MaxShifts = 5;
            doctor.TotalShiftCount = 2;

            var scheduler = new Scheduler();
            Assert.IsFalse(scheduler.DoctorHasExceededHisPersonalMaxShifts(new Slot(new DateTime(2011, 9, 3), "CT", 2, true, 1, true, 1), doctor));
        }
예제 #12
0
        public bool DoctorHasExceededMaxDaysThisRotation(Slot slot, Doctor doctor)
        {
            if (MaxShiftsPerRotation == 0)
                return false;
            var list = GetSlotsByDoctorAndRotation(doctor, slot).ToList();
            list.Add(slot);

            return CountShifts(list) >
                   MaxShiftsPerRotation;
        }
예제 #13
0
 public TestDoctor(Doctor r)
 {
     doctor = r;
     if (doctor.ContactDtos != null)
         foreach (ContactDto i in doctor.ContactDtos)
             cnts.Add(new TestContact(i));
     lpu = new TestCoding(doctor.Lpu);
     person = new TestPerson(doctor.Person);
     position = new TestCoding(doctor.Position);
     role = new TestCoding(doctor.Role);
     speciality = new TestCoding(doctor.Speciality);
 }
예제 #14
0
 public void ThisDoctorWasChosen(Doctor chosenDoctor, bool is24)
 {
     var doctor = doctors.Where(x => x.Name == chosenDoctor.Name).First();
     if (is24)
     {
         doctor.DoubleShiftsWorked++;
         doctor.TotalShiftCount = doctor.TotalShiftCount + 2;
     }
     else
     {
         doctor.TotalShiftCount++;
     }
 }
예제 #15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var doctor = new Doctor();
            int id = 0;
            int.TryParse(txtID.Text,out id);
            doctor.ID = id;
            doctor.Name = txtName.Text;
            doctor.Description = txtDescription.Text;
            _doctorAccessor.InsertOrUpdate(doctor);
            ClearControls();

            RefreshGridView();
        }
예제 #16
0
        public void FalseWhenMaxShiftsPerRotationIsZero()
        {
            var doctor = new Doctor();
            doctor.Name = "House";
            var scheduler = new Scheduler();
            scheduler.Schedule = new List<Slot>();
            scheduler.Schedule.Add(new Slot(new DateTime(2011, 9, 3), "CT", 2, true, 1, true, 1));
            scheduler.Schedule.Add(new Slot(new DateTime(2011, 9, 10), "CT", 2, true, 2, true, 1));
            scheduler.Schedule.Add(new Slot(new DateTime(2011, 9, 17), "CT", 2, true, 3, true, 1));
            scheduler.Schedule[0].doctor = doctor;

            scheduler.MaxShiftsPerRotation = 0;
            Assert.IsFalse(scheduler.DoctorHasExceededMaxDaysThisRotation(scheduler.Schedule[1], doctor));
        }
예제 #17
0
        public ServiceAuthentification()
        {
            Doctor doctor = new Doctor();
            doctor.Name = "NO";
            doctor.Login = doctor.Name.ToLower();
            doctor.Password = "******";
            doctors.Add(doctor.Login, doctor);

            doctor = new Doctor();
            doctor.Name = "JECKIL";
            doctor.Login = doctor.Name.ToLower();
            doctor.Password = "******";
            doctors.Add(doctor.Login, doctor);
        }
예제 #18
0
    private void GetWorklist()
    {
        string connectionString = ConfigurationManager.AppSettings.Get("connString");
        DataSet wrkListNotAttended = new DataSet();
        DataSet wrkListAttended =new DataSet();
        Doctor doctor = new Doctor();
        doctor.Username = Session["UserName"].ToString(); ;

        BusinessLayer businessLayerObj = new BusinessLayer();

        wrkListNotAttended = businessLayerObj.getWorkList(false,doctor, connectionString);
        wrkListAttended = businessLayerObj.getWorkList(true, doctor,connectionString);
        GridView1.DataSource = wrkListNotAttended;
        GridView2.DataSource = wrkListAttended;
        GridView1.DataBind();
        GridView2.DataBind();
    }
예제 #19
0
        private int DoctorFaker()
        {
            var doctor = new Doctor()
            {
                Name = Faker.NameFaker.FirstName(),
                Surname = Faker.NameFaker.LastName(),
                OfficeNumber = Faker.NumberFaker.Number(1,30),
                WorkHourId = 1,
                ContactData = Faker.StringFaker.Numeric(9)
            };
            doctor.UserName = doctor.Name[0] + doctor.Surname;

            context.Doctors.AddOrUpdate(doctor);
            context.SaveChanges();

            return doctor.Id;
        }
예제 #20
0
        public object Doctors(int count = 1, int sleepMs=0, int minPatientCount=0, int maxPatientCount=10)
        {
            //  WorkContext.Response.Buffered = false;

              var result = new List<Doctor>();

              for(var i=0; i<count; i++)
              {
            var doctor = new Doctor
            {
              ID = i,
               Certified = i%2==0,
            Name = "Doctor # "+i, //NaturalTextGenerator.Generate(15),
             Patients = new List<Patient>()
            };

            var pcount = ExternalRandomGenerator.Instance.NextScaledRandomInteger(minPatientCount, maxPatientCount);
            for (var j=0; j<pcount; j++)
            {
              var patient = new Patient
              {
             ID = i*1000+j,
              AdmissionDate = DateTime.Now,
               Balance = j*123.11m,
                DischargeDate = i%3==0?(DateTime?)null:DateTime.Now,
                  Name = "Patient # "+j,
                   Status = i%7==0?PatientStatus.Admitted:PatientStatus.Discharged,
              };

              patient.BinData = new byte[ExternalRandomGenerator.Instance.NextScaledRandomInteger(0,7)];
              for(var k=0; k<patient.BinData.Length; k++)
               patient.BinData[k] = (byte)ExternalRandomGenerator.Instance.NextScaledRandomInteger(0, 255);

              doctor.Patients.Add(patient);

            }

            if (sleepMs>0)//Simulate some kind of DB access
               System.Threading.Thread.Sleep(ExternalRandomGenerator.Instance.NextScaledRandomInteger(0, sleepMs));

            result.Add(doctor);
              }

              return result;
        }
예제 #21
0
        static void Main(string[] args)
        {
            Patient patient = new Patient("Tim","12-08-2015","20-08-2015","Cook","Physician","Fortis");
            Console.WriteLine(patient.ToString());

            //Now, we can add insurance by aggregation
            patient.Insurance = new LifeInsurance
            {
                CompanyName = "HDFC",
                PolicyName = "LIFE-AXA"
            };
            Console.WriteLine(patient.ToString());

            //Doctor is having DoctorInfo and inheriting ToString() method
            Doctor doctor = new Doctor("Peter", "Orthopaedics","Apollo");

            Console.WriteLine(doctor);
            Console.WriteLine(doctor.Information("Some"));

            //Now Call Information Method from different Instances
            DoctorInfo doctorInfo = new DoctorInfo("John","Surgeon","Goverment");

            //Another scenario
            //IS A relationship comes into picture.
            DoctorInfo doctorInfo2 = new Doctor("Michael", "Cardiologists‎","Private");
            Console.WriteLine(doctorInfo2.Information("New Information Type added"));

            Console.WriteLine("Printing Collection!");
            List<DoctorInfo>doctorInfos=new List<DoctorInfo>();

            //Adding in collection
            doctorInfos.Add(doctorInfo);
            doctorInfos.Add(doctor);
            doctorInfos.Add(doctorInfo2);

            //Printing the collection
            foreach (var infos in doctorInfos)
            {
                Console.WriteLine(infos.Information());
            }
               // Console.WriteLine(doctorInfo.Information());
               // Console.WriteLine(doctor.Information());
            Console.ReadLine();
        }
    protected void Button3_Click(object sender, EventArgs e)
    {
        PersistDoctorRequest dRequest = new PersistDoctorRequest();
        Doctor doc = new Doctor();
        dRequest.SecurityToken = "ABC123";
        dRequest.PersistAction = PersistType.Insert;
        proxy = new WebRef.Service();
        proxy.Url = new Uri(proxy.Url).AbsoluteUri;
        // Package customer data in customer transfer object
        DoctorTransferObject doctorTransfer = new DoctorTransferObject();

        doctorTransfer.fName = this.txtFName.Text;
        doctorTransfer.LName = this.txtLName.Text;
        doctorTransfer.phone = this.txtPhone.Text + "@" + ddlProvider.SelectedValue.ToString();
        doctorTransfer.email = this.Email.Text;
        doctorTransfer.user = this.UserName.Text;
        doctorTransfer.pass = Session["Pass"].ToString();
        doctorTransfer.secQu = this.Question.Text;
        doctorTransfer.answer = this.Answer.Text;
        doctorTransfer.city = this.txtCity.Text;
        doctorTransfer.dOBirth = this.txtDoB.Text;
        doctorTransfer.gender = rdGender.Text;
        doctorTransfer.LicType = ddlLic.Text;
        doctorTransfer.NatProvID = txtProvID.Text;
        doctorTransfer.officeAdr = this.txtAddr.Text;
        doctorTransfer.PrmSpl = this.ddlPrmSpl.Text;
        doctorTransfer.state = this.txtState.Text;
        doctorTransfer.title = "Mr.";
        doctorTransfer.zip = this.txtZip.Text;
        dRequest.Doctor = doctorTransfer;
        // Issue customer list request to web service

        PersistDoctorResponse dResponse = proxy.PersistDoctor(dRequest);

        if (dResponse.Acknowledge == AcknowledgeType.Success)
        {
            Session["DocID"] = dResponse.Doctor.docID.ToString();

        }
        else
            Literal2.Text = "Failure to add the user";
        Server.Transfer("~/General/Login.aspx");
    }
        /// <summary>
        /// GET api/doctor/5?includeChildren=true
        /// </summary>
        /// <param name="id">Doctor ID</param>
        /// <param name="children"></param>
        /// <returns></returns>
        public Doctor Get(int id, string children = "")
        {
            string[] childrenArray = null;

            if (!string.IsNullOrWhiteSpace(children))
            {
                childrenArray = children.Split(',');
            }

            var doctor = Doctor.Find(i => i.Id == id, includes: childrenArray);
            if (doctor == null || doctor.Id == 0)
            {
                doctor = new Doctor();
                var person = Person.Find(i => i.Id == id);
                doctor.Person = person;
            }

            return doctor;
        }
예제 #24
0
 public TestDoctor(Doctor r)
 {
     doctor = r;
     if ((doctor.ContactDtos != null) && (doctor.ContactDtos.Length != 0))
     {
         cnts = new List<TestContact>();
         foreach (ContactDto i in doctor.ContactDtos)
             cnts.Add(new TestContact(i));
     }
     if (doctor.Lpu != null)
         lpu = new TestCoding(doctor.Lpu);
     if (doctor.Person != null)
         person = new TestPerson(doctor.Person);
     if (doctor.Position != null)
         position = new TestCoding(doctor.Position);
     if (doctor.Role != null)
         role = new TestCoding(doctor.Role);
     if (doctor.Speciality != null)
         speciality = new TestCoding(doctor.Speciality);
 }
        public ActionResult Post(Doctor doctor)
        {
            if (doctor != null)
            {
                Run("DoctorController.Post(id)",
                    () =>
                    {
                        Doctor.AddOrUpdate(i => i.Id, doctor);

                        NotificationViewModel.AddToCookie("Processo finalizado com sucesso!", "Sucesso!", 10000, NotificationIconType.Success);
                    }, doctor.Id);

                return RedirectToRoute("Person", new { id = doctor.Id });
            }
            else
            {
                NotificationViewModel.AddToCookie("Ocorreu um problema ao salvar o registro!", iconType: NotificationIconType.Error);
            }

            return RedirectToRoute("Error", new { RedirectUrl = string.Format("~/cadastro/pessoa") });
        }
예제 #26
0
        public static void GetDoctors()
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                string queryString = "SELECT * FROM Doctors";

                using (SqlCommand command = new SqlCommand(queryString, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Doctor doctor = new Doctor();
                            doctor.doctorID = (!reader.IsDBNull(reader.GetOrdinal("doctorID"))) ? reader.GetString(0) : "null";
                            doctor.doctorName = (!reader.IsDBNull(reader.GetOrdinal("doctorName"))) ? reader.GetString(1) : "null";
                            doctor.gloveSize = (!reader.IsDBNull(reader.GetOrdinal("gloveSize"))) ? reader.GetDecimal(2) : 0;
                            DoctorsList.Add(doctor);
                        }
                    }
                }
            }
        }
 public IActionResult CreateDoctor(Doctor doctor)
 {
     _docrepo.CreateDoctor(doctor);
     return(RedirectToAction("ListDoctors"));
 }
        public IActionResult Update(Doctor doctor)
        {
            var result = _docrepo.UpdateDoctor(doctor, doctor.Id);

            return(RedirectToAction("ListDoctors"));
        }
        private bool IsEqualDoctorPersistanceAndDoctorEntity(DoctorPersistence doctorPersistence, Doctor doctor)
        {
            if (doctorPersistence.Id != doctor.Id)
            {
                return(false);
            }

            if (!doctorPersistence.Jmbg.Equals(doctor.Jmbg))
            {
                return(false);
            }

            if (!doctorPersistence.Username.Equals(doctor.Username))
            {
                return(false);
            }

            if (!doctorPersistence.Password.Equals(doctor.Password))
            {
                return(false);
            }

            if (!doctorPersistence.Name.Equals(doctor.Name))
            {
                return(false);
            }

            if (!doctorPersistence.Surname.Equals(doctor.Surname))
            {
                return(false);
            }

            if (doctorPersistence.SpecializationId != doctor.SpecializationId)
            {
                return(false);
            }


            return(true);
        }
예제 #30
0
 public int SaveDoctor(Doctor doctor)
 {
     this._doctorRepository.Add(doctor);
     return(this._doctorRepository.SaveChanges());
 }
예제 #31
0
 public bool VerificateOldPassword(Doctor doctor, string password)
 {
     return(_authRepository.VerificateOldPassword(doctor, password));
 }
예제 #32
0
        public dynamic UserCheck(User u)
        {
            using (SqlConnection conn = new SqlConnection(Connection.ConnStr()))
            {
                // TO CHECK IF IM SUPER USER AND REGISTER NEW DOCTORS
                SqlDataAdapter adapter         = new SqlDataAdapter();
                string         EncryptPassword = Encrypt(u.Password);

                string Q = "Use Hospitology;" +
                           "DECLARE @x int " +
                           "SET @x=(SELECT dbo.[User].isDoctor FROM dbo.[User] WHERE (dbo.[User].username=@userName) AND( dbo.[User].[password]=@pass)) " +
                           "IF(@x)=1 " +
                           "BEGIN " +
                           "SELECT * FROM dbo.Doctors WHERE dbo.Doctors.username=@userName " +
                           "END " +
                           "ELSE IF(@x)=0 " +
                           " BEGIN " +
                           "SELECT P.*,D.* FROM Patients as P INNER JOIN Doctors as D ON p.doctor_id=D.id_doctor WHERE p.username=@userName " +
                           "END " +
                           "ELSE IF(@x)=2 " +
                           "BEGIN " +
                           "SELECT * FROM dbo.[Administrator] WHERE dbo.[Administrator].username=@userName END; ";



                adapter.SelectCommand = new SqlCommand(Q, conn);
                adapter.SelectCommand.Parameters.AddWithValue("@userName", u.Username);
                adapter.SelectCommand.Parameters.AddWithValue("@pass", EncryptPassword);
                DataTable tb = new DataTable();

                adapter.Fill(tb);

                PatientAndDoctor patient = new PatientAndDoctor();
                Doctor           doctor  = new Doctor();
                Addministrator   admin   = new Addministrator();

                foreach (DataRow user in tb.Rows)
                {
                    if (tb.Columns.Contains("EGN"))
                    {
                        //Patient Data
                        //EGN is the new username
                        patient.Username   = user["username"].ToString();
                        patient.EGN        = user["EGN"].ToString();
                        patient.Password   = Decrypt(user["password"].ToString());
                        patient.Firstname  = user["first_name"].ToString();
                        patient.Middlename = user["middle_name"].ToString();

                        patient.Lastname    = user["last_name"].ToString();
                        patient.MobilePhone = user["mobile_phone_number"].ToString();
                        patient.Phone       = user["phone_number"].ToString();
                        patient.City        = user["city"].ToString();
                        patient.Address     = user["address"].ToString();
                        //doctor_id not username_doctor
                        patient.DoctorID = user["id_doctor"].ToString();
                        patient.Email    = user["email"].ToString();
                        //Doctor info
                        patient.docLastname = user["last_name"].ToString();

                        //Start get the date string and convert it to differrent format

                        DateTime s = Convert.ToDateTime(user["start_time"]);
                        patient.StartTime = s.ToString("HH:mm");
                        DateTime e = Convert.ToDateTime(user["end_time"]);
                        patient.EndTime = e.ToString("HH:mm");

                        //END get the date string and convert it to differrent format

                        patient.docMobilePhone = user["mobile_phone_number"].ToString();
                        patient.docPhone       = user["phone_number"].ToString();
                        patient.docCity        = user["city"].ToString();
                        patient.docAddress     = user["address"].ToString();
                    }
                    else if (tb.Columns.Contains("id_doctor"))
                    {
                        //if its Doctor i should add query to add all the date for his current day Apppointments

                        //Doctor Data
                        doctor.IDDoctor       = user["id_doctor"].ToString();
                        doctor.Username       = user["username"].ToString();
                        doctor.Password       = Decrypt(user["password"].ToString());
                        doctor.Specialization = user["specialization"].ToString();
                        doctor.Firstname      = user["first_name"].ToString();
                        doctor.Middlename     = user["middle_name"].ToString();
                        doctor.Lastname       = user["last_name"].ToString();
                        doctor.StartTime      = user["start_time"].ToString();
                        doctor.EndTime        = user["end_time"].ToString();
                        doctor.MobilePhone    = user["mobile_phone_number"].ToString();
                        doctor.Phone          = user["phone_number"].ToString();
                        doctor.City           = user["city"].ToString();
                        doctor.Address        = user["address"].ToString();
                        doctor.Email          = user["email"].ToString();
                        doctor.Picture        = user["picture"].ToString();
                    }
                    else if (tb.Columns.Contains("Name"))
                    {
                        //AZ SUM ADMIN
                        admin.AdminName = user["adminstrator_username"].ToString();
                        admin.Password  = Decrypt(user["Password"].ToString());
                    }
                }
                //I Don't want to return List<User> but for now i want to grind code
                //LATER TODO---->>>> CHECK BETTER WAY ! For no such user
                dynamic result = new List <User>();
                if (doctor.Firstname != null)
                {
                    result = doctor;
                }
                else if (patient.Username != null)
                {
                    result = patient;
                }
                else if (admin.AdminName != null)
                {
                    result = admin;
                }

                return(result);
            }
        }
예제 #33
0
        public Doctor GetById(int?id)
        {
            Doctor doctor = db.Doctors.Find(id);

            return(doctor);
        }
예제 #34
0
 public static DoctorDto MapToDto(Doctor doctor)
 {
     return(MapToDtoExpr2().Compile()(doctor));
 }
예제 #35
0
 public int GetBusinessHours(Doctor doctor, DateTime date)
 {
     throw new NotImplementedException();
 }
예제 #36
0
 public IActionResult AddDoctor(Doctor doctor)
 {
     return(Ok(_context.AddDoctor(doctor)));
 }
예제 #37
0
 public IActionResult ModifyDoctor(Doctor doc)
 {
     return(Ok(_context.ModifyDoctor(doc)));
 }
예제 #38
0
        private IEnumerable <Client> CreateListOfClientsWithPatients(Doctor drSmith, Doctor drWho, Doctor drMcDreamy)
        {
            var clientGraphs = new List <Client>();

            var clientSmith = (CreateClientWithPatient("Steve Smith", "Steve", "Mr.", drSmith.Id, MALE_SEX, "Darwin", "Dog",
                                                       "Poodle"));

            clientSmith.Patients.Add(new Patient(1, "Rumor", FEMALE_SEX, new AnimalType("Cat", "Alley"), drWho.Id));

            clientGraphs.Add(clientSmith);

            clientGraphs.Add(CreateClientWithPatient("Julia Lerman", "Julie", "Mrs.", drMcDreamy.Id, MALE_SEX, "Sampson", "Dog", "Newfoundland"));

            return(clientGraphs);
        }
예제 #39
0
 public double GetAverageGrade(Doctor doctor)
 {
     return(_doctorGradeService.GetAverageGrade(doctor));
 }
예제 #40
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var context  = new Pharm4MeContext();
                var context2 = new ApplicationDbContext();
                int userpin  = model.pin;
                if (model.RoleName == "Patient")
                {
                    Patient check1 = context.Patients.Find(userpin);
                    var     check2 = context2.Users.FirstOrDefault(u => u.PatientId == model.pin);
                    if (check1 != null && check2 == null)
                    {
                        var user = new ApplicationUser {
                            UserName = model.Email, Email = model.Email, RoleName = model.RoleName, PatientId = model.pin
                        };
                        var result = await UserManager.CreateAsync(user, model.Password);

                        if (result.Succeeded)
                        {
                            result = UserManager.AddToRole(user.Id, "Patient");
                            await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                            Patient patient = db.Patients.Find(userpin);
                            patient.Email = model.Email;
                            db.SaveChanges();


                            return(RedirectToAction("Index", "Home"));
                        }
                        AddErrors(result);

                        return(View(model));
                    }
                }
                else if (model.RoleName == "Clinician")
                {
                    Doctor check1 = context.Doctors.Find(userpin);
                    var    check2 = context2.Users.FirstOrDefault(u => u.DoctorId == model.pin);
                    if (check1 != null && check2 == null)
                    {
                        var user = new ApplicationUser {
                            UserName = model.Email, Email = model.Email, RoleName = model.RoleName, DoctorId = model.pin
                        };
                        var result = await UserManager.CreateAsync(user, model.Password);

                        if (result.Succeeded)
                        {
                            result = UserManager.AddToRole(user.Id, "Doctor");
                            await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);



                            return(RedirectToAction("Index", "Home"));
                        }
                        AddErrors(result);
                        return(View(model));
                    }
                }
                else if (model.RoleName == "Admin")
                {
                    var user = new ApplicationUser {
                        UserName = model.Email, Email = model.Email, RoleName = model.RoleName
                    };
                    var result = await UserManager.CreateAsync(user, model.Password);

                    if (result.Succeeded)
                    {
                        result = UserManager.AddToRole(user.Id, "Admin");
                        await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);


                        return(RedirectToAction("Index", "Home"));
                    }
                    AddErrors(result);
                    return(View(model));
                }
                else
                {
                    Pharmacist check1 = context.Pharmacists.Find(userpin);
                    var        check2 = context2.Users.FirstOrDefault(u => u.PharmacistId == model.pin);
                    if (check1 != null && check2 == null)
                    {
                        var user = new ApplicationUser {
                            UserName = model.Email, Email = model.Email, RoleName = model.RoleName, PharmacistId = model.pin
                        };
                        var result = await UserManager.CreateAsync(user, model.Password);

                        if (result.Succeeded)
                        {
                            result = UserManager.AddToRole(user.Id, "Manager");
                            await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);



                            return(RedirectToAction("Index", "Home"));
                        }
                        AddErrors(result);
                        return(View(model));
                    }
                }


                AddCustomizeError("Invalid Pin Code");
            }

            // If we got this far, something failed, redisplay form

            return(View(model));
        }
예제 #41
0
 public Doctor Create(Doctor doctor)
 {
     coronaVirusDbContext.Doctors.Add(doctor);
     return(doctor);
 }
예제 #42
0
 public DateTime GetBuisinessDate(Doctor doctor)
 {
     throw new NotImplementedException();
 }
예제 #43
0
 public Doctor Update(Doctor doctor)
 {
     coronaVirusDbContext.Entry(doctor).State = EntityState.Modified;
     return(doctor);
 }
예제 #44
0
 public IActionResult CreateDoctor(Doctor doctor)
 {
     _service.CreateDoctor(doctor);
     return(Ok());
 }
 public List <ValidationOfMedicament> GetMedicamentsOnValidationForDoctor(Doctor doctor)
 {
     return(validationOfMedicamentRepository.GetMedicamentsOnValidationForDoctor(doctor));
 }
예제 #46
0
 public DoctorInfoWindow(Doctor doctor) : this()
 {
     DataContext = doctor;
 }
예제 #47
0
 public int UpdateDoctor(Doctor doctor)
 {
     this._doctorRepository.Update(doctor);
     return(this._doctorRepository.SaveChanges());
 }
예제 #48
0
 public static List<TestDoctor> BuildDoctorFromDataBaseData(string idReferral)
 {
     List<TestDoctor> docs = new List<TestDoctor>();
     using (NpgsqlConnection c = Global.GetSqlConnection())
     {
         string findDoctorsIds = "SELECT * FROM public.referral_doctor WHERE id_referral = '" + idReferral + "'";
         NpgsqlCommand fd = new NpgsqlCommand(findDoctorsIds, c);
         using (NpgsqlDataReader idr = fd.ExecuteReader())
         {
             if (idr["id_doctor"] != DBNull.Value)
             {
                 string idDoctor = idr["id_doctor"].ToString();
                 using (NpgsqlConnection connection = Global.GetSqlConnection())
                 {
                     string findDoctor = "SELECT * FROM public.doctor WHERE id_doctor = '" + idDoctor + "' ORDER BY id_doctor DESC LIMIT 1";
                     NpgsqlCommand doc = new NpgsqlCommand(findDoctor, connection);
                     using (NpgsqlDataReader doctorFromDataBase = doc.ExecuteReader())
                     {
                         Doctor p = new Doctor();
                         while (doctorFromDataBase.Read())
                         {
                             TestDoctor doctor = new TestDoctor(p);
                             if (doctorFromDataBase["id_doctor_role"] != DBNull.Value)
                                 doctor.role = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(doctorFromDataBase["id_doctor_role"]));
                             if (doctorFromDataBase["id_doctor_speciality"] != DBNull.Value)
                                 doctor.speciality = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(doctorFromDataBase["id_doctor_speciality"]));
                             if (doctorFromDataBase["id_lpu"] != DBNull.Value)
                                 doctor.lpu = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(doctorFromDataBase["id_lpu"]));
                             if (doctorFromDataBase["id_position"] != DBNull.Value)
                                 doctor.position = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(doctorFromDataBase["id_position"]));
                             if (doctorFromDataBase["id_person"] != DBNull.Value)
                                 doctor.person = TestPerson.BuildPersonFromDataBaseData(Convert.ToString(doctorFromDataBase["id_person"]), Convert.ToString(doctorFromDataBase["id_doctor_mis"]));
                             if (doctorFromDataBase["id_person"] != DBNull.Value)
                                 doctor.cnts = TestContact.BuildContactsFromDataBaseData(Convert.ToString(doctorFromDataBase["id_person"]));
                             docs.Add(doctor);
                         }
                     }
                 }
             }
         }
     }
     return (docs.Count != 0) ? docs : null;
 }
예제 #49
0
            public void Run()
            {
                Random   random          = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);
                DateTime doctorTime1     = DateTime.Now;
                DateTime doctorTime2     = DateTime.Now;
                DateTime consultantTime1 = DateTime.Now;
                DateTime consultantTime2 = DateTime.Now;
                String   str;


                TimerCallback callback = new TimerCallback(SetInfected);

                System.Threading.Timer timer = new System.Threading.Timer(callback, this, _form._infectionTime * 1000, Timeout.Infinite);

                Thread.Sleep(1000);

                //  Ждем перевода в очередь смотровой комнаты
                _restart.WaitOne();


                timer.Dispose();

                //  Получаем время приема пациента врачом и признак необходимости консультации
                int  receiptTime    = random.Next(1, _form._maxReceiptTime);
                bool isConsultation = (receiptTime % 3 == 0) ? true : false;

                //  Пациент направляется к врачу
                _form._doctorsAvailable.WaitOne();
                lock (_form._freeDoctors)
                {
                    _doctor         = _form._freeDoctors.Dequeue();
                    _doctor.Patient = this;
                }
                doctorTime1 = DateTime.Now;
                str         = "---> Врач " + _doctor.Number.ToString() + " начал прием пациента " + _number.ToString() + " в " +
                              doctorTime1.ToString() + "\n";
                _form.Invoke(_form.ToProtocolDelegate, new Object[] { str });

                //  При необходимости консультации
                if (isConsultation)
                {
                    str = "---> Врачу " + _doctor.Number.ToString() + " при приеме пациента " + _number.ToString() +
                          " потребовалась консультация в " + DateTime.Now.ToString() + "\n";
                    _form.Invoke(_form.ToProtocolDelegate, new Object[] { str });

                    //  Выбираем консультанта, ждем некоторое время
                    if (_form._doctorsAvailable.WaitOne(_form._maxReceiptTime * 1000))
                    {
                        //  Есть доступный консультант
                        lock (_form._freeDoctors)
                        {
                            _consultant         = _form._freeDoctors.Dequeue();
                            _consultant.Patient = this;
                        }
                        consultantTime1 = DateTime.Now;
                        str             = "<--> Консультант " + _consultant.Number.ToString() + " присоединился к врачу " + _doctor.Number.ToString() +
                                          " при приеме пациента " + _number.ToString() + " в " + consultantTime1.ToString() + "\n";
                        _form.Invoke(_form.ToProtocolDelegate, new Object[] { str });
                    }
                    else
                    {
                        //  Врач сам разобрался с диагнозом
                        str = "---> Врач " + _doctor.Number.ToString() + " сам определился с диагнозом пациента " + _number.ToString() +
                              " в " + DateTime.Now.ToString() + "\n";
                        _form.Invoke(_form.ToProtocolDelegate, new Object[] { str });
                    }
                }

                //  Прием у врача
                Thread.Sleep(receiptTime * 1000);

                //  Если был приглашен консультант, то он завершил прием пациента
                if (isConsultation && _consultant != null)
                {
                    consultantTime2 = DateTime.Now;
                    _consultant.Working(consultantTime2 - consultantTime1);
                    str = "<--> Консультант " + _consultant.Number.ToString() + " завершил прием пациента " + _number.ToString() +
                          " в " + consultantTime2.ToString() + "\n";
                    _form.Invoke(_form.ToProtocolDelegate, new Object[] { str });

                    lock (_form._freeDoctors)
                    {
                        _consultant.Patient = null;
                        _form._freeDoctors.Enqueue(_consultant);
                        _consultant = null;
                    }
                    _form._doctorsAvailable.Release();
                }

                //  Врач завершил прием пациента
                doctorTime2 = DateTime.Now;
                _doctor.Working(doctorTime2 - doctorTime1);
                str = "---> Врач " + _doctor.Number.ToString() + " завершил прием пациента " + _number.ToString() +
                      " в " + doctorTime2.ToString() + "\n";
                _form.Invoke(_form.ToProtocolDelegate, new Object[] { str });

                lock (_form._freeDoctors)
                {
                    _doctor.Patient = null;
                    _form._freeDoctors.Enqueue(_doctor);
                    _doctor = null;
                }
                _form._doctorsAvailable.Release();

                //  Пациент покидает смотровую комнату
                str = "---- Пациент " + _number.ToString() + " покинул смотровую комнату в " + DateTime.Now.ToString() + "\n";
                _form.Invoke(_form.ToProtocolDelegate, new Object[] { str });

                //  Удаляем пациента из списка находящихся в смотровой комнате
                lock (_form._observationRoomQueue)
                {
                    _form._observationRoomQueue.Remove(this);
                }
                //  timer.Dispose();
                //  Сигнализация о завершении потока объекта пациента
                _form.Invoke(_form.RemoveCompletedThread, new Object[] { _thread });
            }
예제 #50
0
        private void SetPatientInformation(MWPAT patient, Doctor doc, string filePath)
        {
            Dictionary<string, string> allInformation = new Dictionary<string, string>();
            if (patient != null)  
            {
                allInformation.Add(IndividualRFileInfo.CHART_ID, patient.ChartNumber);
                allInformation.Add(IndividualRFileInfo.FIRST_NAME, patient.FirstName);
                allInformation.Add(IndividualRFileInfo.MIDDLE_INITIAL, "" + patient.MiddleInitial);
                allInformation.Add(IndividualRFileInfo.LAST_NAME, patient.LastName);
                allInformation.Add(IndividualRFileInfo.CITY, patient.City);
                allInformation.Add(IndividualRFileInfo.STATE, patient.State);
                allInformation.Add(IndividualRFileInfo.STREET_1, patient.Street1);
                allInformation.Add(IndividualRFileInfo.STREET_2, patient.Street2);
                allInformation.Add(IndividualRFileInfo.ZIP_CODE, patient.ZipCode);
                if(patient.DateOfBirth != null){
                    allInformation.Add(IndividualRFileInfo.DATE_OF_BIRTH, ((DateTime)patient.DateOfBirth).ToShortDateString());
                }
                
            }
            if(doc != null){
                allInformation.Add(IndividualRFileInfo.DOCTOR_FIRST_NAME, doc.FirstName);
                allInformation.Add(IndividualRFileInfo.DOCTOR_LAST_NAME, doc.LastName);
                allInformation.Add(IndividualRFileInfo.DOCTOR_MIDDLE_INITIAL, doc.MiddleName);
                allInformation.Add(IndividualRFileInfo.DOCTOR_PHONE_1, doc.Tel1);
                allInformation.Add(IndividualRFileInfo.DOCTOR_STREET_1, doc.Address1);
                allInformation.Add(IndividualRFileInfo.DOCTOR_STREET_2, doc.Address2);
                allInformation.Add(IndividualRFileInfo.DOCTOR_STREET_3, doc.Address3);
                allInformation.Add(IndividualRFileInfo.DOCTOR_FAX, doc.Fax);
                allInformation.Add(IndividualRFileInfo.DOCTOR_CITY, doc.City);
                allInformation.Add(IndividualRFileInfo.DOCTOR_STATE, doc.State);
                allInformation.Add(IndividualRFileInfo.DOCTOR_ZIP_CODE, doc.Zipcode);
                allInformation.Add(IndividualRFileInfo.DOCTOR_IND, "" + doc.Ind);
            }
            Dictionary<string, string> metaInfo = this.getFileMetaData(filePath);
            if(metaInfo == null){
                metaInfo = allInformation;
            }else {
                foreach(KeyValuePair<string, string> kv in allInformation ){
                    if(metaInfo.ContainsKey(kv.Key)){
                        metaInfo.Remove(kv.Key);
                    }
                    metaInfo.Add(kv.Key, kv.Value);

                }
            }
            this.setMetaData(filePath, metaInfo);
        }
예제 #51
0
 public async Task <Doctor> RegisterAsync(Doctor doctor, string password)
 {
     return(await _authRepository.RegisterRepositoryAsync(doctor, password));
 }
예제 #52
0
        public IActionResult Get(string TypeName)
        {
            Doctor doctor = _doctorRepository.Get(TypeName);

            return(Ok(doctor));
        }
예제 #53
0
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            string s = dataExam.SelectedDate.ToString();

            string[] lines = s.Split(' ');
            string   datum = lines[0];

            if (String.IsNullOrEmpty(datum))
            {
                MessageBox.Show("Morate izabrati datum za koji želite zakazati prelged.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                dataExam.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(textBoxDoctorExam.Text))
            {
                MessageBox.Show("Morate izabrati doktora kod kog želite zakazati pregled.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                textBoxDoctorExam.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtSmjena.Text))
            {
                MessageBox.Show("Morate izabrati smjenu u kojoj zelite zakazati pregled.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtSmjena.Focus();
                return;
            }

            TimeSpan ts = new TimeSpan(FIRST_SHIFT_TIME, 0, 0);
            DateTime dt = (DateTime)dataExam.SelectedDate;

            if (first.IsSelected)
            {
                ts = new TimeSpan(FIRST_SHIFT_TIME, 0, 0);
                dt = dt + ts;
            }
            else if (second.IsSelected)
            {
                ts = new TimeSpan(SECOND_SHIFT_TIME, 0, 0);
                dt = dt + ts;
            }
            else if (third.IsSelected)
            {
                ts = new TimeSpan(THIRD_SHIFT_TIME, 0, 0);
                dt = dt + ts;
                dt = dt.AddDays(-1);
            }

            List <Examination> allAppointments;
            Doctor             selectedDoctor = (Doctor)textBoxDoctorExam.SelectedItem;

            List <String> typesExam = new List <string>();

            if (selectedDoctor.Type == TypeOfDoctor.drOpstePrakse)
            {
                typesExam.Add(TypeOfExamination.Opsti.ToString());
            }
            else
            {
                typesExam.Add(TypeOfExamination.Operacija.ToString());
                typesExam.Add(TypeOfExamination.Specijalisticki.ToString());
            }
            txtVrsta.DataContext = typesExam;


            allAppointments = ec.getAllAppointments(selectedDoctor, dt);

            List <ExaminationDTO> examDTO = new List <ExaminationDTO>();

            foreach (Examination exm in allAppointments)
            {
                string room = "";
                string type = "";
                if (exm.room.Number != 0)
                {
                    room = exm.room.Number.ToString();
                }
                if (room.Equals(""))
                {
                    type = "";
                }
                else
                {
                    type = exm.Type.ToString();
                }
                ExaminationDTO e1 = new ExaminationDTO();
                e1.IdExamination = exm.IdExamination;
                e1.doctor        = exm.doctor.Name + " " + exm.doctor.Name;
                e1.patientCard   = exm.patientCard.patient.Name + " " + exm.patientCard.patient.Surname + " " + exm.patientCard.patient.Jmbg;
                e1.DateAndTime   = exm.DateAndTime.ToString();
                e1.room          = room;
                e1.Type          = type;

                examDTO.Add(e1);
            }

            if (examDTO.Count == 0)
            {
                MessageBox.Show("Nema slobodnih pregelda za odabrani datum.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                return;
            }
            DataGrid4.ItemsSource = examDTO;
        }
        public ActionResult DeleteConfirmed(string id)
        {
            if (User.Identity.IsAuthenticated)
            {
                string cid = User.Identity.GetUserId();
                UserManager <ApplicationUser> userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(appDb));
                var roles = userManager.GetRoles(cid);
                if (roles[0] == "Doctor")
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }
                    Doctor doctor = db.Doctors.Find(id);
                    db.Doctors.Remove(doctor);
                    db.SaveChanges();
                    if (ModelState.IsValid)
                    {
                        var user = userManager.FindById(id);
                        if (user == null)
                        {
                            return(RedirectToAction("Index"));
                        }

                        // Log user off if current user is being deleted
                        if (cid == id)
                        {
                            HttpContext.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
                        }
                        var logins       = user.Logins;
                        var rolesForUser = userManager.GetRoles(id);

                        using (var transaction = appDb.Database.BeginTransaction())
                        {
                            foreach (var login in logins.ToList())
                            {
                                userManager.RemoveLogin(login.UserId, new UserLoginInfo(login.LoginProvider, login.ProviderKey));
                            }

                            if (rolesForUser.Count() > 0)
                            {
                                foreach (var item in rolesForUser.ToList())
                                {
                                    var result = userManager.RemoveFromRole(user.Id, item);
                                }
                            }

                            userManager.Delete(user);
                            transaction.Commit();
                        }
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        return(View());
                    }
                }
                else
                {
                    return(View("AccessDenied"));
                }
            }
            else
            {
                return(View("NotLoggedIn"));
            }
        }
예제 #55
0
        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            if (appointment < 0)
            {
                MessageBox.Show("Morate selektovati red u tabeli da bi zakazali pregled.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                return;
            }

            else if (String.IsNullOrEmpty(txtVrsta.Text))
            {
                System.Windows.MessageBox.Show("Morate izabrati vrstu pregleda.", "Upozorenje!",
                                               MessageBoxButton.OK, MessageBoxImage.Warning);

                txtVrsta.Focus();
                return;
            }

            Examination exam = new Examination();

            exam.IdExamination = id;
            exam.DateAndTime   = dt;
            exam.doctor        = (Doctor)textBoxDoctorExam.SelectedItem;
            exam.Type          = TypeOfExamination.Opsti;


            if (txtVrsta.SelectedItem.ToString().Equals("Operacija"))
            {
                exam.Type = TypeOfExamination.Operacija;
            }
            else if (txtVrsta.SelectedItem.ToString().Equals("Specijalisticki"))
            {
                exam.Type = TypeOfExamination.Specijalisticki;
            }


            if (String.IsNullOrEmpty(txtSoba.Text))
            {
                System.Windows.MessageBox.Show("Morate izabrati sobu u kojoj zelite zakazati pregled.", "Upozorenje!",
                                               MessageBoxButton.OK, MessageBoxImage.Warning);

                txtSoba.Focus();
                return;
            }
            string roomStr = txtSoba.SelectedValue.ToString();
            int    roomId  = Int32.Parse(roomStr);

            exam.room = rc.ViewRoomByNumber(roomId);

            string[] ss = showName.Text.Split(' ');

            exam.patientCard = ap.ViewPatientCard(ss[ss.Length - 1]);

            ec.ScheduleExamination(exam);

            TimeSpan ts = new TimeSpan(8, 0, 0);

            if (second.IsSelected)
            {
                ts = new TimeSpan(16, 0, 0);
            }
            else if (third.IsSelected)
            {
                ts = new TimeSpan(12, 0, 0);
            }
            List <Examination> allAppointments;
            Doctor             selectedDoctor = (Doctor)textBoxDoctorExam.SelectedItem;

            allAppointments = ec.getAllAppointments(selectedDoctor, (DateTime)dataExam.SelectedDate + ts);

            List <ExaminationDTO> examDTO = new List <ExaminationDTO>();

            foreach (Examination exm in allAppointments)
            {
                string room = "";
                string type = "";
                if (exm.room.Number != 0)
                {
                    room = exm.room.Number.ToString();
                }
                if (room.Equals(""))
                {
                    type = "";
                }
                else
                {
                    type = exm.Type.ToString();
                }
                ExaminationDTO e1 = new ExaminationDTO();
                e1.IdExamination = exm.IdExamination;
                e1.doctor        = exm.doctor.Name + " " + exm.doctor.Name;
                e1.patientCard   = exm.patientCard.patient.Name + " " + exm.patientCard.patient.Surname + " " + exm.patientCard.patient.Jmbg;
                e1.DateAndTime   = exm.DateAndTime.ToString();
                e1.room          = room;
                e1.Type          = type;

                examDTO.Add(e1);
            }

            if (examDTO.Count == 0)
            {
                MessageBox.Show("Nema slobodnih pregelda za odabrani datum.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                return;
            }
            DataGrid4.ItemsSource = examDTO;
            Notification n = new Notification();
            int          idNotification = nc.getLastId();

            n.Id             = ++idNotification;
            n.Type           = TypeOfNotification.Pregled;
            n.Message        = "Novi termin zakazan " + dt.ToString() + " dr. " + selectedDoctor.Name + " " + selectedDoctor.Surname;
            n.JmbgOfReceiver = patientCard.patient.Jmbg;
            nc.SendNotification(n);

            appointment = -1;
        }
예제 #56
0
        private void Button_Click_10(object sender, RoutedEventArgs e)
        {
            if (appointment < 0)
            {
                MessageBox.Show("Morate selektovati red u tabeli da bi otkazali pregled.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);


                return;
            }

            ec.DeleteScheduledExamination(id);

            TimeSpan ts = new TimeSpan(8, 0, 0);

            if (second.IsSelected)
            {
                ts = new TimeSpan(16, 0, 0);
            }
            else if (third.IsSelected)
            {
                ts = new TimeSpan(12, 0, 0);
            }
            List <Examination> allAppointments;
            Doctor             selectedDoctor = (Doctor)textBoxDoctorExam.SelectedItem;

            allAppointments = ec.getAllAppointments(selectedDoctor, (DateTime)dataExam.SelectedDate + ts);

            List <ExaminationDTO> examDTO = new List <ExaminationDTO>();

            foreach (Examination exm in allAppointments)
            {
                string room = "";
                string type = "";
                if (exm.room.Number != 0)
                {
                    room = exm.room.Number.ToString();
                }
                if (room.Equals(""))
                {
                    type = "";
                }
                else
                {
                    type = exm.Type.ToString();
                }
                ExaminationDTO e1 = new ExaminationDTO();
                e1.IdExamination = exm.IdExamination;
                e1.doctor        = exm.doctor.Name + " " + exm.doctor.Name;
                e1.patientCard   = exm.patientCard.patient.Name + " " + exm.patientCard.patient.Surname + " " + exm.patientCard.patient.Jmbg;
                e1.DateAndTime   = exm.DateAndTime.ToString();
                e1.room          = room;
                e1.Type          = type;

                examDTO.Add(e1);

                appointment = -1;
            }

            if (examDTO.Count == 0)
            {
                MessageBox.Show("Nema slobodnih pregelda za odabrani datum.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                return;
            }
            DataGrid4.ItemsSource = examDTO;
        }
예제 #57
0
        public string MoveFile(string path, string file, string targetFile, string chartId, MWPAT patient, Doctor doctor)
        {

            file = file.Replace("\\\\" + System.Net.Dns.GetHostName() + "\\" + this.data["DRR_DRIVE"] + "$", this.data["DRR_DRIVE"] + ":"); //this is not good for deploying to another machine moving project to another machine
            string toReturn = file;
            bool isPatient = false;
            bool isIncoming = false;
             
            if (this.isPatientFolder(path))
            {
                if (chartId == null)
                {

                    Dictionary<string, string> d = getFileMetaData(file);

                    if (d!= null && d.ContainsKey(IndividualRFileInfo.CHART_ID) )
                    {
                        chartId = d[IndividualRFileInfo.CHART_ID];
                    
                    }
                    else
                    {
                        return "File has no chart Id";
                    }
                }
                
                path = data["ROUTING_BASE"] + chartId + Path.DirectorySeparatorChar + path;
                DirectoryInfo dInfo = new DirectoryInfo(path);
                dInfo.Create();
                isPatient = true;
            }
            if (this.isIncomingFolder(path))
            {
                isIncoming = true;
            }
            if (System.IO.Directory.Exists(path) && System.IO.File.Exists(file) && !IsFileLocked(new IndividualRFileInfo(file)))
            {
                System.IO.FileInfo destinationFile = new System.IO.FileInfo(path + Path.DirectorySeparatorChar + targetFile);
                toReturn = targetFile;
                FileInfo sourceFile = new FileInfo(file);
                FileInfo targetPath = new FileInfo(path + Path.DirectorySeparatorChar + targetFile);
                if (targetPath.FullName != sourceFile.FullName && !System.IO.File.Exists(path + Path.DirectorySeparatorChar + targetFile))
                {

                    System.IO.File.Copy(file, path + Path.DirectorySeparatorChar + targetFile, true);
                    System.IO.File.Copy(file, data["DRR_BACKUP_FOLDER"] + Path.DirectorySeparatorChar + targetFile, true);
                    if (System.IO.File.Exists(path + Path.DirectorySeparatorChar + targetFile))
                    {
                        System.IO.File.Delete(file);
                        file = file.Replace(".pdf", ".png");

                        destinationFile = new System.IO.FileInfo(destinationFile.Directory.FullName + Path.DirectorySeparatorChar + targetFile.Replace(".pdf", ".png"));
                        if (destinationFile.Exists)
                        {
                            if (isPatient)
                            {
                                System.IO.File.Delete(file);
                            }
                            else if (isIncoming && System.IO.Directory.Exists(file))
                            {
                                System.IO.File.Move(file, path + destinationFile.Name);
                            }
                        }
                        chartId = this.getValue(this.GetFileChartInformation(path + Path.DirectorySeparatorChar + targetFile), IndividualRFileInfo.CHART_ID);
                        toReturn = "Moved " + toReturn + " (" + chartId + ") \nto " + path + "  Successfully";
                        this.setMetaData(destinationFile.Directory.FullName + Path.DirectorySeparatorChar + targetFile, IndividualRFileInfo.CURRENT_DIRECTORY, destinationFile.Directory.Name);
                         
                        this.SetPatientInformation(patient, doctor, destinationFile.Directory.FullName + Path.DirectorySeparatorChar + targetFile);
                    }
                }
                else if (System.IO.File.Exists(path + Path.DirectorySeparatorChar + targetFile))
                {
                    toReturn = "A file with the same name exists in the target folder. Please use a different name.";

                }
                else if (targetPath.FullName != sourceFile.FullName)
                {
                    chartId = this.getValue(this.GetFileChartInformation(path + Path.DirectorySeparatorChar + targetFile), IndividualRFileInfo.CHART_ID);
                    toReturn = "Moved " + toReturn + " (" + chartId + ") \nto " + path + "  Successfully";
                }
                else
                {
                    toReturn += " can't be moved";
                }
            }
            else if (!System.IO.Directory.Exists(path))
            {
                toReturn += "Directory doesn't exist";
            }
            else if (!System.IO.File.Exists(file))
            {
                toReturn += " doesn't exist";
            }
            else if (IsFileLocked(new IndividualRFileInfo(file)))
            {
                toReturn += " is in use";
            }
            return toReturn;
        }
예제 #58
0
 public BoundaryTest()
 {
     _medicineServices = new MedicineServices(medicineservice.Object);
     _adminMServices   = new AdminMedicineServices(adminservice.Object);
     _user             = new ApplicationUser()
     {
         UserId                = "5f8054f4914569df2b9e7d8e",
         Name                  = "Uma Kumar",
         Email                 = "*****@*****.**",
         Password              = "******",
         MobileNumber          = 9865253568,
         PinCode               = 820003,
         HouseNo_Building_Name = "9/11",
         Road_area             = "Road_area",
         City                  = "Gaya",
         State                 = "Bihar"
     };
     _category = new Category()
     {
         Id              = "5f0ff60a7b7be11c4c3c19e1",
         CatId           = 1,
         Url             = "~/Home",
         OpenInNewWindow = false
     };
     _medicine = new Medicine()
     {
         MedicineId = "5f802874c043a417142b7cc1",
         Name       = "Medicine-1",
         Brand      = "Brand-One",
         Price      = 123,
         Stock      = 10,
         Discount   = 10,
         Details    = "Medicine Details",
         Size       = "100Mg",
         Features   = "Medicine Feature for Medicine-1",
         CatId      = 1
     };
     _appointment = new Appointment()
     {
         AppointmentId = "5f805687914569df2b9e7d90",
         PatientName   = "Uma",
         DoctorName    = "R Kumar",
         Takendate     = DateTime.Now,
         Symtoms       = "Fever",
         PatientAge    = 30,
         Remark        = "Patient Remark"
     };
     _doctor = new Doctor()
     {
         DoctorId       = "5f802b2ec043a417142b7cc3",
         Name           = "R.R",
         Specialization = "MBBS - ENT",
         Qualification  = "MBBS",
         PracticingFrom = DateTime.Now
     };
     _medicineOrder = new MedicineOrder()
     {
         OrderId    = "5f805550914569df2b9e7d8f",
         MedicineId = "",
         UserId     = ""
     };
 }
예제 #59
0
 /// <summary>
 /// Попытка зарегистрировать пользователя-врача
 /// </summary>
 /// <param name="login">Логин</param>
 /// <param name="password">Пароль</param>
 /// <param name="doctor">Данные врача</param>
 /// <returns>Результат регистрации</returns>
 public static RegistrationResult RegisterDoctor(string login, string password, Doctor doctor)
 {
     return UserDao.RegisterDoctor(login, password, doctor);
 }
 private ISpecification <Appointment> GetSpecificationByDoctor(Doctor doctor)
 {
     return(new ExpressionSpecification <Appointment>(o => o.DoctorInAppointment == null ? false : o.DoctorInAppointment.Equals(doctor)));
 }