Ejemplo n.º 1
0
        void btnAdd_MouseClick(object sender, MouseEventArgs e)
        {
            //EmsHeadDO.Emsdrugs.EmsOrDrugList.AddNew();
            if (this.EmsHeadDO.Emsdrugs.EmsOrDrugList.Count(p => String.IsNullOrEmpty(p.Id_srv) && String.IsNullOrEmpty(p.Sd_srvtp)) > 0)
            {
                this.ShowInfo("已经追加了一条空行记录,请先填写完整");
                return;
            }
            EmsOrDrug emsordrug = new EmsOrDrug();

            EmsHeadDO.Emsdrugs.EmsOrDrugList.Add(emsordrug);
            xap.cli.sdk.controls.DataView.XDataRow    row  = gv.DataTable.Rows.DataSourceRow[emsordrug];
            xap.cli.sdk.controls.DataView.XCellRender cell = row.ColumnCellDict["Name_srv"];
            gv.ShowEditor(cell);
        }
Ejemplo n.º 2
0
        void btnAdd_MouseClick(object sender, MouseEventArgs e)
        {
            EmsOrDrug drug = this.EmsHeadDO.Emsdrugs.EmsOrDrugList.FirstOrDefault <EmsOrDrug>(p => string.IsNullOrEmpty(p.Id_srv) && string.IsNullOrEmpty(p.Sd_srvtp));

            if (drug == null)
            {
                drug = new EmsOrDrug();
                this.EmsHeadDO.Emsdrugs.EmsOrDrugList.Add(drug);
            }
            her.FocusIndex          = this.EmsHeadDO.Emsdrugs.EmsOrDrugList.IndexOf(drug);
            gv.DataTable.DataSource = new BindingList <EmsOrDrug>()
            {
                drug
            };
            xap.cli.sdk.controls.DataView.XDataRow    row  = gv.DataTable.Rows.DataSourceRow[drug];
            xap.cli.sdk.controls.DataView.XCellRender cell = row.ColumnCellDict["Name_srv"];
            gv.ShowEditor(cell);
        }