Exemplo n.º 1
0
        /// <summary>
        /// 删除BOM关联零件表
        /// </summary>
        /// <param name="jumbly">一条LINQ的记录集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>删除成功返回True,删除失败返回False</returns>
        public bool DeleteJumbly(P_JumblyBomGoods jumbly, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

                var varJumbly = from a in ctx.P_JumblyBomGoods
                                where a.ID == jumbly.ID
                                select a;

                if (varJumbly.Count() != 1)
                {
                    error = "此数据不存在或者不唯一";
                    return(false);
                }
                else
                {
                    P_JumblyBomGoods lnqGoods = varJumbly.Single();

                    ctx.P_JumblyBomGoods.DeleteOnSubmit(lnqGoods);

                    ctx.SubmitChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新BOM关联零件表
        /// </summary>
        /// <param name="jumbly">一条LINQ的记录集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>更新成功返回True,更新失败返回False</returns>
        public bool UpdateJumbly(P_JumblyBomGoods jumbly, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

                var varData = from a in ctx.P_JumblyBomGoods
                              where a.ID == jumbly.ID
                              select a;

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

                    lnqGoods.IsJumbly      = jumbly.IsJumbly;
                    lnqGoods.BomGoodsCode  = jumbly.BomGoodsCode;
                    lnqGoods.BomGoodsName  = jumbly.BomGoodsName;
                    lnqGoods.BomSpec       = jumbly.BomSpec;
                    lnqGoods.IsStock       = jumbly.IsStock;
                    lnqGoods.JumblyGoodsID = jumbly.JumblyGoodsID;
                    lnqGoods.Quato         = jumbly.Quato;
                    lnqGoods.IsMath        = jumbly.IsMath;
                    lnqGoods.Remark        = jumbly.Remark;

                    ctx.SubmitChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加BOM关联零件表
        /// </summary>
        /// <param name="jumbly">一条P_JumblyBomGoods的LINQ记录集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>添加成功返回True,添加失败返回False</returns>
        public bool AddJumbly(P_JumblyBomGoods jumbly, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

                ctx.P_JumblyBomGoods.InsertOnSubmit(jumbly);
                ctx.SubmitChanges();
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);

                throw;
            }
            return(true);
        }