public async Task <JsonResult> DeleteMainStone(int id) { var orderMainStoneInfoManager = new OrderMainStoneInfoManager(); var result = await orderMainStoneInfoManager.DeleteOrderSetStoneAsync(id); return(Json(result)); }
public async Task <FileStreamResult> OrderMainStoneStatisticsExport(ShipmentReportQuery reportQuery) { var manager = new OrderMainStoneInfoManager(User); var mainStones = await manager.GetOrderMainStoneStatisticsAsync(reportQuery); var titles = new string[] { "序号", "客户", "单号", "主石名称", "主石大小", "风险等级", "收石日期" }; var result = Dickson.Web.Helper.ExcelHelp.Export(titles, "主石收石记录", ws => { var row = 2; int index = 1; foreach (var mainStone in mainStones) { ws.Cells[row, 1].Value = index; ws.Cells[row, 2].Value = mainStone.CustomerName; ws.Cells[row, 3].Value = mainStone.OrderId; ws.Cells[row, 4].Value = mainStone.MainStoneName; ws.Cells[row, 5].Value = mainStone.MainStoneWeight; ws.Cells[row, 6].Value = mainStone.Risk; ws.Cells[row, 7].Value = mainStone.Created; row++; index++; } }); return(result); }
public async Task <ActionResult> OrderMainStoneStatistics(ReportQueryBaseDto reportQuery) { if (!Request.IsAjaxRequest()) { return(View(reportQuery)); } var manager = new OrderMainStoneInfoManager(User); var list = await manager.GetOrderMainStoneStatisticsAsync(reportQuery); return(Json(true, string.Empty, list)); }
public async Task <ActionResult> ViewMainStoneAttachements(int mainStoneId) { List <AttachmentItem> attachments = new List <AttachmentItem>(); var manager = new OrderMainStoneInfoManager(User); var mainStoneAttachments = await manager.GetOrderMainStoneAttachments(mainStoneId); if (mainStoneAttachments != null) { attachments = mainStoneAttachments.OrderByDescending(a => a.Created).Select(a => new AttachmentItem { Id = a.FileInfoId, Url = "/Attachment/" + a.FileInfoId + "/preview" }).ToList(); } return(View(attachments)); }
public async Task <JsonResult> AddMainStone(OrderMainStoneInfoViewModel request, [NamedModelBinder(typeof(CommaSeparatedModelBinder), "attachmentIds")] string[] attachmentIds) { if (!ModelState.IsValid) { return(Json(false, data: ErrorToDictionary())); } var orderMainStoneInfo = Mapper.Map <OrderMainStoneInfoViewModel, OrderMainStoneInfo>(request); orderMainStoneInfo.CreatorId = User.Id; orderMainStoneInfo.Created = DateTime.Now; var orderMainStoneInfoManager = new OrderMainStoneInfoManager(User); var result = await orderMainStoneInfoManager.CreateOrderMainStoneInfoAsync(orderMainStoneInfo, attachmentIds); if (result.Succeeded) { var operationLogManager = new OrderOperationLogManager(User); await operationLogManager.AddLogAsync(OperationLogStatus.ReciveStone, request.OrderId); } return(Json(result)); }