public bool DeleteInfo(int id)
        {
            Base_WarehouseInfo house = dao.GetInfo(id);

            if (daoStore.WarehouseHasProduct(house.WareHouseCode))
            {
                throw new Exception("该仓库信息已使用,不能删除");
            }
            return(dao.DeleteInfo(id));
        }
        public bool UpdateInfo(Base_WarehouseInfo info)
        {
            var query = from house in dc.Base_WarehouseInfo
                        where house.Base_WarehouseInfo_ID == info.Base_WarehouseInfo_ID
                        select house;

            BatchEvaluate.Eval(info, query.First());
            dc.SubmitChanges();
            return(true);
        }
        public int InsertInfo(Base_WarehouseInfo info)
        {
            string msg = dao.ValidateRepeat(info);

            if (msg == "")
            {
                return(dao.InsertInfo(info));
            }
            else
            {
                throw new Exception(msg);
            }
        }
        /// <summary>
        ///   验证仓库代码及简称是否有重复的
        /// </summary>
        /// <param name="info"> 仓库实体 </param>
        /// <returns> 如果不重复返回"" </returns>
        public string ValidateRepeat(Base_WarehouseInfo info)
        {
            int cnt1 =
                dc.Base_WarehouseInfo.Where(itm => itm.WareHouseCode == info.WareHouseCode && itm.Base_WarehouseInfo_ID != info.Base_WarehouseInfo_ID).Count();

            if (cnt1 > 0)
            {
                return("仓库代码重复");
            }
            int cnt2 = dc.Base_WarehouseInfo.Where(itm => itm.ShortName == info.ShortName && itm.Base_WarehouseInfo_ID != info.Base_WarehouseInfo_ID).Count();

            if (cnt2 > 0)
            {
                return("仓库简称重复");
            }
            return("");
        }
 public bool UpdateInfo(Base_WarehouseInfo info)
 {
     return(dao.UpdateInfo(info));
 }
 public int InsertInfo(Base_WarehouseInfo info)
 {
     dc.Base_WarehouseInfo.InsertOnSubmit(info);
     dc.SubmitChanges();
     return(info.Base_WarehouseInfo_ID);
 }