Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <summary>
        /// 添加一个表单操作
        /// </summary>
        /// <param name="loggingSession">当前登录的信息</param>
        /// <param name="billAction"></param>
        /// <returns></returns>
        public bool InsertBillAction(BillActionModel billAction)
        {
            if (string.IsNullOrEmpty(billAction.Id))
            {
                billAction.Id = this.NewGuid();
            }

            billAction.CreateUserID = this.loggingSessionInfo.CurrentUser.User_Id;
            billAction.CreateTime   = this.GetCurrentDateTime();
            billAction.customer_id  = loggingSessionInfo.CurrentLoggingManager.Customer_Id;
            return(billService.InsertBillAction(billAction));
        }
Example #4
0
        /// <summary>
        /// 添加一个表单操作
        /// </summary>
        /// <param name="loggingSession">当前登录的信息</param>
        /// <param name="billAction"></param>
        /// <returns></returns>
        public bool InsertBillAction(LoggingSessionInfo loggingSession, BillActionModel billAction)
        {
            if (string.IsNullOrEmpty(billAction.Id))
            {
                billAction.Id = this.NewGuid();
            }

            billAction.CreateUserID = loggingSession.CurrentUser.User_Id;
            billAction.CreateTime   = this.GetCurrentDateTime();
            billAction.customer_id  = loggingSession.CurrentLoggingManager.Customer_Id;
            cSqlMapper.Instance().Insert("BillAction.Insert", billAction);
            return(true);
        }
Example #5
0
    //保存表单状态数据。
    private void saveBillStatusData(BillActionModel data)
    {
        bool save = new cBillService().InsertBillAction(loggingSessionInfo, data);

        if (save)
        {
            this.Redirect("保存成功", InfoType.Info, this.Request.QueryString["from"] ?? "bill_action_query.aspx");
        }
        else
        {
            this.InfoBox.ShowPopError("保存失败");
        }
    }
Example #6
0
        /// <summary>
        /// 添加一个表单操作
        /// </summary>
        /// <param name="billAction"></param>
        /// <returns></returns>
        public bool InsertBillAction(BillActionModel billActionInfo)
        {
            string sql = "insert into t_def_bill_action "
                         + " (bill_action_id, bill_kind_id, bill_action_code, bill_action_name, "
                         + "  create_flag, modify_flag, approve_flag, reject_flag, cancel_flag, "
                         + "  status, create_user_id, create_time,customer_id,display_index) "
                         + "  values "
                         + "  ('" + billActionInfo.Id + "','" + billActionInfo.KindId + "' ,'" + billActionInfo.Code + "' ,'" + billActionInfo.Description + "' , "
                         + "  '" + billActionInfo.CreateFlag + "' , '" + billActionInfo.ModifyFlag + "' ,'" + billActionInfo.ApproveFlag + "', '" + billActionInfo.RejectFlag + "' ,'" + billActionInfo.CancelFlag + "' , "
                         + "  1, '" + billActionInfo.CreateUserID + "' , '" + billActionInfo.CreateTime + "','" + billActionInfo.customer_id + "','" + billActionInfo.display_index + "')";

            this.SQLHelper.ExecuteNonQuery(sql);
            return(true);
        }
Example #7
0
    //当前表单状态的数据
    private BillActionModel currBillActionData()
    {
        BillActionModel billActModel = new BillActionModel();

        billActModel.KindId        = this.cbBillKind.SelectedValue;
        billActModel.Code          = this.tbCode.Text;
        billActModel.Description   = this.tbDescription.Text;
        billActModel.CreateFlag    = int.Parse(this.cbCreateFlag.SelectedValue);
        billActModel.ApproveFlag   = int.Parse(this.cbApproveFlag.SelectedValue);
        billActModel.ModifyFlag    = int.Parse(this.cbModifyFlag.SelectedValue);
        billActModel.RejectFlag    = int.Parse(this.cbRejectFlag.SelectedValue);
        billActModel.CancelFlag    = int.Parse(this.cbCancelFlag.SelectedValue);
        billActModel.display_index = int.Parse(this.txtDisplayIndex.Text.Trim());
        return(billActModel);
    }
Example #8
0
 /// <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);
 }
Example #9
0
        /// <summary>
        /// 获取表单动作
        /// </summary>
        /// <param name="loggingSession">登录信息</param>
        /// <param name="billKindId">类型标识</param>
        /// <param name="billActionType">动作标识</param>
        /// <returns></returns>
        public BillActionModel GetBillAction(string billKindId, BillActionType billActionType)
        {
            BillActionModel billAction = null;
            string          conn       = "";

            switch (billActionType)
            {
            case BillActionType.Create:
                conn = " and a.create_flag=1 ";
                break;

            case BillActionType.Modify:
                conn = " and a.modify_flag=1 ";
                break;

            case BillActionType.Approve:
                conn = " and a.approve_flag=1 ";
                break;

            case BillActionType.Reject:
                conn = " and a.reject_flag=1 ";
                break;

            case BillActionType.Cancel:
                conn = " and a.cancel_flag=1 ";
                break;

            case BillActionType.Open:
                conn = " and 1=1 ";
                break;

            case BillActionType.Stop:
                conn = " and 1=1 ";
                break;

            default:
                conn = " and 1=1";
                return(null);
            }
            DataSet ds = billService.GetBillAction(billKindId, billActionType, conn);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                billAction = DataTableToObject.ConvertToObject <BillActionModel>(ds.Tables[0].Rows[0]);
            }
            return(billAction);
        }
