Beispiel #1
0
        /// <summary>
        /// 没有明细时判断SubjectMst表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DeletedResult Delete2(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 <SubjectMstModel> subjectMstModels = SubjectMstFacade.Find(dicWhere).Data;

                for (var i = 0; i < subjectMstModels.Count; i++)
                {
                    GHSubjectModel gHSubjectModel = GHSubjectFacade.Find(subjectMstModels[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);
        }
Beispiel #2
0
        public string PostDelete([FromBody] InfoBaseModel <List <long> > phids)
        {
            var deletedresult = new DeletedResult();

            if (phids.infoData.Count > 0)
            {
                List <long> usePhids = BankAccountService.judgeIfUse(phids.infoData);
                if (usePhids.Count > 0)
                {
                    string Msg = "银行账户名称为";
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    new CreateCriteria(dic)
                    .Add(ORMRestrictions <List <long> > .In("PhId", usePhids));
                    IList <BankAccountModel> bankAccounts = BankAccountService.Find(dic).Data;
                    foreach (BankAccountModel bankAccount in bankAccounts)
                    {
                        Msg = Msg + bankAccount.FBankname + ",";
                    }
                    Msg = Msg.Substring(0, Msg.Length - 1) + "已被引用不能删除";
                    deletedresult.Status = ResponseStatus.Error;
                    deletedresult.Msg    = Msg;
                }
                else
                {
                    for (var i = 0; i < phids.infoData.Count; i++)
                    {
                        deletedresult = BankAccountService.Delete <System.Int64>(phids.infoData[i]);
                        //BankAccountService.Find(t => phids.infoData.Contains(t.PhId));
                    }
                }
            }

            return(DataConverterHelper.SerializeObject(deletedresult));
        }
Beispiel #3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DeletedResult DeleteAddinOperator(long id)
        {
            var           result  = AddinOperatorRule.Delete <Int64>(id);
            DeletedResult dresult = new DeletedResult();

            dresult.DelRows = result;
            dresult.Status  = "success"; //返回状态

            return(dresult);
        }
Beispiel #4
0
        /// <summary>
        /// 根据岗位主键集合删除岗位与岗位对应操作员信息
        /// </summary>
        /// <param name="phidList">岗位主键集合</param>
        /// <param name="uCode">用户账号</param>
        /// <returns></returns>
        public DeletedResult DeletedPostOpers(List <long> phidList, string uCode)
        {
            DeletedResult deletedResult     = new DeletedResult();
            Dictionary <string, object> dic = new Dictionary <string, object>();

            new CreateCriteria(dic)
            .Add(ORMRestrictions <List <long> > .In("PostPhid", phidList));
            var record = this.GAppvalRecordFacade.Find(dic).Data;

            if (record.Count > 0)
            {
                throw new Exception("此岗位已被审批使用,无法进行删除!");
            }
            dic.Clear();
            new CreateCriteria(dic)
            .Add(ORMRestrictions <List <long> > .In("PostPhid", phidList));
            var procPost = this.GAppvalProc4PostFacade.Find(dic).Data;

            if (procPost.Count > 0)
            {
                throw new Exception("此岗位已被流程使用,无法进行删除!");
            }
            dic.Clear();
            new CreateCriteria(dic)
            .Add(ORMRestrictions <List <long> > .In("PhId", phidList))
            .Add(ORMRestrictions <byte> .Eq("IsSystem", (byte)1));
            var sysPosts = this.GAppvalPostFacade.Find(dic).Data;

            if (sysPosts.Count > 0 && uCode != "Admin")
            {
                throw new Exception("内置岗位普通操作员不能进行删除!");
            }
            dic.Clear();
            new CreateCriteria(dic)
            .Add(ORMRestrictions <List <long> > .In("PhId", phidList));
            var posts = this.GAppvalPostFacade.Find(dic).Data;

            if (posts.Count > 0)
            {
                deletedResult = this.GAppvalPostFacade.Delete(dic);
                dic.Clear();
                new CreateCriteria(dic)
                .Add(ORMRestrictions <List <long> > .In("PostPhid", phidList));
                var opers = this.GAppvalPost4OperFacade.Find(dic).Data;
                if (opers.Count > 0)
                {
                    deletedResult = this.GAppvalPost4OperFacade.Delete(dic);
                }
            }
            return(deletedResult);
        }
Beispiel #5
0
        ///// <summary>
        ///// 方法实例
        ///// </summary>
        ///// <returns></returns>
        //public List<MethodAroundMstModel> ExampleMethod<MethodAroundMstModel>(string param)
        //{
        //    //编写代码
        //}
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DeletedResult DeleteMethodAround(long id)
        {
            var result = MethodAroundMstRule.Delete <Int64>(id);

            AssemblyRule.DeleteByForeignKey <Int64>(id);
            SqlRule.DeleteByForeignKey <Int64>(id);
            ExpRule.DeleteByForeignKey <Int64>(id);
            ExpVarRule.DeleteByForeignKey <Int64>(id);

            DeletedResult dresult = new DeletedResult();

            dresult.DelRows = result;
            dresult.Status  = "success"; //返回状态

            return(dresult);
        }
Beispiel #6
0
        /// <summary>
        /// 删除审批类型
        /// </summary>
        /// <param name="proc_phid">审批类型id</param>
        /// <returns></returns>
        public DeletedResult PostDeleteProcType(long proc_phid)
        {
            if (proc_phid == 0)
            {
                return(null);
            }

            IList <GAppvalProcModel> procModels = GAppvalProcFacade.Find(t => t.SPLXPhid == proc_phid).Data;

            //批量删除审批流程
            GAppvalProcFacade.DeleteAppvalProc(procModels);

            DeletedResult deletedResult = QTSysSetFacade.Delete(proc_phid);

            return(deletedResult);
        }
Beispiel #7
0
        ///// <summary>
        ///// 方法实例
        ///// </summary>
        ///// <returns></returns>
        //public List<ExtendFunctionMstModel> ExampleMethod<ExtendFunctionMstModel>(string param)
        //{
        //    //编写代码
        //}
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DeletedResult DeleteExtendFunc(long id)
        {
            var result = ExtendFunctionMstRule.Delete <Int64>(id);

            assemblyRule.DeleteByForeignKey <Int64>(id);
            sqlRule.DeleteByForeignKey <Int64>(id);


            DeletedResult dresult = new DeletedResult();

            dresult.DelRows = result;
            dresult.Status  = "success"; //返回状态

            //刷新缓存配置
            executor.RefreshConfigure();

            return(dresult);
        }
Beispiel #8
0
        public string PostDeleteProcType([FromBody] ProcRequestModel requestModel)
        {
            if (requestModel == null || requestModel.ApprovalTypeIds == null || requestModel.ApprovalTypeIds.Count == 0)
            {
                return(DCHelper.ErrorMessage("审批类型id为空!"));
            }

            try
            {
                //判断审批流程是否被引用
                foreach (long id in requestModel.ApprovalTypeIds)
                {
                    bool symbol = GAppvalProcService.ProcIsUsed(id);
                    //bool symbol = GAppvalProcService.ProcIsUsed(requestModel.ApprovalTypeId);
                    if (symbol)
                    {
                        return(DCHelper.ErrorMessage("删除失败,已有审批流程被引用!"));
                    }
                    var procs = this.GAppvalProcService.Find(t => t.SPLXPhid == id).Data;
                    if (procs != null && procs.Count > 0)
                    {
                        throw new Exception("此类型下已存在审批流,不能删除此审批流类型!");
                    }
                }

                DeletedResult deletedResult = GAppvalProcService.PostDeleteProcTypes(requestModel.ApprovalTypeIds);
                if (deletedResult != null && deletedResult.DelRows > 0)
                {
                    return(DCHelper.SuccessMessage("删除成功!"));
                }
                else
                {
                    return(DCHelper.ErrorMessage("删除失败!"));
                }
            }
            catch (Exception e) {
                return(DCHelper.ErrorMessage(e.Message));
            }
        }
Beispiel #9
0
        /// <summary>
        /// 批量删除审批类型
        /// </summary>
        /// <param name="ids">审批类型id集合</param>
        /// <returns></returns>
        public DeletedResult PostDeleteProcTypes(List <long> ids)
        {
            if (ids == null || ids.Count == 0)
            {
                return(null);
            }

            foreach (long proc_phid in ids)
            {
                IList <GAppvalProcModel> procModels = GAppvalProcFacade.Find(t => t.SPLXPhid == proc_phid).Data;

                //批量删除审批流程
                GAppvalProcFacade.DeleteAppvalProc(procModels);
            }

            Dictionary <string, object> dicWhere = new Dictionary <string, object>();

            new CreateCriteria(dicWhere)
            .Add(ORMRestrictions <List <long> > .In("PhId", ids));
            DeletedResult deletedResult = QTSysSetFacade.Delete(dicWhere);

            return(deletedResult);
        }
Beispiel #10
0
        /// <summary>
        /// 删除收入预算数据
        /// </summary>
        /// <param name="phid">收入预算主键</param>
        /// <returns></returns>
        public DeletedResult SaveDelete(long phid)
        {
            DeletedResult deletedResult = new DeletedResult();
            var           ysIncomes     = this.YsIncomeMstFacade.Find(t => t.PhId == phid).Data;

            if (ysIncomes != null && ysIncomes.Count == 1)
            {
                //未上报,未送审,未生成预算的数据才能删除
                if (ysIncomes[0].FApproval == (byte)0 && ysIncomes[0].FIsbudget == (byte)0 && ysIncomes[0].FIsreport == (byte)0)
                {
                    ysIncomes[0].PersistentState = PersistentState.Deleted;
                    deletedResult = this.YsIncomeMstFacade.Delete <long>(ysIncomes[0].PhId);//删除主从表数据
                }
                else
                {
                    throw new Exception("只有未上报,未送审以及未生成预算的收入预算才能删除!");
                }
            }
            else
            {
                throw new Exception("传递的收入预算主键有误!");
            }
            return(deletedResult);
        }
        /// <summary>
        /// 是否为申报单位的设置
        /// </summary>
        /// <returns>返回Json串</returns>
        public CommonResult <CorrespondenceSettings2Model> UpdateIfSBOrg(List <OrganizeModel> models, List <CorrespondenceSettings2Model> DeleteData, List <OrganizeModel> InsertData)
        {
            //末级组织保存对应关系
            string OrgCode;
            string OrgPhId;
            var    selectresult = new PagedResult <CorrespondenceSettings2Model>();
            CommonResult <CorrespondenceSettings2Model> result = new CommonResult <CorrespondenceSettings2Model>();

            if (models != null && models.Count > 0)
            {
                for (int i = 0; i < models.Count; i++)
                {
                    var           dicWhere = new Dictionary <string, object>();
                    OrganizeModel organize = models[i];
                    OrgCode = organize.OCode;
                    OrgPhId = organize.PhId.ToString();
                    new CreateCriteria(dicWhere).
                    Add(ORMRestrictions <string> .Eq("Dwdm", OrgCode)).
                    Add(ORMRestrictions <string> .Eq("Dydm", OrgCode)).
                    Add(ORMRestrictions <string> .Eq("Dylx", "ZC")).
                    Add(ORMRestrictions <string> .Eq("DefStr2", OrgPhId));
                    selectresult = base.ServiceHelper.LoadWithPageInfinity("GQT3.QT.DYGX2_All", dicWhere);
                    if (selectresult.TotalItems == 0)
                    {
                        try
                        {
                            CorrespondenceSettings2Model correspondence = new CorrespondenceSettings2Model();
                            correspondence.PersistentState = SUP.Common.Base.PersistentState.Added;
                            correspondence.Dwdm            = OrgCode;
                            correspondence.Dydm            = OrgCode;
                            correspondence.Dylx            = "ZC";
                            correspondence.DefStr2         = OrgPhId;
                            SavedResult <Int64> savedResult = base.Save <Int64>(correspondence, "");
                        }
                        catch (Exception e)
                        {
                            result.Status = ResponseStatus.Error;
                            result.Msg    = "设置失败,请重新设置!";
                            return(result);
                        }
                    }
                }
            }

            long Deleteid;  //主表主键

            if (DeleteData != null && DeleteData.Count > 0)
            {
                for (int i = 0; i < DeleteData.Count; i++)
                {
                    CorrespondenceSettings2Model delete = DeleteData[i];
                    Deleteid = delete.PhId;

                    try
                    {
                        //判断当前组织是否在项目中被使用,如果使用则不能删除
                        Dictionary <string, object> where1 = new Dictionary <string, object>();
                        new CreateCriteria(where1).Add(ORMRestrictions <string> .Eq("FDeclarationUnit", delete.Dwdm));
                        FindedResults <ProjectMstModel> findedResults = ProjectMstFacade.Find(where1);
                        if (findedResults.Data.Count > 0)
                        {
                            result.Status = ResponseStatus.Error;
                            result.Msg    = "设置失败,组织已被引用!";
                            return(result);
                        }
                        else
                        {
                            Dictionary <string, object> where2 = new Dictionary <string, object>();
                            new CreateCriteria(where2).Add(ORMRestrictions <string> .Eq("FOcode", delete.Dwdm));
                            DeletedResult deletedResult = BudgetProcessCtrlFacade.Delete(where2);
                        }

                        base.Delete <System.Int64>(Deleteid);
                    }
                    catch (Exception e)
                    {
                        result.Status = ResponseStatus.Error;
                        result.Msg    = "设置失败,请重新设置!";
                        return(result);
                    }
                }
            }

            if (InsertData != null && InsertData.Count > 0)
            {
                for (int i = 0; i < InsertData.Count; i++)
                {
                    OrganizeModel insertorganize = InsertData[i];
                    var           insertOrgCode  = insertorganize.OCode;
                    var           insertOrgPhId  = insertorganize.PhId.ToString();
                    try
                    {
                        CorrespondenceSettings2Model correspondence2 = new CorrespondenceSettings2Model();
                        correspondence2.PersistentState = SUP.Common.Base.PersistentState.Added;
                        correspondence2.Dwdm            = insertOrgCode;
                        correspondence2.Dylx            = "SB";
                        correspondence2.DefStr2         = insertOrgPhId;
                        SavedResult <Int64> savedResult2 = base.Save <Int64>(correspondence2, "");

                        //向预算进度控制表添加相应的记录
                        Dictionary <string, object> where1 = new Dictionary <string, object>();
                        new CreateCriteria(where1).Add(ORMRestrictions <string> .Eq("FOcode", insertorganize.OCode));
                        FindedResults <BudgetProcessCtrlModel> findedResults = BudgetProcessCtrlFacade.Find(where1);
                        //判断进度表中是否已经存在
                        if (findedResults.Data.Count == 0)
                        {
                            List <BudgetProcessCtrlModel> budgetProcessList = new List <BudgetProcessCtrlModel>();
                            Dictionary <string, object>   where2            = new Dictionary <string, object>();
                            Dictionary <string, object>   where3            = new Dictionary <string, object>();
                            Dictionary <string, object>   where4            = new Dictionary <string, object>();
                            new CreateCriteria(where2).Add(ORMRestrictions <Int64> .Eq("ParentOrgId", insertorganize.PhId));
                            new CreateCriteria(where3).Add(ORMRestrictions <string> .Eq("OCode", insertorganize.OCode));
                            new CreateCriteria(where4).Add(ORMRestrictions.Or(where2, where3));
                            List <OrganizeModel> organizeList = OrganizationFacade.Find(where4).Data.ToList();
                            //获得组织对象,前端传过来的组织对象可能没有组织名称
                            OrganizeModel organizeModel = organizeList.Find(t => t.IfCorp == "Y");
                            if (organizeList.Count > 1)
                            {
                                for (int j = 0; j < organizeList.Count; j++)
                                {
                                    if ("N".Equals(organizeList[j].IfCorp))
                                    {
                                        BudgetProcessCtrlModel budgetProcessCtrlModel = new BudgetProcessCtrlModel();
                                        budgetProcessCtrlModel.PersistentState = PersistentState.Added;
                                        budgetProcessCtrlModel.FOcode          = organizeModel.OCode;
                                        budgetProcessCtrlModel.FOname          = organizeModel.OName;
                                        budgetProcessCtrlModel.FDeptCode       = organizeList[j].OCode;
                                        budgetProcessCtrlModel.FDeptName       = organizeList[j].OName;
                                        budgetProcessCtrlModel.FProcessStatus  = "1";
                                        budgetProcessList.Add(budgetProcessCtrlModel);
                                    }
                                }
                            }
                            else
                            {
                                BudgetProcessCtrlModel budgetProcessCtrlModel = new BudgetProcessCtrlModel();
                                budgetProcessCtrlModel.PersistentState = PersistentState.Added;
                                budgetProcessCtrlModel.FOcode          = organizeModel.OCode;
                                budgetProcessCtrlModel.FOname          = organizeModel.OName;
                                budgetProcessCtrlModel.FProcessStatus  = "1";
                                budgetProcessList.Add(budgetProcessCtrlModel);
                            }
                            BudgetProcessCtrlFacade.Save <Int64>(budgetProcessList);
                        }
                    }
                    catch (Exception e)
                    {
                        result.Status = ResponseStatus.Error;
                        result.Msg    = "设置失败,请重新设置!";
                        return(result);
                    }
                }
            }

            return(result);
        }