Ejemplo n.º 1
0
		public static void Main (string[] args)
		{
			Console.WriteLine ("Travis");
			person Travis = new person ();
			Travis.name = "Travis";
			Travis.amountOfIntelligence = 30;
			Travis.attackPower = 100;
			Travis.defensePower = 10;
			Travis.printBase ();

			Console.WriteLine ();


			Console.WriteLine ("Dog");
			animal dog = new animal ();
			dog.name = "spooky";
			dog.amountOfIntelligence = 80;
			dog.typeOfAnimal = "dog";
			dog.attackPower = 100;
			dog.defensePower = 100;
			dog.printBase ();
			dog.GetType ();

			Console.ReadLine ();
			
	}
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            double averageage;
            person.sumofallages = 0;
            
            person p1 = new person();
            p1.spouse = new person();
          

            System.Console.WriteLine("           (Enter information for p1 )");
            p1.getinformation();
            System.Console.WriteLine("           (Enter information for p2 )");
            person p2 = new person();
            p2.spouse = new person();
            p2.getinformation();
          
           //person.sumofallages =p1.age+p1.spouse.age+p2.age+p2.spouse.age;

           averageage = person.sumofallages / 4;


            System.Console.WriteLine("           ( Print persons and spouse's name and age)"+"\n");
            p1.printNameandAge();
            p2.printNameandAge();
            System.Console.WriteLine("total age is:  "+person.sumofallages);
            System.Console.WriteLine("average age is:  " + averageage);
            System.Console.WriteLine("press any key to continue");
            System.Console.ReadKey();
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            var Re = new ReturnDate();

            mydbEntities1 db = new mydbEntities1();

            var query = from p in db.users

                        select p;

            List<person> new1 = new List<person>();

            foreach (var q in query)
            {
                person p1 = new person();
                p1.id = q.id;
                p1.firstname = q.firstname;
                p1.lastname = q.lastname;
                p1.phone = q.phone;
                p1.email = q.email;
                new1.Add(p1);
            }

            Re.total = new1.Count.ToString();
            Re.rows = new1;

            DataContractJsonSerializer json = new DataContractJsonSerializer(Re.GetType());
            json.WriteObject(context.Response.OutputStream, Re);
        }
 public static void Main(string[] args)
 {
     person tempperson;
     int day=0;
     string statpark = Console.ReadLine();
     while (!string.IsNullOrEmpty(statpark))
     {
         //initialize hash
         List<person> lp=new List<person>();
         while (!statpark.Equals("CLOSE"))
         {
             if (statpark.Equals("OPEN"))//next
             {
                 statpark = Console.ReadLine();day++;
             }
             string[] tempsplit = statpark.Split();
             if (tempsplit[0].Equals("ENTER"))
             {
                 if (lp.Exists(item => item.name == tempsplit[1]))
                 {
                     int idx = lp.FindIndex(item => item.name == tempsplit[1]);
                     int min=int.Parse(tempsplit[2]);
                     string nma=lp[idx].name;
                     double pri=lp[idx].price;
                     lp[idx] = new person(nma,pri,min);
                 }
                 else
                 {
                     tempperson.currminute = int.Parse(tempsplit[2]);
                     tempperson.name = tempsplit[1];
                     tempperson.price = 0;
                     lp.Add(tempperson);
                 }
             }
             else //EXIT
             {
                 int idx = lp.FindIndex(item => item.name == tempsplit[1]);
                 int myminutes=int.Parse(tempsplit[2]);
                 string nama=lp[idx].name;
                 double harga=lp[idx].price+((myminutes-lp[idx].currminute)*0.1);
                 int menitsekarang=lp[idx].currminute;
                 lp[idx]=new person(nama,harga,menitsekarang);
             }
             statpark = Console.ReadLine();
         }
         //output
         var tempc=from x in lp orderby x.name select x;
         lp = tempc.ToList();
         Console.WriteLine("Day {0}",day);
         foreach (person prs in lp)
         {
             Console.WriteLine(String.Format("{0} ${1:F2}", prs.name, prs.price));
         }
         Console.WriteLine();
         //clear hash
         lp=new List<person>();
         statpark = Console.ReadLine();
     }
 }
	public static void Main (string[] args)
	{
		Console.Write ("Потребител:");			string _user = Console.ReadLine ();
		Console.Write ("Парола:");				string _pass = Console.ReadLine ();
		//Дефиниране на клас
		person _person=new person (_user, _pass);
		//Достъпване на клас
		Console.WriteLine (_person.userFName+ " "+ person.userLName);

	}
        static void Main(string[] args)
        {
            Console.Write("Enter user: "******"Enter passwort: ");
            string pass = Console.ReadLine();
            person Person = new person(user, pass);
            Console.WriteLine(Person.UserFName+" "+Person.UserLName);

        }
Ejemplo n.º 7
0
 void SpeakerPage_Loaded(object sender, RoutedEventArgs e)
 {
     this.Speaker = (App.Current as App).schedule.Speaker.Single(_speaker => _speaker.ID == this.ID);
     this.Events = (App.Current as App).schedule.Events.Where(_event => _event.Persons.Contains(this.Speaker)).ToList<@event>();
     this.Dispatcher.BeginInvoke(() =>
     {
         this.LayoutRoot.DataContext = this.Speaker;
         this.lB_EventList.ItemsSource = this.Events;
     });
 }
 public person Delete_person_select(int ID)
 {
     person = person.Select(ID);
     Delete_person_id_txt_lbl.Text = Convert.ToString(person.person_id);
     Delete_Resource_ID_txt_lbl.Text = Convert.ToString(person.Resource_ID);
     Delete_address_id_txt_lbl.Text = Convert.ToString(person.address_id);
     Delete_address_id2_txt_lbl.Text = Convert.ToString(person.address_id2);
     Delete_birthdate_txt_lbl.Text = Convert.ToString(person.birthdate);
     Delete_certification_number_txt_lbl.Text = Convert.ToString(person.certification_number);
     Delete_f_name_txt_lbl.Text = Convert.ToString(person.f_name);
     Delete_m_initial_txt_lbl.Text = Convert.ToString(person.m_initial);
     Delete_l_name_txt_lbl.Text = Convert.ToString(person.l_name);
     Delete_gender_txt_lbl.Text = Convert.ToString(person.gender);
     Delete_person_type_txt_lbl.Text = Convert.ToString(person.person_type);
     Delete_phone_primary_txt_lbl.Text = Convert.ToString(person.phone_primary);
     Delete_phone_secondary_txt_lbl.Text = Convert.ToString(person.phone_secondary);
     Delete_email_txt_lbl.Text = Convert.ToString(person.email);
     Delete_ssn_txt_lbl.Text = Convert.ToString(person.ssn);
     Delete_Maiden_Name_txt_lbl.Text = Convert.ToString(person.Maiden_Name);
     Delete_Visa_Issue_Date_txt_lbl.Text = Convert.ToString(person.Visa_Issue_Date);
     Delete_Visa_Expire_Date_txt_lbl.Text = Convert.ToString(person.Visa_Expire_Date);
     Delete_Visa_Selected_Value_B1_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_B1);
     Delete_Visa_Selected_Value_B2_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_B2);
     Delete_Visa_Selected_Value_K1_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_K1);
     Delete_Visa_Selected_Value_K3_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_K3);
     Delete_Visa_Selected_Value_L1_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_L1);
     Delete_Visa_Selected_Value_L2_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_L2);
     Delete_Visa_Selected_Value_H4_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_H4);
     Delete_Visa_Selected_Value_F1_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_F1);
     Delete_Visa_Selected_Value_J1_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_J1);
     Delete_Visa_Selected_Value_M1_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_M1);
     Delete_Visa_Selected_Value_H_1B_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_H_1B);
     Delete_Visa_Selected_Value_H_2B_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_H_2B);
     Delete_Visa_Selected_Value_B_2_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_B_2);
     Delete_Visa_Selected_Value_Schengen_txt_lbl.Text = Convert.ToString(person.Visa_Selected_Value_Schengen);
     Delete_Perm_Resident_Alien_Resid_Date_txt_lbl.Text = Convert.ToString(person.Perm_Resident_Alien_Resid_Date);
     Delete_Perm_Resident_Alien_Expire_Date_txt_lbl.Text = Convert.ToString(person.Perm_Resident_Alien_Expire_Date);
     Delete_Perm_Resident_Alien_A_number_txt_lbl.Text = Convert.ToString(person.Perm_Resident_Alien_A_number);
     Delete_Perm_Resident_Alien_USCIS_number_txt_lbl.Text = Convert.ToString(person.Perm_Resident_Alien_USCIS_number);
     Delete_Perm_Resident_Alien_Birth_Country_txt_lbl.Text = Convert.ToString(person.Perm_Resident_Alien_Birth_Country);
     Delete_Perm_Resident_Alien_Category_txt_lbl.Text = Convert.ToString(person.Perm_Resident_Alien_Category);
     Delete_Driver_State_ID_txt_lbl.Text = Convert.ToString(person.Driver_State_ID);
     Delete_Citizenship_txt_lbl.Text = Convert.ToString(person.Citizenship);
     Delete_Marital_Status_txt_lbl.Text = Convert.ToString(person.Marital_Status);
     Delete_Minor_Children_txt_lbl.Text = Convert.ToString(person.Minor_Children);
     return person;
 }
        //select a client and display data
        protected void Update_gvClientSearchresult_SelectedIndexChanged(object sender, EventArgs e)
        {
            person = person.Select(Convert.ToInt32(Update_gvClientSearchresult.SelectedDataKey.Value));
            GlobalVariables.PersonID = Convert.ToInt32(Update_gvClientSearchresult.SelectedDataKey.Value);

            address = address.Select(person.address_id);
            missing = missing.Select(person.person_id);
            deceased = deceased.Select(person.person_id);

            client = client.Select(person.person_id);
            GlobalVariables.ClientID = client.client_id;

            Update_LocationDiscription_txt.Text = missing.last_known_location;
            Update_reason_of_death_txt.Text = deceased.reason_of_death;
            Update_time_of_death_txt.Text = Convert.ToString(deceased.time_of_death);
            Update_identifying_marks_txt.Text = deceased.identifying_marks;
            Update_external_exam_txt.Text = deceased.external_exam;
            Update_date_of_autopsy_txt.Text = Convert.ToString(deceased.date_of_autopsy.ToShortDateString());
            Update_internal_exam_txt.Text = deceased.external_exam;
            Update_client_other_info_txt.Text = missing.client_other_info;
            Update_Client_latitude_txt.Text = Convert.ToString(address.latitude);
            Update_Client_longitude_txt.Text = Convert.ToString(address.longitude);
            Update_Client_zip_plus_four_txt.Text = Convert.ToString(address.zip_plus_four);
            Update_Client_str_add2_txt.Text = address.str_add;
            Update_Client_str_add_txt.Text = address.str_add2;
            Update_Client_County_Township_txt.Text = address.County_Township;
            Update_Client_country_txt.Text = address.country;
            Update_Client_state_txt.Text = address.state;
            Update_Client_city_txt.Text = address.city;
            Update_hair_color_ddl.SelectedValue = client.hair_color;
            Update_skin_color_ddl.SelectedValue = client.skin_color;
            Update_eye_color_ddl.SelectedValue = client.eye_color;
            Update_ethnicity_txt.Text = client.ethnicity;
            Update_weight_txt.Text = Convert.ToString(client.weight);
            Update_height_ddl.SelectedValue = Convert.ToString(client.height);
            Update_date_of_disappearance_txt.Text = Convert.ToString(missing.date_of_disappearance.ToShortDateString());
            Update_clothing_txt.Text = missing.clothing;
            Update_phone_primary_txt.Text = person.phone_primary;
            Update_ssn_txt.Text = Convert.ToString(person.ssn);
            Update_gender_ddl.SelectedValue = person.gender;
            Update_l_name_txt.Text = person.l_name;
            Update_m_initial_txt.Text = person.m_initial;
            Update_f_name_txt.Text = person.f_name;

            //change condishions
            Update_txtFirstName.Text = person.f_name.ToString();
            Update_txtLastName.Text = person.l_name.ToString();

            if (client.client_status == "D")
            {
                Update_Deceased_Div.Style.Add("display", "block");
                Update_deceasedYes.Checked = true;
                Update_missingYes.Checked = false;
            }
            else
            {
                Update_Deceased_Div.Style.Add("display", "none");
                Update_deceasedYes.Checked = false;
                Update_missingYes.Checked = true;
            }

            Update_sClient_L.Text = "</br>" + person.f_name + " " + person.l_name + " is selected.";
        }
        //INSERT
        protected void insert_Click(object sender, EventArgs e)
        {
            try
            {
                address = address_insert();
                person = person_insert();
                client = client_insert();
                missing = missing_insert();

                if (Insert_deceasedYes.Checked == true)
                {
                    deceased = deceased_insert();
                }
                case_intake = case_intake_insert();
                case_client = case_client_insert();
                encounter = encounter_insert();
            }
            catch { Insert_lbl_Client_Error.Text = "There has been an error updating information for the missing client."; }
            finally { Insert_lbl_Client_Error.Text = "The missing client's information has been successfully updated."; }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Take a DB person row and concat first + last names
        /// </summary>
        /// <param name="row"></param>
        /// <returns>FirstName LastName</returns>
        public static string FullName(person row)
        {
            // No name is known
            if (row == null || (row.first_name == null && row.last_name == null))
            {
                return null;
            }

            // Only last name is known
            if (row.first_name == null)
            {
                return row.last_name;
            }

            // Only first name is known
            else if (row.last_name == null)
            {
                return row.first_name;
            }

            // Both names are known
            return row.first_name.Trim() + " " + row.last_name.Trim();
        }
Ejemplo n.º 12
0
    protected void btnaddpost_Click(object sender, EventArgs e)
    {
        string mess;
        person per     = new person();
        person findper = new person();

        per.hr_emp_num = txbupid.Text;
        per.name       = txbname.Text;
        per.job        = txbjob.Text;
        per.department = txbdepartment.Text;
        OleDbConnection conn = new OleDbConnection(db.constring());

        if (txbname.Text == "" || txbjob.Text == "" || txbdepartment.Text == "" || txbupid.Text == "")
        {
            mess = "请将信息填写完整!!!";
            Response.Write(message.goBack(mess));
        }
        else
        {
            try
            {
                int.Parse(txbupid.Text);
                if (txbjob.Text == "总经理" && txbupid.Text == "0")
                {
                    person.InsertPerson(per);
                    btnaddpost.Visible = false;
                    Panel1.Visible     = false;
                    mess = "新人员添加成功!!!";
                    string url = "personManage.aspx";
                    Response.Write(message.MessageAndUrl(mess, url));
                }
                else
                {
                    person hr_per = new person();
                    hr_per = person.FindEmp_num(txbupid.Text);
                    if (hr_per != null)
                    {
                        if (txbjob.Text == "采购员" && hr_per.job == "部门经理")
                        {
                            person.InsertPerson(per);
                            btnaddpost.Visible = false;
                            Panel1.Visible     = false;
                            mess = "新人员成功!!!";
                            string url = "personManage.aspx";
                            Response.Write(message.MessageAndUrl(mess, url));
                        }
                        else if (txbjob.Text == "部门经理" && hr_per.job == "总经理")
                        {
                            person.InsertPerson(per);
                            btnaddpost.Visible = false;
                            Panel1.Visible     = false;
                            mess = "新人员添加成功!!!";
                            string url = "personManage.aspx";
                            Response.Write(message.MessageAndUrl(mess, url));
                        }
                        else
                        {
                            mess = "添加员工职称与上级员工职称不相匹配!!!";
                            Response.Write(message.goBack(mess));
                        }
                    }
                    else
                    {
                        mess = "该上级员工号不存在!!!";
                        Response.Write(message.goBack(mess));
                    }
                }
            }
            catch
            {
                mess = "上级编号只能是数字";
                Response.Write(message.goBack(mess));
            }
        }
    }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     person = Update_person_select(Convert.ToInt32(Update_person_GridView.SelectedValue));
 }
 // Use this for initialization
 void Start()
 {
     monumentSystem = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MonumentSystem>();
     pe             = GameObject.FindGameObjectWithTag("Player").GetComponent <person>();
 }
        //select a client and display data
        protected void Insert_gvClientSearchresult_SelectedIndexChanged(object sender, EventArgs e)
        {
            person = person.Select(Convert.ToInt32(Insert_gvClientSearchresult.SelectedDataKey.Value));
            GlobalVariables.PersonID = Convert.ToInt32(Insert_gvClientSearchresult.SelectedDataKey.Value);

            client = client.Select(GlobalVariables.PersonID);
            GlobalVariables.ClientID = client.client_id;

            Insert_txtFirstName.Text = person.f_name.ToString();
            Insert_txtLastName.Text = person.l_name.ToString();

            Insert_firstName_L.Visible = false;
            Insert_lastName_L.Visible = false;
            Insert_txtFirstName.Visible = false;
            Insert_txtLastName.Visible = false;
            Insert_btnNameSearch.Visible = false;
            Insert_changeClient.Visible = true;

            Insert_sClient_L.Text = "</br>" + person.f_name + " " + person.l_name + " is selected.";

            Insert_refreshcase();
        }
        //select a client and display data
        protected void Update_gvClientSearchresult_SelectedIndexChanged(object sender, EventArgs e)
        {
            Update_lbl_pet_Error.Text = "";
            person = person.Select(Convert.ToInt32(Update_gvClientSearchresult.SelectedDataKey.Value));
            GlobalVariables.PersonID = Convert.ToInt32(Update_gvClientSearchresult.SelectedDataKey.Value);

            client = client.Select(GlobalVariables.PersonID);
            GlobalVariables.ClientID = client.client_id;

            Update_txtfirstname.Text = person.f_name.ToString();
            Update_txtlastname.Text = person.l_name.ToString();

            Update_refreshcase();
        }
