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 System.Drawing.Image Execute(CodeActivityContext context) { try { string ip = "localhost"; string port = Port.Get <string>(context); string db = dbName.Get <string>(context); string version = Version.Get <string>(context); string group = Group.Get <string>(context); string entity = Entity.Get <string>(context); string function = Function.Get <string>(context); int merchId = MerchId.Get <int>(context); int fpid = FPId.Get <int>(context); int sysId = SysId.Get <int>(context); int formId = FormId.Get <int>(context); string serviceKey = ServiceKey.Get <string>(context); int imageId = ImageId.Get <int>(context); string url = string.Format("http://{0}:{1}/{2}/{3}/{4}/{5}/{6}?MerchId={7}&SysId={8}&FormId={9}&FPId={10}&key={11}&ImageId={12}", ip, port, db, version, group, entity, function, merchId, sysId, formId, fpid, serviceKey, imageId); HttpClient client = new HttpClient(); Task <HttpResponseMessage> message = client.GetAsync(url); message.Wait(); Task <string> messageResult = message.Result.Content.ReadAsStringAsync(); messageResult.Wait(); System.Drawing.Image result = null; byte[] imageByteArray = Convert.FromBase64String(messageResult.Result.Replace("\"", "")); using (MemoryStream stream = new MemoryStream(imageByteArray)) { result = System.Drawing.Image.FromStream(stream); } return(result); } catch (Exception ex) { throw ex; } }
// ===================================================== 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); }