public decimal UpdateFlow(decimal flowID, decimal accessGroupId, string flowName, IList <UnderManagment> underMnagList) { try { BFlow bflow = new BFlow(); Flow flow = bflow.GetByID(flowID); flow.ID = flowID; flow.FlowName = flowName; flow.AccessGroup = new PrecardAccessGroup() { ID = accessGroupId }; flow.UnderManagmentList = new List <UnderManagment>(); foreach (UnderManagment un in underMnagList) { un.Flow = flow; flow.UnderManagmentList.Add(un); } UnderManagmentRepository underRep = new UnderManagmentRepository(false); underRep.DeleteUnderManagments(flow.ID); bflow.SaveChanges(flow, UIActionType.EDIT); return(flow.ID); } catch (Exception ex) { LogException(ex, "BManager", "UpdateFlow"); throw ex; } }
/// <summary> /// یک جریان کاری را حذف میکند /// </summary> /// <param name="flowID"></param> public void DeleteFlow(decimal flowID) { Flow flow = new Flow(); flow.ID = flowID; bFlow.SaveChanges(flow, UIActionType.DELETE); }
/// <summary> /// درج جریان کاری /// </summary> /// <param name="personId">شناسه پست سلزمانی مدیر اولیه</param> /// <param name="accessGroup">شناسه گروه دسترسی</param> /// <param name="flowName">نام جریان کاری</param> /// <param name="underMnagList">افراد و بخشهای تحت مدیریت</param> /// <returns></returns> public decimal InsertFlowByOrganization(decimal organizationId, decimal accessGroup, string flowName, IList <UnderManagment> underMnagList) { Flow flow = new Flow(); using (NHibernateSessionManager.Instance.BeginTransactionOn()) { try { flow.FlowName = flowName; flow.AccessGroup = new PrecardAccessGroup() { ID = accessGroup }; flow.ActiveFlow = true; flow.ManagerFlowList = new List <ManagerFlow>(); flow.UnderManagmentList = new List <UnderManagment>(); Manager mng = managerRep.GetManagerByOrganID(organizationId); if (mng == null || mng.ID == 0) { Manager manager = new Manager(); manager.OrganizationUnit = new OrganizationUnit() { ID = organizationId }; manager.Active = true; this.SaveChanges(manager, UIActionType.ADD); mng = manager; } ManagerFlow managerFlow = new ManagerFlow(); managerFlow.Flow = flow; managerFlow.Manager = mng; managerFlow.Level = 1; managerFlow.Active = true; flow.ManagerFlowList.Add(managerFlow); foreach (UnderManagment un in underMnagList) { un.Flow = flow; flow.UnderManagmentList.Add(un); } BFlow bflow = new BFlow(); bflow.SaveChanges(flow, UIActionType.ADD); NHibernateSessionManager.Instance.CommitTransactionOn(); return(flow.ID); } catch (Exception ex) { NHibernateSessionManager.Instance.RollbackTransactionOn(); LogException(ex, "BManager", "InsertFlowByOrganization"); throw ex; } } }