public SaveResult Save(FBEntity fbEntity) { SaveResult result = new SaveResult(); try { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { result = fbCommonBLL.FBCommSaveEntity(fbEntity); } } catch (Exception ex) { result.Successful = false; result.Exception = ex.Message; } return(result); }
public SaveResult Save(SaveEntity saveEntity) { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { SaveResult result = new SaveResult(); try { result = fbCommonBLL.Save(saveEntity); } catch (Exception ex) { result.Successful = false; result.Exception = ex.Message; Tracer.Debug(ex.ToString()); } return(result); } }
public List <EntityObject> GetTravelExpApplyMaster(string travelExpApplyMasterID) { using (FBCommonBLL bll = new FBCommonBLL()) { List <EntityObject> list = new List <EntityObject>(); QueryExpression qe = QueryExpression.Equal("T_FB_EXTENSIONALORDER.TRAVELEXPAPPLYMASTERID", travelExpApplyMasterID); qe.QueryType = typeof(T_FB_TRAVELEXPAPPLYMASTER).Name; FBEntity entitys = bll.GetFBEntity(qe); if (entitys == null || entitys.Entity == null) { return(null); } IEnumerable listResult = entitys as IEnumerable; foreach (var entity in listResult) { list.Add(entity as EntityObject); } return(list); } }
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; } }
public bool HRPersonPostChanged(T_HR_EMPLOYEEPOSTCHANGE personChange, ref string message) { try { using (FBCommonBLL bll = new FBCommonBLL()) { var setting = SystemBLL.GetSetting(null); var qePostID = QueryExpression.Equal(FieldName.OwnerPostID, personChange.FROMPOSTID); var qeOwnerID = QueryExpression.Equal(FieldName.OwnerID, personChange.T_HR_EMPLOYEE.EMPLOYEEID); var qeSubjectID = QueryExpression.Equal("T_FB_SUBJECT.SUBJECTID", setting.MONEYASSIGNSUBJECTID); qePostID.RelatedExpression = qeOwnerID; qeOwnerID.RelatedExpression = qeSubjectID; var entity = bll.GetEntity <T_FB_BUDGETACCOUNT>(qePostID); if (entity != null) { entity.OWNERCOMPANYID = personChange.TOCOMPANYID; entity.OWNERDEPARTMENTID = personChange.TODEPARTMENTID; entity.OWNERPOSTID = personChange.TOPOSTID; entity.OWNERID = personChange.T_HR_EMPLOYEE.EMPLOYEEID; bll.BassBllSave(entity, FBEntityState.Modified); } return(true); } } catch (Exception ex) { message = "修改异动后的预算活动经费数据异常!"; Tracer.Debug(message + " 异常信息: " + ex.ToString()); return(false); } }
public SaveResult Save(FBEntity fbEntity) { SaveResult result = new SaveResult(); try { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { fbCommonBLL.BeginTransaction(); result = fbCommonBLL.FBCommSaveEntity(fbEntity); if (result.Successful) { fbCommonBLL.CommitTransaction(); } } } catch (Exception ex) { result.Successful = false; result.Exception = ex.Message; Tracer.Debug(ex.ToString()); } return(result); }
public T_FB_EXTENSIONALORDER UpdateExtensionOrder(string strModelCode, string orderID, string strCheckStates, ref string strMsg) { using (FBCommonBLL fbCommonBLL = new FBCommonBLL()) { try { SystemBLL.Debug("UpdateExtensionOrder方法已被调用,参数:strModelCode: " + strModelCode + ", orderID: " + orderID + ", strCheckStates: " + strCheckStates); QueryExpression queryExpression = QueryExpression.Equal("ORDERID", orderID); if (strModelCode == "Travel") { QueryExpression tempQE = QueryExpression.Equal("TravelSubject", "1"); tempQE.RelatedExpression = QueryExpression.Equal("EXTENSIONALTYPECODE", "CCPX"); queryExpression.RelatedExpression = tempQE; } //查出保存的外部单据 queryExpression.QueryType = typeof(T_FB_EXTENSIONALORDER).Name; queryExpression.IsNoTracking = true; List <FBEntity> listDetail = fbCommonBLL.QueryFBEntities(queryExpression); //如果存在外部单据 if (listDetail.Count > 0) { var saveFBEntity = listDetail[0]; saveFBEntity.Entity.SetValue("CHECKSTATES", Decimal.Parse(strCheckStates)); saveFBEntity.FBEntityState = FBEntityState.Modified; //var temp = fbCommonBLL.FBCommSaveEntity(listDetail[0]); SaveResult temp = new SaveResult(); try { temp.FBEntity = fbCommonBLL.SaveT_FB_EXTENSIONALORDER(listDetail[0]); temp.Successful = true; } catch (Exception ex) { temp.Exception = ex.Message; temp.Successful = false; } if (temp.Successful) { return(temp.FBEntity.Entity as T_FB_EXTENSIONALORDER); } else { strMsg = temp.Exception; } } else { strMsg = "没有可操作的数据"; } } catch (Exception ex) { strMsg = ex.Message; if (!(ex is FBBLLException)) { // strMsg = "单据审核异常,请联系管理员"; Tracer.Debug("审核" + strModelCode + "的单据[" + orderID + "]出现异常,错误消息为:" + ex.ToString()); } } return(null); } }
public int UpdateCheckState(string strModelCode, string orderID, string strCheckStates, ref string strMsg) { int i = -1; try { SystemBLL.Debug("UpdateCheckState方法已被调用,参数:strModelCode: " + strModelCode + ", orderID: " + orderID + ", strCheckStates: " + strCheckStates); // begin 用于出差报销、事项审批的手机提交 if (strModelCode == "Travel") { var tempResult = UpdateExtensionOrder(strModelCode, orderID, strCheckStates, ref strMsg); return((tempResult == null) ? -1 : 1); } // end FBCommonService fbCommonService = new FBCommonService(); List <EntityInfo> EntityInfoList = fbCommonService.GetEntityInfoList(); if (EntityInfoList == null) { strMsg = "预算服务初始化异常,请重试。"; return(-1); } if (EntityInfoList.Count() == 0) { strMsg = "预算服务初始化异常,请重试。"; return(-1); } string strTypeName = ""; string strKeyName = ""; CheckStates cs = CheckStates.UnSubmit; switch (strCheckStates) { case "1": cs = CheckStates.Approving; break; case "2": cs = CheckStates.Approved; break; case "3": cs = CheckStates.UnApproved; break; default: break; } var entityInfo = EntityInfoList.Where(t => t.Type == strModelCode).FirstOrDefault(); strTypeName = entityInfo.Type; strKeyName = entityInfo.KeyName; /////add 2012.12.12 /////传入报销月份为时间去和当前时间判断,如果不在同一年 /////说明该报销单是跨年的,则不能进行审核操作,即当年的报销单只能在当年进行报销 //if (dNewCheckStates == FBAEnums.CheckStates.Approved || dNewCheckStates == FBAEnums.CheckStates.Approving) //{ // if (IsOverYear(entity.BUDGETARYMONTH)) // { // strMsg = "报销单跨年后只能终审不通过(财务规定)"; // Tracer.Debug(strMsg); // return; // } //} using (FBCommonBLL bllCommon = new FBCommonBLL()) { bllCommon.BeginTransaction(); SystemBLL.Debug("BeginTransaction " + strModelCode + " 的单据[" + orderID + "]"); try { QueryExpression qe = QueryExpression.Equal(strKeyName, orderID); qe.QueryType = strTypeName; var data = qe.Query(bllCommon); var order = data.FirstOrDefault(); if (order == null) { strMsg = "没有可操作的数据"; return(-1); } bllCommon.AuditFBEntityWithoutFlow(order, cs, ref strMsg); i = 1; if (string.IsNullOrEmpty(strMsg)) { bllCommon.CommitTransaction(); SystemBLL.Debug("CommitTransaction " + strModelCode + " 的单据[" + orderID + "]"); } else { bllCommon.RollbackTransaction(); SystemBLL.Debug("RollbackTransaction 审核" + strModelCode + "的单据[" + orderID + "]失败,提示消息为:" + strMsg); } } catch (Exception ex) { bllCommon.RollbackTransaction(); SystemBLL.Debug("RollbackTransaction 审核" + strModelCode + "的单据[" + orderID + "]失败,提示消息为:" + strMsg); throw ex; } } } catch (Exception ex) { strMsg = "单据审核异常,请联系管理员"; throw ex; } // 把消息通过异常机制返回 if (!string.IsNullOrWhiteSpace(strMsg)) { SystemBLL.Debug("审核" + strModelCode + "的单据[" + orderID + "]失败,提示消息为:" + strMsg); throw new Exception(strMsg); } return(i); }