Esempio n. 1
0
        void GridSaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
        {
            try
            {
                //move the changes back to the external data object
                if (e.ColIndex == 1 && e.RowIndex > 0)
                {
                    externalData[e.RowIndex - 1].ExpandState = (int)e.Style.ImageIndex;
                    externalData[e.RowIndex - 1].IndentLevel = (int)e.Style.Tag;
                }

                if (e.ColIndex > 0 && e.RowIndex > 0)
                {
                    externalData[e.RowIndex - 1].Items[e.ColIndex - 1] = (string)e.Style.CellValue;
                }
            }
            catch { }

            //refresh this row so change is displayed
            if (!externalData.Locked)
            {
                externalData.CollapseData();
                this.gridControl1.Refresh();
            }
            e.Handled = true;
        }
Esempio n. 2
0
        protected override void OnSaveCellInfo(GridSaveCellInfoEventArgs e)
        {
            int rowIndex = e.RowIndex;
            int colIndex = e.ColIndex;

            if ((rowIndex > 0) && (colIndex > 0))
            {
                GridStyleInfo style = e.Style;
                if ((style.Tag != null) && (this.ЯчейкиДанных != null))
                {
                    string str = ЯчейкаМетаструктуры.ПолучитьКодЯчейки(style.Tag.ToString());
                    if (this.ЯчейкиДанных.СодержитИндекс(str))
                    {
                        ТипЯчейки ячейки = this.ЯчейкиДанных[str];
                        if (style.CellType == "FormulaCell")
                        {
                            ячейки.Значение = e.Style.FormattedText;
                        }
                        else
                        {
                            if (ячейки is СсылкаНаСправочник)
                            {
                                if (e.Style.CellValue is ЗаписьСправочника)
                                {
                                    ячейки.Значение = e.Style.CellValue;
                                    e.Style.Text    = (ячейки as СсылкаНаСправочник).ЗначениеСтрокой;
                                }
                                if (e.Style.CellValue == null)
                                {
                                    ячейки.Значение = null;
                                    e.Style.Text    = string.Empty;
                                }
                            }
                            else
                            {
                                ячейки.Значение = e.Style.Text;
                            }
                            base.ЭкраннаяФорма.ДанныеИзменились = true;
                            if (ячейки.ТолькоЧтение)
                            {
                                this.УстановитьСтильЯчейкиТолькоЧтение(style);
                            }
                            else if (ячейки.Описание.ОбязательноДляЗаполнения)
                            {
                                this.УстановитьСтильОбязательнойДляЗаполненияЯчейки(style, ячейки.ЗначениеЗаполнено);
                            }
                            else if ((base.ВариантОткрытия == ВариантОткрытияФормы.Чтение) || (base.ВариантОткрытия == ВариантОткрытияФормы.СводнаяФормаБезРедактирования))
                            {
                                base.УстановитьСтильНередактируемойЯчейки(style);
                            }
                            else
                            {
                                base.УстановитьСтильРедактируемойЯчейки(style);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// This event is used to save the changes made in grid to Excel sheet.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void gridModel_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
        {
            int        index     = this.tabBarSplitterControl.ActivePageIndex;
            IWorksheet Worksheet = workbook.Worksheets[index];

            //Used to save the changes made in grid to Excel sheet which is currently in view.
            excelConverter.SaveCellInfoToExcelsheet(Worksheet, sender as GridModel, e.Style);
        }
Esempio n. 4
0
 /// <summary>
 /// Save the cell information once it updated
 /// </summary>
 void m_syncGrid_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
 {
     // Don't save changes.
     e.Handled = true;
 }
Esempio n. 5
0
        private void Model_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
        {
            if (gridDataBoundGrid1.Enabled == true)
            {
                GridModel model = this.gridDataBoundGrid1.Model;
                int ColIndex = this.gridDataBoundGrid1.Model.NameToColIndex("CheckBox");

                if (e.RowIndex > 0 && e.ColIndex == ColIndex)
                {
                    int keyColIndex1 = model.NameToColIndex("Type");
                    string key1 = model[e.RowIndex, keyColIndex1].Text;
                    int keyColIndex2 = model.NameToColIndex("Name");
                    string key2 = model[e.RowIndex, keyColIndex2].Text;

                    // Save the checkbox value that is modified by the user.
                    if (key1 != null && key2 != null)
                    {
                        CheckBoxValues[key1 + ":" + key2] = (bool)e.Style.CellValue;
                        if ((bool)e.Style.CellValue)
                        {
                            if (!SelectedTargetRows.Contains(e.RowIndex))
                                SelectedTargetRows.Add(e.RowIndex);
                        }
                        else
                            if (SelectedTargetRows.Contains(e.RowIndex))
                                SelectedTargetRows.Remove(e.RowIndex);

                        int perms = 0;
                        foreach (int j in SelectedTargetRows)
                        {
                            perms += (int)gridDataBoundGrid1[j, 4].CellValue;
                        }

                        List<string> keyList = entitlementCtl.GetAssignedKeyList();
                        foreach (string s in keyList)
                        {
                            BrokerAdapter.InstanceOf().UpdateObjectPermissions(s, perms);
                        }

                        int curidx = EntitlementCtl.CurrentAssignmentObjectIndex;
                        entitlementCtl.SetAssignmentObjectSelection(curidx);
                        entitlementCtl.RefreshAssignedObjects();
                        entitlementCtl.RefreshPermissions();
                    }
                }
            }
        }