示例#1
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);
        }
示例#2
0
        public void IsGoodInRangeTest()
        {
            //string ConnectionString = string.Empty; // TODO: 初始化为适当的值
            DBLendingInfoDetail target = new DBLendingInfoDetail(connstr); // TODO: 初始化为适当的值
            int    nLendingType        = 0;                                // TODO: 初始化为适当的值
            int    strLendingExInfo    = 102;                              // TODO: 初始化为适当的值
            string WorkShopGUID        = string.Empty;                     // TODO: 初始化为适当的值

            WorkShopGUID = "3B50BF66-DABB-48C0-8B6D-05DB80591090";
            bool expected = true; // TODO: 初始化为适当的值
            bool actual;

            actual = target.IsGoodInRange(nLendingType, strLendingExInfo, WorkShopGUID);
            Assert.AreEqual(expected, actual);
            // Assert.Inconclusive("验证此测试方法的正确性。");
        }