示例#1
0
        public ControlTreeDataGrid(IDataEntryDataService dataService
                                   , ApplicationSettings appSettings
                                   , FormDataEntryLogic dataEntryController)
            : this()
        {
            DataService         = dataService;
            DataEntryController = dataEntryController;
            AppSettings         = appSettings;

            DataGridTableStyle tableStyle = dataService.InitializeTreeColumns(this);

            _speciesColumn    = tableStyle.GridColumnStyles["TreeDefaultValue"] as EditableComboBoxColumn;
            _sgColumn         = tableStyle.GridColumnStyles["SampleGroup"] as EditableComboBoxColumn;
            _stratumColumn    = tableStyle.GridColumnStyles["Stratum"] as EditableComboBoxColumn;
            _treeNumberColumn = tableStyle.GridColumnStyles["TreeNumber"] as EditableTextBoxColumn;
            _initialsColoumn  = tableStyle.GridColumnStyles["Initials"] as EditableComboBoxColumn;
            _logsColumn       = tableStyle.GridColumnStyles["LogCountActual"] as DataGridButtonColumn;
            _kpiColumn        = tableStyle.GridColumnStyles["KPI"] as EditableTextBoxColumn;
            _errorsColumn     = tableStyle.GridColumnStyles["Errors"] as DataGridTextBoxColumn;

            Settings_CruisersChanged(null, null);//initialize initials column

            if (_logsColumn != null)
            {
                _logsColumn.Click += this.LogsClicked;
                LogColumnVisable   = DataService.EnableLogGrading;
            }
            if (_stratumColumn != null)
            {
                _stratumColumn.DataSource = dataService.TreeStrata;
            }
        }
示例#2
0
        public LayoutPlot(IDataEntryDataService dataService
                          , ISampleSelectorRepository sampleSelectorRepository
                          , ApplicationSettings appSettings
                          , ISoundService soundService
                          , IViewController viewController
                          , PlotStratum stratum) : this()
        {
            SampleSelectorRepository = sampleSelectorRepository;
            DataService = dataService;
            AppSettings = appSettings;

            this.ViewLogicController = new LayoutPlotLogic(stratum,
                                                           this,
                                                           dataService,
                                                           soundService,
                                                           DialogService.Instance,
                                                           AppSettings,
                                                           viewController,
                                                           sampleSelectorRepository);

            //Setup DataGrid
            _tableStyle = stratum.InitializeTreeColumns(_dataGrid);

            _speciesColumn    = _tableStyle.GridColumnStyles["TreeDefaultValue"] as EditableComboBoxColumn;
            _sgColumn         = _tableStyle.GridColumnStyles["SampleGroup"] as EditableComboBoxColumn;
            _treeNumberColumn = _tableStyle.GridColumnStyles["TreeNumber"] as EditableTextBoxColumn;
            _initialsColoumn  = _tableStyle.GridColumnStyles["Initials"] as EditableComboBoxColumn;
            _logsColumn       = _tableStyle.GridColumnStyles["LogCountActual"] as DataGridButtonColumn;
            _kpiColumn        = _tableStyle.GridColumnStyles["KPI"] as EditableTextBoxColumn;
            _errorsColumn     = _tableStyle.GridColumnStyles["Error"] as DataGridTextBoxColumn;

            if (_logsColumn != null)
            {
                _logsColumn.Click += this.LogsClicked;
                LogColumnVisable   = DataService.EnableLogGrading;
            }
            Settings_CruisersChanged(null, null);//initialize initials column

            InitializeTallyPanel();

            this.ViewLogicController.UpdateCurrentPlot();
        }
示例#3
0
        private void CshMxGrid(TrasenClasses.GeneralControls.ButtonDataGridEx xcjwDataGrid)
        {
            #region 添加明细的列------------------
            List <ColumnDefine> columns = new List <ColumnDefine>();
            columns.Add(PubClass.NewColumnDefine("序号", "序号", 30, true, 1));
            columns.Add(PubClass.NewColumnDefine("发药", "发药", 30, true, 0));
            columns.Add(PubClass.NewColumnDefine("床号", "床号", (IsVisable("床号", true) ? 30 : 0), true, 0));    //住院+床号  或者  门诊
            columns.Add(PubClass.NewColumnDefine("姓名", "姓名", (IsVisable("姓名", true) ? 50 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("住院号", "住院号", (IsVisable("住院号", true) ? 60 : 0), true, 0)); //住院号或者门诊号
            columns.Add(PubClass.NewColumnDefine("性别", "性别", (IsVisable("性别", true) ? 30 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("年龄", "年龄", (IsVisable("年龄", false) ? 40 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("剂型", "剂型", (IsVisable("剂型", false) ? 50 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("商品名", "商品名", (IsVisable("商品名", true) ? 60 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("品名", "品名", (IsVisable("品名", true) ? 100 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("规格", "规格", (IsVisable("规格", true) ? 100 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("厂家", "厂家", (IsVisable("厂家", false) ? 100 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("单价", "单价", (IsVisable("单价", true) ? 80 : 0), true, 0));
            //columns.Add(PubClass.NewColumnDefine("库存数", "库存数", (IsVisable("库存数", false) ? 50 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("数量", "数量", (IsVisable("数量", true) ? 60 : 0), true, 0));
            //update code by py 7-1 18:40
            columns.Add(PubClass.NewColumnDefine("单位", "单位", (IsVisable("单位", true) ? 35 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("剂数", "剂数", (IsVisable("剂数", true) ? 55 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("金额", "金额", (IsVisable("金额", true) ? 70 : 0), true, 0));

            columns.Add(PubClass.NewColumnDefine("煎药", "煎药", (IsVisable("煎药", true) ? 60 : 0), true, 0));

            columns.Add(PubClass.NewColumnDefine("用法", "用法", (IsVisable("用法", true) ? 50 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("频次", "频次", (IsVisable("频次", true) ? 45 : 0), true, 0));

            columns.Add(PubClass.NewColumnDefine("剂量", "剂量", (IsVisable("剂量", true) ? 45 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("剂量单位", "剂量单位", (IsVisable("剂量单位", false) ? 45 : 0), true, 0));

            columns.Add(PubClass.NewColumnDefine("货号", "货号", (IsVisable("货号", false) ? 50 : 0), true, 0));

            columns.Add(PubClass.NewColumnDefine("处方日期", "处方日期", (IsVisable("处方日期", true) ? 110 : 0), true, 0));//住院:处方日期  门诊:录入日期
            columns.Add(PubClass.NewColumnDefine("记费日期", "记费日期", (IsVisable("记费日期", true) ? 77 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("记费员", "记费员", (IsVisable("记费员", true) ? 70 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("发药日期", "发药日期", (IsVisable("发药日期", true) ? 60 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("发药员", "发药员", (IsVisable("发药员", true) ? 70 : 0), true, 0));

            //columns.Add(PubClass.NewColumnDefine("配药员", "配药员", (IsVisable("配药员", false) ? 45 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("处方号", "处方号", (IsVisable("处方号", true) ? 100 : 0), true, 0));

            columns.Add(PubClass.NewColumnDefine("zy_id", "zy_id", 0, true, 0));     //cfmxid
            columns.Add(PubClass.NewColumnDefine("cjid", "cjid", 0, true, 0));
            columns.Add(PubClass.NewColumnDefine("dept_id", "dept_id", 0, true, 0)); //KSDM
            columns.Add(PubClass.NewColumnDefine("doc_id", "doc_id", 0, true, 0));   //YSDM
            //columns.Add(PubClass.NewColumnDefine("unitrate", "unitrate", 0, true, 0));
            columns.Add(PubClass.NewColumnDefine("ypsl", "ypsl", 0, true, 0));
            columns.Add(PubClass.NewColumnDefine("zxdw", "zxdw", 0, true, 0));
            columns.Add(PubClass.NewColumnDefine("dwbl", "dwbl", 0, true, 0));
            columns.Add(PubClass.NewColumnDefine("inpatient_id", "inpatient_id", 0, true, 0));//PATID
            columns.Add(PubClass.NewColumnDefine("批发价", "批发价", (IsVisable("批发价", false) ? 75 : 0), true, 0));
            columns.Add(PubClass.NewColumnDefine("批发金额", "批发金额", (IsVisable("批发金额", false) ? 75 : 0), true, 0));
            //columns.Add(PubClass.NewColumnDefine("charge_bit", "charge_bit", 0, true, 0));
            //columns.Add(PubClass.NewColumnDefine("discharge_bit", "discharge_bit", 0, true, 0));
            columns.Add(PubClass.NewColumnDefine("医生", "医生", (IsVisable("批发金额", true) ? 75 : 0), true, 0)); //医生名字
            columns.Add(PubClass.NewColumnDefine("dept_ly", "dept_ly", 0, true, 0));                        //科室名字
            //columns.Add(PubClass.NewColumnDefine("诊断", "诊断", 0, true, 0));
            //columns.Add(PubClass.NewColumnDefine("中医诊断", "中医诊断", (IsVisable("中医诊断", false) ? 100 : 0), true, 0));
            //columns.Add(PubClass.NewColumnDefine("中医症型", "中医症型", (IsVisable("中医症型", false) ? 100 : 0), true, 0));
            //columns.Add(PubClass.NewColumnDefine("STATITEM_CODE", "STATITEM_CODE", 0, true, 0));
            //columns.Add(PubClass.NewColumnDefine("家庭地址", "家庭地址", (IsVisable("家庭地址", false) ? 100 : 0), true, 0));
            //columns.Add(PubClass.NewColumnDefine("联系方式", "联系方式", (IsVisable("联系方式", false) ? 75 : 0), true, 0));
            //columns.Add(PubClass.NewColumnDefine("身份证", "身份证", (IsVisable("身份证", false) ? 100 : 0), true, 0));
            //columns.Add(PubClass.NewColumnDefine("cz_id", "cz_id", 0, true, 0));
            //columns.Add(PubClass.NewColumnDefine("kcid", "kcid", 0, true, 0));
            //columns.Add(PubClass.NewColumnDefine("execdept_id", "execdept_id", 0, true, 0));
            columns.Add(PubClass.NewColumnDefine("hwh", "hwh", 0, true, 0));
            columns.Add(PubClass.NewColumnDefine("特殊用法", "tsyf", 150, true, 0));
            columns.Add(PubClass.NewColumnDefine("剂量单位数量", "剂量单位数量", 0, true, 0));

            DataTable dtTmp = new DataTable();
            dtTmp.TableName = "tbmx";
            int index = 0;
            foreach (ColumnDefine cd in columns)
            {
                //DataGridEnableBoolColumn
                if (cd.ColBoolButton == 0)
                {
                    DataGridEnableTextBoxColumn colText = new DataGridEnableTextBoxColumn(index);
                    colText.HeaderText        = cd.HeaderText;
                    colText.MappingName       = cd.MappingName;
                    colText.Width             = cd.ColWidth;
                    colText.NullText          = "";
                    colText.ReadOnly          = cd.ColReadOnly;
                    colText.CheckCellEnabled += new TrasenClasses.GeneralControls.DataGridEnableTextBoxColumn.EnableCellEventHandler(myDataGrid1_CheckCellEnabled);

                    xcjwDataGrid.TableStyles[0].GridColumnStyles.Add(colText);
                    DataColumn datacol;
                    if (cd.MappingName.Trim() == "ypsl" || cd.MappingName == "金额")
                    {
                        datacol = new DataColumn(cd.MappingName, Type.GetType("System.Decimal"));
                    }
                    else
                    {
                        datacol = new DataColumn(cd.MappingName);
                    }

                    dtTmp.Columns.Add(datacol);
                }
                else
                {
                    DataGridButtonColumn btnCol = new DataGridButtonColumn(index);
                    btnCol.HeaderText  = cd.HeaderText;
                    btnCol.MappingName = cd.MappingName;
                    btnCol.Width       = cd.ColWidth;

                    btnCol.CellButtonClicked += new DataGridCellButtonClickEventHandler(btnCol_CellButtonClicked);
                    xcjwDataGrid.TableStyles[0].GridColumnStyles.Add(btnCol);

                    this.myDataGrid1.MouseDown += new MouseEventHandler(btnCol.HandleMouseDown);
                    this.myDataGrid1.MouseUp   += new MouseEventHandler(btnCol.HandleMouseUp);

                    DataColumn datacol;
                    datacol = new DataColumn(cd.MappingName);
                    dtTmp.Columns.Add(datacol);
                }
                index++;
            }

            xcjwDataGrid.DataSource = dtTmp;
            xcjwDataGrid.TableStyles[0].MappingName = "tbmx";

            if (ss.网络内容显示商品名 == true)
            {
                xcjwDataGrid.TableStyles[0].GridColumnStyles["商品名"].Width = 100;
            }
            else
            {
                xcjwDataGrid.TableStyles[0].GridColumnStyles["商品名"].Width = 0;
            }

            if ((new SystemCfg(8007)).Config == "0")
            {
                this.myDataGrid1.TableStyles[0].GridColumnStyles["医生"].Width = 0;
            }
            #endregion
        }
        public static DataGridTableStyle InitializeTreeColumns(this ITreeFieldProvider provider, EditableDataGrid grid)
        {
            DataGridTableStyle tblStyle = new System.Windows.Forms.DataGridTableStyle()
            {
                MappingName = "Tree"
            };

            int screenWidth = Screen.PrimaryScreen.WorkingArea.Width;
            int charWidth   = MeasureTextWidth(grid, "0");

            // Loop through each item in the fields list,
            // set up a column style and add it to the table style.

            foreach (TreeFieldSetupDO field in provider.TreeFields)
            {
                DataGridTextBoxColumn col;

                switch (field.Field)
                {
                case "CuttingUnit":
                {
                    continue;
                }

                case "Species":
                {
                    col = new FMSC.Controls.EditableComboBoxColumn()
                    {
                        DisplayMember = "Species",
                        //((EditableComboBoxColumn)col).ValueMember = "Self";
                        MappingName = "TreeDefaultValue",
                        Format      = "[Species]"
                    };
                    break;
                }

                case "CountOrMeasure":
                {
                    col = new FMSC.Controls.EditableComboBoxColumn()
                    {
                        //((EditableComboBoxColumn)col).DisplayMember = "CountOrMeasure";
                        //((EditableComboBoxColumn)col).ValueMember = "CountOrMeasure";
                        DataSource = new string[] { "C", "M", "I" }
                    };
                    break;
                }

                case "LiveDead":
                {
                    col = new FMSC.Controls.EditableComboBoxColumn()
                    {
                        //((EditableComboBoxColumn)col).DisplayMember = "LiveDead";
                        //((EditableComboBoxColumn)col).ValueMember = "LiveDead";
                        DataSource = new string[] { "L", "D" }
                    };
                    break;
                }

                case "Stratum":
                {
                    if (provider is PlotStratum)
                    {
                        col = new DataGridTextBoxColumn();
                    }
                    else
                    {
                        col = new FMSC.Controls.EditableComboBoxColumn()
                        {
                            DisplayMember = "Code"
                                            //((EditableComboBoxColumn)col).ValueMember = "Code";
                        };
                    }
                    break;
                }

                case "SampleGroup":
                {
                    col = new FMSC.Controls.EditableComboBoxColumn()
                    {
                        DisplayMember = "Code"
                                        //((EditableComboBoxColumn)col).ValueMember = "Code";
                    };
                    break;
                }

                case "KPI":
                {
                    col = MakeColumn(field.ColumnType);
                    //col.ReadOnly = true;
                    break;
                }

                case "Initials":
                {
                    col = new FMSC.Controls.EditableComboBoxColumn()
                    {
                        DisplayMember = "Initials",
                        ValueMember   = "Initials"
                    };
                    break;
                }

                default:    //all other columns
                {
                    col = MakeColumn(field.ColumnType);
                    break;
                }
                }

                // Set up width: autowidth or fixed width
                if (field.Width == 0.0)
                {
                    col.Width = MeasureTextWidth(grid, field.Heading.Trim()) + 18;//plus 18 to allow for padding
                }
                else
                {
                    int width1 = (int)field.Width;
                    if (width1 <= 10)
                    {
                        int width2 = (charWidth * width1) + 18;
                        col.Width = Math.Min(screenWidth, width2);
                    }
                    else
                    {
                        col.Width = Math.Min(screenWidth, width1);
                    }
                }

                if (String.IsNullOrEmpty(col.MappingName)) //see if we have already set the Mapping Name
                {
                    col.MappingName = field.Field;
                }
                if (String.IsNullOrEmpty(col.HeaderText))
                {
                    col.HeaderText = field.Heading;
                }
                if (string.IsNullOrEmpty(col.Format))
                {
                    col.Format = field.Format; // 'C' = currency, 'N' = number (E.G. "N1" means one decimal place), #0.00
                }
                col.FormatInfo = null;
                //this.myCustomColumnBase.Width = (int)myTreeFieldSetups[i].Width;
                col.NullText = String.Empty;// <- look into this

                // Add the column style to the table style
                tblStyle.GridColumnStyles.Add(col);
            }

            DataGridButtonColumn logsCol = new DataGridButtonColumn();

            logsCol.HeaderText  = "Logs";
            logsCol.MappingName = "LogCountActual";
            logsCol.Width       = MeasureTextWidth(grid, logsCol.HeaderText) + 18;//plus 18 to allow for padding
            tblStyle.GridColumnStyles.Add(logsCol);

            tblStyle.GridColumnStyles.Add(MakeErrorColumn(screenWidth));
            // Add the newly created DataGridTableStyle to the grid.
            grid.TableStyles.Add(tblStyle);

            return(tblStyle);
        }
示例#5
0
        public Form1()
        {
            InitializeComponent();
            // tell our form that we want to intercept all key press events in our form.Otherwise our KeyPress event method will only get events when the form class has focus.
            //this.KeyPreview = true;

            //give our dataGrid our SIP, so that I can listen and react to events on our SIP
            editableDataGrid1.SIP = inputPanel1;

            editableDataGrid1.CellValidating   += new EditableDataGridCellValidatingEventHandler(editableDataGrid1_CellValidating);
            editableDataGrid1.CellValueChanged += new EditableDataGridCellValueChangedEventHandler(editableDataGrid1_CellValueChanged);

            buttonPanel1.Text = "something";

            ////allow new rows on datagrid
            //editableDataGrid1.AllowNewRow = true;

            //set up columns for our dataGrid
            DataGridTableStyle ts = new DataGridTableStyle()
            {
                MappingName = "something"
            };

            comboBoxCol = new EditableComboBoxColumn()
            {
                MappingName = "num1"
            };
            textBoxCol = new EditableTextBoxColumn()
            {
                MappingName = "word", MaxTextLength = 12, GoToNextColumnWhenTextCompleate = true
            };
            dateTimeCol = new EditableDateTimePickerColumn()
            {
                MappingName = "date"
            };
            upDwnCol = new EditableUpDownColumn()
            {
                MappingName = "upDwn"
            };
            readOnlyTextBoxCol = new EditableTextBoxColumn()
            {
                MappingName = "word2", ReadOnly = true
            };
            ts.GridColumnStyles.Add(comboBoxCol);
            ts.GridColumnStyles.Add(textBoxCol);
            ts.GridColumnStyles.Add(dateTimeCol);
            ts.GridColumnStyles.Add(upDwnCol);
            ts.GridColumnStyles.Add(readOnlyTextBoxCol);

            //set up our button column and give it a event handler for button clicks
            //note the mapping name for the buttonColumn must be provided and a valid property to bind to
            //this is because the dataGrid only displays columns that have a valid MappingName
            //I've created a work around that should work for Full Framework, and will probably be able to make a workaround for Mobile
            //, but until then provide a mapping name.
            //For DAL DataObjects you could use the Tag property as a mapping name, since it isn't reserved for any propuse, and is intended for special cases like this.
            DataGridButtonColumn buttonCol = new DataGridButtonColumn()
            {
                MappingName = "button", UseCellColumnTextForCellValue = true, Text = "click me"
            };

            buttonCol.Click += new ButtonCellClickEventHandler(buttonCol_Click);
            ts.GridColumnStyles.Add(buttonCol);

            editableDataGrid1.TableStyles.Add(ts);

            //create some dummy data to test the grid
            List <something> things = new List <something>();

            for (int i = 0; i < 100; i++)
            {
                things.Add(new something()
                {
                    num1 = i, word = "word", button = "click me"
                });
            }
            bindingSource1.DataSource = things;
            //editableDataGrid1.DataSource = things;
        }