public List<FBEntity> QueryAuditOrder(QueryExpression qe) { using (AuditBLL bll = new AuditBLL()) { return bll.GetAuditedFBEntity(qe); } }
public QueryResult Query(QueryExpression qe) { try { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { return fbCommonBLL.QueryData(qe); } } catch (Exception ex) { QueryExpression qeTemp = qe; string parameter = ""; while (qeTemp != null) { parameter += string.Format("Name:{0} ; Value:{1} ; QueryType:{2}", qeTemp.PropertyName, qeTemp.PropertyValue, qeTemp.QueryType) + "\r\n"; qeTemp = qeTemp.RelatedExpression; } Tracer.Debug(ex.ToString() + "\r\n参数: " + parameter); // throw ex; QueryResult qr = new QueryResult(); qr.Exception = ex.ToString(); qr.Result = new List<FBEntity>(); qr.Pager = qe.Pager; return qr; } }
protected void btnTest_Click(object sender, EventArgs e) { FBCommonService s = new FBCommonService(); QueryExpression qe = new QueryExpression() { QueryType = typeof(T_FB_COMPANYBUDGETAPPLYMASTER).Name }; var data = s.QueryFBEntities(qe); this.GridView1.DataSource = data; DataBind(); }
public static QueryExpression Equal(string propertyName, string propertyValue) { QueryExpression qe = new QueryExpression(); qe.PropertyName = propertyName; qe.PropertyValue = propertyValue; qe.RelatedType = RelationType.And; return qe; }
private void TryGetQueryExpression(string propertyName, string propertyValue, ref QueryExpression parentQueryExpression) { if (!string.IsNullOrEmpty(propertyValue)) { QueryExpression qe = QueryExpression.Equal(propertyName, propertyValue); parentQueryExpression.RelatedExpression = qe; parentQueryExpression = qe; } }
public List<FBEntity> FBEntityBllGetFBEntities(QueryExpression queryExpression) { List<EntityObject> list = BaseGetEntities(queryExpression); List<FBEntity> listResult = list.ToFBEntityList(); listResult.ForEach(entity => { GetFBEntityFull(entity); }); return listResult; }
public FBEntity GetFBEntity(QueryExpression qp) { try { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { return fbCommonBLL.GetFBEntity(qp); } } catch (Exception ex) { Tracer.Debug(ex.ToString()); throw ex; } }
public FBEntity FBEntityBLLGetFBEntity(QueryExpression queryExpression) { FBEntity entity = new FBEntity(); List<EntityObject> list = BaseGetEntities(queryExpression); EntityObject eo = list.FirstOrDefault(); if (eo == null) { return null; } entity.Entity = eo; GetFBEntityFull(entity); return entity; }
public List<FBEntity> GetCompany(QueryExpression qe) { //string strType=qe.QueryType; //switch (strType) //{ // case "T_FB_SUBJECTDEPTMENT": // listC = InnerGetCompany(qe); // break; // case "T_FB_SUBJECTCOMPANY": // listC = InnerGetCompany(qe); // break; // case "T_FB_SUBJECTPOST": // listC = InnerGetCompany(qe); // break; // case "T_FB_SUBJECTCOMPANYSET": // listC = InnerGetCompany(qe); // break; // default: // break; //} List<VirtualCompany> listC = InnerGetCompany(qe); List<FBEntity> listResult = listC.ToFBEntityList(); listResult.ForEach(company => { VirtualCompany vcCompany = company.Entity as VirtualCompany; List<FBEntity> listDepartMent = vcCompany.DepartmentCollection.ToFBEntityList(); RelationManyEntity rme = new RelationManyEntity(); rme.EntityType = typeof(VirtualDepartment).Name; rme.FBEntities = listDepartMent; company.CollectionEntity.Add(rme); listDepartMent.ForEach(department => { VirtualDepartment virtualDepartment = department.Entity as VirtualDepartment; List<FBEntity> listPost = virtualDepartment.PostCollection.ToFBEntityList(); RelationManyEntity rmePost = new RelationManyEntity(); rmePost.EntityType = typeof(VirtualPost).Name; rmePost.FBEntities = listPost; department.CollectionEntity.Add(rmePost); }); }); return listResult; }
/// <summary> /// 获取预算总帐 /// </summary> /// <param name="sbjectID"></param> /// <param name="companyID"></param> /// <param name="departmentID"></param> /// <param name="type"></param> /// <returns></returns> protected List<T_FB_BUDGETACCOUNT> FetchBudgetAccount(string sbjectID, string companyID, string departmentID, BudgetAccountBLL.AccountObjectType type) { QueryExpression qeTop = new QueryExpression(); QueryExpression qeFirst = qeTop; TryGetQueryExpression("T_FB_SUBJECT.SUBJECTID", sbjectID, ref qeTop); TryGetQueryExpression("OWNERCOMPANYID", companyID, ref qeTop); TryGetQueryExpression("OWNERDEPARTMENTID", departmentID, ref qeTop); // TryGetQueryExpression("ACCOUNTOBJECTTYPE", ((int)type).ToString(), ref qeTop); if (qeFirst.RelatedExpression == null) { return new List<T_FB_BUDGETACCOUNT>(); } qeFirst = qeFirst.RelatedExpression; qeFirst.QueryType = typeof(T_FB_BUDGETACCOUNT).Name; BudgetAccountBLL bll = new BudgetAccountBLL(); List<T_FB_BUDGETACCOUNT> listResult = bll.FetchBUDGETACCOUNT(qeFirst, type); return listResult; }
public static T_FB_SYSTEMSETTINGS GetSetting(QueryExpression qe) { try { if (etityT_FB_SYSTEMSETTINGS == null) { using (FBEntityBLL bll = new FBEntityBLL()) { etityT_FB_SYSTEMSETTINGS = bll.GetTable<T_FB_SYSTEMSETTINGS>().FirstOrDefault(); } } etityT_FB_SYSTEMSETTINGS.Settings = Settings; return etityT_FB_SYSTEMSETTINGS; } catch (Exception ex) { Tracer.Debug("获取预算初始化信息出错,出错信息:" + ex.ToString()); throw ex; } }
public List<FBEntity> QueryFBEntities(QueryExpression qe) { try { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { return fbCommonBLL.QueryFBEntities(qe); } } catch (Exception ex) { QueryExpression qeTemp = qe; string parameter = ""; while (qeTemp != null) { parameter += string.Format("Name:{0} ; Value:{1} ; QueryType:{2}", qeTemp.PropertyName, qeTemp.PropertyValue, qeTemp.QueryType) + "\r\n"; qeTemp = qeTemp.RelatedExpression; } Tracer.Debug(ex.ToString() + "\r\n参数: " + parameter); throw ex; } }
internal List<VirtualPost> GetVirtualPost(QueryExpression qe) { List<VirtualPost> listPost = new List<VirtualPost>(); string action = ((int)Utility.Permissions.Browse).ToString(); //if (listPost.Count == 0) //{ List<OrganizationWS.T_HR_POST> postList = organizationService.GetPostByEntityPerm(qe.VisitUserID, action, qe.VisitModuleCode).ToList(); postList.ForEach(postHR => { VirtualPost vp = new VirtualPost(); vp.ID = postHR.POSTID; vp.Name = postHR.T_HR_POSTDICTIONARY.POSTNAME; listPost.Add(vp); }); //} return listPost; }
public List<FBEntity> GetFBEntities(QueryExpression qp) { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { return fbCommonBLL.GetFBEntities(qp); } }
public List<FBEntity> QueryFBEntities(QueryExpression queryExpression) { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { List<string> listOrder = new List<string>(); listOrder.Add(typeof(T_FB_EXTENSIONORDERDETAIL).Name); listOrder.Add(typeof(T_FB_EXTENSIONALORDER).Name); listOrder.Add(typeof(T_FB_EXTENSIONALTYPE).Name); if (!listOrder.Contains(queryExpression.QueryType)) { return new List<FBEntity>(); } queryExpression.IsUnCheckRight = true; List<FBEntity> listDetail = fbCommonBLL.QueryFBEntities(queryExpression); return listDetail; } }
public List<string> RemoveExtensionOrder(List<string> orderIDs) { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { List<string> listResult = new List<string>(); fbCommonBLL.BeginTransaction(); QueryExpression qe = new QueryExpression(); qe.Operation = QueryExpression.Operations.Equal; qe.PropertyName = "ORDERID"; orderIDs.ForEach(item => { qe.PropertyValue = item; List<T_FB_EXTENSIONALORDER> list = fbCommonBLL.GetEntities<T_FB_EXTENSIONALORDER>(qe); list.ForEach(entity => { // 只能删除未提交的单据 if (((int)entity.CHECKSTATES) != (int)CheckStates.UnSubmit) { listResult.Add(item); } else { fbCommonBLL.Remove(entity); } }); }); return listResult; } }
private List<DebtInfo> GetDebtInfo(QueryExpression qe) { using (FBCommonBLL bll = new FBCommonBLL()) { List<DebtInfo> result = new List<DebtInfo>(); qe.Include = new string[] { typeof(T_FB_BORROWAPPLYDETAIL).Name }; qe.OrderBy = new string[] { "PLANREPAYDATE" }; List<T_FB_BORROWAPPLYMASTER> list = bll.GetEntities<T_FB_BORROWAPPLYMASTER>(qe); list = list.OrderBy(item => item.PLANREPAYDATE).ToList(); result = list.CreateList(item => { DebtInfo debtInfo = new DebtInfo(); decimal? deblt = item.T_FB_BORROWAPPLYDETAIL.Sum(detail => { return detail.UNREPAYMONEY; }); debtInfo.Debt = deblt == null ? 0 : deblt.Value; debtInfo.EmployeeID = item.OWNERID; debtInfo.OrderType = "T_FB_BORROWAPPLYMASTER"; debtInfo.OrderCode = item.BORROWAPPLYMASTERCODE; return debtInfo; }); return result; } }
/// <summary> /// 保存公司科目维护 /// 级联的去除不可用的部门科目和岗位科目 /// </summary> /// <param name="fbEntityList"></param> /// <returns></returns> public bool SaveListT_FB_SUBJECTCOMPANY(List<FBEntity> fbEntityList) { QueryExpression qeSCom = new QueryExpression(); QueryExpression qeTop = qeSCom; string StrCompanyID = "";//公司ID bool IsExistPlus = false; // 找出没有设置年度预算而后又允许年度预算的 List<T_FB_SUBJECTCOMPANY> inActivedlist = fbEntityList.CreateList(item => { T_FB_SUBJECTCOMPANY entity = item.Entity as T_FB_SUBJECTCOMPANY; if (string.IsNullOrEmpty(StrCompanyID)) { StrCompanyID = entity.OWNERCOMPANYID; QueryExpression qe = QueryExpression.Equal("SUBJECTCOMPANYID", entity.SUBJECTCOMPANYID); var baData = this.InnerGetEntities<T_FB_SUBJECTCOMPANY>(qe); if (baData.Count() > 0) { T_FB_SUBJECTCOMPANY OldSub = new T_FB_SUBJECTCOMPANY(); OldSub = baData.FirstOrDefault(); if (OldSub.ISYEARBUDGET == 0) { if (entity.ISYEARBUDGET == 1) { QueryExpression qeAccount = QueryExpression.Equal("OWNERCOMPANYID", entity.OWNERCOMPANYID); QueryExpression qeAccount1 = QueryExpression.Equal("T_FB_SUBJECT.SUBJECTID", entity.T_FB_SUBJECT != null ? entity.T_FB_SUBJECT.SUBJECTID : entity.T_FB_SUBJECTReference.EntityKey.EntityKeyValues[0].Value.ToString()); QueryExpression qeAccount2 = QueryExpression.Equal("ACCOUNTOBJECTTYPE", "1"); QueryExpression qeAccount3 = new QueryExpression(); qeAccount3.PropertyName = "USABLEMONEY"; qeAccount3.PropertyValue = "0"; qeAccount3.Operation = QueryExpression.Operations.LessThanOrEqual; qeAccount3.Operation = QueryExpression.Operations.LessThan;//是否有问题 qeAccount.RelatedType = QueryExpression.RelationType.And; qeAccount1.RelatedType = QueryExpression.RelationType.And; qeAccount2.RelatedType = QueryExpression.RelationType.And; qeAccount3.RelatedType = QueryExpression.RelationType.And; qeAccount.RelatedExpression = qeAccount1; qeAccount2.RelatedExpression = qeAccount1; qeAccount3.RelatedExpression = qeAccount2; qeAccount3.QueryType = typeof(T_FB_BUDGETACCOUNT).Name; //var baDataAccount = this.InnerGetEntities<T_FB_BUDGETACCOUNT>(qeAccount); //if(baDataAccount.Count() >0) //{ // //IsExistPlus= true; //} } } } } //return entity.ACTIVED != 1 ? entity : null; return entity; }); if (IsExistPlus) { return IsExistPlus; } //var baData = this.InnerGetEntities<T_FB_SUBJECTCOMPANY>(qeDept); // 查出公司科目相关的部门科目及岗位科目 inActivedlist.ForEach(item => { qeTop.RelatedExpression = QueryExpression.Equal("T_FB_SUBJECTCOMPANY.SUBJECTCOMPANYID", item.SUBJECTCOMPANYID); qeTop.RelatedType = QueryExpression.RelationType.Or; qeTop = qeTop.RelatedExpression; }); // 将部门科目及岗位科目置为不可用 if (qeSCom.RelatedExpression != null) { qeSCom = qeSCom.RelatedExpression; qeSCom.Include = new string[] { "T_FB_SUBJECTPOST" }; List<T_FB_SUBJECTDEPTMENT> inActiveDataList = GetEntities<T_FB_SUBJECTDEPTMENT>(qeSCom.RelatedExpression); inActiveDataList.ForEach(item => { item.ACTIVED = 0; item.T_FB_SUBJECTPOST.ToList().ForEach(itemPost => { itemPost.ACTIVED = 0; }); }); } if (fbEntityList.Count > 0) { //记录公司部门科目设置修改流水 SaveListT_FB_WFSUBJECTSETTING(fbEntityList, "1"); } return FBEntityBLLSaveList(fbEntityList); }
/// <summary> /// 可用额度汇总 /// </summary> /// <param name="qe"></param> /// <returns></returns> public List<FBEntity> QueryQueryBudgetAccount(QueryExpression qe) { // qe.VisitModuleCode = typeof(T_FB_BUDGETACCOUNT).Name; qe.Include = new string[] { "T_FB_SUBJECT" }; qe.QueryType = "T_FB_BUDGETACCOUNT"; if (qe.RightType != "QueryBudgetAccount") { qe.RightType = "QueryBudgetAccount"; } List<T_FB_BUDGETACCOUNT> listBudgetAccount = GetEntities<T_FB_BUDGETACCOUNT>(qe); List<T_FB_BUDGETACCOUNT> listBAPerson = listBudgetAccount.FindAll(item => { return !string.IsNullOrEmpty(item.OWNERID); }); List<string> listUserIDs = listBAPerson.CreateList(item => { return item.OWNERID; }); OrganizationBLL orgbll = new OrganizationBLL(); List<VirtualUser> listUser = orgbll.GetVirtualUser(listUserIDs); List<VirtualCompany> listCompany = orgbll.GetVirtualCompany(qe); List<VirtualDepartment> listDepartment = orgbll.GetVirtualDepartment(qe); List<VirtualPost> listPost = orgbll.GetVirtualPost(qe); listBudgetAccount.ForEach(item => { VirtualCompany vc = listCompany.FirstOrDefault(item2 => { return item2.ID == item.OWNERCOMPANYID; }); item.OWNERCOMPANYID = vc == null ? "" : vc.Name; VirtualDepartment vd = listDepartment.FirstOrDefault(item2 => { return item2.ID == item.OWNERDEPARTMENTID; }); item.OWNERDEPARTMENTID = vd == null ? "" : vd.Name; VirtualPost vp = listPost.FirstOrDefault(item2 => { return item2.ID == item.OWNERPOSTID; }); item.OWNERPOSTID = vp == null ? "" : vp.Name; VirtualUser vu = listUser.FirstOrDefault(item2 => { return item2.ID == item.OWNERID; }); item.OWNERID = vu == null ? "" : vu.Name; }); listBudgetAccount = listBudgetAccount.OrderByDescending(item => item.BUDGETYEAR) .ThenByDescending(item => item.BUDGETMONTH) .ThenBy(item => item.ACCOUNTOBJECTTYPE) .ThenBy(item => item.OWNERCOMPANYID) .ThenBy(item => item.OWNERDEPARTMENTID) .ThenBy(item => item.OWNERPOSTID) .ThenBy(item => item.OWNERID).ToList(); return listBudgetAccount.ToFBEntityList(); }
public List<EntityObject> GetEntities(string entityType) { using (BudgetAccountBLL bll = new BudgetAccountBLL()) { DateTime dtStart = DateTime.Parse(this.tbStart.Text); DateTime dtEnd = DateTime.Parse(this.tbEnd.Text); QueryExpression qeStart = new QueryExpression(); qeStart.PropertyName = FieldName.UpdateDate; qeStart.PropertyValue = this.tbStart.Text; qeStart.Operation = QueryExpression.Operations.GreaterThanOrEqual; QueryExpression qeEnd = new QueryExpression(); qeEnd.PropertyName = FieldName.UpdateDate; qeEnd.PropertyValue = this.tbEnd.Text; qeEnd.Operation = QueryExpression.Operations.LessThanOrEqual; QueryExpression qeCheckStatesPass = QueryExpression.Equal(FieldName.CheckStates, "2"); QueryExpression qeCheckStatesPassing = QueryExpression.Equal(FieldName.CheckStates, "1"); qeStart.RelatedExpression = qeEnd; qeEnd.RelatedExpression = qeCheckStatesPass; qeCheckStatesPass.RelatedType = QueryExpression.RelationType.Or; qeCheckStatesPass.RelatedExpression = qeCheckStatesPassing; qeStart.QueryType = entityType; qeStart.OrderByExpression = new OrderByExpression { OrderByType = OrderByType.Asc, PropertyName = FieldName.UpdateDate }; qeStart.IsNoTracking = true; return qeStart.Query(bll); } }
public List<VirtualCompany> InnerGetCompany(QueryExpression qe) { try { string action = ((int)Utility.Permissions.Browse).ToString(); List<OrganizationWS.T_HR_COMPANY> comList = organizationService.GetCompanyByEntityPerm(qe.VisitUserID, action, qe.VisitModuleCode).ToList(); List<OrganizationWS.V_DEPARTMENT> deptList = organizationService.GetDepartmentView(qe.VisitUserID, action, qe.VisitModuleCode).ToList(); List<OrganizationWS.V_POST> vpostList = organizationService.GetPostView(qe.VisitUserID, action, qe.VisitModuleCode).ToList(); //有效的部门和岗位 deptList = deptList.Where(s => s.EDITSTATE == "1").ToList(); vpostList = vpostList.Where(s => s.EDITSTATE == "1").ToList(); List<OrganizationWS.T_HR_POST> postList = new List<OrganizationWS.T_HR_POST>(); try { foreach (var ent in vpostList) { OrganizationWS.T_HR_POST pt = new OrganizationWS.T_HR_POST(); pt.POSTID = ent.POSTID; pt.FATHERPOSTID = ent.FATHERPOSTID; pt.CHECKSTATE = ent.CHECKSTATE; pt.EDITSTATE = ent.EDITSTATE; pt.T_HR_POSTDICTIONARY = new OrganizationWS.T_HR_POSTDICTIONARY(); pt.T_HR_POSTDICTIONARY.POSTDICTIONARYID = Guid.NewGuid().ToString(); pt.T_HR_POSTDICTIONARY.POSTNAME = ent.POSTNAME; pt.T_HR_DEPARTMENT = new OrganizationWS.T_HR_DEPARTMENT(); try { string strDepartmentid = deptList.Where(s => s.DEPARTMENTID == ent.DEPARTMENTID).FirstOrDefault().DEPARTMENTID; pt.T_HR_DEPARTMENT.DEPARTMENTID = strDepartmentid; postList.Add(pt); } catch (Exception ex) { SystemBLL.Debug("当前员工:"+qe.VisitUserID+"查询岗位所属部门错误,岗位名称 " + ent.POSTNAME + "岗位id" + ent.POSTID + "没找到所属部门,可能是权限不足导致"); } } } catch (Exception ex) { throw ex; } List<VirtualCompany> listCompany = new List<VirtualCompany>(); try { comList.ForEach(comHR => { List<VirtualDepartment> listDepartment = new List<VirtualDepartment>(); VirtualCompany vc = new VirtualCompany(); vc.ID = comHR.COMPANYID; vc.Name = comHR.CNAME; vc.DepartmentCollection = listDepartment; listCompany.Add(vc); List<OrganizationWS.V_DEPARTMENT> deptListPart = deptList.FindAll(item => { if (item.COMPANYID == null) { return false; } return item.COMPANYID == comHR.COMPANYID; }); deptListPart.ForEach(deptHR => { try { List<VirtualPost> listPost = new List<VirtualPost>(); VirtualDepartment vd = new VirtualDepartment(); vd.ID = deptHR.DEPARTMENTID; vd.Name = deptHR.DEPARTMENTNAME; vd.VirtualCompany = vc; vd.PostCollection = listPost; listDepartment.Add(vd); List<OrganizationWS.T_HR_POST> postListPart = postList.FindAll(item => { if (item.T_HR_DEPARTMENT.DEPARTMENTID == null) { return false; } return item.T_HR_DEPARTMENT.DEPARTMENTID == deptHR.DEPARTMENTID; }); postListPart.ForEach(postHR => { try { VirtualPost vp = new VirtualPost(); vp.ID = postHR.POSTID; vp.Name = postHR.T_HR_POSTDICTIONARY.POSTNAME; vp.VirtualCompany = vc; vp.VirtualDepartment = vd; listPost.Add(vp); } catch (Exception ex) { throw ex; } }); } catch (Exception ex) { throw ex; } }); }); } catch (Exception ex) { throw ex; } return listCompany; } catch (Exception ex) { SystemBLL.Debug(ex.ToString()); throw new Exception ("调用HR服务异常", ex); } }
internal List<VirtualCompany> GetVirtualCompany(QueryExpression qe) { List<VirtualCompany> listCompany = new List<VirtualCompany>(); string action = ((int)Utility.Permissions.Browse).ToString(); string ModuleCode = qe.VisitModuleCode; if (qe.VisitModuleCode == "T_FB_SUBJECTCOMPANY_COMPANY") { ModuleCode = "T_FB_SUBJECTCOMPANY"; } List<string> CompanyIds = new List<string>(); //在公司科目维护中去掉以下2个公司 CompanyIds.Add("427eb67d-35b4-47a9-9609-baf5355d2ed5");//深圳市神州通投资集团有限公司 CompanyIds.Add("7cd6c0a4-9735-476a-9184-103b962d3383");//初始化公司 List<OrganizationWS.T_HR_COMPANY> comList = organizationService.GetCompanyByEntityPerm(qe.VisitUserID, action, ModuleCode).ToList(); comList.ForEach(comHR => { VirtualCompany vc = new VirtualCompany(); vc.ID = comHR.COMPANYID; vc.Name = comHR.CNAME; if (ModuleCode == "T_FB_SUBJECTCOMPANY" || ModuleCode == "T_FB_SUBJECTCOMPANYSET") { if (!(CompanyIds.IndexOf(vc.ID) > -1)) { listCompany.Add(vc); } } else { listCompany.Add(vc); } }); return listCompany; }
internal List<VirtualDepartment> GetVirtualDepartment(QueryExpression qe) { List<VirtualDepartment> listDepartment = new List<VirtualDepartment>(); string action = ((int)Utility.Permissions.Browse).ToString(); //if (listDepartment.Count == 0) //{ List<OrganizationWS.V_DEPARTMENT> deptList = organizationService.GetDepartmentView(qe.VisitUserID, action, qe.VisitModuleCode).ToList(); deptList.ForEach(deptHR => { VirtualDepartment vd = new VirtualDepartment(); vd.ID = deptHR.DEPARTMENTID; vd.Name = deptHR.DEPARTMENTNAME; listDepartment.Add(vd); }); //} return listDepartment; }