/// <summary>
        /// 插入新记录
        /// </summary>
        /// <param name="dataContext">数据上下文</param>
        /// <param name="goodsShelfLife">数据集</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool InsertInfo(DepotManagementDataContext dataContext, KF_GoodsShelfLife goodsShelfLife, out string error)
        {
            error = null;

            try
            {
                var varInfo = from a in dataContext.KF_GoodsShelfLife
                              where a.BatchNo == goodsShelfLife.BatchNo &&
                              a.GoodsID == goodsShelfLife.GoodsID
                              select a;

                if (varInfo.Count() != 0)
                {
                    error = "数据不唯一";
                    return(false);
                }
                else
                {
                    dataContext.KF_GoodsShelfLife.InsertOnSubmit(goodsShelfLife);
                }

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 设置一条物品记录
        /// </summary>
        /// <param name="goodsShelfLife">数据集</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool SetInfo(KF_GoodsShelfLife goodsShelfLife, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

                var varInfo = from a in dataContext.KF_GoodsShelfLife
                              where a.BatchNo == goodsShelfLife.BatchNo &&
                              a.GoodsID == goodsShelfLife.GoodsID
                              select a;

                if (varInfo.Count() != 1)
                {
                    error = "数据不唯一或者为空";
                    return(false);
                }
                else
                {
                    KF_GoodsShelfLife lnqGoodsShelfLife = varInfo.Single();

                    lnqGoodsShelfLife.DateInProduced  = goodsShelfLife.DateInProduced;
                    lnqGoodsShelfLife.FillInDate      = ServerTime.Time;
                    lnqGoodsShelfLife.FillInPersonnel = BasicInfo.LoginName;
                    lnqGoodsShelfLife.ShelfLife       = goodsShelfLife.ShelfLife;
                }

                dataContext.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 设置删除标志
        /// </summary>
        /// <param name="goodsID">物品ID</param>
        /// <param name="batchNo">批次号</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool UpdateDeleteFlag(int goodsID, string batchNo)
        {
            DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

            var varData = from a in dataContext.KF_GoodsShelfLife
                          where a.GoodsID == goodsID &&
                          a.BatchNo == batchNo
                          select a;

            if (varData.Count() != 1)
            {
                return(false);
            }
            else
            {
                KF_GoodsShelfLife lnqShelfLife = varData.Single();

                lnqShelfLife.IsDelete = true;
            }

            dataContext.SubmitChanges();

            return(true);
        }