protected override string Execute(CodeActivityContext context) { try { int userId = UserId.Get <int>(context); int workspaceId = WorkspaceId.Get <int>(context); int fpid = FPId.Get <int>(context); int subsystemId = SubsystemId.Get <int>(context); string reportName = ReportName.Get <string>(context); string[] paramTypes = new[] { ParamTypes.Get <string>(context) }; string[] paramValues = new[] { ParamValues.Get <string>(context) }; string outputFileName = PrintReport(userId, workspaceId, fpid, subsystemId, reportName, paramTypes, paramValues, out string exceptionStr); if (outputFileName == null) { return(exceptionStr); } return(Convert.ToBase64String(File.ReadAllBytes(outputFileName))); } catch (Exception ex) { EventLog.WriteEntry("BasePrint.TadbirPrint", ex.Message); return("-4"); //ex.Message; //throw ex; } }
protected override void Execute(IWorkflowActivityContext context) { var user = UserId.Get(context.ExecutionContext.InnerContext); var role = RoleId.Get(context.ExecutionContext.InnerContext); var remove = Remove.Get(context.ExecutionContext.InnerContext); if (user == null || role == null) { return; } var relationship = "systemuserroles_association"; if (remove) { context.OrganizationService.Disassociate( user.LogicalName, user.Id, new Relationship(relationship), new EntityReferenceCollection { role }); } else { context.OrganizationService.Associate( user.LogicalName, user.Id, new Relationship(relationship), new EntityReferenceCollection { role }); } }
protected virtual void Share(IWorkflowActivityContext context, EntityReference entity) { var user = UserId.Get(context.GetExecutionContext()); var team = TeamId.Get(context.GetExecutionContext()); if (user != null) { Share(context, entity, user); } if (team != null) { Share(context, entity, team); } }
// ===================================================== protected override string Execute(CodeActivityContext context) { ip = IP.Get(context); port = Port.Get(context); database = Database.Get(context); version = Version.Get(context); userId = UserId.Get(context); fpId = FPId.Get(context); serviceKey = ServiceKey.Get(context); customerIdList = getCustomerId(); if (customerIdList != null && customerIdList.Count != 0) { for (int i = 0; i < customerIdList.Count; i++) { var customer = getCustomerById(customerIdList[i][0]); customerList.Add(customer); if (customer.AccId != "0") { var account = getAccountById(customer.AccId); accountList.Add(account); } if (customer.FAccId != 0) { var detailAcc = getDetailAccById(customer.FAccId); detailAccList.Add(detailAcc); } if (customer.CCId != 0) { var costCenter = getCostCenterById(customer.CCId); costCenterList.Add(costCenter); } if (customer.PrjId != 0) { var project = getProjectById(customer.PrjId); projectList.Add(project); } if (customer.AccId != "0" && customer.FAccId != 0) { var detailAcc = detailAccList[detailAccList.Count - 1]; var accVsDetail = getAccVsDetailByFullId(customer.AccId, customer.FAccId, getDetFullId(detailAcc)); accVsDetailList.Add(accVsDetail); } if (customer.AccId != "0" && customer.CCId != 0) { var accVsCC = getAccVsCCByFullId(customer.AccId, customer.CCId); accVsCCList.Add(accVsCC); } if (customer.AccId != "0" && customer.PrjId != 0) { var accVsPrj = getAccVsPrjByFullId(customer.AccId, customer.PrjId); accVsPrjList.Add(accVsPrj); } } } string resutl = SerializeResult(); return(resutl); }