示例#1
0
        public void SendLendingInfoTest()
        {
            // string ConnectionString = string.Empty; // TODO: 初始化为适当的值
            DBLendingInfoDetail target = new DBLendingInfoDetail(connstr); // TODO: 初始化为适当的值
            string TrainmanGUID        = string.Empty;                     // TODO: 初始化为适当的值
            string remark = string.Empty;                                  // TODO: 初始化为适当的值
            List <LendingInfoDetail> lifd = null;                          // TODO: 初始化为适当的值

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

            //定义他的值
            TrainmanGUID               = "08809D42-3B1C-4318-B818-756A7ED04300";
            lendinfo.dtBorrwoTime      = DateTime.Now;
            lendinfo.nBorrowVerifyType = 1;

            lendinfo.strTrainmanGUID    = TrainmanGUID;
            lendinfo.strLenderGUID      = "02517596-577B-4A0C-9E7F-A8C1AA35888E";
            lendinfo.strLendingInfoGUID = Guid.NewGuid().ToString();
            lendinfo.nLendingType       = 1;
            lendinfo.strLendingExInfo   = 450;
            lendinfo.nReturnState       = 0;
            lendinfo.dtModifyTime       = DateTime.Now;

            lifd.Add(lendinfo);
            target.SendLendingInfo(TrainmanGUID, remark, lifd);
            Assert.IsNotNull(lifd);
            // Assert.Inconclusive("无法验证不返回值的方法。");
        }
示例#2
0
        public Get_OutSendGoods Send(string data)
        {
            Get_OutSendGoods json = new Get_OutSendGoods();

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

                foreach (LendingInfoDetail l in input.lendingDetailList)
                {
                    if (db.CheckLendAble(l, input.WorkShopGUID))
                    {
                        json.resultStr = "提交失败:" + l.strLendingTypeAlias + " " + l.strLendingExInfo + "已经出借,无法再次借出!";
                        throw new ArgumentOutOfRangeException(l.strLendingTypeAlias + " " + l.strLendingExInfo + "已经出借,无法再次借出!");
                    }
                    if (input.UsesGoodsRange)
                    {
                        if (!db.IsGoodInRange(l.nLendingType, l.strLendingExInfo, input.WorkShopGUID))
                        {
                            json.resultStr = "提交失败:" + l.strLendingTypeAlias + " " + l.strLendingExInfo + "物品编码不在指定的编码范围内,请检查!";
                            throw new ArgumentOutOfRangeException(l.strLendingTypeAlias + " " + l.strLendingExInfo + "物品编码不在指定的编码范围内,请检查!");
                        }
                    }
                }
                db.SendLendingInfo(input.TrainmanGUID, input.remark, input.lendingDetailList);
                json.result    = "0";
                json.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                json.result = "1";
                // json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }