public Get_OutGiveBackLendingInfo Recieve(string data)
        {
            Get_OutGiveBackLendingInfo json = new Get_OutGiveBackLendingInfo();

            try
            {
                Get_InGiveBackLendingInfo input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InGiveBackLendingInfo>(data);

                foreach (LendingInfoDetail l in input.lendingDetailList)
                {
                    if (!db.CheckReturnAble(input.TrainmanGUID, l))
                    {
                        json.resultStr = "提交失败:未找到" + l.strLendingTypeAlias + " " + l.strLendingExInfo + "的借用记录!";
                        throw new ArgumentOutOfRangeException("未找到" + l.strLendingTypeAlias + " " + l.strLendingExInfo + "的借用记录!");
                    }
                }

                db.GiveBackDetail(input.lendingDetailList);

                foreach (LendingInfoDetail l in input.lendingDetailList)
                {
                    db.UpdateLendingInfoRemark(l.strLendingInfoGUID, input.remark);
                }
                json.result    = "0";
                json.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                json.result = "1";
                //json.resultStr = "提交失败:" ;
            }
            return(json);
        }
예제 #2
0
        public void GiveBackDetailTest()
        {
            //   string ConnectionString = string.Empty; // TODO: 初始化为适当的值
            DBLendingInfoDetail      target = new DBLendingInfoDetail(connstr); // TODO: 初始化为适当的值
            List <LendingInfoDetail> lifd   = null;                             // TODO: 初始化为适当的值

            lifd = new List <LendingInfoDetail>();
            LendingInfoDetail l = new LendingInfoDetail();

            l.nGiveBackVerifyType     = 0;
            l.strGiveBackTrainmanGUID = "55E0BDC7-CCD4-4979-BA69-D890F814F08D";
            l.strGUID = "25416FBC-35E7-40E4-B881-6C2314D4C08D";
            lifd.Add(l);
            target.GiveBackDetail(lifd);
            Assert.IsNotNull(lifd);
            // Assert.Inconclusive("无法验证不返回值的方法。");
        }