public void SaveRemark() { var comment = new OPC_Comment(); comment.RelationId = id; comment.Content = RemarkContent; comment.CreateUser = 1; comment.CreateDate = DateTime.Now; bool isSuccess = false; switch (enumSetRemarkType) { case EnumSetRemarkType.SetSaleRemark: OPC_SaleComment salecomment = Mapper.Map <OPC_Comment, OPC_SaleComment>(comment); salecomment.SaleOrderNo = comment.RelationId; isSuccess = AppEx.Container.GetInstance <IRemarkService>().WriteSaleRemark(salecomment); break; case EnumSetRemarkType.SetSaleDetailRemark: OPC_SaleDetailsComment saledetailscomment = Mapper.Map <OPC_Comment, OPC_SaleDetailsComment>(comment); saledetailscomment.SaleDetailId = id; isSuccess = AppEx.Container.GetInstance <IRemarkService>().WriteSaleDetailsRemark(saledetailscomment); break; case EnumSetRemarkType.SetOrderRemark: OPC_OrderComment orderComment = Mapper.Map <OPC_Comment, OPC_OrderComment>(comment); orderComment.OrderNo = id; isSuccess = AppEx.Container.GetInstance <IRemarkService>().WriteOrderRemark(orderComment); break; case EnumSetRemarkType.SetShipSaleRemark: OPC_ShipComment shipSaleComment = Mapper.Map <OPC_Comment, OPC_ShipComment>(comment); shipSaleComment.ShippingCode = comment.RelationId; isSuccess = AppEx.Container.GetInstance <IRemarkService>().WriteShippingRemark(shipSaleComment); break; case EnumSetRemarkType.SetSaleRMARemark: OPC_SaleRMAComment rmaSaleRemark = Mapper.Map <OPC_Comment, OPC_SaleRMAComment>(comment); rmaSaleRemark.RMANo = comment.RelationId; isSuccess = AppEx.Container.GetInstance <IRemarkService>().WriteSaleRmaRemark(rmaSaleRemark); break; case EnumSetRemarkType.SetRMARemark: OPC_SaleRMAComment rmaRemark = Mapper.Map <OPC_Comment, OPC_SaleRMAComment>(comment); rmaRemark.RMANo = comment.RelationId; isSuccess = AppEx.Container.GetInstance <IRemarkService>().WriteRmaRemark(rmaRemark); break; } if (!isSuccess) { MvvmUtility.ShowMessageAsync("保存备注失败", "提示", MessageBoxButton.OK, MessageBoxImage.Error); } else { RemarkContent = ""; OpenWinSearch(id, enumSetRemarkType); } }
public bool WriteShippingRemark(OPC_ShipComment saleComment) { try { bool bResult = RestClient.Post("trans/AddShippingSaleComment", saleComment); return(bResult); } catch (Exception ex) { return(false); } }