예제 #1
0
        /// <summary>
        /// 保存增值税发票资质信息
        /// </summary>
        /// <param name="VatInvoiceProof"></param>
        /// <returns></returns>
        public ResultDTO SaveVatInvoiceProofExt(Jinher.AMP.BTP.Deploy.CustomDTO.VatInvoiceProofInfoDTO vatInvoiceP)
        {
            try
            {
                ContextSession  contextSession  = ContextFactory.CurrentThreadContext;
                VatInvoiceProof vatInvoiceProof = VatInvoiceProof.ObjectSet().FirstOrDefault(n => n.Id == vatInvoiceP.Id);
                if (vatInvoiceProof == null)
                {
                    VatInvoiceProof vatInvoiceProo = VatInvoiceProof.CreateVatInvoiceProof();
                    vatInvoiceProo.Id              = vatInvoiceP.Id;
                    vatInvoiceProo.CompanyName     = vatInvoiceP.CompanyName;
                    vatInvoiceProo.Address         = vatInvoiceP.Address;
                    vatInvoiceProo.BankCode        = vatInvoiceP.BankCode;
                    vatInvoiceProo.BankName        = vatInvoiceP.BankName;
                    vatInvoiceProo.BusinessLicence = vatInvoiceP.BusinessLicence;
                    vatInvoiceProo.PersonalProof   = vatInvoiceP.PersonalProof;
                    vatInvoiceProo.Phone           = vatInvoiceP.Phone;
                    vatInvoiceProo.IdentifyNo      = vatInvoiceP.IdentifyNo;
                    vatInvoiceProo.TaxRegistration = vatInvoiceP.TaxRegistration;
                    contextSession.SaveObject(vatInvoiceProo);
                }
                else
                {
                    vatInvoiceProof.EntityState     = System.Data.EntityState.Modified;
                    vatInvoiceProof.Id              = vatInvoiceP.Id;
                    vatInvoiceProof.CompanyName     = vatInvoiceP.CompanyName;
                    vatInvoiceProof.Address         = vatInvoiceP.Address;
                    vatInvoiceProof.BankCode        = vatInvoiceP.BankCode;
                    vatInvoiceProof.BankName        = vatInvoiceP.BankName;
                    vatInvoiceProof.BusinessLicence = vatInvoiceP.BusinessLicence;
                    vatInvoiceProof.PersonalProof   = vatInvoiceP.PersonalProof;
                    vatInvoiceProof.Phone           = vatInvoiceP.Phone;
                    vatInvoiceProof.IdentifyNo      = vatInvoiceP.IdentifyNo;
                    vatInvoiceProof.TaxRegistration = vatInvoiceP.TaxRegistration;
                    contextSession.SaveObject(vatInvoiceProof);
                }

                contextSession.SaveChanges();
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("保存增值税发票资质信息异常。vatInvoiceP:{0}", vatInvoiceP), ex);
                return(new ResultDTO {
                    ResultCode = 1, Message = "Error"
                });
            }
            return(new ResultDTO {
                ResultCode = 0, Message = "Success"
            });
        }