/// <summary>
        /// 添加装配用途
        /// </summary>
        /// <param name="purpose">用途名称</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>成功返回true, 失败返回false</returns>
        public bool AddAssemblingPurpose(string purpose, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.View_ZPX_MultiBatchPartPurpose
                             where r.装配用途名称 == purpose
                             select r;

                if (result.Count() > 0)
                {
                    error = "装配用途已经存在不允许重复添加";
                    return(false);
                }

                ZPX_AssemblingPurpose purposeObj = new ZPX_AssemblingPurpose();

                purposeObj.Purpose = purpose;

                dataContxt.ZPX_AssemblingPurpose.InsertOnSubmit(purposeObj);

                dataContxt.SubmitChanges();

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 修改装配用途
        /// </summary>
        /// <param name="oldPurpose">旧用途名称</param>
        /// <param name="newPurpose">新用途名称</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>成功返回true, 失败返回false</returns>
        public bool UpdateAssemblingPurpose(string oldPurpose, string newPurpose, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.ZPX_AssemblingPurpose
                             where r.Purpose == oldPurpose
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("“{0}”装配用途不存在,无法修改", oldPurpose);
                    return(false);
                }

                ZPX_AssemblingPurpose purposeObj = result.Single();

                purposeObj.Purpose = newPurpose;

                dataContxt.SubmitChanges();

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }