protected void TestStatementAccountPostProcess(IObjectSpace os, fmCSAStatementAccount sa) { Assert.AreNotEqual(sa.ImportResult, null); IList <fmCSAOperationJournal> opers = os.GetObjects <fmCSAOperationJournal>( CriteriaOperator.And(new BinaryOperator("BankAccount", sa.BankAccount), new BinaryOperator("OperationDate", sa.DateFrom.Date, BinaryOperatorType.GreaterOrEqual), new BinaryOperator("OperationDate", sa.DateTo.Date.AddDays(1), BinaryOperatorType.Less)), true); Decimal summ = 0; summ = opers.Sum(oper => oper.SumIn); Assert.AreEqual(sa.TotalRecaivedAtAccount, summ); summ = opers.Sum(oper => oper.SumOut); Assert.AreEqual(sa.TotalWriteOfAccount, summ); foreach (fmCSAStatementAccountDoc doc in sa.PayInDocs) { summ = opers.Where(oper => oper.PaymentDocument == doc.PaymentDocument).Sum(oper => oper.SumIn); Assert.AreEqual(doc.PaymentCost, summ); } foreach (fmCSAStatementAccountDoc doc in sa.PayOutDocs) { summ = opers.Where(oper => oper.PaymentDocument == doc.PaymentDocument).Sum(oper => oper.SumOut); Assert.AreEqual(doc.PaymentCost, summ); } foreach (fmCDocRCBRequisites req in sa.DocRCBRequisites) { Assert.AreNotEqual(req.StatementOfAccountDoc, null); Assert.AreEqual(sa.BankAccount, req.BankAccount); Assert.AreEqual(sa.Bank, req.Bank); fmCSAStatementAccountDoc doc = req.StatementOfAccountDoc; Assert.AreEqual(doc.ImportResult, sa.ImportResult); Assert.AreNotEqual(doc.PaymentPayerRequisites.BankAccount, doc.PaymentReceiverRequisites.BankAccount); TestDocRCBRequsites(os, doc.PaymentPayerRequisites); TestDocRCBRequsites(os, doc.PaymentReceiverRequisites); Assert.AreNotEqual(doc.PaymentDocument, null); fmCDocRCB paydoc = doc.PaymentDocument; TestDocRCBRequsites(os, paydoc.PaymentPayerRequisites); TestDocRCBRequsites(os, paydoc.PaymentReceiverRequisites); Assert.AreEqual(doc.PaymentPayerRequisites.BankAccount, paydoc.PaymentPayerRequisites.BankAccount); Assert.AreEqual(doc.PaymentPayerRequisites.Bank, paydoc.PaymentPayerRequisites.Bank); Assert.AreEqual(doc.PaymentReceiverRequisites.BankAccount, paydoc.PaymentReceiverRequisites.BankAccount); Assert.AreEqual(doc.PaymentReceiverRequisites.Bank, paydoc.PaymentReceiverRequisites.Bank); if (doc.PaymentReceiverRequisites == req) { Assert.AreEqual(doc.StatementAccountIn, sa); } if (doc.PaymentPayerRequisites == req) { Assert.AreEqual(doc.StatementAccountOut, sa); } } }
public virtual void AutoBinding(fmCSAStatementAccountDoc StatementAccountDoc, fmCPRRepaymentTask RepaymentTask) { fmCSAStatementAccount statement = null; statement = StatementAccountDoc.PaymentPayerRequisites.StatementOfAccount; if (statement != null && statement.BankAccount != null) { AutoBinding(statement.BankAccount, RepaymentTask); } //if (statement == null) { statement = StatementAccountDoc.PaymentReceiverRequisites.StatementOfAccount; //} if (statement != null && statement.BankAccount != null) { AutoBinding(statement.BankAccount, RepaymentTask); } }
private void AutoBinding_Execute(object sender, SimpleActionExecuteEventArgs e) { foreach (fmCSAStatementAccountDoc doc in e.SelectedObjects) { //current = View.CurrentObject as fmCSAStatementAccountDoc; if (doc == null) { continue; } using (IObjectSpace os = ObjectSpace.CreateNestedObjectSpace()) { fmCSAStatementAccountDoc current = os.GetObject <fmCSAStatementAccountDoc>(doc); doc.PaymentDocument.AutoBinding(current, null); os.CommitChanges(); } ObjectSpace.CommitChanges(); } //DevExpress.XtraEditors.XtraMessageBox.Show("Автоматическая привязка Заявок произведена успешно"); }
/// <summary> /// Создать и открыть объект fmCPRRepaymentTask в модальном окне /// </summary> private void ManualBinding_Execute(object sender, SimpleActionExecuteEventArgs e) { fmCSAStatementAccountDoc current = e.CurrentObject as fmCSAStatementAccountDoc; if (current == null) { return; } //fmCPRRepaymentTask RT = ObjectSpace.CreateObject<fmCPRRepaymentTask>(); //IObjectSpace objectSpace = ObjectSpace.CreateNestedObjectSpace(); // Frame.Application.CreateObjectSpace(); IObjectSpace objectSpace = Application.CreateObjectSpace(); // Create object //fmCPRRepaymentTask nestedRT = objectSpace.GetObject<fmCPRRepaymentTask>(RT); fmCPRRepaymentTask nestedRT = objectSpace.CreateObject <fmCPRRepaymentTask>(); if (current.StatementAccountIn != null) { nestedRT.BankAccount = objectSpace.GetObject <crmBankAccount>(current.StatementAccountIn.BankAccount); } else if (current.StatementAccountOut.BankAccount != null) { nestedRT.BankAccount = objectSpace.GetObject <crmBankAccount>(current.StatementAccountOut.BankAccount); } nestedRT.PaymentDocument = objectSpace.GetObject <fmCDocRCB>(current.PaymentDocument); nestedRT.FillRepaymentTaskLines(); nestedRT.FillRequestList(); // Show object string DetailViewId = Frame.Application.FindDetailViewId(nestedRT.GetType()); //BaseObject passedObj = nestedRT; // objectSpace.GetObject<BaseObject>(rt); TargetWindow openMode = TargetWindow.NewModalWindow; DetailView dv = Frame.Application.CreateDetailView(objectSpace, DetailViewId, true, nestedRT); ShowViewParameters svp = new ShowViewParameters() { CreatedView = dv, TargetWindow = openMode, Context = TemplateContext.View, CreateAllControllers = true }; e.ShowViewParameters.Assign(svp); }