コード例 #1
0
        public void UpdateExpenseDocumentOnTransaction(FnExpenseDocument exp, Guid txId)
        {
            ExpenseDataSet ds = (ExpenseDataSet)TransactionService.GetDS(txId);

            if (exp.Document != null)
            {
                ExpenseDataSet.DocumentRow docRow = ds.Document.FindByDocumentID(exp.Document.DocumentID);
                docRow.BeginEdit();
                docRow.DocumentNo = exp.Document.DocumentNo;
                //docRow.DocumentStatus = exp.Document.DocumentStatus;
                docRow.Subject = exp.Document.Subject;
                docRow.Memo    = exp.Document.Memo;
                if (exp.Document.DocumentType != null)
                {
                    docRow.DocumentTypeID = exp.Document.DocumentType.DocumentTypeID;
                }
                if (exp.Document.CompanyID != null)
                {
                    docRow.CompanyID = exp.Document.CompanyID.CompanyID;
                }
                if (exp.Document.CreatorID != null)
                {
                    docRow.CreatorID = exp.Document.CreatorID.Userid;
                }
                if (exp.Document.RequesterID != null)
                {
                    docRow.RequesterID = exp.Document.RequesterID.Userid;
                }
                if (exp.Document.ReceiverID != null)
                {
                    docRow.ReceiverID = exp.Document.ReceiverID.Userid;
                }
                if (exp.Document.ApproverID != null)
                {
                    docRow.ApproverID = exp.Document.ApproverID.Userid;
                }

                docRow.Active  = exp.Document.Active;
                docRow.CreDate = exp.CreDate;
                docRow.CreBy   = exp.CreBy;
                docRow.UpdDate = exp.UpdDate;
                docRow.UpdBy   = exp.UpdBy;
                docRow.UpdPgm  = exp.UpdPgm;

                docRow.EndEdit();
                docRow.AcceptChanges();
            }
            ExpenseDataSet.FnExpenseDocumentRow expRow = ds.FnExpenseDocument.FindByExpenseID(exp.ExpenseID);
            expRow.BeginEdit();

            if (exp.ServiceTeam != null)
            {
                expRow.ServiceTeamID = exp.ServiceTeam.ServiceTeamID;
            }
            if (exp.PB != null)
            {
                expRow.PBID = exp.PB.Pbid;
            }
            expRow.PaymentType  = exp.PaymentType;
            expRow.TotalAdvance = (decimal)exp.TotalAdvance;
            expRow.TotalExpense = (decimal)exp.TotalExpense;
            expRow.CreDate      = exp.CreDate;
            expRow.CreBy        = exp.CreBy;
            expRow.UpdDate      = exp.UpdDate;
            expRow.UpdBy        = exp.UpdBy;
            expRow.UpdPgm       = exp.UpdPgm;

            expRow.EndEdit();
            expRow.AcceptChanges();
        }