예제 #1
0
        private void btnSave_ServerClick(object sender, EventArgs e)
        {
            int ObjectTypeId = int.Parse(pc["GlobalSubscription_ObjectType"]);

            // —формируем массив выбранных элементов, представив их в виде строки EventTypeId_ObjectRoleId
            ArrayList selectedValues = new ArrayList();

            foreach (DataGridItem item in grdMain.Items)
            {
                string sEventTypeId = item.Cells[0].Text;

                for (int i = 2; i < item.Cells.Count; i++)
                {
                    TableCell cell = item.Cells[i];

                    foreach (Control ctrl in cell.Controls)
                    {
                        CheckBox chk = ctrl as CheckBox;
                        if (chk != null && chk.Checked)
                        {
                            selectedValues.Add(String.Format("{0}_{1}", sEventTypeId, chk.ID.Substring(5)));
                        }
                    }
                }
            }

            SystemEvents.AddGlobalSubscriptions(ObjectTypeId, selectedValues);
        }