private static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // TODO: Substitute the code below with a valid transaction code for your transaction string transactionCode = "BCDD106976764746641F8FA665F51E88"; try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); bool cancelResult = PreApprovalService.CancelPreApproval(credentials, transactionCode); Console.WriteLine(cancelResult); Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Instantiate a new payment request PaymentRequest payment = new PaymentRequest(); // Sets the currency payment.Currency = Currency.Brl; // Add an item for this preApproval payment request payment.Items.Add(new Item("0001", "Seguro contra roubo do Notebook", 1, 10.00m)); // Sets a reference code for this payment request, it is useful to identify this payment in future notifications. payment.Reference = "REF1234"; // Sets the previous preApproval code payment.PreApprovalCode = "235FD1B69494E6ACC4C37F8A60C05E89"; try { AccountCredentials credentials = PagSeguroConfiguration.GetAccountCredentials(isSandbox); String result = PreApprovalService.ChargePreApproval(credentials, payment); } catch (PagSeguroServiceException exception) { foreach (ServiceError element in exception.Errors) { } } }
public Aluno_pgto CancelarAssinaturaCode(string code) { EnvironmentConfiguration.ChangeEnvironment(isSandbox); try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); if (PreApprovalService.CancelPreApproval(credentials, code)) { var transaction = PreApprovalSearchService.SearchByCode(credentials, code); return(AssinaturaTratarRetorno(transaction)); } else { var transaction = PreApprovalSearchService.SearchByCode(credentials, code); return(AssinaturaTratarRetorno(transaction)); } } catch (PagSeguroServiceException exception) { string retorno = exception.Message + "\n"; foreach (ServiceError element in exception.Errors) { retorno += element + "\n"; } return(new Aluno_pgto()); } }
public JsonResult LoadUpload(string HTCode, string ApplierMUDID, string BUHeadMUDID, string Type, string State, int rows, int page) { int total; var list = PreApprovalService.QueryLoad(HTCode, ApplierMUDID, BUHeadMUDID, Type, State, rows, page, out total ).Select(a => new { c0 = a.c0, c1 = FormatterNull(a.c1), c2 = FormatterNull(a.c2), c3 = FormatterNull(a.c3), c4 = FormatterNull(a.c4), c5 = FormatterNull(a.c5), c6 = FormatterNull(a.c6), c7 = FormatterNull(a.c7), c8 = FormatterNull(a.c8), c9 = FormatterNull(a.c9), c10 = FormatterNull(a.c10), c11 = FormatterNull(a.c11), c12 = FormatterNull(a.c12), c13 = FormatterNull(a.c13), c14 = FormatterNull(a.c14) }).ToArray();; return(Json(new { state = 1, rows = list, total = total })); }
static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); // TODO: Substitute the code below with a valid transaction code for your transaction bool cancelResult = PreApprovalService.CancelPreApproval(credentials, "3DFAD3123412340334A96F9136C38804"); Console.WriteLine(cancelResult); Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
public JsonResult ExistentSecondAgent(string AgentMudid) { //判断当前用户是否是直线经理,是否有审批权限 var a = IUserInfoService.isSecondApproval(AgentMudid); var b = PreApprovalService.HasApprove(AgentMudid); if (a.ApprovalCount != 0 || b) { var obj = IUserInfoService.isSecondAgentBack(AgentMudid); return(Json(new { state = 1, data = obj, isAgent = 1 })); } return(Json(new { state = 1, isAgent = 0 })); }
public JsonResult ShowSecondName(string AgentMudid) { var res = IUserInfoService.Find(AgentMudid); if (res != null) { var userId = res.UserId; var isHaveApproval = IUserInfoService.isSecondApproval(userId); var has = PreApprovalService.HasApprove(userId); if (isHaveApproval.ApprovalCount > 0 || has) { return(Json(new { state = 1, ishave = 1, res })); } else { return(Json(new { state = 1, ishave = 0, txt = "当前代理人不是二线经理,或没有审批权限,请重试!" })); } } return(Json(new { state = 1, ishave = 0, txt = "不存在此MUDID" })); }
static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); // Instantiate a new payment request PaymentRequest payment = new PaymentRequest(); // Sets the currency payment.Currency = Currency.Brl; // Add an item for this preApproval payment request payment.Items.Add(new Item("0001", "Seguro contra roubo do Notebook", 1, 100.00m)); // Sets a reference code for this payment request, it is useful to identify this payment in future notifications. payment.Reference = "REF1234"; // Sets the previous preApproval code payment.PreApprovalCode = "3DFAD3123412340334A96F9136C38804"; string preApprovalTransactionCode = PreApprovalService.CreatePreApprovalPaymentRequest(credentials, payment); Console.WriteLine(preApprovalTransactionCode); Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // TODO: Substitute the code below with a valid transaction code for your transaction String transactionCode = "BCDD106976764746641F8FA665F51E88"; try { AccountCredentials credentials = PagSeguroConfiguration.GetAccountCredentials(isSandbox); bool cancelResult = PreApprovalService.CancelPreApproval(credentials, transactionCode); } catch (PagSeguroServiceException exception) { foreach (ServiceError element in exception.Errors) { } } }
/// <summary> /// Calls the PagSeguro web service and register this request for payment /// </summary> /// <param name="credentials">PagSeguro credentials</param> /// <returns>The Uri to where the user needs to be redirected to in order to complete the payment process</returns> public Uri Register(Credentials credentials) { return(PreApprovalService.CreateCheckoutRequest(credentials, this)); }
/// <summary> /// Calls the PagSeguro web service and register this request for payment /// </summary> /// <param name="credentials">PagSeguro credentials</param> /// <returns>The Uri to where the user needs to be redirected to in order to complete the payment process</returns> public Uri Register(Credentials credentials) { return(PreApprovalService.CreatePreApproval(credentials, this)); }
public void ExportApproval(string HTCode, string ApplierMUDID, string BUHeadMUDID, string Category, string Type) { #region 抓取数据 int total = 0; var list = PreApprovalService.QueryLoad(HTCode, ApplierMUDID, BUHeadMUDID, Category, Type, int.MaxValue, 1, out total ).Select(a => new { c1 = FormatterNull(a.c1), c2 = FormatterNull(a.c2), c3 = FormatterNull(a.c3), c4 = FormatterNull(a.c4), c5 = FormatterNull(a.c5), c6 = FormatterNull(a.c6), c7 = FormatterNull(a.c7), c8 = FormatterNull(a.c8), c9 = FormatterNull(a.c9), c10 = FormatterNull(a.c10), c11 = FormatterNull(a.c11), c12 = FormatterNull(a.c12), c13 = FormatterNull(a.c13) }).ToArray();; #endregion #region 构建Excel HSSFWorkbook wk = new HSSFWorkbook(); ISheet sheet = wk.CreateSheet("Cater"); IRow row = sheet.CreateRow(0); //ICellStyle style = wk.CreateCellStyle(); //style.WrapText = true; //style.Alignment = HorizontalAlignment.Center; //IFont font = wk.CreateFont(); //font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold; //font.FontHeightInPoints = 10; //style.SetFont(font); ICellStyle style = wk.CreateCellStyle(); style.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightOrange.Index; style.FillPattern = NPOI.SS.UserModel.FillPattern.SolidForeground; style.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightOrange.Index; style.Alignment = HorizontalAlignment.Center; IFont font = wk.CreateFont(); font.Color = NPOI.HSSF.Util.HSSFColor.White.Index; font.Boldweight = short.MaxValue; font.FontHeightInPoints = 10; style.SetFont(font); #endregion #region 生成表头 var title = new string[] { "HT编号", "申请人姓名", "申请人MUDID", "流程类别", "流程状态", "提交日期", "提交时间", "审批人MUDID", "审批人姓名", "审批动作", "审批理由", "审批日期", "审批时间" }; sheet.DefaultRowHeight = 200 * 2; for (var i = 0; i < title.Length; i++) { sheet.SetColumnWidth(i, 15 * 256); } for (var i = 0; i < title.Length; i++) { ICell cell = row.CreateCell(i); cell.SetCellValue(title[i]); cell.SetCellType(CellType.String); cell.CellStyle = style; } #endregion #region 制作表体 for (var i = 1; i <= list.Length; i++) { var item = list[i - 1]; row = sheet.CreateRow(i); ICell cell = null; //2018-1-12 史强 注释掉序号列 //cell = row.CreateCell(0); //cell.SetCellValue(i); var j = 0; if (item != null) { cell = row.CreateCell(j); cell.SetCellValue(item.c1); cell = row.CreateCell(++j); cell.SetCellValue(item.c2); cell = row.CreateCell(++j); cell.SetCellValue(item.c3); cell = row.CreateCell(++j); cell.SetCellValue(item.c4); cell = row.CreateCell(++j); cell.SetCellValue(item.c5); cell = row.CreateCell(++j); cell.SetCellValue(item.c6); cell = row.CreateCell(++j); cell.SetCellValue(item.c7); cell = row.CreateCell(++j); cell.SetCellValue(item.c8); cell = row.CreateCell(++j); cell.SetCellValue(item.c9); cell = row.CreateCell(++j); cell.SetCellValue(item.c10); cell = row.CreateCell(++j); cell.SetCellValue(item.c11); cell = row.CreateCell(++j); cell.SetCellValue(item.c12); cell = row.CreateCell(++j); cell.SetCellValue(item.c13); cell = row.CreateCell(++j); } } #endregion #region 写入到客户端 using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) { wk.Write(ms); Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.xls", DateTime.Now.ToString("yyyyMMddHHmmssfff"))); Response.ContentType = "application/vnd.ms-excel"; Response.BinaryWrite(ms.ToArray()); } #endregion }
/// <summary> /// 保存重新分配审批人 /// </summary> /// <param name="UploadID"></param> /// <param name="userId"></param> /// <param name="userName"></param> /// <returns></returns> public JsonResult UploadApprover(string UploadID, string htcode, string userId, string userName) { UploadID = UploadID.Replace(",", "','"); var res = PreApprovalService.LoadByID(UploadID); var preList = new List <string>(); var upoList = new List <string>(); var preHTcodes = new List <string>(); var upoHTcodes = new List <string>(); foreach (var item in res) { if (item.c4 == "预申请") { preList.Add(item.c0.ToString()); preHTcodes.Add(item.c1.ToString()); //var cont = "重新分配审批人-预申请:" + item.c1; //var num = operationAuditService.AddAudit("3", cont); } else { upoList.Add(item.c0.ToString()); upoHTcodes.Add(item.c1.ToString()); //var cont = "重新分配审批人-上传文件:" + item.c1; //var num = operationAuditService.AddAudit("3", cont); } } if (preList.Count > 0) { var preIds = string.Join("','", preList); var preHTs = string.Join(",", preHTcodes); PreApprovalService.UpdatePreReAssign(preIds, CurrentAdminUser.Email, CurrentAdminUser.Name, userId, userName); var cont = "重新分配审批人-预申请:" + preHTs; var num = operationAuditService.AddAudit("3", cont); //发消息 foreach (var preId in preList) { var preApproval = PreApprovalService.GetPreApprovalByID(preId).FirstOrDefault(); if (preApproval != null) { string applicantMsg = preApproval.ModifyDate == preApproval.CreateDate ? $"{preApproval.HTCode},您有需要审批的预申请。请<a href='{ConfigurationManager.AppSettings["MealH5SiteUrl"]}/P/PreApproval/Approval?id={preId}&from=0'>点击这里</a>进行审批。" : $"{preApproval.HTCode},您有需要审批的预申请修改。请<a href='{ConfigurationManager.AppSettings["MealH5SiteUrl"]}/P/PreApproval/Approval?id={preId}&from=0'>点击这里</a>进行审批。"; var rtnVal = WxMessageClientChannelFactory.GetChannel().SendText(userId, applicantMsg); } } } if (upoList.Count > 0) { var upoIds = string.Join("','", upoList); var upoHTs = string.Join(",", upoHTcodes); PreApprovalService.UpdatePuoReAssign(upoIds, CurrentAdminUser.Email, CurrentAdminUser.Name, userId, userName); var cont = "重新分配审批人-上传文件:" + upoHTs; var num = operationAuditService.AddAudit("3", cont); //发消息 foreach (var uplId in upoList) { var uploadFile = UploadFileQueryService.FindPreUploadFile(uplId); if (uploadFile != null) { var messageBase = "该订单已上传会议支持文件"; switch (uploadFile.FileType) { case 1: messageBase = "该订单已提交退单原因"; break; case 2: messageBase = "该订单已提交会议支持文件丢失原因"; break; case 3: messageBase = "该订单已提交未送达,会议未正常召开原因"; break; } var approverMsg = $"{uploadFile.HTCode},{messageBase},请<a href='{ConfigurationManager.AppSettings["MealH5SiteUrl"]}/P/Upload/Approval?id={uplId}&from=0'>点击这里</a>进行审批。"; var rtnVal = WxMessageClientChannelFactory.GetChannel().SendText(userId, approverMsg); } } } return(Json(new { state = 1 })); }