Exemplo n.º 1
0
        /// <summary>
        /// 有明细时判断是否处于审批流程中
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DeletedResult DeleteIfDtl(long id)
        {
            var deletedresult = new DeletedResult();

            try
            {
                QtBaseProjectModel qtBaseProjectModel = base.Find(id).Data;
                var dicWhere = new Dictionary <string, object>();
                new CreateCriteria(dicWhere).
                Add(ORMRestrictions <string> .Eq("FProjCode", qtBaseProjectModel.FProjCode)).
                Add(ORMRestrictions <string> .Eq("FYear", qtBaseProjectModel.FYear));
                IList <SubjectMstBudgetDtlModel> subjectMstBudgetDtlModels = SubjectMstBudgetDtlFacade.Find(dicWhere).Data;

                for (var i = 0; i < subjectMstBudgetDtlModels.Count; i++)
                {
                    GHSubjectModel gHSubjectModel = GHSubjectFacade.Find(subjectMstBudgetDtlModels[i].Mstphid).Data;
                    if (gHSubjectModel.FApproveStatus != "1")
                    {
                        deletedresult.Status = ResponseStatus.Error;
                        deletedresult.Msg    = "有数据处于审批流程当中,无法删除!";
                        return(deletedresult);
                    }
                }

                deletedresult = base.Delete(id);
            }
            catch (Exception ex)
            {
                deletedresult.Status = ResponseStatus.Error;
                deletedresult.Msg    = ex.Message.ToString();
            }
            return(deletedresult);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 判断是否有明细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Boolean JudgeHaveDtl(long id)
        {
            QtBaseProjectModel qtBaseProjectModel = base.Find(id).Data;
            var dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere).
            Add(ORMRestrictions <string> .Eq("FProjCode", qtBaseProjectModel.FProjCode));
            if (SubjectMstBudgetDtlFacade.Find(dicWhere).Data.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }