Beispiel #1
0
        /// <summary>
        /// 根据传入的网格获取ID
        /// </summary>
        /// <param name="dg">网格控件</param>
        /// <returns>ID字典集合</returns>
        public Dictionary <string, string> GetHeadID(EfwControls.CustomControl.DataGrid dg)
        {
            int     currentIndex = dg.CurrentCell.RowIndex;
            DataRow currentRow   = ((DataTable)(dg.DataSource)).Rows[currentIndex];

            CurrentRow = currentRow;
            Dictionary <string, string> rtn = new Dictionary <string, string>();

            rtn.Add("InHeadID", currentRow["InHeadID"].ToString());
            return(rtn);
        }
Beispiel #2
0
        /// <summary>
        /// 病人列表点击事件的勾选
        /// </summary>
        /// <param name="sender">触发控件</param>
        /// <param name="e">事件参数</param>
        private void grdPatList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            EfwControls.CustomControl.DataGrid grdList = tabControl1.SelectedTabIndex == 0 ? grdApplyList : (tabControl1.SelectedTabIndex == 1 ? grdExamList : grdTreatList);

            if (grdPatList.Rows.Count > 0)
            {
                if (e.ColumnIndex == 0)
                {
                    int       rowIndex = grdPatList.CurrentCell.RowIndex;
                    DataTable dt       = grdPatList.DataSource as DataTable;
                    if (dt.Rows.Count > 0)
                    {
                        if (Convert.ToInt32(dt.Rows[rowIndex]["checked"]) == 1)
                        {
                            dt.Rows[rowIndex]["checked"] = 0;
                            // 从医嘱列表中去掉对应的数据
                            DataTable commandDt = grdList.DataSource as DataTable;
                            commandDt.TableName = "DocList";
                            DataView view     = new DataView(commandDt);
                            string   sqlWhere = string.Format("SerialNumber <> {0}", dt.Rows[rowIndex]["SerialNumber"].ToString());
                            view.RowFilter     = sqlWhere;
                            view.Sort          = "SerialNumber, ApplyHeadID ASC";
                            grdList.DataSource = view.ToTable();
                        }
                        else
                        {
                            dt.Rows[rowIndex]["checked"] = 1;
                            // 将对应病人的数据追加到医嘱列表中

                            //NotCopiedDocDt.TableName = "DocList";
                            DataView view = new DataView(dtExamList);
                            view.RowFilter = string.Format("SerialNumber = {0}", dt.Rows[rowIndex]["SerialNumber"].ToString());
                            view.Sort      = "SerialNumber, ApplyHeadID ASC";
                            DataTable commandDt = grdList.DataSource as DataTable;
                            DataTable tempDt    = view.ToTable();
                            for (int i = 0; i < tempDt.Rows.Count; i++)
                            {
                                tempDt.Rows[i]["checked"] = 1;
                            }

                            if (commandDt != null)
                            {
                                commandDt.Merge(tempDt);
                            }
                            else
                            {
                                grdList.DataSource = tempDt;
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 数据列表的点击勾选事件
        /// </summary>
        /// <param name="sender">触发控件</param>
        /// <param name="e">事件参数</param>
        private void grdList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            EfwControls.CustomControl.DataGrid grdList = (EfwControls.CustomControl.DataGrid)sender;

            if (grdList.Rows.Count > 0)
            {
                int       rowIndex     = grdList.CurrentCell.RowIndex;
                DataTable dt           = grdList.DataSource as DataTable;
                int       iApplyHeadID = Convert.ToInt32(dt.Rows[rowIndex]["ApplyHeadID"]);

                if (e.ColumnIndex == 0)
                {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        string    strWhere = string.Format(" ApplyHeadID={0}", iApplyHeadID);
                        DataRow[] arrayDr  = dt.Select(strWhere);
                        // 去掉选中
                        if (Convert.ToInt32(dt.Rows[rowIndex]["checked"]) == 1)
                        {
                            if (arrayDr.Length > 0)
                            {
                                for (int i = 0; i < arrayDr.Length; i++)
                                {
                                    arrayDr[i]["checked"] = 0;
                                }
                            }
                        }
                        else
                        {
                            if (arrayDr.Length > 0)
                            {
                                for (int i = 0; i < arrayDr.Length; i++)
                                {
                                    arrayDr[i]["checked"] = 1;
                                }
                            }
                            // 选中数据
                            //dt.Rows[rowIndex]["CheckFlg"] = 1;
                        }
                    }
                }
            }
        }