Ejemplo n.º 1
0
        /// <summary>
        /// 获取统计大类ID
        /// </summary>
        /// <param name="statID">中心统计大类ID</param>
        /// <returns>本院统计大类ID</returns>
        private int getsubitemId(int statID)
        {
            Basic_StatItem subitem = Listitem.Find(x => x.StatID == statID);

            if (subitem == null)
            {
                return(0);
            }

            return(subitem.ID);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取分类明细ID
        /// </summary>
        /// <param name="subtype">类型</param>
        /// <param name="statID">统计大类ID</param>
        /// <returns>分类明细ID</returns>
        private int getsubclassId(int subtype, int statID)
        {
            Basic_StatItem subitem = Listitem.Find(x => x.StatID == statID);

            if (subitem == null)
            {
                return(0);
            }

            Basic_StatItemSubclass subclass = null;

            switch (subtype)
            {
            case 1:
                subclass = Listsubclass.Find(x => x.SubID == subitem.AccItemID);
                break;

            case 2:
                subclass = Listsubclass.Find(x => x.SubID == subitem.CostItemID);
                break;

            case 3:
                subclass = Listsubclass.Find(x => x.SubID == subitem.BaItemID);
                break;

            case 4:
                subclass = Listsubclass.Find(x => x.SubID == subitem.PoItemID);
                break;

            case 5:
                subclass = Listsubclass.Find(x => x.SubID == subitem.OutFpItemID);
                break;

            case 6:
                subclass = Listsubclass.Find(x => x.SubID == subitem.InFpItemID);
                break;
            }

            if (subclass == null)
            {
                return(0);
            }

            return(subclass.SubID);
        }
Ejemplo n.º 3
0
        public ServiceResponseData SaveHostStatItem()
        {
            int            workID   = requestData.GetData <int>(0);
            Basic_StatItem statitem = requestData.GetData <Basic_StatItem>(1);

            SetWorkId(workID);
            this.BindDb(statitem);
            statitem.save();

            //还需要保存分类节点下面的子节点中,如果没有设置数据的默认同父节点一致
            List <Basic_CenterStatItem> listStat = NewObject <Basic_CenterStatItem>().getlist <Basic_CenterStatItem>();
            List <Basic_StatItem>       listItem = NewDao <IBasicDataStatItemDao>().GetHostStatItemData(workID);

            savechildstatitem(statitem, listStat, listItem);

            responseData.AddData(true);
            return(responseData);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 选中统计大类
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="e">参数</param>
        private void treeStat_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
        {
            if (e.Node == null)
            {
                return;
            }

            Basic_CenterStatItem item = e.Node.Tag as Basic_CenterStatItem;

            currStatItem             = new Basic_StatItem();
            currStatItem.ID          = getsubitemId(item.StatID);
            currStatItem.StatID      = item.StatID;
            currStatItem.StatName    = item.StatName;
            currStatItem.AccItemID   = getsubclassId(1, item.StatID);
            currStatItem.CostItemID  = getsubclassId(2, item.StatID);
            currStatItem.BaItemID    = getsubclassId(3, item.StatID);
            currStatItem.PoItemID    = getsubclassId(4, item.StatID);
            currStatItem.OutFpItemID = getsubclassId(5, item.StatID);
            currStatItem.InFpItemID  = getsubclassId(6, item.StatID);
            frmFormItem.Load(currStatItem);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存子节点下的统计分类
        /// </summary>
        /// <param name="statitem">统计大类信息</param>
        /// <param name="listStat">中心统计大类信息</param>
        /// <param name="listItem">本院统计大类</param>
        private void savechildstatitem(Basic_StatItem statitem, List <Basic_CenterStatItem> listStat, List <Basic_StatItem> listItem)
        {
            foreach (Basic_CenterStatItem item in listStat.FindAll(x => x.PStatID == statitem.StatID))
            {
                Basic_StatItem childitem = listItem.Find(x => x.StatID == item.StatID);
                if (childitem == null)
                {
                    childitem = NewObject <Basic_StatItem>();
                }

                childitem.StatID      = item.StatID;
                childitem.StatName    = item.StatName;
                childitem.AccItemID   = childitem.AccItemID == 0 ? statitem.AccItemID : childitem.AccItemID;
                childitem.CostItemID  = childitem.CostItemID == 0 ? statitem.CostItemID : childitem.CostItemID;
                childitem.BaItemID    = childitem.BaItemID == 0 ? statitem.BaItemID : childitem.BaItemID;
                childitem.PoItemID    = childitem.PoItemID == 0 ? statitem.PoItemID : childitem.PoItemID;
                childitem.OutFpItemID = childitem.OutFpItemID == 0 ? statitem.OutFpItemID : childitem.OutFpItemID;
                childitem.InFpItemID  = childitem.InFpItemID == 0 ? statitem.InFpItemID : childitem.InFpItemID;
                childitem.save();
                savechildstatitem(childitem, listStat, listItem);
            }
        }