Example #1
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        DeptsTableAdapter dta = new DeptsTableAdapter();
          DropDownList dept = FormView1.FindControl("Dept") as DropDownList;
          var d = dta.GetDeptByDescription(dept.Text);

          GroupsTableAdapter gta = new GroupsTableAdapter();
          DropDownList group = FormView1.FindControl("Group") as DropDownList;
          var g = gta.GetGroupByName(group.Text);

          ProjectsTableAdapter ta = new ProjectsTableAdapter();
          TextBox tb = FormView1.FindControl("NameTextBox") as TextBox;
          CheckBox cb = FormView1.FindControl("ActiveCheckBox") as CheckBox;
          ta.Insert(Guid.NewGuid(), tb.Text, cb.Checked, d[0].Id, g[0].Id);
          GoBack();
    }
Example #2
0
    void dd_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList dd = sender as DropDownList;

        if (dd.SelectedItem == null)
          return;

        m_ddTrigger = dd.ID;

        switch (dd.ID)
        {
          case "Dept":
        GroupsTableAdapter gta = new GroupsTableAdapter();
        DropDownList dst = Panel1.FindControl("Group") as DropDownList;
        dst.DataSource = gta.GetGroupsByDeptId(new Guid(dd.SelectedValue));
        dst.DataBind();
        break;
          case "Group":
        TeamsTableAdapter tta = new TeamsTableAdapter();
        dst = Panel1.FindControl("Team") as DropDownList;
        dst.DataSource = tta.GetTeamsByGroupId(new Guid(dd.SelectedValue));
        dst.DataBind();
        break;
          case "Team":
        break;
        }
    }
        private void NormativesForm_Load(object sender, EventArgs e)
        {
            // TODO: данная строка кода позволяет загрузить данные в таблицу "newVipAvtoSet.Normatives". При необходимости она может быть перемещена или удалена.
            normativesTableAdapter.Fill(newVipAvtoSet.Normatives);

            var adapter = new GroupsTableAdapter();
            adapter.Fill(newVipAvtoSet.Groups);
            adapter.Dispose();

            dataGridView1.DataSource = newVipAvtoSet.Normatives;

            string[] groups =
                (from NewVipAvtoSet.GroupsRow item in newVipAvtoSet.Groups
                    select item.Title).ToArray();

            groupSelector.Items.AddRange(groups);

            if (newVipAvtoSet.GetGroupTitle(_selectedGroup) != null || groupSelector.Items.Count == 0)
            {
                groupSelector.Text = newVipAvtoSet.GetGroupTitle(_selectedGroup);
            }
            else
            {
                groupSelector.SelectedIndex = 0;
            }

            int id = newVipAvtoSet.GetGroupId(groupSelector.Text);
            ((DataTable) dataGridView1.DataSource).DefaultView.RowFilter = string.Format("GroupId = '{0}'", id);
        }