Beispiel #1
0
        private void DepartmentsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string name = DepartmentsList.SelectedItem.ToString();

            var id = departments
                     .Where(d => d.Name == name)
                     .FirstOrDefault().Id;
            var emps = employees
                       .Where(x => x.DepId == id)
                       .ToList();

            EmpList.Items.Clear();
            foreach (var x in emps)
            {
                EmpList.Items.Add($"{x.FirstName} {x.LastName}");
            }
            Add_but.Enabled = true;
            FName.Clear();
            LName.Clear();
            Position.Clear();
            Experience.Clear();
        }
Beispiel #2
0
        protected void getCompleteProfile(int in_current_userId, int in_profileId)
        {
            connect.Open();
            SqlCommand cmd = connect.CreateCommand();

            try
            {
                cmd.CommandText = "select physicianCompleteProfileId from PhysicianCompleteProfiles where userId = '" + in_profileId + "' ";
                ID = cmd.ExecuteScalar().ToString();
                cmd.CommandText = "select [physicianCompleteProfile_isPrivate] from PhysicianCompleteProfiles where userId = '" + in_profileId + "' ";
                Private         = Convert.ToInt32(cmd.ExecuteScalar());
                if (in_current_userId == in_profileId || Private == 0)//If the user trying access the profile is the owner
                {
                    cmd.CommandText = "select [physicianCompleteProfile_Dialysis] from [PhysicianCompleteProfiles] where userId = '" + in_profileId + "' ";
                    Dialysis        = cmd.ExecuteScalar().ToString();
                    cmd.CommandText = "select [physicianCompleteProfile_homeDialysis] from [PhysicianCompleteProfiles] where userId = '" + in_profileId + "' ";
                    HomeDialysis    = cmd.ExecuteScalar().ToString();
                    cmd.CommandText = "select [physicianCompleteProfile_transplantation] from [PhysicianCompleteProfiles] where userId = '" + in_profileId + "' ";
                    Transplantation = cmd.ExecuteScalar().ToString();
                    cmd.CommandText = "select [physicianCompleteProfile_hypertension] from [PhysicianCompleteProfiles] where userId = '" + in_profileId + "' ";
                    Hypertension    = cmd.ExecuteScalar().ToString();
                    cmd.CommandText = "select [physicianCompleteProfile_GN] from [PhysicianCompleteProfiles] where userId = '" + in_profileId + "' ";
                    GN = cmd.ExecuteScalar().ToString();
                    cmd.CommandText = "select [physicianCompleteProfile_physicianId] from [PhysicianCompleteProfiles] where userId = '" + in_profileId + "' ";
                    PhysicianID     = cmd.ExecuteScalar().ToString();
                    cmd.CommandText = "select count(*) from PhysicianExperiences where physicianCompleteProfileId = '" + ID + "' ";
                    int experiencesCount = Convert.ToInt32(cmd.ExecuteScalar());
                    if (experiencesCount > 0)
                    {
                        Experience = new List <string[]>();
                    }
                    for (int i = 1; i <= experiencesCount; i++)
                    {
                        cmd.CommandText = "select physicianExperienceId from(SELECT rowNum = ROW_NUMBER() OVER(ORDER BY physicianExperienceId ASC), * FROM PhysicianExperiences where physicianCompleteProfileId = '" + ID + "') as t where rowNum = '" + i + "'";
                        string experienceId = cmd.ExecuteScalar().ToString();
                        cmd.CommandText = "select physicianExperience_hospitalName from PhysicianExperiences where physicianExperienceId = '" + experienceId + "' ";
                        string hospitalName = cmd.ExecuteScalar().ToString();
                        cmd.CommandText = "select physicianExperience_hospitalAddress from PhysicianExperiences where physicianExperienceId = '" + experienceId + "' ";
                        string hospitalAddress = cmd.ExecuteScalar().ToString();
                        cmd.CommandText = "select physicianExperience_fromYear from PhysicianExperiences where physicianExperienceId = '" + experienceId + "' ";
                        string fromYear = cmd.ExecuteScalar().ToString();
                        cmd.CommandText = "select physicianExperience_toYear from PhysicianExperiences where physicianExperienceId = '" + experienceId + "' ";
                        string   toYear = cmd.ExecuteScalar().ToString();
                        string[] result = new string[] { hospitalName, hospitalAddress, fromYear, toYear };
                        Experience.Add(result);
                    }
                }
                else //if (Private == 1) if the account is set to private and the user accessing it is not the owner:
                {
                    //If the account is private or the user trying to access is not the owner, show nothing:
                    Dialysis        = "";
                    HomeDialysis    = "";
                    Transplantation = "";
                    Hypertension    = "";
                    GN          = "";
                    PhysicianID = "";
                    if (Experience != null)
                    {
                        Experience.Clear();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An error occured while trying to retrieve the Physician Complete Profile ID (" + ID + "): ", e);
                //If there is an error, set everything to blank to avoid null values:
                Dialysis        = "";
                HomeDialysis    = "";
                Transplantation = "";
                Hypertension    = "";
                GN          = "";
                PhysicianID = "";
                if (Experience != null)
                {
                    Experience.Clear();
                }
            }

            connect.Close();
        }
 void Open()
 {
     Canvas.gameObject.SetActive(true);
     Experience.Clear();
 }