Ejemplo n.º 17
0
        public static void UpdateGrid(this DataGrid grid)
        {

            List<person> gridlist = new List<person>();
            using (var db = new CVDBContext())
            {
                var query1 = from u in db.Users
                             select u.User_ID;
                foreach (var user in query1.ToList())
                {
                    List<string> tmptags = new List<string>();
                    List<string> tmpskills = new List<string>();
                    var query2 = from rel in db.User_Skill_REL
                                 join skill in db.Skills on rel.Skill_ID equals skill.Skill_ID
                                 where rel.User_ID == user
                                 select skill.Skill_Name;
                    string skillstring = "";
                    foreach (var v in query2)
                    {
                        tmpskills.Add(v);
                        skillstring += v;
                    }
                    var query3 = from rel in db.User_Tag_REL
                                 join tag in db.Tags on rel.Tag_ID equals tag.Tag_ID
                                 where rel.User_ID == user
                                 select tag.Tag_Name;
                    string tagstring = "";
                    foreach (var v in query3)
                    {
                        tmptags.Add(v);
                        tagstring += v;
                    }

                    var query4 = from u in db.Users
                                 join ud in db.User_Details on u.User_ID equals ud.User_ID
                                 where u.User_ID == user
                                 select new { u.User_ID, u.First_Name, u.Last_Name, ud.Available, ud.Available_Date /*, tagstring, skillstring*/ };
                    person p = new person
                    {
                        id = query4.First().User_ID,
                        first_name = query4.First().First_Name,
                        last_name = query4.First().Last_Name,
                        available = query4.First().Available,
                        date = query4.First().Available_Date,
                        tags = tmptags,
                        skills = tmpskills
                    };
                    gridlist.Add(p);
                }
                gridlist = gridlist.OrderByDescending(x => x.available)
                    .ThenBy(x => x.date)
                    .ThenBy(x => x.last_name)
                    .ThenBy(x => x.first_name)
                    .ToList();
                grid.ItemsSource = gridlist;
            }
        }
        protected void Save_Client_information()
        {
            decimal[] add1cord = new decimal[2];
            decimal[] add2cord = new decimal[2];

            clientperson.SetColumnDefaults();
            clientAddress.SetColumnDefaults();
            clientAddress2.SetColumnDefaults();
            client.SetColumnDefaults();

            clientperson.person_id = GlobalVariables.PersonID;
            clientperson.address_id = GlobalVariables.ClientAddressID;
            clientperson.address_id2 = GlobalVariables.ClientAddressID2;
            clientAddress.address_id = GlobalVariables.ClientAddressID;
            clientAddress2.address_id = GlobalVariables.ClientAddressID2;

            client.client_id = GlobalVariables.ClientID;
            client.Info_Field = null;

            clientperson.f_name = txt_F_Name.Text;
            clientperson.l_name = txt_L_Name.Text;
            clientperson.person_type = "C";
            clientperson.m_initial = txt_M_Initial.Text;
            clientperson.Maiden_Name = txt_Maiden_Name.Text;
            clientperson.gender = ddl_Gender.SelectedValue;
            clientperson.email = txt_email.Text;
            if (txt_SSN.Text != "")
            {
                clientperson.ssn = Convert.ToInt32(txt_SSN.Text);
            }
            clientperson.Driver_State_ID = txt_DrvLic.Text;
            if (txt_Birthdate.Text != "")
            {
                clientperson.birthdate = Convert.ToDateTime(txt_Birthdate.Text);
            }
            clientperson.phone_primary = txt_Phone_Primary.Text;
            clientperson.phone_secondary = txt_Phone_Secondary.Text;
            clientperson.Marital_Status = ddl_Marital_Status.SelectedValue.ToString();
            clientperson.Citizenship = ddl_CitizenShip.SelectedValue.ToString();
            Set_Visa_Type();
            if (TxtVisaIssDate.Text != "")
            {
                clientperson.Visa_Issue_Date = Convert.ToDateTime(TxtVisaIssDate.Text.ToString());
            }
            if (TxtVisaExpDate.Text != "")
            {
                clientperson.Visa_Expire_Date = Convert.ToDateTime(TxtVisaExpDate.Text.ToString());
            }
            if (TxtUSCISNum.Text != "")
            {
                clientperson.Perm_Resident_Alien_USCIS_number = Convert.ToInt32(TxtUSCISNum.Text);
            }
            if (TxtANumber.Text != "")
            {
                clientperson.Perm_Resident_Alien_A_number = Convert.ToInt32(TxtANumber.Text);
            }
            if (TxtresDate.Text != "")
            {
                clientperson.Perm_Resident_Alien_Resid_Date = Convert.ToDateTime(TxtresDate.Text);
            }
            if (TxtResExpDate.Text != "")
            {
                clientperson.Perm_Resident_Alien_Expire_Date = Convert.ToDateTime(TxtResExpDate.Text);
            }
            clientperson.Perm_Resident_Alien_Birth_Country = TxtCountryOfBirth.Text;
            clientperson.Perm_Resident_Alien_Category = TxtCategory.Text;

            clientAddress.address_type_id = 2;
            clientAddress.str_add = txtCurr_str_addr.Text;
            clientAddress.str_add2 = TxtCurr_str_addr2.Text;
            clientAddress.city = txtCurr_city.Text;
            clientAddress.state = ddlCurr_st.SelectedValue;
            clientAddress.zip_plus_four = txtCurr_zip.Text;
            clientAddress.country = TxtCurr_Country.Text;
            clientAddress.County_Township = TxtCurr_CountyTownship.Text;

            add1cord = GeoLocation.getCoordinates(clientAddress.str_add, clientAddress.str_add2, clientAddress.city, clientAddress.state, clientAddress.zip_plus_four, "DMCS");

            clientAddress.latitude = add1cord[0];
            clientAddress.longitude = add1cord[1];

            client.client_status = ddl_client_status.SelectedValue;

            if (clientAddress.address_id == 0)
            {
                clientAddress = clientAddress.Insert(clientAddress);
                clientperson.address_id = clientAddress.address_id;
            }
            else
            {
                clientAddress.Update(clientAddress);
            }

            if (txtPrev_city.Text != "" && TxtPrev_Country.Text != "" &&
               ddlPrev_st.SelectedValue != "" && txtPrev_str_addr.Text != "")
            {
                clientAddress2.address_type_id = 3;
                clientAddress2.str_add = txtPrev_str_addr.Text;
                clientAddress2.str_add2 = txtPrev_str_addr2.Text;
                clientAddress2.city = txtPrev_city.Text;
                clientAddress2.state = ddlPrev_st.SelectedValue;
                clientAddress2.zip_plus_four = txtPrev_zip.Text;
                clientAddress2.str_add2 = txtPrev_str_addr2.Text;
                clientAddress2.country = TxtPrev_Country.Text;
                clientAddress2.County_Township = TxtPrev_countyTownship.Text;

                add2cord = GeoLocation.getCoordinates(clientAddress2.str_add, clientAddress2.str_add2, clientAddress2.city, clientAddress2.state, clientAddress2.zip_plus_four, "DMCS");

                clientAddress2.latitude = add2cord[0];
                clientAddress2.longitude = add2cord[1];

                if (clientAddress2.address_id == 0)
                {
                    clientAddress2 = clientAddress2.Insert(clientAddress2);
                    clientperson.address_id2 = clientAddress2.address_id;
                }
                else
                {
                    clientAddress2.Update(clientAddress2);
                }

            }

            if (clientperson.person_id == 0)
            {
                clientperson = clientperson.Insert(clientperson);
            }
            else
            {
                clientperson.Update(clientperson);
            }

            if (client.client_id == 0)
            {
                client.client_id = clientperson.person_id;
                client = client.Insert(client);
            }
            else
            {
                client.Update(client);
            }
        }
        protected void gvClientSearchresult_SelectedIndexChanged(object sender, EventArgs e)
        {
            clientperson = clientperson.Select(Convert.ToInt32(gvClientSearchresult.SelectedDataKey.Value));
            GlobalVariables.PersonID = Convert.ToInt32(gvClientSearchresult.SelectedDataKey.Value);

            fill_Client_information();

            refreshcase();
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Creates a new row in the database
        /// </summary>
        /// <returns>Insert ID of the new row</returns>
        public override int New()
        {
            base.New();

            CurrentRow = new person()
            {
                created = DateTime.Now,
                company_id = Model.Company.ANONYMOUS,
                first_name = "???",
                last_name = "???",
                username = "******"+DateTime.Now.Ticks
            };

            CurrentConnection.persons.InsertOnSubmit(CurrentRow);
            CurrentConnection.SubmitChanges();
            return CurrentRow.id;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="PersonId"></param>
        /// <returns></returns>
        public override bool Load(int PersonId)
        {
            var q = from x in CurrentConnection.persons where x.id.Equals(PersonId) && x.deleted.Equals(0) select x;
            CurrentRow = q.FirstOrDefault();

            return true;
        }
Ejemplo n.º 22
0
        public static String Person(person person)
        {
            try
            {
                String personCSV = person.sourcedid[0].id + ",";
                if (person.userid != null && person.userid[0] != null)
                {
                    if (person.userid[0].Value != null)
                        personCSV += person.userid[0].Value + ",";
                    else
                        personCSV += " ,";
                    if (person.userid[1].Value != null)
                        personCSV += person.userid[1].Value + ",";
                    else
                        personCSV += " ,";

                }
                else
                    personCSV += " , ,";

                if (person.name != null)
                {
                    if (person.name.fn != null)
                        personCSV += person.name.fn + ",";
                    else
                        personCSV += " ,";
                    if (person.name.n != null)
                        if (person.name.n.given != null)
                            personCSV += person.name.n.given + ",";
                        else
                            personCSV += " ,";
                    else
                        personCSV += " ,";
                    if (person.name.n != null)
                        if (person.name.n.family != null)
                            personCSV += person.name.n.family + ",";
                        else
                            personCSV += " ,";
                    else
                        personCSV += " ,";
                }
                else
                    personCSV += " , , ,";
                if (person.email != null)
                    personCSV += person.email + ",";
                else
                    personCSV += " ,";
                if (person.tel != null)
                {
                    for (int i = 0; i < person.tel.Length; i++)
                    {
                        if (person.tel[i] != null)
                            if (person.tel[i].Value != null)
                                personCSV += person.tel[0].Value + ",";
                            else
                                personCSV += " ,";
                        else
                            personCSV += " ,";

                    }
                    personCSV += " ,";
                }
                else
                    personCSV += " ,";
                if (person.adr != null)
                {
                    if (person.adr.pcode != null)
                        personCSV += person.adr.pcode + ",";
                    else
                        personCSV += " ,";
                    if (person.adr.street != null)
                        personCSV += person.adr.street[0] + ",";
                    else
                        personCSV += " ,";
                    if (person.adr.locality != null)
                        personCSV += person.adr.locality + ",";
                    else
                        personCSV += " ,";
                }
                else
                    personCSV += " , , ,";
                if (person.demographics != null)
                {
                    if (person.demographics.bday != null)
                        personCSV += person.demographics.bday + ",";
                    else
                        personCSV += " ,";
                    if (person.demographics.gender != null)
                        personCSV += person.demographics.gender + ",";
                    else
                        personCSV += " ,";
                }
                else
                    personCSV += " , ,";
                if (person.institutionrole != null)
                    if (person.institutionrole[0] != null)
                        personCSV += person.institutionrole[0].institutionroletype.ToString() + ",";
                    else
                        personCSV += " ,";
                else
                    personCSV += " ,";
                if (person.systemrole != null)
                    personCSV += person.systemrole.systemroletype.ToString();
                else
                    personCSV += " ,";

                if (person.extension.altadr != null)
                {
                    personCSV += person.extension.altadr.extadd + ",";
                    personCSV += person.extension.altadr.locality + ",";
                    personCSV += person.extension.altadr.pcode + ",";
                    personCSV += person.extension.altadr.street + ",";
                }
                else
                    personCSV += " , , , ,";

                if (person.extension.emailwork != null)
                {
                    personCSV += person.extension.emailwork + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.employmentend != null)
                {
                    personCSV += person.extension.employmentend + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.employmentstart != null)
                {
                    personCSV += person.extension.employmentstart + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.municipalitycode != null)
                {
                    personCSV += person.extension.municipalitycode + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.municipalityname != null)
                {
                    personCSV += person.extension.municipalityname + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.nativelanguage != null)
                {
                    personCSV += person.extension.nativelanguage + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.geographickeycode != null)
                {
                    personCSV += person.extension.geographickeycode + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.privacy != null)
                {
                    personCSV += person.extension.privacy + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.programcode != null)
                {
                    personCSV += person.extension.programcode + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.schoolunitcode != null)
                {
                    personCSV += person.extension.schoolunitcode + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.signature != null)
                {
                    personCSV += person.extension.signature + ",";
                }
                else
                    personCSV += " ,";

                if (person.extension.timestamp != null)
                {
                    personCSV += person.extension.timestamp + ",";
                }
                else
                    personCSV += " ,";

                return personCSV + "\r\n";
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public person(person p)
 {
     this.age  = p.age;
     this.name = p.name;
 }
        //update the pet records -- update btn
        protected void update(object sender, EventArgs e)
        {
            if (Update_GVcases.SelectedValue == null)
            {
                Update_lbl_pet_Error.Text = "You must first select a case to continue";
                return;
            }
            else if (Update_gvClientSearchresult.SelectedValue == null)
            {
                Update_lbl_pet_Error.Text = "You must first select a client to continue";
                return;
            }
            if (Update_DDL_Call_Center.SelectedValue == "-1")
            {
                Update_lbl_pet_Error.Text = "Please a call center to contuinue.";
                return;
            }
            else if (Update_DDlDisasters.SelectedValue == "-1")
            {
                Update_lbl_pet_Error.Text = "Please a disaster to contuinue.";
                return;
            }
            else
            {

                person = person.Select(Convert.ToInt32(Update_gvClientSearchresult.SelectedDataKey.Value));
                client = client.Select(Convert.ToInt32(Update_gvClientSearchresult.SelectedDataKey.Value));

                //PetType exchange
                Pet_Type.Pet_Type_ID = GlobalVariables.Pet_Type_ID;

                Pet_Type.Pet_Type = Update_petType_ddl.SelectedValue;
                Pet_Type.Pet_Breed = Update_petBreed_txt.Text;
                Pet_Type.Pet_Species = Update_petSpecies_ddl.SelectedValue;

                //Pet exchange
                pet.Pet_Record_ID = Convert.ToInt32(Update_gvPetSearchresult.SelectedDataKey.Value);
                pet.Pet_Type_ID = GlobalVariables.Pet_Type_ID;

                pet.Pet_Name = Update_petName_txt.Text;
                pet.Pet_Location_Found_ID = 1;
                if (Update_petDateOfBirth_txt.Text != "") { pet.Pet_Date_Of_Birth = Convert.ToDateTime(Update_petDateOfBirth_txt.Text); }
                pet.Pet_RFID = Update_petRFID_txt.Text;
                pet.Date_Modified = DateTime.Now;
                pet.Date_Created = DateTime.Now;
                pet.Pet_Description = Update_petDiscription_txt.Text;
                pet.Pet_Gender = Convert.ToString(Update_petGender_DDL.SelectedValue);
                pet.Pet_Color = Update_petColor_txt.Text;
                pet.Pet_Vet_ID = Update_petVetID_txt.Text;
                pet.Pet_License_Tag = Update_petLicenseTag_txt.Text;
                pet.Pet_Tatoo_No = Update_petTatooNumber_txt.Text;
                pet.Pet_Sterilized = Convert.ToString(Update_petNeutered_DDL.SelectedValue);
                pet.Pet_Weight = Convert.ToInt32(Update_petWeight_txt.Text);
                pet.Pet_Condition = Update_petConditionID_ddl.SelectedValue;
                pet.Pet_Status = Update_petStatusID_txt.Text;

                if (Update_Image_Name.Text != "")
                {
                    //=========
                    //Save Image to server then DB Object
                    string fileName = Update_gvPetSearchresult.SelectedDataKey.Value + "_" + Update_petName_txt.Text + ".jpg";
                    string smallPath = Server.MapPath("Pet_Images/100x100/" + fileName);
                    string mediumPath = Server.MapPath("Pet_Images/200x200/" + fileName);
                    string originalPath = Server.MapPath("Pet_Images/Original/" + fileName);
                    string originalTempPath = Server.MapPath("Pet_Images/Original/" + Update_Image_Name.Text);

                    //create clone image to re-size
                    System.Drawing.Image small_pet_picture = System.Drawing.Image.FromFile(originalTempPath);
                    //resize
                    small_pet_picture = resizeImage(small_pet_picture, new Size(100, 100));
                    //Convert back to byte[] array
                    byte[] small_pet_picture_bytes = imageToByteArray(small_pet_picture);

                    //create clone image to re-size
                    System.Drawing.Image medium_pet_picture = System.Drawing.Image.FromFile(originalTempPath);
                    //resize
                    medium_pet_picture = resizeImage(medium_pet_picture, new Size(200, 200));
                    //Convert back to byte[] array
                    byte[] medium_pet_picture_bytes = imageToByteArray(medium_pet_picture);

                    //create clone image to re-size
                    System.Drawing.Image original_pet_picture = System.Drawing.Image.FromFile(originalTempPath);
                    //Convert to byte[] array
                    byte[] original_pet_picture_bytes = imageToByteArray(original_pet_picture);

                    //save resized images
                    File.WriteAllBytes(@smallPath, small_pet_picture_bytes);
                    File.WriteAllBytes(@mediumPath, medium_pet_picture_bytes);
                    File.WriteAllBytes(@originalPath, original_pet_picture_bytes);
                    //save to database
                    pet.Pet_Picture = imageToByteArray(System.Drawing.Image.FromFile(originalPath));
                }
                else
                {
                    pet.Pet_Picture = new byte[0];
                }

                //ClientWPets
                ClientWPets.CLIENTWPETS_ID = GlobalVariables.CLIENTWPETS_ID;
                ClientWPets.Pet_Record_ID = pet.Pet_Record_ID;
                ClientWPets.Client_id = client.client_id;
                ClientWPets.Location_ID = GlobalVariables.Location_ID;
                ClientWPets.cp_Date = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
                ClientWPets.ownership = Convert.ToString("y");

                //Location
                Location.Location_ID = GlobalVariables.Location_ID;
                Location.type = decideLocationType();
                Location.city = Update_city_txt.Text;
                Location.state = Update_state_txt.Text;
                Location.zip = Convert.ToInt32(Update_zip_txt.Text);
                Location.county = Update_county_txt.Text;
                Location.location_desc = Update_LocationDiscription_txt.Text;
                Location.n_long = Convert.ToDecimal(Update_long_txt.Text);
                Location.s_long = 0;
                Location.e_long = 0;
                Location.w_long = 0;
                Location.n_lat = Convert.ToDecimal(Update_lat_txt.Text);
                Location.s_lat = 0;
                Location.e_lat = 0;
                Location.w_lat = 0;

                //update

                if (Pet_Deceased.Pet_Deceased_ID == 0 && Update_deceasedYes.Checked == true)
                {
                    if (Update_DateDeceased_txt.Text == "" || Update_serviceType_DDL.SelectedValue == "-1")
                    {
                        Update_lbl_pet_Error.Text = "Please fill out The Date Found and or Service Type.";
                    }
                    else
                    {
                        //Pet_Deceased exchange
                        Pet_Deceased.Pet_Deceased_ID = pet.Pet_Record_ID;
                        Pet_Deceased.Date_Deceased = Convert.ToDateTime(Update_DateDeceased_txt.Text);
                        Pet_Deceased.Funeral = Update_funeral_txt.Text;
                        Pet_Deceased.Cemetary_Name = Update_cemetaryName_txt.Text;
                        Pet_Deceased.Deceased_Type = Update_serviceType_DDL.SelectedValue;
                        Pet_Deceased.Date_Modified = DateTime.Now;
                        Pet_Deceased.Date_Created = DateTime.Now;
                        Pet_Deceased.Location_ID = Location.Location_ID;
                        Pet_Deceased = Pet_Deceased.Insert(Pet_Deceased);
                    }
                }
                if (GlobalVariables.Pet_Deceased_ID != 0 && Update_deceasedYes.Checked == true)
                {
                    if (Update_DateDeceased_txt.Text == "" || Update_serviceType_DDL.SelectedValue == "")
                    {
                        Update_lbl_pet_Error.Text = "Please fill out The Date Found and or Service Type.";
                    }
                    else
                    {
                        //Pet_Deceased exchange
                        Pet_Deceased.Pet_Deceased_ID = pet.Pet_Record_ID;
                        Pet_Deceased.Date_Deceased = Convert.ToDateTime(Update_DateDeceased_txt.Text);
                        Pet_Deceased.Funeral = Update_funeral_txt.Text;
                        Pet_Deceased.Cemetary_Name = Update_cemetaryName_txt.Text;
                        Pet_Deceased.Deceased_Type = Update_serviceType_DDL.SelectedValue;
                        Pet_Deceased.Location_ID = Location.Location_ID;
                        //Pet_Deceased.Date_Created == null
                        Pet_Deceased.Date_Modified = DateTime.Now;

                        Pet_Deceased.Update(Pet_Deceased);
                    }
                }
                if (GlobalVariables.Pet_Missing_ID == 0 && Update_missingYes.Checked == true)
                {
                    //Pet_Missing exchange
                    Pet_Missing.Pet_Missing_ID = pet.Pet_Record_ID;
                    Pet_Missing.Last_Known_Location_ID = Location.Location_ID;
                    Pet_Missing.Date_Reported = DateTime.Now;
                    Pet_Missing.Date_Created = DateTime.Now;
                    Pet_Missing.Date_Missing = Convert.ToDateTime(Update_DateMissing_txt.Text);
                    Pet_Missing.Time_Lost = Convert.ToDateTime(Update_TimeLost_txt.Text);
                    Pet_Missing.Collar_Description = Update_collarDescription_txt.Text;
                    Pet_Missing.Lost_Explanation = Update_lostExplanation_txt.Text;
                    if (Update_LengthOwned_txt.Text != "") { Pet_Missing.Length_Owned = Convert.ToInt32(Update_LengthOwned_txt.Text); }
                    if (Update_RewardAmt_txt.Text != "") { Pet_Missing.Reward_Amt = Convert.ToDecimal(Update_RewardAmt_txt.Text); }
                    Pet_Missing.Breeder = Update_Breeder_txt.Text;
                    Pet_Missing.Date_Modified = DateTime.Now;

                    Pet_Missing = Pet_Missing.Insert(Pet_Missing);
                }
                if (GlobalVariables.Pet_Missing_ID != 0 && Update_missingYes.Checked == true)
                {
                    //Pet_Missing exchange
                    Pet_Missing.Pet_Missing_ID = pet.Pet_Record_ID;
                    Pet_Missing.Last_Known_Location_ID = Location.Location_ID;
                    Pet_Missing.Date_Reported = DateTime.Now;
                    Pet_Missing.Date_Created = DateTime.Now;
                    Pet_Missing.Date_Missing = Convert.ToDateTime(Update_DateMissing_txt.Text);
                    Pet_Missing.Time_Lost = Convert.ToDateTime(Update_TimeLost_txt.Text);
                    Pet_Missing.Collar_Description = Update_collarDescription_txt.Text;
                    Pet_Missing.Lost_Explanation = Update_lostExplanation_txt.Text;
                    if (Update_LengthOwned_txt.Text != "") { Pet_Missing.Length_Owned = Convert.ToInt32(Update_LengthOwned_txt.Text); }
                    if (Update_RewardAmt_txt.Text != "") { Pet_Missing.Reward_Amt = Convert.ToDecimal(Update_RewardAmt_txt.Text); }
                    Pet_Missing.Breeder = Update_Breeder_txt.Text;
                    Pet_Missing.Date_Modified = DateTime.Now;
                    Pet_Missing.Update(Pet_Missing);
                }

                pet.Update(pet);
                Pet_Type.Update(Pet_Type);
                Location.Update(Location);
                ClientWPets.Update(ClientWPets);

                ////////////////////////////////////////
                encounter.case_id = GlobalVariables.CaseID;
                encounter.agency_id = 0;
                encounter.call_center_id = Convert.ToInt32(Update_DDL_Call_Center.SelectedValue);
                encounter.client_id = GlobalVariables.ClientID;
                encounter.create_date = DateTime.Now;
                if (GlobalVariables.Pet_Deceased_ID != null || GlobalVariables.Pet_Deceased_ID != 0)
                {
                    encounter.close_date = DateTime.Now;
                }
                else
                {
                    encounter.close_date = Convert.ToDateTime("9/9/9");
                }

                encounter.disaster_id = Convert.ToInt32(Update_DDlDisasters.SelectedValue);
                encounter.Location_ID = Location.Location_ID;
                encounter.Pet_Record_ID = pet.Pet_Record_ID;

                encounter.Insert(encounter);

                Update_lbl_pet_Error.Text = "The selected pets informatin has been successfully updated.";
            }
        }
Ejemplo n.º 25
0
 public person Update(person updatePerson)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 26
0
        public NewPersonForm(person editPerson = null)
        {
            InitializeComponent();
            this.TopMost = true;
            this.TopLevel = true;
            if (editPerson == null)
            {
                this.edit = false;
                this.Text = "Create New Person";
                systemRoleTypeBox.SelectedItem = "None";

                sourceIdCurrLabel.Hide();
                //addSourceIdLabel.Hide();
                //addSourceIdInput.Hide();


                bdayPicker.Width = 90;
                this.lastDigitInput = new TextBox();
                this.lastDigitInput.Width = 45;
                this.lastDigitInput.TabIndex = 13;
                this.lastDigitInput.Location = new Point(bdayPicker.Width + 1 + bdayPicker.Left, bdayPicker.Top);
                this.Controls.Add(this.lastDigitInput);

                bdayLabel.Text = "*Social security number:";
                bdayLabel.Left -= 92; 
            }
            else
            {
                this.edit = true;

                this.newEditPerson = editPerson;

                this.Text = "Edit " + editPerson.name.fn;
                createEditButton.Text = "Save";

                sourceIdCurrLabel.Text = editPerson.sourcedid[0].id;
                if (editPerson.sourcedid.ToList().Count == 2)
                    sourceIdOldLabel.Text = editPerson.sourcedid[1].id;


                fnInput.Text = editPerson.name.n.given;
                lnInput.Text = editPerson.name.n.family;

                bdayPicker.Text = editPerson.demographics.bday;
                genderBox.SelectedItem = editPerson.demographics.gender;

                emailInput.Text = editPerson.email;
                hNumberInput.Text = editPerson.tel[0].Value;
                mNumberInput.Text = editPerson.tel[1].Value;

                postcodeInput.Text = editPerson.adr.pcode;
                streetInput.Text = editPerson.adr.street[0];
                localityInput.Text = editPerson.adr.locality;

                institutionTypeBox.SelectedItem = editPerson.institutionrole[0].institutionroletype.ToString();
                institutionPrimaryBox.SelectedItem = editPerson.institutionrole[0].primaryrole.ToString();

                systemRoleTypeBox.SelectedItem = editPerson.systemrole.systemroletype.ToString();
                if (editPerson.userid != null)
                {
                    if (editPerson.userid[0].Value != null)
                        userIdInput.Text = editPerson.userid[0].Value;
                    if (editPerson.userid[0].useridtype != null)
                        userIdTypeBox.SelectedItem = editPerson.userid[0].useridtype;
                }
            }
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            bdayPicker.CustomFormat = "";
        }
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     person = Insert_person_select(Convert.ToInt32(Insert_person_GridView.SelectedValue));
 }
Ejemplo n.º 28
0
 public Task <person> updatePerson(person Person)
 {
     return(_PersonRepository.updatePerson(Person));
 }
Ejemplo n.º 29
0
        private void getDataTwo()
        {
            try
            {
                JObject data;
                movie   tempMovie;
                person  tempPerson;

                url  = "http://www.omdbapi.com/?i=";
                url += textBox1.Text;

                tempMovie  = new movie();
                tempPerson = new person();

                WebRequest      request  = WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream       dataStream = response.GetResponseStream();
                StreamReader reader     = new StreamReader(dataStream);

                data = JObject.Parse(reader.ReadToEnd());

                string[] dateTemp = Convert.ToString(data["Released"]).Split(' ');

                int tempMonth = (int)Enum.Parse(typeof(months), dateTemp[1]);

                DateTime date = new DateTime(Convert.ToInt32(dateTemp[2]), tempMonth, Convert.ToInt32(dateTemp[0]));

                tempMovie.title        = ((string)data["Title"]).ToLower();
                tempMovie.release_date = date;
                tempMovie.description  = (string)data["Plot"];

                bool c = dbMovie.addMovie(tempMovie);

                textBox2.Text = c.ToString();

                if (c == true)
                {
                    cast tempCast = new cast();
                    tempCast.movie_id = tempMovie.id;

                    char[] separator = { ' ' };

                    tempMovie.id = (dbMovie.getMovieByTitle(tempMovie.title)).id;

                    string[] Actors    = Convert.ToString(data["Actors"]).Split(',');
                    string[] Writers   = Convert.ToString(data["Writer"]).Split(',');
                    string[] Directors = Convert.ToString(data["Director"]).Split(',');

                    for (int i = 0; i < Actors.Length; i++)
                    {
                        Actors[i] = Actors[i].Trim();
                    }

                    for (int i = 0; i < Writers.Length; i++)
                    {
                        Writers[i] = Writers[i].Trim();
                    }

                    for (int i = 0; i < Directors.Length; i++)
                    {
                        Directors[i] = Directors[i].Trim();
                    }

                    foreach (string a in Actors)
                    {
                        tempPerson.name = a.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string d in Directors)
                    {
                        tempPerson.name = d.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string w in Writers)
                    {
                        string[] tempName = w.ToLower()
                                            .Split('(');

                        tempPerson.name = tempName[0];
                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string a2 in Actors)
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(a2)).id;
                        tempCast.role      = 2;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string d2 in Directors)
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(d2)).id;
                        tempCast.role      = 1;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string w2 in Writers)
                    {
                        string[] tempName = w2.ToLower()
                                            .Split('(');
                        tempCast.person_id = (dbPerson.getPersonByName(tempName[0])).id;
                        tempCast.role      = 3;
                        dbPerson.addRole(tempCast);
                    }

                    dataStream.Close();
                    reader.Close();
                    response.Close();

                    textBox1.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public person person_insert()
        {
            person.Resource_ID = 0;
            person.address_id = address.address_id;
            person.address_id2 = 0;
            person.f_name = Insert_f_name_txt.Text;
            person.m_initial = Insert_m_initial_txt.Text;
            person.l_name = Insert_l_name_txt.Text;
            person.certification_number = "HI!";
            person.gender = Insert_gender_ddl.SelectedValue;
            person.person_type = "C";
            person.phone_primary = Insert_phone_primary_txt.Text;
            person.ssn = Convert.ToInt32(Insert_ssn_txt.Text);
            person.birthdate = Convert.ToDateTime("1 / 1 / 1900");
            person.phone_secondary = "";
            person.email = "";
            person.ssn = 0;
            person.Maiden_Name = "";
            person.Visa_Issue_Date = Convert.ToDateTime("1 / 1 / 1900");
            person.Visa_Expire_Date = Convert.ToDateTime("1 / 1 / 1900");
            person.Visa_Selected_Value_B1 = 0;
            person.Visa_Selected_Value_B2 = 0;
            person.Visa_Selected_Value_K1 = 0;
            person.Visa_Selected_Value_K3 = 0;
            person.Visa_Selected_Value_L1 = 0;
            person.Visa_Selected_Value_L2 = 0;
            person.Visa_Selected_Value_H4 = 0;
            person.Visa_Selected_Value_F1 = 0;
            person.Visa_Selected_Value_J1 = 0;
            person.Visa_Selected_Value_M1 = 0;
            person.Visa_Selected_Value_H_1B = 0;
            person.Visa_Selected_Value_H_2B = 0;
            person.Visa_Selected_Value_B_2 = 0;
            person.Visa_Selected_Value_Schengen = 0;
            person.Perm_Resident_Alien_Resid_Date = Convert.ToDateTime("1 / 1 / 1900");
            person.Perm_Resident_Alien_Expire_Date = Convert.ToDateTime("1 / 1 / 1900");
            person.Perm_Resident_Alien_A_number = 0;
            person.Perm_Resident_Alien_USCIS_number = 0;
            person.Perm_Resident_Alien_Birth_Country = "";
            person.Perm_Resident_Alien_Category = "";
            person.Driver_State_ID = "";
            person.Citizenship = "";
            person.Marital_Status = "";
            person.Minor_Children = 0;

            person = person.Insert(person);
            ////Insert_gvClientSearchresult.DataBind();
            return person;
        }
Ejemplo n.º 31
0
        private void createEditButton_Click(object sender, EventArgs e)
        {
            if (this.lastDigitInput != null) //create
            {
                this.newEditPerson = new person();
                // System Role
                newEditPerson.sourcedid[0].id = this.lastDigitInput.Text;
                // check what system role is chosen
                if ((String)systemRoleTypeBox.SelectedItem == "None")
                    newEditPerson.systemrole.systemroletype = systemroleSystemroletype.None;
                else if ((String)systemRoleTypeBox.SelectedItem == "User")
                    newEditPerson.systemrole.systemroletype = systemroleSystemroletype.User;
                else if ((String)systemRoleTypeBox.SelectedItem == "User")
                    newEditPerson.systemrole.systemroletype = systemroleSystemroletype.SysAdmin;
                // Name
                newEditPerson.name.n.family = lnInput.Text;
                newEditPerson.name.n.given = fnInput.Text;
                newEditPerson.name.fn = fnInput.Text + " " + lnInput.Text;
                //Contact info
                newEditPerson.email = emailInput.Text;
                newEditPerson.tel[0].teltype = telTeltype.Item1;
                newEditPerson.tel[0].Value = hNumberInput.Text;
                newEditPerson.tel[1].teltype = telTeltype.Mobile;
                newEditPerson.tel[1].Value = mNumberInput.Text;
                newEditPerson.tel[2].teltype = telTeltype.Item2;
                newEditPerson.tel[2].Value = workNumberInput.Text;
                // Address info
                newEditPerson.adr.pcode = postcodeInput.Text;
                newEditPerson.adr.street[0] = streetInput.Text;
                newEditPerson.adr.locality = localityInput.Text;
                // Demographics
                newEditPerson.demographics.bday = bdayPicker.Text;
                newEditPerson.demographics.gender = genderBox.SelectedItem.ToString();
                // Institution role
                if ((String)institutionTypeBox.SelectedItem == "Student")
                    newEditPerson.institutionrole[0].institutionroletype = institutionroleInstitutionroletype.Student;
                else if ((String)institutionTypeBox.SelectedItem == "Staff")
                    newEditPerson.institutionrole[0].institutionroletype = institutionroleInstitutionroletype.Student;
                else if ((String)institutionTypeBox.SelectedItem == "Contact")
                    newEditPerson.institutionrole[0].institutionroletype = institutionroleInstitutionroletype.Contact;
                else if ((String)institutionTypeBox.SelectedItem == "Child")
                    newEditPerson.institutionrole[0].institutionroletype = institutionroleInstitutionroletype.Other;

                if ((String)institutionPrimaryBox.SelectedValue == "No")
                    newEditPerson.institutionrole[0].primaryrole = institutionrolePrimaryrole.No;
                else
                    newEditPerson.institutionrole[0].primaryrole = institutionrolePrimaryrole.Yes;
            }
            else // edit
            {
                // System Role
               
                // check what system role is chosen
                if ((String)systemRoleTypeBox.SelectedItem == "None")
                    newEditPerson.systemrole.systemroletype = systemroleSystemroletype.None;
                else if ((String)systemRoleTypeBox.SelectedItem == "User")
                    newEditPerson.systemrole.systemroletype = systemroleSystemroletype.User;
                else if ((String)systemRoleTypeBox.SelectedItem == "Administrator")
                    newEditPerson.systemrole.systemroletype = systemroleSystemroletype.SysAdmin;
                // Name
                newEditPerson.name.n.family = lnInput.Text;
                newEditPerson.name.n.given = fnInput.Text;
                newEditPerson.name.fn = fnInput.Text + " " + lnInput.Text;
                //Contact info
                newEditPerson.email = emailInput.Text;
                newEditPerson.tel[0].teltype = telTeltype.Item1;
                newEditPerson.tel[0].Value = hNumberInput.Text;
                if(newEditPerson.tel.Length >= 2)
                {
                    newEditPerson.tel[1].teltype = telTeltype.Mobile;
                    newEditPerson.tel[1].Value = mNumberInput.Text;
                }
                if (newEditPerson.tel.Length >= 3)
                {
                    newEditPerson.tel[2].teltype = telTeltype.Item2;
                    newEditPerson.tel[2].Value = workNumberInput.Text;
                }
                // Address info
                newEditPerson.adr.pcode = postcodeInput.Text;
                newEditPerson.adr.street[0] = streetInput.Text;
                newEditPerson.adr.locality = localityInput.Text;
                // Demographics
                newEditPerson.demographics.bday = bdayPicker.Text;
                newEditPerson.demographics.gender = genderBox.SelectedItem.ToString();
                // Institution role
                if ((String)institutionTypeBox.SelectedItem == "Student")
                    newEditPerson.institutionrole[0].institutionroletype = institutionroleInstitutionroletype.Student;
                else if ((String)institutionTypeBox.SelectedItem == "Staff")
                    newEditPerson.institutionrole[0].institutionroletype = institutionroleInstitutionroletype.Staff;
                else if ((String)institutionTypeBox.SelectedItem == "Contact")
                    newEditPerson.institutionrole[0].institutionroletype = institutionroleInstitutionroletype.Contact;
                else if ((String)institutionTypeBox.SelectedItem == "Child")
                    newEditPerson.institutionrole[0].institutionroletype = institutionroleInstitutionroletype.Other;

                if ((String)institutionPrimaryBox.SelectedItem == "No")
                    newEditPerson.institutionrole[0].primaryrole = institutionrolePrimaryrole.No;
                else
                    newEditPerson.institutionrole[0].primaryrole = institutionrolePrimaryrole.Yes;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();

        }
Ejemplo n.º 32
0
        static void Main(string[] args)
        {
            double averageage;
            person.sumofallages = 0;
            //string spousename;
            person p1 = new person();
            p1.spouse = new person();
            bool ans;

            System.Console.WriteLine("           (Enter information for p1 )");
            System.Console.WriteLine("First name? ");
            p1.firstname = System.Console.ReadLine();
            System.Console.WriteLine("Last name? ");
            p1.lastname = System.Console.ReadLine();
            System.Console.WriteLine("Age? ");
            p1.age = int.Parse(System.Console.ReadLine());
            System.Console.WriteLine("what is ur marrital status : married?");
            ans = bool.Parse(System.Console.ReadLine());
            if (ans == true)
            {
                System.Console.WriteLine("spouse First name? ");
                p1.spouse.firstname = System.Console.ReadLine();
                System.Console.WriteLine("spouse Age? ");
                p1.spouse.age = int.Parse(System.Console.ReadLine());
                p1.spousename = p1.spouse.firstname + " " + p1.lastname;
                    
            }
            else
            { p1.spousename = "no spouse";

            }

            person p2 = new person();
            p2.spouse = new person();
            System.Console.WriteLine("           (Enter information for p2)");
            System.Console.WriteLine("First name? ");
            p2.firstname = System.Console.ReadLine();
            System.Console.WriteLine("Last name? ");
            p2.lastname = System.Console.ReadLine();
            System.Console.WriteLine("enter ur age");
            p2.age = int.Parse(System.Console.ReadLine());
            System.Console.WriteLine("what is ur marrital status : married?");
            ans = bool.Parse(System.Console.ReadLine());
            if (ans == true)
            {
                System.Console.WriteLine("spouse First name? ");
                p2.spouse.firstname = System.Console.ReadLine();
                System.Console.WriteLine("spouse Age? ");
                p2.spouse.age = int.Parse(System.Console.ReadLine());
                p2.spousename = p2.spouse.firstname + " " + p2.lastname;
            }
            else
            {
                p2.spousename = "no spouse";

            }
          
            person.sumofallages =p1.age+p1.spouse.age+p2.age+p2.spouse.age;

            averageage = person.sumofallages / 4;


            System.Console.WriteLine("           ( Print persons and spouse's name and age)"+"\n");
            p1.printNameandAge();
            p2.printNameandAge();
            System.Console.WriteLine("total age is:  "+person.sumofallages);
            System.Console.WriteLine("average age is:  " + averageage);
            System.Console.WriteLine("press any key to continue");
            System.Console.ReadKey();
        }
Ejemplo n.º 33
0
 private String getGUID(person person)
 {
     foreach (userid uid in person.userid)
     {
         if (uid.useridtype == "GUID")
         {
             return uid.Value;
         }
     }
     return "";
 }
Ejemplo n.º 34
0
        /// <summary>
        /// Converts this instance of <see cref="personDto"/> to an instance of <see cref="person"/>.
        /// </summary>
        /// <param name="dto"><see cref="personDto"/> to convert.</param>
        public static person ToEntity(this personDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new person();

            entity.v_PersonId           = dto.v_PersonId;
            entity.v_FirstName          = dto.v_FirstName;
            entity.v_FirstLastName      = dto.v_FirstLastName;
            entity.v_SecondLastName     = dto.v_SecondLastName;
            entity.i_DocTypeId          = dto.i_DocTypeId;
            entity.v_DocNumber          = dto.v_DocNumber;
            entity.d_Birthdate          = dto.d_Birthdate;
            entity.v_BirthPlace         = dto.v_BirthPlace;
            entity.i_SexTypeId          = dto.i_SexTypeId;
            entity.i_MaritalStatusId    = dto.i_MaritalStatusId;
            entity.i_LevelOfId          = dto.i_LevelOfId;
            entity.v_TelephoneNumber    = dto.v_TelephoneNumber;
            entity.v_AdressLocation     = dto.v_AdressLocation;
            entity.v_GeografyLocationId = dto.v_GeografyLocationId;
            entity.v_ContactName        = dto.v_ContactName;
            entity.v_EmergencyPhone     = dto.v_EmergencyPhone;
            entity.b_PersonImage        = dto.b_PersonImage;
            entity.v_Mail                     = dto.v_Mail;
            entity.i_BloodGroupId             = dto.i_BloodGroupId;
            entity.i_BloodFactorId            = dto.i_BloodFactorId;
            entity.b_FingerPrintTemplate      = dto.b_FingerPrintTemplate;
            entity.b_RubricImage              = dto.b_RubricImage;
            entity.b_FingerPrintImage         = dto.b_FingerPrintImage;
            entity.t_RubricImageText          = dto.t_RubricImageText;
            entity.v_CurrentOccupation        = dto.v_CurrentOccupation;
            entity.i_DepartmentId             = dto.i_DepartmentId;
            entity.i_ProvinceId               = dto.i_ProvinceId;
            entity.i_DistrictId               = dto.i_DistrictId;
            entity.i_ResidenceInWorkplaceId   = dto.i_ResidenceInWorkplaceId;
            entity.v_ResidenceTimeInWorkplace = dto.v_ResidenceTimeInWorkplace;
            entity.i_TypeOfInsuranceId        = dto.i_TypeOfInsuranceId;
            entity.i_NumberLivingChildren     = dto.i_NumberLivingChildren;
            entity.i_NumberDependentChildren  = dto.i_NumberDependentChildren;
            entity.i_OccupationTypeId         = dto.i_OccupationTypeId;
            entity.v_OwnerName                = dto.v_OwnerName;
            entity.i_NumberLiveChildren       = dto.i_NumberLiveChildren;
            entity.i_NumberDeadChildren       = dto.i_NumberDeadChildren;
            entity.i_IsDeleted                = dto.i_IsDeleted;
            entity.i_InsertUserId             = dto.i_InsertUserId;
            entity.d_InsertDate               = dto.d_InsertDate;
            entity.i_UpdateUserId             = dto.i_UpdateUserId;
            entity.d_UpdateDate               = dto.d_UpdateDate;
            entity.i_InsertNodeId             = dto.i_InsertNodeId;
            entity.i_UpdateNodeId             = dto.i_UpdateNodeId;
            entity.i_Relationship             = dto.i_Relationship;
            entity.v_ExploitedMineral         = dto.v_ExploitedMineral;
            entity.i_AltitudeWorkId           = dto.i_AltitudeWorkId;
            entity.i_PlaceWorkId              = dto.i_PlaceWorkId;

            dto.OnEntity(entity);

            return(entity);
        }
Ejemplo n.º 35
0
 public Task <person> createPerson(person Person)
 {
     return(_PersonRepository.createPerson(Person));
 }
Ejemplo n.º 36
0
        bool search(person p)
        {
            phbContext phb = new phbContext();

            return(phb.persons.Any(i => i.fullName.Contains(p.fullName)));
        }
 public MemberRegistrationViewModel(List <organization> organizations)
 {
     this.organizations = organizations;
     person             = new person();
     connection         = new connection();
 }
Ejemplo n.º 38
0
 public bool Exist(person p)
 {
     return(db1.persons.Any(i => i.fullName == p.fullName));
 }
 public person person_update(int ID)
 {
     person = person.Select(ID);
     //person.person_id = Convert.ToInt32(Update_gvClientSearchresult.SelectedValue);
     person.f_name = Update_f_name_txt.Text;
     person.m_initial = Update_m_initial_txt.Text;
     person.l_name = Update_l_name_txt.Text;
     person.gender = Update_gender_ddl.SelectedValue;
     person.person_type = "C";
     person.phone_primary = Update_phone_primary_txt.Text;
     person.ssn = Convert.ToInt32(Update_ssn_txt.Text);
     person.Minor_Children = -1;
     person.Update(person);
     //Update_gvClientSearchresult.DataBind();
     return person;
 }
Ejemplo n.º 40
0
 RecordData(person, personalModeChoices);
 //UPDATE
 protected void update_Click(object sender, EventArgs e)
 {
     try
     {
         //check to see if a insert is needed for deceased
         person = person.Select(Convert.ToInt32(Update_gvClientSearchresult.SelectedValue));
         client = client.Select(person.person_id);
         if (Update_deceasedYes.Checked == true)
         {
             person = person_update(Convert.ToInt32(Update_gvClientSearchresult.SelectedValue));
             missing = missing_update(person.person_id);
             //check if update of insert of deceased
             deceased = deceased.Select(client.client_id);
             if (deceased.deceased_id == 0) { deceased = deceased_insert_For_Update(); }
             else { deceased = deceased_update(person.person_id); }
         }
         else
         {
             person = person_update(Convert.ToInt32(Update_gvClientSearchresult.SelectedValue));
             missing = missing_update(person.person_id);
         }
         address = address_update(person.address_id);
         client = client_update(person.person_id);
         encounter = encounter_insert();
         Update_refreshclient();
     }
     catch { Update_lbl_Client_Error.Text = "There has been an error updating information for the missing client."; }
     finally { Update_lbl_Client_Error.Text = "The missing client's information has been successfully updated."; }
 }
Ejemplo n.º 42
0
        public void UpdatePerson(person objPerson)
        {
            IPersonRepository repo = new PersonRepository();

            repo.UpdatePerson(objPerson);
        }
Ejemplo n.º 43
0
 private void button1_Click(object sender, EventArgs e)
 {
     // How do I create a new instance of person using these variables
     this.Person = new Person();
     //set properties
 }
Ejemplo n.º 44
0
 public OrderDAL(int company, int totalPrice, int pickupBranch, int returnBranch, DateTime pickupDate, DateTime returnDate, int carId, List <Extention> extetions, searchBLL search, person person, creaditCardBLL creaditCard, string notes)
 {
     Company         = company;
     this.totalPrice = totalPrice;
     PickupBranch    = pickupBranch;
     ReturnBranch    = returnBranch;
     PickupDate      = GetDate(pickupDate);
     ReturnDate      = GetDate(returnDate);
     CarId           = carId;
     this.extetions  = extetions;
     Search          = search;
     this.person     = person;
     this.CreditCard = creaditCard;
     this.notes      = notes;
 }
Ejemplo n.º 45
0
 private static String getPID(person person)
 {
     try
     {
         foreach (userid uid in person.userid)
         {
             if (uid.useridtype == "PID")
             {
                 return uid.Value;
             }
         }
         return "";
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 46
0
        private void ParsePidf(byte[] pidfContent)
        {
            presence presence;

            using (MemoryStream stream = new MemoryStream(pidfContent))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(presence));
                presence = serializer.Deserialize(stream) as presence;
            }

            PresenceStatus status = PresenceStatus.Offline;

            if (presence != null)
            {
                person[] persons = presence.Persons;
                person   person  = null;
                if (persons != null)
                {
                    if (persons.Length > 0)
                    {
                        person = persons[0];
                    }

                    DateTime lastTimeStamp = DateTime.MinValue;
                    foreach (person p in persons)
                    {
                        String timeStamp = p.GetTimeStamp();
                        if (!String.IsNullOrEmpty(timeStamp))
                        {
                            DateTime timestamp = Rfc3339DateTime.Parse(timeStamp);
                            if (timestamp.CompareTo(lastTimeStamp) > 0)
                            {
                                lastTimeStamp = timestamp;
                                person        = p;
                            }
                        }
                    }
                }
                String statusicon = (person != null && person.statusicon != null) ? person.statusicon.Value : null;

                Contact contact = this.contactService.ContactFind(presence.entity);
                if (contact != null)
                {
                    if (person != null)
                    {
                        //
                        // Basic
                        //
                        if (person.overridingWillingness != null)
                        {
                            status = (person.overridingWillingness.basic == basicType.closed) ? PresenceStatus.Offline : PresenceStatus.Online;
                            if (!String.IsNullOrEmpty(person.overridingWillingness.Until))
                            {
                                contact.HyperAvaiability = Rfc3339DateTime.Parse(person.overridingWillingness.Until).ToLocalTime();
                            }
                        }

                        //
                        //  Activities
                        //
                        if (person.activities != null && person.activities.ItemsElementName != null)
                        {
                            if (person.activities.ItemsElementName.Length > 0)
                            {
                                switch (person.activities.ItemsElementName[0])
                                {
                                case BogheCore.Generated.rpid.ItemsChoiceType.away:
                                case BogheCore.Generated.rpid.ItemsChoiceType.shopping:
                                case BogheCore.Generated.rpid.ItemsChoiceType.sleeping:
                                case BogheCore.Generated.rpid.ItemsChoiceType.working:
                                case BogheCore.Generated.rpid.ItemsChoiceType.appointment:
                                    status = PresenceStatus.Away;
                                    break;

                                case BogheCore.Generated.rpid.ItemsChoiceType.busy:
                                    status = PresenceStatus.Busy;
                                    break;

                                case BogheCore.Generated.rpid.ItemsChoiceType.vacation:
                                    status = PresenceStatus.BeRightBack;
                                    break;

                                case BogheCore.Generated.rpid.ItemsChoiceType.onthephone:
                                case BogheCore.Generated.rpid.ItemsChoiceType.playing:
                                    status = PresenceStatus.OnThePhone;
                                    break;

                                case BogheCore.Generated.rpid.ItemsChoiceType.dinner:
                                case BogheCore.Generated.rpid.ItemsChoiceType.breakfast:
                                case BogheCore.Generated.rpid.ItemsChoiceType.meal:
                                    status = PresenceStatus.OutToLunch;
                                    break;
                                }
                            }
                        }

                        // Assign status
                        contact.PresenceStatus = status;

                        // Free Text
                        String note = person.GetNote();
                        if (!String.IsNullOrEmpty(note))
                        {
                            contact.FreeText = note;
                        }

                        // Avatar

                        /*if (!String.IsNullOrEmpty(statusicon))
                         * {
                         *  contact.Avatar = this.GetContactStatusIcon(statusicon);
                         * }*/

                        // Home Page
                        String hp = person.homepage;
                        if (!String.IsNullOrEmpty(hp))
                        {
                            contact.HomePage = hp;
                        }

                        // Service willingness (open/closed)
                        // IMPORTANT: ignore availability[service.status]

                        /*if (presence.tuple != null && presence.tuple.Length > 0)
                         * {
                         *  foreach (tuple service in presence.tuple)
                         *  {
                         *      if (service != null && service.willingness != null && service.serviceDescription != null)
                         *      {
                         *          if (service.willingness.basic == basicType.closed)
                         *          {
                         *              contact.AddClosedServices(service.serviceDescription.serviceid);
                         *          }
                         *          else if (contact.ClosedServices.Contains(service.serviceDescription.serviceid))
                         *          {
                         *              contact.RemoveClosedServices(service.serviceDescription.serviceid);
                         *          }
                         *      }
                         *  }
                         * }*/
                    }
                    else
                    {
                        // Get the first tuple
                        tuple tuple = (presence.tuple != null && presence.tuple.Length > 0) ? presence.tuple[0] : null;
                        contact.PresenceStatus = (tuple != null && tuple.status != null && tuple.status.basic == basic.open) ? PresenceStatus.Online : PresenceStatus.Offline;
                    }
                }
            }
        }
Ejemplo n.º 47
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            String type = txtType.SelectedItem.ToString();

            if (isANewPerson)
            {
                objPerson             = new person();
                objPerson.name        = txtName.Text.ToString();
                objPerson.lastName    = txtLastName.Text.ToString();
                objPerson.age         = Decimal.ToInt32(numericAge.Value);
                objPerson.email       = txtEmail.Text.ToString();
                objPerson.address     = txtAddress.Text.ToString();
                objPerson.phone       = Decimal.ToInt32(numericPhoneNumber.Value);
                objPerson.nationality = txtNationality.Text.ToString();
                objPerson.DNI         = Decimal.Parse(txtDNI2.Text.ToString());
                objPerson.gender      = cmbGender.SelectedItem.ToString();
                objPerson.dateOfBith  = dateOfBirth.Value.Date;
                personServ.CreatePerson(objPerson);
            }
            String name        = objPerson.name;
            char   firstletter = name[0];
            int    dniValue    = Decimal.ToInt32(objPerson.DNI);

            username = firstletter + dniValue.ToString();
            //Verifico si tiene usuario y si no es estoy creando paciente
            if (userService.GetUserByUsername(username) == null && type != "Patient")
            {
                objUser          = new user();
                objUser.username = username;
                objUser.email    = txtEmail.Text.ToString();
                objUser.password = "******";
                userService.CreateUser(objUser);
            }
            //VERIFICAR TIPO DE USUARIO
            if (type.Equals("Admin"))
            {
                admin objAdmin = new admin();
                //Buscamos el usuario
                objUser = userService.GetUserByUsername(username);
                //Buscamos la persona
                objPerson = personServ.GetPersonByDni(dniValue);
                //Lo asignamos al admin
                objAdmin          = new admin();
                objAdmin.userId   = objUser.id;
                objAdmin.personId = objPerson.ID;
                //lo creamos
                if (adminService.GetAdminByUserId(objAdmin.userId) != null)
                {
                    MessageBox.Show("This user is already an Admin");
                }
                else
                {
                    adminService.CreateAdmin(objAdmin);
                    MessageBox.Show("New Admin Saved");
                    enableTextbox(false);
                    initialize();
                }
            }

            else if (type.Equals("Doctor"))
            {
                doctor objDoctor = new doctor();
                //Buscamos el usuario
                objUser = userService.GetUserByUsername(username);
                //Buscamos la persona
                objPerson = personServ.GetPersonByDni(dniValue);
                //Lo asignamos al admin
                objDoctor                  = new doctor();
                objDoctor.userId           = objUser.id;
                objDoctor.personId         = objPerson.ID;
                objDoctor.dateOfEnrollment = DateTime.Today;
                objDoctor.status           = true;
                //lo creamos
                if (docService.GetDoctorByUserId(objDoctor.userId) != null)
                {
                    MessageBox.Show("This user is already a Doctor");
                }
                else
                {
                    docService.CreateDoctor(objDoctor);
                    MessageBox.Show("New Doctor Saved");
                    enableTextbox(false);
                    initialize();
                }
            }

            else if (type.Equals("Nurse"))
            {
                nurse objNurse = new nurse();
                //Buscamos el usuario
                objUser = userService.GetUserByUsername(username);
                //Buscamos la persona
                objPerson = personServ.GetPersonByDni(dniValue);
                //Lo asignamos al admin
                objNurse          = new nurse();
                objNurse.userid   = objUser.id;
                objNurse.personId = objPerson.ID;
                //lo creamos
                if (nurService.GetNurseByUserId(objNurse.userid) != null)
                {
                    MessageBox.Show("This user is already a Nurse");
                }
                else
                {
                    nurService.CreateNurse(objNurse);
                    MessageBox.Show("New Nurse Saved");
                    enableTextbox(false);
                    initialize();
                }
            }
            else if (type.Equals("Patient"))
            {
                patient objPatient = new patient();
                //Buscamos el usuario
                objUser = userService.GetUserByUsername(username);
                //Buscamos la persona
                objPerson = personServ.GetPersonByDni(dniValue);
                //Lo asignamos al admin
                objPatient          = new patient();
                objPatient.personId = objPerson.ID;
                //lo creamos
                if (patientServ.GetPatientByPersonId(objPatient.personId) != null)
                {
                    MessageBox.Show("This user is already a Patient");
                }
                else
                {
                    patientServ.CreatePatient(objPatient);
                    MessageBox.Show("New Patient Saved");
                    enableTextbox(false);
                    initialize();
                }
            }
        }
Ejemplo n.º 48
0
 public editOrderDal(int orderId, int externalOrderId, int company, int totalPrice, int pickupBranch, int returnBranch, DateTime pickupDate, DateTime returnDate, int carId, List <Extention> extetions, searchBLL search, person person, creaditCardBLL creaditCard, string notes) : base(company, totalPrice, pickupBranch, returnBranch, pickupDate, returnDate, carId, extetions, search, person, creaditCard, notes)
 {
     this.orderId         = orderId;
     this.externalOrderId = externalOrderId;
 }
Ejemplo n.º 49
0
        public person Create(person newPerson)
        {
            var createPerson = _personRepository.Create(newPerson);

            return(createPerson);
        }
Ejemplo n.º 50
0
        public ActionResult CreateCustomer(customer_view customer_form_page)
        {
            var _session = sessionService.GetSession(this.HttpContext, true, false);

            //validation check
            var personfirstname = persons.GetAll().Where(s => s.firstName.ToUpper().Contains(customer_form_page.firstName.ToUpper())).ToList();
            var personlastname  = persons.GetAll().Where(s => s.lastName.ToUpper().Contains(customer_form_page.lastName.ToUpper())).ToList();
            var personmainphone = persons.GetAll().Where(s => s.mainPhone.ToUpper().Contains(customer_form_page.mainPhone.ToUpper())).ToList();

            var _person = new person();

            _person.firstName = customer_form_page.firstName;
            _person.lastName  = customer_form_page.lastName;
            _person.mainPhone = customer_form_page.mainPhone;
            _person.email     = customer_form_page.email;

            //first, last name and main phone validation

            if (_person.firstName == null)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (_person.firstName.Trim().Length > 50)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (_person.lastName == null)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (_person.lastName.Trim().Length > 50)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (_person.mainPhone == null)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            else if (_person.mainPhone.Trim().Length > 30)
            {
                return(RedirectToAction("ErrorMessage"));
            }
            //else if (personfirstname.Count() > 0 && personlastname.Count() > 0 && personmainphone.Count() > 0)
            else if (personfirstname.Count() > 0 && personlastname.Count() > 0)
            {
                return(RedirectToAction("ErrorMessage"));
            }

            _person.createDate = DateTime.Now;
            _person.lastUpdate = DateTime.Now;

            persons.Insert(_person);
            persons.Commit();

            var _customer = new customer();

            _customer.ID             = _person.ID;
            _customer.cellPhone      = customer_form_page.cellPhone;
            _customer.homePhone      = customer_form_page.homePhone;
            _customer.faxNumber      = customer_form_page.faxNumber;
            _customer.comments       = customer_form_page.comments;
            _customer.street         = customer_form_page.street;
            _customer.city           = customer_form_page.city;
            _customer.postalCode     = customer_form_page.postalCode;
            _customer.provinceCode   = customer_form_page.provinceCode;
            _customer.countryCode    = customer_form_page.countryCode;
            _customer.isEmailReceipt = customer_form_page.isEmailReceipt;
            _customer.isPartyMember  = customer_form_page.isPartyMember;
            _customer.createDate     = DateTime.Now;
            _customer.lastUpdate     = DateTime.Now;
            customers.Insert(_customer);
            customers.Commit();

            _session.idCustomer = _customer.ID;
            sessions.Update(_session);
            sessions.Commit();

            return(RedirectToAction("CustomerDetails", new { id = _customer.ID }));
        }
 protected void INSERT(object sender, EventArgs e)
 {
     person = person_insert();
 }
Ejemplo n.º 52
0
        /// <summary>
        /// Création d'une nouvelle task à l'intérieur d'un groupe
        /// </summary>
        /// <param name="newTask">La nouvelle task</param>
        /// <param name="groupID">Le ID du groupe dans lequel créer la tâche</param>
        /// <param name="personID">Le ID de la personne </param>
        /// <returns></returns>
        public task CreateNewTask(task newTask, object groupID, object personID)
        {
            if (newTask == null)
            {
                throw new ServiceException("La nouvelle Task est null");
            }

            if (groupID == null)
            {
                throw new ServiceException("Le ID du group est null");
            }

            if (personID == null)
            {
                throw new ServiceException("Le ID de la personne est null");
            }

            try
            {
                using (var context = new pigeonsEntities1())
                {
                    if (newTask.Task_DateTime == default(DateTime))
                    {
                        newTask.Task_DateTime = null;
                    }

                    /*********** Validation du groupe ***********/
                    group groupValidation = groupDAO.GetByID(context, groupID);

                    if (groupValidation == null)
                    {
                        throw new ServiceException(string.Format("Le groupe {0} n'existe pas", groupID));
                    }

                    if (!groupValidation.Is_active)
                    {
                        throw new ServiceException(string.Format("Le groupe {0} n'est pas actif. Impossible d'ajouter une Task", groupID));
                    }

                    /*********** Validation de la personne ***********/
                    person personValidation = personDAO.GetByID(context, personID);

                    if (personValidation == null)
                    {
                        throw new ServiceException(string.Format("La person {0} n'existe pas", personID));
                    }

                    /*********** Validation du following ***********/
                    following followingValidation = followingDAO.GetByID(context, personID, groupID);

                    if (followingValidation == null)
                    {
                        throw new ServiceException(string.Format("Le following [ {0} - {1} ] n'existe pas", personID, groupID));
                    }

                    if (!followingValidation.Is_active)
                    {
                        throw new ServiceException(string.Format("Le person ID : {0} n'est plus active dans le groupe ID : {1}", personID, groupID));
                    }

                    // Tout est beau. Insertion dans la table Task
                    newTask.Is_completed = false;
                    taskDAO.Insert(context, newTask);
                    context.SaveChanges();

                    return(newTask);
                }
            }
            catch (DAOException daoException)
            {
                throw new ServiceException(daoException.Message);
            }
        }
 protected void UPDATE(object sender, EventArgs e)
 {
     person = person_update(Convert.ToInt32(Update_person_GridView.SelectedValue));
 }
Ejemplo n.º 54
0
    public static void Main()
    {
        const int SIZE  = 500;
        int       count = 0;

        person[] p      = new person[SIZE];
        string   option = "";

        do
        {
            Console.WriteLine("Programs:");
            Console.WriteLine();
            Console.WriteLine("1- Add a new person");
            Console.WriteLine("2- Show all people");
            Console.WriteLine("3- Search a person by name");
            Console.WriteLine("4- Search a person by a year interval");
            Console.WriteLine("5- Show the oldest people");
            Console.WriteLine("6- Search a person by address");
            Console.WriteLine("7- Sort people by name");
            Console.WriteLine("T- Terminate application");
            Console.WriteLine();
            Console.WriteLine("Menu...");
            option = Console.ReadLine().ToUpper();

            switch (option)
            {
            case "1":     // Add
                if (count <= SIZE)
                {
                    do
                    {
                        Console.Write("Enter the name: ");
                        p[count].name = Console.ReadLine();
                    }while (p[count].name == "" &&
                            p[count].name.Length > 40);

                    Console.Write("Enter the e-mail: ");
                    p[count].mail = Console.ReadLine();

                    Console.Write("Enter the address: ");
                    p[count].address = Console.ReadLine();

                    Console.Write("Enter the year of birth: ");
                    p[count].birthYear = Convert.ToInt16(Console.ReadLine());

                    count++;
                }
                else
                {
                    Console.WriteLine("Database full");
                }

                break;

            case "2":     // Show all
                if (count == 0)
                {
                    Console.WriteLine("Database is empty.");
                    Console.WriteLine();
                }
                else
                {
                    for (int i = 0; i < count; i++)
                    {
                        if (p[i].name.Length <= 30)
                        {
                            Console.WriteLine(i + ": " + p[i].name);
                        }
                        else
                        {
                            Console.WriteLine(i + ": " +
                                              p[i].name.Substring(0, 30));
                        }

                        if (i % 20 == 19)      // Pause after 20 lines
                        {
                            Console.ReadLine();
                        }
                    }
                }
                break;

            case "3":     // Search
                if (count == 0)
                {
                    Console.WriteLine("Database is empty");
                    Console.WriteLine();
                }
                else
                {
                    Console.Write(
                        "Which person do you want to find? ");
                    string search = Console.ReadLine();
                    Console.WriteLine();

                    int amountFound = 0;

                    for (int i = 0; i < count; i++)
                    {
                        if (p[i].name.ToUpper().Contains(search.ToUpper()))
                        {
                            Console.WriteLine("PERSON Nº{0}", i + 1);
                            Console.WriteLine("Name: {0}", p[i].name);
                            Console.WriteLine("E-mail: {0}",
                                              p[i].mail);
                            Console.WriteLine("Address: {0}",
                                              p[i].address);
                            Console.WriteLine("Year of birth: {0}",
                                              p[i].birthYear);

                            amountFound++;
                        }
                    }

                    if (amountFound == 0)
                    {
                        Console.WriteLine(
                            "Can't find any person containing \"{0}\".",
                            search);
                    }

                    Console.WriteLine();
                }
                break;

            case "4":     // Edit an entry
                string nameByYear = "";
                if (count == 0)
                {
                    Console.WriteLine("Database is empty");
                    Console.WriteLine();
                }
                else
                {
                    Console.Write(
                        "Enter the initial year you want to search: ");
                    short initialYear = Convert.ToInt16(Console.ReadLine());
                    Console.Write(
                        "Enter the final year you want to search: ");
                    short finalYear = Convert.ToInt16(Console.ReadLine());
                    Console.WriteLine();

                    int amountFound2 = 0;

                    for (int i = 0; i < count; i++)
                    {
                        if (p[i].birthYear >= initialYear &&
                            p[i].birthYear <= finalYear)
                        {
                            nameByYear += p[i].name;
                            nameByYear += "-";

                            amountFound2++;
                        }
                    }
                    nameByYear = nameByYear.Remove(nameByYear.Length - 1, 1);

                    if (amountFound2 == 0)
                    {
                        Console.WriteLine(
                            "Can't find any person born between \"{0}\""
                            + " and \"{1}\".", initialYear, finalYear);
                    }
                    else
                    {
                        Console.WriteLine(nameByYear);
                    }

                    Console.WriteLine();
                }
                break;

            case "5":     // Delete
                short lastYear = p[0].birthYear;
                for (int i = 1; i < count; i++)
                {
                    if (p[i].birthYear < lastYear)
                    {
                        lastYear = p[i].birthYear;
                    }
                }

                Console.WriteLine("Oldest people:");
                for (int i = 0; i < count; i++)
                {
                    if (p[i].birthYear == lastYear)
                    {
                        Console.WriteLine(p[i].name);
                    }
                }
                Console.WriteLine();
                break;

            case "6":     // Sort
                string goOn = "";

                if (count == 0)
                {
                    Console.WriteLine("Database is empty");
                    Console.WriteLine();
                }
                else
                {
                    Console.Write(
                        "Which address do you want to find? ");
                    string searchAddress = Console.ReadLine();
                    Console.WriteLine();

                    int amountFound3 = 0;

                    int i = 0;
                    while (i < count || goOn != "fin")
                    {
                        if (p[i].name.ToUpper().Contains(searchAddress.ToUpper()))
                        {
                            Console.WriteLine("PERSON Nº{0}", i + 1);
                            Console.WriteLine("Name: {0}", p[i].name);
                            Console.WriteLine("E-mail: {0}",
                                              p[i].mail);
                            Console.WriteLine("Address: {0}",
                                              p[i].address);
                            Console.WriteLine("Year of birth: {0}",
                                              p[i].birthYear);

                            amountFound3++;

                            goOn = Console.ReadLine();
                            i++;
                        }
                    }

                    if (amountFound3 == 0)
                    {
                        Console.WriteLine(
                            "Can't find any person containing \"{0}\".",
                            searchAddress);
                    }

                    Console.WriteLine();
                }
                break;

            case "7":
                for (int i = 0; i < count - 1; i++)
                {
                    for (int j = i + 1; j < count; j++)
                    {
                        if (p[i].name.CompareTo(p[j].name) > 0)
                        {
                            person aux = p[i];
                            p[i] = p[j];
                            p[j] = aux;
                        }
                    }
                }
                break;

            case "T":     // Quit
            case "Q":
                Console.WriteLine("Bye!!!");
                break;

            default:
                Console.WriteLine("Wrong option");
                break;
            }
        }while ((option != "T") && (option != "Q"));
    }
Ejemplo n.º 55
0
        public async Task <IActionResult> person_set_action(person doc, int?idx, string mode_type, List <IFormFile> ImageFile)
        {
            string file_id = "";

            #region 기본 사용자 정보
            string user_id        = User.Identity.Name;
            int    department_idx = Convert.ToInt32(UserData.user_get(user_id, "department_idx"));
            int    company_idx    = Convert.ToInt32(UserData.user_get(user_id, "company_idx"));
            int    auth           = Convert.ToInt32(UserData.user_get(user_id, "auth"));
            #endregion

            string msg = "";



            if (doc.use_yn == "on")
            {
                doc.use_yn = "Y";
            }
            else
            {
                doc.use_yn = "N";
            }


            if (idx == null)
            {
                #region 저장
                msg     = "입력";
                file_id = user_id + DateTime.Now.ToShortDateString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();

                doc.write_date = DateTime.Now;
                doc.fileId     = file_id;
                db.person.Add(doc);
                db.SaveChanges(); // 실제로 저장


                msg = Util.msg.msg_insert;

                #endregion
            }
            else
            {
                if (mode_type == "D")
                {
                    #region 삭제



                    person _update =
                        (from a in db.person where a.idx == idx select a).Single();
                    _update.use_yn = "N";


                    db.SaveChanges(); // 실제로 저장



                    #endregion
                }
                else
                {
                    #region 수정
                    msg     = "수정";
                    file_id = doc.fileId;

                    if (string.IsNullOrEmpty(file_id))
                    {
                        file_id = user_id + DateTime.Now.ToShortDateString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();

                        doc.fileId = file_id;
                    }

                    doc.edit_date = DateTime.Now;


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

                    //idx 제외 업데이트=================================
                    db.Entry(doc).Property("write_date").IsModified    = false;
                    db.Entry(doc).Property("work_end_date").IsModified = false;
                    //==================================================


                    db.SaveChanges();

                    msg = Util.msg.msg_edit;

                    #endregion
                }
            }
            #region  일 올리기


            var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
            Configuration = builder.Build();
            string Models_photo = Configuration["user_app:file_list_url"];
            string company_id   = UserData.user_get(user_id, "company_id");


            int s = 1;
            foreach (var formFile in ImageFile)
            {
                double file_size = formFile.Length;
                if (file_size < _fileSizeLimit)
                {
                    var formFileContent =
                        await FileHelpers
                        .ProcessFormFile <IFormFile>(
                            formFile, ModelState, _permittedExtensions,
                            _fileSizeLimit);


                    #region 변수
                    // 변수 =========================================================================================================================
                    string only = user_id + DateTime.Today.ToShortDateString().Replace("-", "") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();
                    //  var trustedFileNameForFileStorage = Path.GetRandomFileName();   //랜덤이름

                    string file_ex = ""; // 확장자

                    try { file_ex = Path.GetFileName(formFile.FileName).Split('.').Last(); }
                    catch
                    {
                    }
                    var _fileName = only + "." + file_ex;     // 신규 파일 이름



                    var    _local_path      = _targetFilePath + company_id + "/";   // 신규 파일 경로
                    var    filePath         = Path.Combine(_local_path, _fileName); // 전체 경로
                    string desiredThumbPath = _local_path + "s/";                   // 작은 이미지 전체 경로

                    string ore_fileName = Path.GetFileName(formFile.FileName);
                    #endregion



                    //경로에 폴더가 없으면 만들어준다.=============================================
                    var dInfo   = new DirectoryInfo(_local_path);
                    var dInfo_s = new DirectoryInfo(desiredThumbPath);
                    if (!dInfo.Exists)
                    {
                        dInfo.Create();
                    }
                    if (!dInfo_s.Exists)
                    {
                        dInfo_s.Create();
                    }
                    //=================================================================================



                    using (var fileStream = System.IO.File.Create(filePath))
                    {
                        await fileStream.WriteAsync(formFileContent);
                    }

                    if (get_word.img_check(file_ex) == "img")
                    {
                        // 세로 기준
                        ResizeImage(desiredThumbPath, formFile, _fileName, 300, 0);
                    }


                    var _insert = new Md_Image()
                    {
                        Md_id      = file_id,
                        ImagePath  = Models_photo + company_id + "/" + _fileName,
                        fileName   = ore_fileName,
                        use_yn     = "Y",
                        file_ex    = file_ex,
                        file_size  = file_size,
                        r_date     = DateTime.Now,
                        write_id   = User.Identity.Name,
                        sImagePath = Models_photo + company_id + "/s/" + _fileName,
                    };

                    db.Md_Image.Add(_insert);
                    db.SaveChanges();
                }
                s++;
            }


            #endregion
            return(Redirect("/person/person_set_list"));
        }
Ejemplo n.º 56
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (txtDNI.Text.ToString().Length != 8)
            {
                MessageBox.Show("Invalid DNI. Try Again");
            }
            else
            {
                //DNI validos

                int dni = Int32.Parse(txtDNI.Text.ToString());
                DNI = dni;
                //Guradmos persona

                objPerson = personServ.GetPersonByDni(dni);

                //SI existe (Perosna ya registrasa)(Update)
                if (objPerson != null)
                {
                    MessageBox.Show("Person: " + objPerson.name + " " + objPerson.lastName);

                    btnAdd.Text = "Update";
                    //Obtengo el usuario
                    String name = objPerson.name;

                    char firstletter = name[0];
                    int  dniValue    = Decimal.ToInt32(objPerson.DNI);
                    username = firstletter + dniValue.ToString();
                    //guardamos usuario
                    objUser = userService.GetUserByUsername(username);
                    enableTextboxUpdate(true);

                    isANewPerson = false;

                    //Coloco los datos en los textboxs
                    txtName.Text     = objPerson.name;
                    txtLastName.Text = objPerson.lastName;
                    txtDNI2.Text     = objPerson.DNI.ToString();
                    if (objPerson.gender.Equals("Male"))
                    {
                        cmbGender.SelectedIndex = 1;
                    }
                    else
                    {
                        cmbGender.SelectedIndex = 0;
                    }
                    numericAge.Value         = objPerson.age;
                    numericPhoneNumber.Value = objPerson.phone;
                    dateOfBirth.Text         = objPerson.dateOfBith.ToString();
                    txtEmail.Text            = objPerson.email;
                    txtAddress.Text          = objPerson.address;
                    txtNationality.Text      = objPerson.nationality;

                    //Para ver si ya tinte i¿un clinic History

                    patient       objPatient       = patientServ.GetPatientByPersonId(objPerson.ID);
                    clinicHistory objClinicHistory = clinicHistoryService.GetClinicHistoryByPatientId(objPatient.id);
                    objClinicHistory = clinicHistoryService.GetClinicHistoryByPatientId(objPatient.id);
                    idPatient        = objPatient.id;

                    if (objPatient == null)
                    {
                        MessageBox.Show("No es un paciente");

                        enableTextboxCreateUpdateClinicHistory(false);
                        btnAddAlergi.Enabled = false;
                    }
                    else
                    {
                        if (objClinicHistory == null)
                        {
                            enableTextboxCreateUpdateClinicHistory(true);
                            btnCreateClinicHistory.Text = "create clinic history";
                            MessageBox.Show("Person: " + objPerson.name + " " + objPerson.lastName + " no cuenta con una historia clinica");
                            isANewHistory          = true;
                            txtDateOfCreation.Text = DateTime.Today.ToString();
                            btnAddAlergi.Enabled   = false;
                        }
                        else
                        {
                            idPClinicHsitory = objClinicHistory.id;

                            this.load();
                            btnCreateClinicHistory.Text = "update clinic history";
                            MessageBox.Show("Person: " + objPerson.name + " " + objPerson.lastName + " cuenta con una historia clinica");
                            isANewHistory          = false;
                            txtDateOfCreation.Text = objClinicHistory.date.ToString();
                            txtDescription.Text    = objClinicHistory.description;
                            txtHeigth.Value        = objClinicHistory.height.Value;
                            txtWeigth.Value        = objClinicHistory.weight.Value;
                            enableTextboxCreateUpdateClinicHistory(true);
                            if (objClinicHistory.alergies.Equals("si"))
                            {
                                ckAlergias.Checked   = true;
                                btnAddAlergi.Enabled = true;
                            }
                            else
                            {
                                ckAlergias.Checked   = false;
                                btnAddAlergi.Enabled = false;
                            }
                        }
                    }
                }
                else
                {
                    isANewPerson = true;
                    MessageBox.Show("New Person");
                    enableTextbox(true);
                    initialize();
                }
            }
        }
 public void Can_limit_cyclical_dependencies()
 {
     using (JsConfig.With(maxDepth: 4))
     {
         var p = new person();
         p.teacher = new person { name = "sam", teacher = p };
         p.name = "bob";
         p.PrintDump();
         p.ToJsv().Print();
         p.ToJson().Print();
     }
 }
Ejemplo n.º 58
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (isANewPerson)
            {
                objPerson             = new person();
                objPerson.name        = txtName.Text.ToString();
                objPerson.lastName    = txtLastName.Text.ToString();
                objPerson.age         = Decimal.ToInt32(numericAge.Value);
                objPerson.email       = txtEmail.Text.ToString();
                objPerson.address     = txtAddress.Text.ToString();
                objPerson.phone       = Decimal.ToInt32(numericPhoneNumber.Value);
                objPerson.nationality = txtNationality.Text.ToString();
                objPerson.DNI         = Decimal.Parse(txtDNI2.Text.ToString());
                objPerson.gender      = cmbGender.SelectedItem.ToString();
                objPerson.dateOfBith  = dateOfBirth.Value.Date;

                personServ.CreatePerson(objPerson);
                isANewHistory = true;
                enableTextboxCreateUpdateClinicHistory(true);
            }

            else
            {
                //No es una perosna nueva esto es poara el UPDATE
                if (!isANewPerson)
                {
                    objPerson = personServ.GetPersonByDni(DNI);

                    objPerson.name        = txtName.Text.ToString();
                    objPerson.lastName    = txtLastName.Text.ToString();
                    objPerson.age         = Decimal.ToInt32(numericAge.Value);
                    objPerson.email       = txtEmail.Text.ToString();
                    objPerson.address     = txtAddress.Text.ToString();
                    objPerson.phone       = Decimal.ToInt32(numericPhoneNumber.Value);
                    objPerson.nationality = txtNationality.Text.ToString();
                    objPerson.DNI         = Decimal.Parse(txtDNI2.Text.ToString());
                    objPerson.gender      = cmbGender.SelectedItem.ToString();
                    objPerson.dateOfBith  = dateOfBirth.Value.Date;

                    personServ.UpdatePerson(objPerson);
                }
            }
            String name        = objPerson.name;
            char   firstletter = name[0];
            int    dniValue    = Decimal.ToInt32(objPerson.DNI);

            username = firstletter + dniValue.ToString();
            //Verifico si tiene usuario y si no es estoy creando paciente
            if (userService.GetUserByUsername(username) == null)
            {
                objUser          = new user();
                objUser.username = username;
                objUser.email    = txtEmail.Text.ToString();
                objUser.password = "******";
                userService.CreateUser(objUser);
            }
            patient objPatient = new patient();

            //Buscamos el usuario
            objUser = userService.GetUserByUsername(username);
            //Buscamos la persona
            objPerson = personServ.GetPersonByDni(dniValue);
            //Lo asignamos al admin
            objPatient          = new patient();
            objPatient.personId = objPerson.ID;
            //lo creamos
            if (patientServ.GetPatientByPersonId(objPatient.personId) != null)
            {
                MessageBox.Show("Cambios registrados");
            }
            else
            {
                patientServ.CreatePatient(objPatient);
                idPatient = objPatient.id;
                MessageBox.Show("New Patient Saved");
                enableTextbox(false);
                initialize();
            }
        }
