Exemplo n.º 1
0
Arquivo: FlowBLL.cs Projeto: JuRogn/OA
        public static List<FLOW_MODELFLOWRELATION_T> GetFlowByModelName(string CompanyID, string DepartID, string ModelCode, string FlowType)
        {
            try
            {
                //Flow_ModelFlowRelation_TDAL Dal = new Flow_ModelFlowRelation_TDAL();
                //以部门查找流程
                List<FLOW_MODELFLOWRELATION_T> xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(CompanyID, DepartID, ModelCode, FlowType, "1");

                if (xoml != null && xoml.Count > 0) //找到匹配流程返回
                    return xoml;
                //部门的上级机构查找流程
                OrganizationServiceClient Organization = new OrganizationServiceClient ();
                Dictionary<string, string> OrganizationList= Organization.GetFatherByDepartmentID(DepartID);
                  if(OrganizationList==null || OrganizationList.Count <=0)
                      throw new Exception("GetFlowByModelName-->GetFatherByDepartmentID:没有找到部门的上级机构!");
                  foreach (var item in OrganizationList) 
                  {
                      if (item.Value == "0")
                      {
                          xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(CompanyID, item.Key, ModelCode, FlowType, "0"); //如果上级机构是公司直接查询公司关联流程并返回
                          return xoml;
                      }

                      xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(CompanyID, item.Key, ModelCode, FlowType, "1");
                      if (xoml != null && xoml.Count > 0) //找到匹配流程返回
                          return xoml;
                      
                  }    
                return xoml;

            }
            catch (Exception ex)
            {
                throw new Exception("GetFlowByModelName:"+ex.Message);// return null;
            }

        }
Exemplo n.º 2
0
        /// <summary>
        /// 通过模块名查找使用流程
        /// </summary>
        /// <param name="CompanyID"></param>
        /// <param name="DepartID"></param>
        /// <param name="ModelCode"></param>
        /// <param name="FlowType"></param>
        /// <returns></returns>
        public static List<FLOW_MODELFLOWRELATION_T> GetFlowByModelName(OracleConnection con, string CompanyID, string DepartID, string ModelCode, string FlowType)
        {
            try
            {
                //Flow_ModelFlowRelation_TDAL Dal = new Flow_ModelFlowRelation_TDAL();
                //以部门查找流程
                LogHelper.WriteLog("以部门查找流程FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName:OrgType='1' ;CompanyID=" + CompanyID + ";DepartID=" + DepartID + ";FlowType=" + FlowType + "");
                List<FLOW_MODELFLOWRELATION_T> xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(con, CompanyID, DepartID, ModelCode, FlowType, "1");
                if (xoml != null && xoml.Count > 0) //找到匹配流程返回
                {
                    LogHelper.WriteLog("找到匹配流程返回");
                    return xoml;
                }
                //部门的上级机构查找流程
                LogHelper.WriteLog("没有找到匹配流程返回,继续部门的上级机构查找流程");
                #region 加入缓存
                //Dictionary<string, string> OrganizationList = CacheProvider.GetCache<Dictionary<string, string>>(DepartID);
                //if (OrganizationList == null || OrganizationList.Count <= 0)
                //{
                //    OrganizationServiceClient Organization = new OrganizationServiceClient();
                //    OrganizationList = Organization.GetFatherByDepartmentID(DepartID);
                //    CacheProvider.Add<Dictionary<string, string>>(DepartID, OrganizationList);                    
                //}
                #endregion
                OrganizationServiceClient Organization = new OrganizationServiceClient();
                LogHelper.WriteLog("Organization.InnerChannel.LocalAddress=" + Organization.InnerChannel.LocalAddress.Uri + ";Organization.InnerChannel.RemoteAddress.Uri=" + Organization.InnerChannel.RemoteAddress.Uri);
                Dictionary<string, string> OrganizationList = Organization.GetFatherByDepartmentID(DepartID);
                LogHelper.WriteLog("查找部门的上级机构");
                if (OrganizationList == null || OrganizationList.Count <= 0)
                {
                    throw new Exception("GetFlowByModelName-->GetFatherByDepartmentID:没有找到部门的上级机构!");
                }
                foreach (var item in OrganizationList)
                {
                    if (item.Value == "0")
                    {
                        LogHelper.WriteLog("FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName:OrgType='0'");
                        xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(con, CompanyID, item.Key, ModelCode, FlowType, "0"); //如果上级机构是公司直接查询公司关联流程并返回

                        return xoml;
                    }
                    LogHelper.WriteLog("FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName:OrgType='1'");
                    xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(con, CompanyID, item.Key, ModelCode, FlowType, "1");

                    if (xoml != null && xoml.Count > 0) //找到匹配流程返回
                        return xoml;

                }
                return xoml;

            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("FlowBll2->GetFlowByModelName:" + ex.Message);
                throw new Exception("GetFlowByModelName:" + ex.Message);// return null;
            }

        }
