Ejemplo n.º 1
0
        public AddClassroomForm(string connectionString, long id)
        {
            InitializeComponent();
            context = new classroom_fundEntities(connectionString);
            responsibleP.DataSource = (from p in context.person
                                       select p.first_name + ";" + p.last_name + ";" + p.middle_name + ";" + p.phone_number + ";" + p.address).ToList();
            responsibleP.SelectedItem = null;
            this.id = id;
            classroom c = context.classroom.Find(id);

            floorInput.Value    = c.floor_number;
            numberInput.Value   = c.number;
            capacityInput.Value = c.capacity;
            safetyInput.Checked = c.compliance_with_safety_regulations;
            string pers = (from p in context.person
                           where p.id == c.responsible_person_id
                           select p.first_name + ";" + p.last_name + ";" + p.middle_name + ";" + p.phone_number + ";" + p.address).FirstOrDefault();

            foreach (string item in responsibleP.Items)
            {
                if (pers == item)
                {
                    responsibleP.SelectedItem = item;
                }
            }
            submitButton.Text = "Изменить";
            mode = false;
        }
Ejemplo n.º 2
0
 public void Update(classroom cr)
 {
     this.floor_number          = cr.floor_number;
     this.responsible_person_id = cr.responsible_person_id;
     this.number   = cr.number;
     this.capacity = cr.capacity;
     this.compliance_with_safety_regulations = cr.compliance_with_safety_regulations;
 }