Ejemplo n.º 59
0
        private void getDataOne()
        {
            try
            {
                JObject data;
                movie   tempMovie;
                person  tempPerson;

                url  = "http://mymovieapi.com/?id=";
                url += textBox1.Text + urlParams;

                tempMovie  = new movie();
                tempPerson = new person();

                WebRequest      request  = WebRequest.Create(url);
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream       dataStream = response.GetResponseStream();
                StreamReader reader     = new StreamReader(dataStream);

                data = JObject.Parse(reader.ReadToEnd());

                int year  = (int)data["release_date"][0]["year"];
                int day   = (int)data["release_date"][0]["day"];
                int month = (int)data["release_date"][0]["month"];

                DateTime date = new DateTime(year, month, day);

                tempMovie.title        = ((string)data["title"]).ToLower();
                tempMovie.release_date = date;
                tempMovie.description  = (string)data["plot"];

                bool c = dbMovie.addMovie(tempMovie);

                textBox2.Text = c.ToString();

                if (c == true)
                {
                    cast tempCast = new cast();
                    tempCast.movie_id = tempMovie.id;

                    char[] separator = { ' ' };

                    tempMovie.id = (dbMovie.getMovieByTitle(tempMovie.title)).id;

                    foreach (string a in data["actors"])
                    {
                        tempPerson.name = a.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string d in data["directors"])
                    {
                        tempPerson.name = d.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string w in data["writers"])
                    {
                        tempPerson.name = w.ToLower();

                        dbPerson.addNewPerson(tempPerson);
                    }

                    foreach (string a2 in data["actors"])
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(a2)).id;
                        tempCast.role      = 2;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string d2 in data["directors"])
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(d2)).id;
                        tempCast.role      = 1;
                        dbPerson.addRole(tempCast);
                    }

                    foreach (string w2 in data["writers"])
                    {
                        tempCast.person_id = (dbPerson.getPersonByName(w2)).id;
                        tempCast.role      = 3;
                        dbPerson.addRole(tempCast);
                    }

                    dataStream.Close();
                    reader.Close();
                    response.Close();

                    textBox1.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     person = Update_person_select(Convert.ToInt32(Update_person_GridView.SelectedValue));
 }