Exemplo n.º 3
0
Arquivo: FlowBLL.cs Projeto: JuRogn/OA
        /// <summary>
        /// 通过模块名查找使用流程
        /// </summary>
        /// <param name="CompanyID"></param>
        /// <param name="DepartID"></param>
        /// <param name="ModelCode"></param>
        /// <param name="FlowType"></param>
        /// <returns></returns>
        public static List<FLOW_MODELFLOWRELATION_T> GetFlowByModelName(OracleConnection con, string CompanyID, string DepartID, string ModelCode, string FlowType, ref FlowUser user)
        {
            try
            {
                //Flow_ModelFlowRelation_TDAL Dal = new Flow_ModelFlowRelation_TDAL();
                //以部门查找流程
                LogHelper.WriteLog("以部门查找流程FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName:OrgType='1' ;CompanyID=" + CompanyID + ";DepartID=" + DepartID + ";FlowType=" + FlowType + "");
                List<FLOW_MODELFLOWRELATION_T> xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(con, CompanyID, DepartID, ModelCode, FlowType, "1");
                if (xoml != null && xoml.Count > 0) //找到匹配流程返回
                {
                    #region 写日志
                    if (user != null)
                    {
                        if (CompanyID == user.CompayID && DepartID == user.DepartmentID)
                        {
                            LogHelper.WriteLog("FormID=" + user.FormID + ";找到公司[ " + user.CompayName + " ]下部门[ " + user.DepartmentName + " ]的匹配流程返回");
                        }
                    }
                    #endregion
                    return xoml;
                }
                //部门的上级机构(一般是公司)查找流程
                if (user != null)
                {
                    LogHelper.WriteLog("FormID=" + user.FormID + ";没有找到公司[ " + user.CompayName + " ]下部门[ " + user.DepartmentName + " ]的匹配流程返回,继续部门的上级机构查找流程");
                }
                OrganizationServiceClient Organization = new OrganizationServiceClient();
                LogHelper.WriteLog("Organization.InnerChannel.LocalAddress=" + Organization.InnerChannel.LocalAddress.Uri + ";Organization.InnerChannel.RemoteAddress.Uri=" + Organization.InnerChannel.RemoteAddress.Uri);
                Dictionary<string, string> OrganizationList = Organization.GetFatherByDepartmentID(DepartID);
                LogHelper.WriteLog("FormID=" + user.FormID + ";继续查找部门的上级机构");
                if (OrganizationList == null || OrganizationList.Count <= 0)
                {
                    string info = "FormID=" + user.FormID + ";没有找到所在部门的上级机构";
                    #region 写日志
                    if (user != null)
                    {
                        if (DepartID == user.DepartmentID)
                        {
                            info = "FormID=" + user.FormID + ";没有找到所在部门[ " + user.DepartmentName + " ]的上一级上级机构";
                            LogHelper.WriteLog(info);
                        }
                    }
                    #endregion
                    throw new Exception("没有找到所在部门[ " + user.DepartmentName + " ]的上一级上级机构");
                }
                foreach (var item in OrganizationList)
                {
                    if (item.Value == "0")
                    {

                        xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(con, CompanyID, item.Key, ModelCode, FlowType, "0"); //如果上级机构是公司直接查询公司关联流程并返回
                        #region 写日志
                        if (user.CompayID == CompanyID)
                        {
                            LogHelper.WriteLog("FormID=" + user.FormID + ";找到所在部门[ " + user.DepartmentName + " ]的上一级上级机构 [" + user.CompayName + "]");
                        }
                        else
                        {
                            LogHelper.WriteLog("FormID=" + user.FormID + ";找到所在部门[ " + user.DepartmentName + " ]的上一级上级机构 ");
                        }
                        #endregion
                        return xoml;
                    }

                    xoml = FLOW_MODELFLOWRELATION_TDAL.GetFlowByModelName(con, CompanyID, item.Key, ModelCode, FlowType, "1");

                    if (xoml != null && xoml.Count > 0) //找到匹配流程返回
                    {
                        #region 写日志
                        if (user.CompayID == CompanyID)
                        {
                            LogHelper.WriteLog("FormID=" + user.FormID + ";找到所在部门[ " + user.DepartmentName + " ]的上一级上级机构 [" + user.CompayName + "]");
                        }
                        else
                        {
                            LogHelper.WriteLog("FormID=" + user.FormID + ";找到所在部门[ " + user.DepartmentName + " ]的上一级上级机构 ");
                        }
                        #endregion
                        return xoml;
                    }

                }
                return xoml;

            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("FlowBLL->GetFlowByModelName:" + ex.Message);
                throw new Exception("GetFlowByModelName:" + ex.Message);// return null;
            }

        }