/// <summary> /// 新建一个Bill /// </summary> /// <param name="loggingSession">当前登录用户的Session信息</param> /// <param name="bill">Bill</param> /// <returns>操作的状态</returns> public BillOperateStateService InsertBill(LoggingSessionInfo loggingSession, BillModel bill) { //获取表单类别 BillKindModel billKind = GetBillKindById(loggingSession, bill.KindId); if (billKind == null) { return(BillOperateStateService.NotExistKind); } //获取表单状态 BillStatusModel beginBillStatus = GetBillBeginStatus(loggingSession, bill.KindId); if (beginBillStatus == null) { return(BillOperateStateService.NotSetBeginStatus); } BillActionModel billCreateAction = GetBillAction(loggingSession, bill.KindId, BillActionType.Create); if (billCreateAction == null) { return(BillOperateStateService.NotSetCreateAction); } Hashtable hashTable = new Hashtable(); hashTable.Add("RoleId", GetBasicRoleId(loggingSession.CurrentUserRole.RoleId)); hashTable.Add("BillKindId", bill.KindId); hashTable.Add("BillActionId", billCreateAction.Id); hashTable.Add("PreviousBillStatus", beginBillStatus.Status); hashTable.Add("LanguageKindId", loggingSession.CurrentLanguageKindId); BillActionRoleModel billCreateActionRole = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionRoleModel>("BillActionRole.SelectByKindIdAndActionIdAndRoleIdAndPreviousStatus", hashTable); if (billCreateActionRole == null) { return(BillOperateStateService.NotAllowCreate); } ////判断是否超出系统设置时间 //if (billCreateActionRole.ValidateDate == 0) //{ // return BillOperateStateService.OutDateTime; //} if (billKind.MoneyFlag == 1) { if ((bill.Money < billCreateActionRole.MinMoney) || (bill.Money > billCreateActionRole.MaxMoney)) { return(BillOperateStateService.OutOfMoneyScope); } } bill.AddUserId = loggingSession.CurrentUser.User_Id; bill.AddDate = GetCurrentDateTime(); bill.Status = billCreateActionRole.CurrentStatus; cSqlMapper.Instance(loggingSession.CurrentLoggingManager).Insert("Bill.Insert", bill); InsertBillActionLog(loggingSession, bill, billCreateAction, billCreateActionRole, null); return(BillOperateStateService.CreateSuccessful); }
/// <summary> /// 新建一个Bill /// </summary> /// <param name="loggingSession">当前登录用户的Session信息</param> /// <param name="bill">Bill</param> /// <returns>操作的状态</returns> public BillOperateStateService InsertBill(BillModel bill) { //获取表单类别 BillKindModel billKind = GetBillKindById(bill.KindId); if (billKind == null) { return(BillOperateStateService.NotExistKind); } //获取表单状态 BillStatusModel beginBillStatus = GetBillBeginStatus(bill.KindId); if (beginBillStatus == null) { return(BillOperateStateService.NotSetBeginStatus); } BillActionModel billCreateAction = GetBillAction(bill.KindId, BillActionType.Create); if (billCreateAction == null) { return(BillOperateStateService.NotSetCreateAction); } //获取角色与操作集合 BillActionRoleModel billCreateActionRole = new BillActionRoleModel(); DataSet ds = new DataSet(); ds = billService.GetbillCreateActionRole(bill.KindId, billCreateAction.Id, GetBasicRoleId(this.loggingSessionInfo.CurrentUserRole.RoleId), beginBillStatus.Status); if (ds != null && ds.Tables[0].Rows.Count > 0) { billCreateActionRole = DataTableToObject.ConvertToObject <BillActionRoleModel>(ds.Tables[0].Rows[0]); } if (billCreateActionRole == null) { return(BillOperateStateService.NotAllowCreate); } //if (billKind.MoneyFlag == 1) //{ // if ((bill.Money < billCreateActionRole.MinMoney) || (bill.Money > billCreateActionRole.MaxMoney)) // { // return BillOperateStateService.OutOfMoneyScope; // } //} bill.AddUserId = this.loggingSessionInfo.CurrentUser.User_Id; bill.AddDate = GetCurrentDateTime(); bill.Status = billCreateActionRole.CurrentStatus; //插入bill信息 billService.InsertBill(bill); //InsertBillActionLog(loggingSession, bill, billCreateAction, billCreateActionRole, null); return(BillOperateStateService.CreateSuccessful); }
/// <summary> /// 添加一个角色与表单操作的关系 /// </summary> /// <param name="loggingSession">当前登录的信息</param> /// <param name="billActionRole">角色与表单操作的关系</param> /// <returns></returns> public bool InsertBillActionRole(BillActionRoleModel billActionRole) { if (string.IsNullOrEmpty(billActionRole.Id)) { billActionRole.Id = this.NewGuid(); } billActionRole.CreateUserID = this.loggingSessionInfo.CurrentUser.User_Id; billActionRole.CreateTime = this.GetCurrentDateTime(); return(billService.InsertBillActionRole(billActionRole)); }
private BillActionRoleModel currBillActionRoleData() { BillActionRoleModel billAcRoModel = new BillActionRoleModel(); billAcRoModel.KindId = this.cbBillKind.SelectedValue; billAcRoModel.RoleId = this.cbRole.SelectedValue; billAcRoModel.ActionId = this.cbBillAction.SelectedValue; billAcRoModel.PreviousStatus = this.cbPrevBillStatus.SelectedValue; billAcRoModel.CurrentStatus = this.cbCurrBillStatus.SelectedValue; billAcRoModel.MinMoney = int.Parse(this.tbMinMoney.Text); billAcRoModel.MaxMoney = int.Parse(this.tbMaxMoney.Text); return(billAcRoModel); }
/// <summary> /// 添加一个角色与表单操作的关系 /// </summary> /// <param name="loggingSession">当前登录的信息</param> /// <param name="billActionRole">角色与表单操作的关系</param> /// <returns></returns> public bool InsertBillActionRole(LoggingSessionInfo loggingSession, BillActionRoleModel billActionRole) { if (string.IsNullOrEmpty(billActionRole.Id)) { billActionRole.Id = this.NewGuid(); } billActionRole.CreateUserID = loggingSession.CurrentUser.User_Id; billActionRole.CreateTime = this.GetCurrentDateTime(); cSqlMapper.Instance().Insert("BillActionRole.Insert", billActionRole); return(true); }
/// <summary> /// 添加一个角色与表单操作的关系 /// </summary> /// <param name="billActionRole"></param> /// <returns></returns> public bool InsertBillActionRole(BillActionRoleModel billActionRole) { string sql = "insert into t_def_bill_action_role " + " (bill_action_role_id, bill_kind_id, bill_action_id, role_id, " + " pre_bill_status, cur_bill_status, min_money, max_money, " + " create_user_id, create_time,customer_id) " + " values " + " ('" + billActionRole.Id + "','" + billActionRole.KindId + "','" + billActionRole.ActionId + "','" + billActionRole.RoleId + "','" + billActionRole.PreviousStatus + "','" + billActionRole.CurrentStatus + "','" + billActionRole.MinMoney + "','" + billActionRole.MaxMoney + "', " + " '" + billActionRole.CreateUserID + "','" + billActionRole.CreateTime + "','" + this.loggingSessionInfo.CurrentLoggingManager.Customer_Id + "' customer_id)"; this.SQLHelper.ExecuteNonQuery(sql); return(true); }
private void saveBillActionRoleData(BillActionRoleModel data) { bool save = new cBillService().InsertBillActionRole(loggingSessionInfo, data); if (save) { this.Redirect("保存成功", InfoType.Info, this.Request.QueryString["from"] ?? "bill_role_action_query.aspx"); //this.InfoBox.ShowPopInfo("保存成功"); //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>go_back();</script>"); } else { this.InfoBox.ShowPopError("保存失败"); } }
/// <summary> /// 插入一个Bill的动作日志 /// </summary> /// <param name="loggingSession">当前登录用户的Session信息</param> /// <param name="bill">Bill信息</param> /// <param name="billAction">Bill的动作信息</param> /// <param name="billActionRole">Bill在当前角色下与Bill的动作的关联信息</param> /// <param name="remark">批注</param> private void InsertBillActionLog(LoggingSessionInfo loggingSession , BillModel bill , BillActionModel billAction, BillActionRoleModel billActionRole, string remark) { //BillActionLogInfo billActionLog = new BillActionLogInfo(); //billActionLog.Id = NewGuid(); //billActionLog.ActionUserId = loggingSession.CurrentUser.Id; //billActionLog.ActionDate = GetCurrentDateTime(); //billActionLog.BillId = bill.Id; //billActionLog.BillActionId = billAction.Id; //billActionLog.PreviousStatus = billActionRole.PreviousStatus; //billActionLog.CurrentStatus = billActionRole.CurrentStatus; //billActionLog.ActionComment = remark; //OraMapper.Instance().Insert("BillActionLog.Insert", billActionLog); }
/// <summary> /// 批准一个Bill(事务由调用方负责) Jermyn2012-09-17 /// </summary> /// <param name="loggingSession">当前登录用户的Session信息</param> /// <param name="billId">Bill</param> /// <param name="remark">批注</param> /// <param name="strBillActionType">状态</param> /// <param name="strError">输出错误参数</param> /// <returns>操作的状态</returns> public BillOperateStateService ApproveBill(string billId, string remark, BillActionType strBillActionType, out string strError) { if (strBillActionType.Equals("")) { strError = "BillActionType.Approve"; strBillActionType = BillActionType.Approve; } BillModel bill = GetBillById(billId); if (bill == null) { strError = "BillOperateStateService.NotExist"; return(BillOperateStateService.NotExist); } BillKindModel billKind = GetBillKindById(bill.KindId); if (billKind == null) { strError = "BillOperateStateService.NotExistKind"; return(BillOperateStateService.NotExistKind); } BillStatusModel currentBillStatus = GetBillStatusByKindIdAndStatus(billKind.Id, bill.Status); if (currentBillStatus == null) { strError = "BillOperateStateService.NotExistStatus"; return(BillOperateStateService.NotExistStatus); } BillActionModel billApproveAction = GetBillAction(bill.KindId, strBillActionType); if (billApproveAction == null) { strError = "BillOperateStateService.NotSetApproveAction"; return(BillOperateStateService.NotSetApproveAction); } //获取审批权限 DataSet ds = billService.GetbillCreateActionRole(bill.KindId, billApproveAction.Id, GetBasicRoleId(this.loggingSessionInfo.CurrentUserRole.RoleId), currentBillStatus.Status); BillActionRoleModel billApproveActionRole = new BillActionRoleModel(); if (ds != null && ds.Tables[0].Rows.Count > 0) { billApproveActionRole = DataTableToObject.ConvertToObject <BillActionRoleModel>(ds.Tables[0].Rows[0]); } if (billApproveActionRole == null) { strError = "BillOperateStateService.NotAllowApprove--" //+ "RoleId:" + GetBasicRoleId(loggingSession.CurrentUserRole.RoleId).ToString() + "----" //+ "BillKindId:" + bill.KindId + "----" //+ "BillActionId:" + billApproveAction.Id + "----" //+ "PreviousBillStatus:" + currentBillStatus.Status + "----" + "InoutStatus" + bill.Status + "--" + bill.BillStatusDescription + "--" + bill.Id ; return(BillOperateStateService.NotAllowApprove); } //if (billKind.MoneyFlag == 1) //{ // if ((bill.Money < billApproveActionRole.MinMoney) || (bill.Money > billApproveActionRole.MaxMoney)) // { // strError = "BillOperateStateService.OutOfMoneyScope"; // return BillOperateStateService.OutOfMoneyScope; // } //} bill.ModifyUserId = this.loggingSessionInfo.CurrentUser.User_Id; bill.ModifyDate = GetCurrentDateTime(); bill.Status = billApproveActionRole.CurrentStatus; BillStatusModel nextBillStatus = GetBillStatusByKindIdAndStatus(billKind.Id, billApproveActionRole.CurrentStatus); if (nextBillStatus == null) { strError = "BillOperateStateService.NotExistStatus"; return(BillOperateStateService.NotExistStatus); } //修改bill billService.UpdateBill(bill); //InsertBillActionLog(loggingSession, bill, billApproveAction, billApproveActionRole, remark); strError = "BillOperateStateService.ApproveSuccessful"; return(BillOperateStateService.ApproveSuccessful); }
/// <summary> /// 批准一个Bill(事务由调用方负责) /// </summary> /// <param name="loggingSession">当前登录用户的Session信息</param> /// <param name="billId">Bill</param> /// <param name="remark">批注</param> /// <param name="strBillActionType">状态</param> /// <returns>操作的状态</returns> public BillOperateStateService ApproveBill(string billId, string remark, BillActionType strBillActionType) { if (strBillActionType.Equals("")) { strBillActionType = BillActionType.Approve; } BillModel bill = GetBillById(billId); if (bill == null) { return(BillOperateStateService.NotExist); } BillKindModel billKind = GetBillKindById(bill.KindId); if (billKind == null) { return(BillOperateStateService.NotExistKind); } BillStatusModel currentBillStatus = GetBillStatusByKindIdAndStatus(billKind.Id, bill.Status); if (currentBillStatus == null) { return(BillOperateStateService.NotExistStatus); } BillActionModel billApproveAction = GetBillAction(bill.KindId, strBillActionType); if (billApproveAction == null) { return(BillOperateStateService.NotSetApproveAction); } Hashtable hashTable = new Hashtable(); BillActionRoleModel billApproveActionRole = new BillActionRoleModel(); DataSet ds = new DataSet(); ds = billService.GetbillCreateActionRole(bill.KindId, billApproveAction.Id, GetBasicRoleId(this.loggingSessionInfo.CurrentUserRole.RoleId), currentBillStatus.Status); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { billApproveActionRole = DataTableToObject.ConvertToObject <BillActionRoleModel>(ds.Tables[0].Rows[0]); } if (billApproveActionRole == null) { return(BillOperateStateService.NotAllowApprove); } //if (billKind.MoneyFlag == 1) //{ // if ((bill.Money < billApproveActionRole.MinMoney) || (bill.Money > billApproveActionRole.MaxMoney)) // { // return BillOperateStateService.OutOfMoneyScope; // } //} bill.ModifyUserId = this.loggingSessionInfo.CurrentUser.User_Id; bill.ModifyDate = GetCurrentDateTime(); bill.Status = billApproveActionRole.CurrentStatus; BillStatusModel nextBillStatus = GetBillStatusByKindIdAndStatus(billKind.Id, billApproveActionRole.CurrentStatus); if (nextBillStatus == null) { return(BillOperateStateService.NotExistStatus); } billService.UpdateBill(bill); //InsertBillActionLog(loggingSession, bill, billApproveAction, billApproveActionRole, remark); return(BillOperateStateService.ApproveSuccessful); }
/// <summary> /// 判断能否添加一个角色与表单操作的关系 /// </summary> /// <param name="loggingSession">当前登录的信息</param> /// <param name="billActionRole">要添加的角色与表单操作的关系</param> /// <returns></returns> public BillActionRoleCheckState CheckAddBillActionRole(LoggingSessionInfo loggingSession, BillActionRoleModel billActionRole) { Hashtable ht = new Hashtable(); //查询表单操作 ht.Add("BillActionId", billActionRole.ActionId); BillActionModel bill_action = new BillActionModel(); DataSet ds = billService.GetBillActionByActionId(billActionRole.ActionId); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { bill_action = DataTableToObject.ConvertToObject <BillActionModel>(ds.Tables[0].Rows[0]); } if (bill_action == null) { return(BillActionRoleCheckState.NotExistAction); } //查询角色与表单的关系列表 ht.Add("BillKindID", billActionRole.KindId); ht.Add("RoleID", billActionRole.RoleId); IList <SelectBillActionRoleInfo> bill_action_role_lst = this.SelectBillActionRoleList(ht); //角色与表单的关系为空,可以添加 if (bill_action_role_lst == null || bill_action_role_lst.Count == 0) { return(BillActionRoleCheckState.Successful); } //一个角色对一个表单,只能有一个新建操作 if (bill_action.CreateFlag == 1) { foreach (BillActionRoleModel m in bill_action_role_lst) { if (m.RoleId == billActionRole.RoleId && m.ActionId == billActionRole.ActionId) { return(BillActionRoleCheckState.ExistCreate); } } return(BillActionRoleCheckState.Successful); } //一个角色对一个表单,对同一个前置状态,只能有一个修改、审核、退回操作 foreach (BillActionRoleModel m in bill_action_role_lst) { if (m.RoleId == billActionRole.RoleId && m.ActionId == billActionRole.ActionId && m.PreviousStatus == billActionRole.PreviousStatus) { //修改操作 if (bill_action.ModifyFlag == 1) { return(BillActionRoleCheckState.ExistModify); } else { //审核操作 if (bill_action.ApproveFlag == 1) { return(BillActionRoleCheckState.ExistApprove); } else { //退回操作 if (bill_action.RejectFlag == 1) { return(BillActionRoleCheckState.ExistReject); } else { //删除操作 return(BillActionRoleCheckState.ExistCancel); } } } } } return(BillActionRoleCheckState.Successful); }
/// <summary> /// 批准一个Bill(事务由调用方负责) Jermyn2012-09-17 /// </summary> /// <param name="loggingSession">当前登录用户的Session信息</param> /// <param name="billId">Bill</param> /// <param name="remark">批注</param> /// <param name="strBillActionType">状态</param> /// <param name="strError">输出错误参数</param> /// <returns>操作的状态</returns> public BillOperateStateService ApproveBill(LoggingSessionInfo loggingSession, string billId, string remark, BillActionType strBillActionType, out string strError) { if (strBillActionType.Equals("")) { strError = "BillActionType.Approve"; strBillActionType = BillActionType.Approve; } BillModel bill = GetBillById(loggingSession, billId); if (bill == null) { strError = "BillOperateStateService.NotExist"; return(BillOperateStateService.NotExist); } BillKindModel billKind = GetBillKindById(loggingSession, bill.KindId); if (billKind == null) { strError = "BillOperateStateService.NotExistKind"; return(BillOperateStateService.NotExistKind); } BillStatusModel currentBillStatus = GetBillStatusByKindIdAndStatus(loggingSession, billKind.Id, bill.Status); if (currentBillStatus == null) { strError = "BillOperateStateService.NotExistStatus"; return(BillOperateStateService.NotExistStatus); } BillActionModel billApproveAction = GetBillAction(loggingSession, bill.KindId, strBillActionType); if (billApproveAction == null) { strError = "BillOperateStateService.NotSetApproveAction"; return(BillOperateStateService.NotSetApproveAction); } Hashtable hashTable = new Hashtable(); //hashTable.Add("RoleId", loggingSession.CurrentUserRole.RoleId); hashTable.Add("RoleId", GetBasicRoleId(loggingSession.CurrentUserRole.RoleId)); hashTable.Add("BillKindId", bill.KindId); hashTable.Add("BillActionId", billApproveAction.Id); hashTable.Add("PreviousBillStatus", currentBillStatus.Status); hashTable.Add("LanguageKindId", loggingSession.CurrentLanguageKindId); BillActionRoleModel billApproveActionRole = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionRoleModel>("BillActionRole.SelectByKindIdAndActionIdAndRoleIdAndPreviousStatus", hashTable); if (billApproveActionRole == null) { strError = "BillOperateStateService.NotAllowApprove--" //+ "RoleId:" + GetBasicRoleId(loggingSession.CurrentUserRole.RoleId).ToString() + "----" //+ "BillKindId:" + bill.KindId + "----" //+ "BillActionId:" + billApproveAction.Id + "----" //+ "PreviousBillStatus:" + currentBillStatus.Status + "----" + "InoutStatus" + bill.Status + "--" + bill.BillStatusDescription + "--" + bill.Id ; return(BillOperateStateService.NotAllowApprove); } //判断是否超出系统设置时间 //if (billApproveActionRole.ValidateDate == 0) //{ // return BillOperateStateService.OutDateTime; //} if (billKind.MoneyFlag == 1) { if ((bill.Money < billApproveActionRole.MinMoney) || (bill.Money > billApproveActionRole.MaxMoney)) { strError = "BillOperateStateService.OutOfMoneyScope"; return(BillOperateStateService.OutOfMoneyScope); } } bill.ModifyUserId = loggingSession.CurrentUser.User_Id; bill.ModifyDate = GetCurrentDateTime(); bill.Status = billApproveActionRole.CurrentStatus; BillStatusModel nextBillStatus = GetBillStatusByKindIdAndStatus(loggingSession, billKind.Id, billApproveActionRole.CurrentStatus); if (nextBillStatus == null) { strError = "BillOperateStateService.NotExistStatus"; return(BillOperateStateService.NotExistStatus); } cSqlMapper.Instance(loggingSession.CurrentLoggingManager).Update("Bill.Update", bill); InsertBillActionLog(loggingSession, bill, billApproveAction, billApproveActionRole, remark); strError = "BillOperateStateService.ApproveSuccessful"; return(BillOperateStateService.ApproveSuccessful); }
/// <summary> /// 删除一个Bill(事务由调用方负责) /// </summary> /// <param name="loggingSession">当前登录用户的Session信息</param> /// <param name="billId">Bill</param> /// <param name="remark">批注</param> /// <returns>操作的状态</returns> private BillOperateStateService DeleteBill(LoggingSessionInfo loggingSession, string billId, string remark) { BillModel bill = GetBillById(loggingSession, billId); if (bill == null) { return(BillOperateStateService.NotExist); } BillKindModel billKind = GetBillKindById(loggingSession, bill.KindId); if (billKind == null) { return(BillOperateStateService.NotExistKind); } BillStatusModel billStatus = GetBillStatusByKindIdAndStatus(loggingSession, billKind.Id, bill.Status); if (billStatus == null) { return(BillOperateStateService.NotExistStatus); } BillStatusModel billDeleteStatus = GetBillDeleteStatus(loggingSession, billKind.Id); if (billDeleteStatus == null) { return(BillOperateStateService.NotSetDeleteStatus); } BillActionModel billDeleteAction = GetBillAction(loggingSession, bill.KindId, BillActionType.Cancel); if (billDeleteAction == null) { return(BillOperateStateService.NotSetModifyAction); } Hashtable hashTable = new Hashtable(); //hashTable.Add("RoleId", loggingSession.CurrentUserRole.RoleId); hashTable.Add("RoleId", GetBasicRoleId(loggingSession.CurrentUserRole.RoleId)); hashTable.Add("BillKindId", bill.KindId); hashTable.Add("BillActionId", billDeleteAction.Id); hashTable.Add("PreviousBillStatus", billStatus.Status); hashTable.Add("LanguageKindId", loggingSession.CurrentLanguageKindId); BillActionRoleModel billDeleteActionRole = cSqlMapper.Instance().QueryForObject <BillActionRoleModel>("BillActionRole.SelectByKindIdAndActionIdAndRoleIdAndPreviousStatus", hashTable); if (billDeleteActionRole == null) { return(BillOperateStateService.NotAllowCancel); } ////判断是否超出系统设置时间 //if (billDeleteActionRole.ValidateDate == 0) //{ // return BillOperateStateService.OutDateTime; //} if (billKind.MoneyFlag == 1) { if ((bill.Money < billDeleteActionRole.MinMoney) || (bill.Money > billDeleteActionRole.MaxMoney)) { return(BillOperateStateService.OutOfMoneyScope); } } bill.ModifyUserId = loggingSession.CurrentUser.User_Id; bill.ModifyDate = GetCurrentDateTime(); bill.Status = billDeleteActionRole.CurrentStatus; cSqlMapper.Instance().Update("Bill.Update", bill); InsertBillActionLog(loggingSession, bill, billDeleteAction, billDeleteActionRole, remark); return(BillOperateStateService.CancelSuccessful); }
/// <summary> /// 判断能否添加一个角色与表单操作的关系 /// </summary> /// <param name="loggingSession">当前登录的信息</param> /// <param name="billActionRole">要添加的角色与表单操作的关系</param> /// <returns></returns> public BillActionRoleCheckState CheckAddBillActionRole(LoggingSessionInfo loggingSession, BillActionRoleModel billActionRole) { Hashtable ht = new Hashtable(); //查询表单操作 ht.Add("BillActionId", billActionRole.ActionId); BillActionModel bill_action = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.SelectById", ht); if (bill_action == null) { return(BillActionRoleCheckState.NotExistAction); } //查询角色与表单的关系列表 ht.Add("BillKindID", billActionRole.KindId); ht.Add("RoleID", billActionRole.RoleId); IList <SelectBillActionRoleInfo> bill_action_role_lst = this.SelectBillActionRoleList(loggingSession, ht); //角色与表单的关系为空,可以添加 if (bill_action_role_lst == null || bill_action_role_lst.Count == 0) { return(BillActionRoleCheckState.Successful); } //一个角色对一个表单,只能有一个新建操作 if (bill_action.CreateFlag == 1) { foreach (BillActionRoleModel m in bill_action_role_lst) { if (m.RoleId == billActionRole.RoleId && m.ActionId == billActionRole.ActionId) { return(BillActionRoleCheckState.ExistCreate); } } return(BillActionRoleCheckState.Successful); } //一个角色对一个表单,对同一个前置状态,只能有一个修改、审核、退回操作 foreach (BillActionRoleModel m in bill_action_role_lst) { if (m.RoleId == billActionRole.RoleId && m.ActionId == billActionRole.ActionId && m.PreviousStatus == billActionRole.PreviousStatus) { //修改操作 if (bill_action.ModifyFlag == 1) { return(BillActionRoleCheckState.ExistModify); } else { //审核操作 if (bill_action.ApproveFlag == 1) { return(BillActionRoleCheckState.ExistApprove); } else { //退回操作 if (bill_action.RejectFlag == 1) { return(BillActionRoleCheckState.ExistReject); } else { //删除操作 return(BillActionRoleCheckState.ExistCancel); } } } } } return(BillActionRoleCheckState.Successful); }