public ActionResult AddGoodsPayment(GoodsPayment model)
 {
     try
     {
         if (model != null)
         {
             model.Noter      = Session["LoginedUser"].ToString();
             model.RecordTime = DateTime.Now;
             if (GoodsPaymentRepository.Add(model) != null)
             {
                 return(Json(new { Success = true }));
             }
         }
         return(Json(new
         {
             Success = false,
             Message = "参数有误。"
         }));
     }
     catch (Exception ex)
     {
         LogRepository.Add(new EventLog()
         {
             Name = Session["LoginedUser"].ToString(), Date = DateTime.Now.ToLocalTime(), Event = "新增资金支付情况表失败" + ex.Message
         });
         return(Json(new
         {
             Success = false,
             Message = ex.Message
         }));
     }
 }
        public async Task <ActionResult> GetGoodsPaymentDetails(string ID)
        {
            try
            {
                if (!string.IsNullOrEmpty(ID))
                {
                    Guid         gid    = new Guid(ID);
                    GoodsPayment findgp = await GoodsPaymentRepository.FindAsync(p => p.GoodsPaymentID == gid);

                    if (findgp != null)
                    {
                        return(Json(new
                        {
                            Success = true,
                            CustomerName = findgp.CustomerName,
                            ContractNo = findgp.ContractNo,
                            Get = findgp.Get,
                            Pay = findgp.Pay,
                            Remark = findgp.Remark,
                            PaymentDate = findgp.PaymentDate
                        }, JsonRequestBehavior.AllowGet));
                    }
                }
                return(Json(new
                {
                    Success = false,
                    Message = "参数有误。"
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                LogRepository.Add(new EventLog()
                {
                    Name = Session["LoginedUser"].ToString(), Date = DateTime.Now.ToLocalTime(), Event = "获取资金支付情况表明细失败" + ex.Message
                });
                return(Json(new
                {
                    Success = false,
                    Message = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }
        public async Task <ActionResult> DeleteGoodsPayment(string ID)
        {
            try
            {
                if (!string.IsNullOrEmpty(ID))
                {
                    Guid         gid    = new Guid(ID);
                    GoodsPayment findgp = await GoodsPaymentRepository.FindAsync(p => p.GoodsPaymentID == gid);

                    if (findgp != null)
                    {
                        if (GoodsPaymentRepository.Delete(findgp))
                        {
                            return(Json(new { Success = true }));
                        }
                    }
                }
                return(Json(new
                {
                    Success = false,
                    Message = "参数有误。"
                }));
            }
            catch (Exception ex)
            {
                LogRepository.Add(new EventLog()
                {
                    Name = Session["LoginedUser"].ToString(), Date = DateTime.Now.ToLocalTime(), Event = "删除资金支付情况失败" + ex.Message
                });
                return(Json(new
                {
                    Success = false,
                    Message = ex.Message
                }));
            }
        }