Example #10
0
        /// <summary>
        /// 获取表单动作
        /// </summary>
        /// <param name="loggingSession">登录信息</param>
        /// <param name="billKindId">类型标识</param>
        /// <param name="billActionType">动作标识</param>
        /// <returns></returns>
        public BillActionModel GetBillAction(LoggingSessionInfo loggingSession, string billKindId, BillActionType billActionType)
        {
            Hashtable hashTable = new Hashtable();

            hashTable.Add("LanguageKindId", loggingSession.CurrentLanguageKindId);
            hashTable.Add("BillKindId", billKindId);
            hashTable.Add("BillActionCode", billActionType.ToString());
            hashTable.Add("CustomerId", loggingSession.CurrentLoggingManager.Customer_Id);
            BillActionModel billAction = null;

            switch (billActionType)
            {
            case BillActionType.Create:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetCreateActionByKindId", hashTable);
                break;

            case BillActionType.Modify:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetModifyActionByKindId", hashTable);
                break;

            case BillActionType.Approve:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetApproveActionByKindId", hashTable);
                break;

            case BillActionType.Reject:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetRejectActionByKindId", hashTable);
                break;

            case BillActionType.Cancel:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetCancelActionByKindId", hashTable);
                break;

            case BillActionType.Open:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetOpenActionByKindId", hashTable);
                break;

            case BillActionType.Stop:
                billAction = cSqlMapper.Instance(loggingSession.CurrentLoggingManager).QueryForObject <BillActionModel>("BillAction.GetStopActionByKindId", hashTable);
                break;

            default:
                return(null);
            }
            return(billAction);
        }
Example #11
0
        /// <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);
        }
Example #12
0
        /// <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);
        }
Example #13
0
        /// <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);
        }
Example #14
0
        /// <summary>
        /// 判断能否添加一个表单操作
        /// </summary>
        /// <param name="loggingSession">当前登录的信息</param>
        /// <param name="billAction">要添加的表单操作</param>
        /// <returns></returns>
        public BillActionCheckState CheckAddBillAction(LoggingSessionInfo loggingSession, BillActionModel billAction)
        {
            //获取表单类型下的所有的表单状态
            IList <BillActionModel> bill_action_lst = this.GetAllBillActionsByBillKindId(billAction.KindId);

            //为空,可以添加
            if (bill_action_lst == null || bill_action_lst.Count == 0)
            {
                return(BillActionCheckState.Successful);
            }

            //检查编码
            foreach (BillActionModel m in bill_action_lst)
            {
                if (m.Code == billAction.Code)
                {
                    return(BillActionCheckState.ExistCode);
                }
            }

            //一个表单类型下,只能有一个新建标志为1的表单操作
            if (billAction.CreateFlag == 1)
            {
                foreach (BillActionModel m in bill_action_lst)
                {
                    if (m.CreateFlag == 1)
                    {
                        return(BillActionCheckState.ExistCreateAction);
                    }
                }
                return(BillActionCheckState.Successful);
            }

            //一个表单类型下,只能有一个修改标志为1的表单操作
            if (billAction.ModifyFlag == 1)
            {
                foreach (BillActionModel m in bill_action_lst)
                {
                    if (m.ModifyFlag == 1)
                    {
                        return(BillActionCheckState.ExistModifyAction);
                    }
                }
                return(BillActionCheckState.Successful);
            }
            //一个表单类型下,只能有一个审核标志为1的表单操作
            if (billAction.ApproveFlag == 1)
            {
                foreach (BillActionModel m in bill_action_lst)
                {
                    if (m.ApproveFlag == 1)
                    {
                        return(BillActionCheckState.ExistApproveAction);
                    }
                }
            }
            //一个表单类型下,只能有一个退回标志为1的表单操作
            if (billAction.RejectFlag == 1)
            {
                foreach (BillActionModel m in bill_action_lst)
                {
                    if (m.RejectFlag == 1)
                    {
                        return(BillActionCheckState.ExistRejectAction);
                    }
                }
            }
            //一个表单类型下,只能有一个删除标志为1的表单操作
            if (billAction.CancelFlag == 1)
            {
                foreach (BillActionModel m in bill_action_lst)
                {
                    if (m.CancelFlag == 1)
                    {
                        return(BillActionCheckState.ExistCancelAction);
                    }
                }
                return(BillActionCheckState.Successful);
            }

            return(BillActionCheckState.Successful);
        }
Example #15
0
        /// <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);
        }
Example #16
0
        /// <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);
        }
Example #17
0
        /// <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);
        }