int ucModify_Save(Neusoft.HISFC.Models.Fee.BedFeeItem bedFeeItem)
        {
            // [2007/02/06] 新增加的代码
            //判断是否已经添加了

            //for (int i = 0, j = this.neuSpread1_Sheet1.Rows.Count; i < j; i++)
            //{
            //    if (this.neuSpread1_Sheet1.GetText(i,1).Equals(bedFeeItem.ID))
            //    {
            //        MessageBox.Show("数据已经存在,不能添加", "提示", MessageBoxButtons.OK);
            //        return;
            //    }
            //}
            // 新增加的代码结束

            if (bedFeeItem.User03 == "ADD")
            {
                for (int i = 0, j = this.neuSpread1_Sheet1.Rows.Count; i < j; i++)
                {
                    if (this.neuSpread1_Sheet1.GetText(i, 1).Equals(bedFeeItem.ID))
                    {
                        MessageBox.Show("数据已经存在,不能添加", "提示", MessageBoxButtons.OK);


                        return(-1);
                    }
                }
                int row = this.neuSpread1_Sheet1.RowCount;

                this.neuSpread1_Sheet1.Rows.Add(row, 1);

                row = this.neuSpread1_Sheet1.Rows.Count - 1;

                this.SetValue(bedFeeItem, row);
                //修改人:路志鹏

                //时间:2007-4-10
                //目的:修改[当填写和存在的数据一致的项目,保存,给出信息提示不允许保存成功,此时再添加不同项目,保存成功,但却将提示的那个与存在数据一致的项目也保存成功了]

                //ArrayList bedFeeItemList = this.bedFeeItemManager.QueryBedFeeItemByMinFeeCode(bedFeeItem.FeeGradeCode);

                //this.neuSpread1_Sheet1.RowCount = bedFeeItemList.Count;

                //for (int i = 0; i < bedFeeItemList.Count; i++)
                //{
                //    Neusoft.HISFC.Models.Fee.BedFeeItem bedFeeItemQuery = bedFeeItemList[i] as Neusoft.HISFC.Models.Fee.BedFeeItem;

                //    SetValue(bedFeeItemQuery, i);
                //}
                return(0);
            }
            if (bedFeeItem.User03 == "MODIFY")
            {
                int activeRow = this.neuSpread1_Sheet1.ActiveRowIndex;

                this.SetValue(bedFeeItem, activeRow);
                return(0);
            }
            return(0);
        }
        public int Modify()
        {
            if (this.neuSpread1_Sheet1.RowCount == 0)
            {
                return(-1);
            }

            int activeRow = this.neuSpread1_Sheet1.ActiveRowIndex;

            Neusoft.HISFC.Models.Fee.BedFeeItem bedFeeItem = this.neuSpread1_Sheet1.Rows[activeRow].Tag as Neusoft.HISFC.Models.Fee.BedFeeItem;

            ucModify.SaveType   = ucBedFeeItemModify.EnumSaveTypes.Modify;
            bedFeeItem.User03   = "MODIFY";
            ucModify.BedFeeItem = bedFeeItem;
            ucModify.ItemInfo.Clear();
            ucModify.ItemInfo.AddRange(itemInfoList);

            Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(ucModify);

            // [2007/02/06] 新增加的代码开始

            this.isDirty = true;
            // 新增加代码结束


            return(1);
        }
        /// <summary>
        /// 在一个床位等级中增加新项目

        /// </summary>
        /// <returns></returns>
        public int Add()
        {
            // [2007/02/06] 新增加代码开始

            if (tvBedGrade.SelectedNode == null)
            {
                MessageBox.Show("请注意一个床位等级");
                return(1);
            }
            // 新增加代码结束


            int activeRow = this.neuSpread1_Sheet1.ActiveRowIndex;

            Neusoft.HISFC.Models.Fee.BedFeeItem obedFeeItem = new Neusoft.HISFC.Models.Fee.BedFeeItem();

            if (tvBedGrade.SelectedNode.Level == 0)
            {
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("请选择床位等级"));

                return(1);
            }

            obedFeeItem.FeeGradeCode = tvBedGrade.SelectedNode.Tag.ToString();
            obedFeeItem.User03       = "ADD";

            // [2007/02/07] 新增加的代码
            this.ucModify  = new ucBedFeeItemModify();
            ucModify.Save += new ucBedFeeItemModify.ClickSave(ucModify_Save);
            // 新增加的代码结束


            ucModify.SaveType   = ucBedFeeItemModify.EnumSaveTypes.Add;
            ucModify.BedFeeItem = obedFeeItem;
            ucModify.ItemInfo.Clear();
            ucModify.ItemInfo.AddRange(itemInfoList);

            Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(ucModify);

            // [2007/02/06] 新增加的代码开始

            this.isDirty = true;
            // 新增加代码结束


            return(1);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        public int Query()
        {
            Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm(Language.Msg("正在处理,请稍候^^"));

            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            TreeNode treeNode = this.tvBedGrade.SelectedNode;

            if (treeNode == null)
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                return(-1);
            }
            if (treeNode.Parent == null)
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                return(-1);
            }
            if (treeNode.Tag == null)
            {
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                return(-1);
            }
            if (treeNode.Level == 0)
            {
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("请选择床位等级"));
                Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
                return(-1);
            }
            ArrayList bedFeeItemList = this.bedFeeItemManager.QueryBedFeeItemByMinFeeCode(treeNode.Tag.ToString());

            this.neuSpread1_Sheet1.RowCount = bedFeeItemList.Count;

            for (int i = 0; i < bedFeeItemList.Count; i++)
            {
                Neusoft.HISFC.Models.Fee.BedFeeItem bedFeeItem = bedFeeItemList[i] as Neusoft.HISFC.Models.Fee.BedFeeItem;

                SetValue(bedFeeItem, i);
            }

            Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm();
            return(1);
        }
        /// <summary>
        /// 添充床位等级所包含内容
        /// </summary>
        /// <param name="feeCodeStat"></param>
        /// <param name="row"></param>
        private void SetValue(Neusoft.HISFC.Models.Fee.BedFeeItem bedFeeItem, int row)
        {
            //{21267B78-C198-43ed-8C52-5364C6F70FDA}
            Neusoft.HISFC.Models.Fee.Item.Undrug item = this.itemManager.GetUndrugByCode(bedFeeItem.ID);

            if (item.ValidState == "0")
            {
                this.neuSpread1_Sheet1.RowHeader.Cells[row, 0].Text      = "帐页停用";
                this.neuSpread1_Sheet1.RowHeader.Cells[row, 0].ForeColor = Color.Red;
            }

            if (item.ValidState == "2")
            {
                this.neuSpread1_Sheet1.RowHeader.Cells[row, 0].Text      = "帐页废弃";
                this.neuSpread1_Sheet1.RowHeader.Cells[row, 0].ForeColor = Color.Red;
            }

            if (item.ValidState == "1")
            {
                this.neuSpread1_Sheet1.RowHeader.Cells[row, 0].Text      = string.Empty;
                this.neuSpread1_Sheet1.RowHeader.Cells[row, 0].ForeColor = this.neuSpread1_Sheet1.ColumnHeader.Cells[0, 0].ForeColor;
            }

            this.neuSpread1_Sheet1.SetValue(row, 0, bedFeeItem.PrimaryKey);
            this.neuSpread1_Sheet1.SetValue(row, 1, bedFeeItem.ID);
            this.neuSpread1_Sheet1.SetValue(row, 2, bedFeeItem.Name);
            this.neuSpread1_Sheet1.SetValue(row, 3, bedFeeItem.Qty);
            // {88D26424-49FC-4b64-A0C3-6569CD196970}

            //this.neuSpread1_Sheet1.SetValue(row, 4, itemManager.GetValidItemByUndrugCode(bedFeeItem.ID).Price.ToString());
            this.neuSpread1_Sheet1.SetValue(row, 4, itemManager.GetUndrugByCode(bedFeeItem.ID).Price.ToString());
            this.neuSpread1_Sheet1.SetValue(row, 5, bedFeeItem.BeginTime.Date == new DateTime(1, 1, 1).Date?string.Empty:bedFeeItem.BeginTime.Date.ToString("yyyy-MM-dd"));

            this.neuSpread1_Sheet1.SetValue(row, 6, bedFeeItem.EndTime.Date == new DateTime(1, 1, 1).Date?string.Empty:bedFeeItem.EndTime.Date.ToString("yyyy-MM-dd"));
            this.neuSpread1_Sheet1.SetValue(row, 7, bedFeeItem.IsBabyRelation);
            this.neuSpread1_Sheet1.SetValue(row, 8, bedFeeItem.IsTimeRelation);
            this.neuSpread1_Sheet1.SetValue(row, 9, GetValidName(bedFeeItem.ValidState));
            this.neuSpread1_Sheet1.SetValue(row, 10, bedFeeItem.SortID);

            this.neuSpread1_Sheet1.Rows[row].Tag = bedFeeItem;
        }