Exemple #1
0
 public void AddOrganisation(OrganisationBO organisation)
 {
     _unitOfWork.OrganisationTable.AddSingle(new OrganisationDetail
     {
         Code = organisation.Code,
         Name = organisation.Name
     });
     _unitOfWork.Commit();
 }
Exemple #2
0
        public void UpdateOrganisation(OrganisationBO organisation)
        {
            var org = new OrganisationDetail
            {
                Name = organisation.Name,
                Code = organisation.Code
            };

            _unitOfWork.OrganisationTable.UpdateSingle(organisation.Id, org);
            _unitOfWork.Commit();
        }
Exemple #3
0
        void CreateNewSepaDocument_SAVE(string _sSequenceType)
        {
            SepaDirectDebitGroupHeader m_aGroupHeader;
            SepaMessageInfo m_aSepaMessageInfo;

            OrganisationVO myCurrentOrganisationVO;
            OrganisationBO myCurrentOrganisationBO;

            SepaPaymentInformationVO myPaymentInformationVO;
            SepaDirectDebitRawDataBO mySepaDirectDebitRawDataBO;
            SepaDirectDebitRawDataVO [] mySepaDirectDebitRawDataVO;
            SepaDirectDebitTransactionInformation mySepaDirectDebitTransactionInformation;

            myCurrentOrganisationBO = new OrganisationBO();
            myCurrentOrganisationVO = myCurrentOrganisationBO.getOrganisationById(m_CurrentOrganisation);

            mySepaDirectDebitRawDataBO = new SepaDirectDebitRawDataBO(m_CurrentOrganisation);
            mySepaDirectDebitRawDataVO = mySepaDirectDebitRawDataBO.getDirectDebitRawDataById(_sSequenceType);

              //Creation of the Sepa Document
              //Group Header
            m_aGroupHeader = new SepaDirectDebitGroupHeader();
            m_aGroupHeader.MessageIdentification = mySepaDirectDebitRawDataVO[1].MessageID;
            m_aGroupHeader.CreationDateTime = mySepaDirectDebitRawDataVO[1].CreationDateTime;
            m_aGroupHeader.NumberOfTransactions = int.Parse(mySepaDirectDebitRawDataBO.getNumberOfTransactions(_sSequenceType).ToString());

              //Kontrollsumme im Groupheader als Summe aus der Datenbank ermitteln
            m_aGroupHeader.ControlSum =  (decimal) GetControlSumFromDBTable(_sSequenceType);

            m_aGroupHeader.InitiatingPartyName = mySepaDirectDebitRawDataVO[1].InitiatingPartyname;
            m_aGroupHeader.InitiatingPartyId = mySepaDirectDebitRawDataVO[1].CreditorIdentification;

            m_aSepaDocument = null;
            m_aSepaMessageInfo = SepaMessageInfo.Create(SepaWellKnownMessageInfos.Pain_008_003_02);

              //Payment Information
              //myPaymentInformationBO = new SepaPaymentInformationBO(m_CurrentOrganisation, m_CurrentDirectDebit);
              //myPaymentInformationVO = myPaymentInformationBO.getPaymentInformationById(m_CurrentOrganisation);
            myPaymentInformationVO = new SepaPaymentInformationVO();
            myPaymentInformationVO.PaymentInformationIdentification = mySepaDirectDebitRawDataVO[1].PaymentInformationID;
            myPaymentInformationVO.PaymentMethod = "DD";
            myPaymentInformationVO.BatchBooking = "true";
            myPaymentInformationVO.NumberOfTransactions = m_aGroupHeader.NumberOfTransactions;

              //Summe der Einzeltransaktionen ermitteln
            decimal dControlSum = 0;
            for (int i = 0; i < myPaymentInformationVO.NumberOfTransactions; i++)
            {
                dControlSum = dControlSum + Convert.ToDecimal(mySepaDirectDebitRawDataVO[i].InstructedAmount);
            }
              //Stimmt die Summe der Einzeltransaktionen mit der Kontrollsumme aus der Datenbank überein?
            Debug.Assert(m_aGroupHeader.ControlSum == dControlSum);

            myPaymentInformationVO.ControlSum = dControlSum;
            myPaymentInformationVO.ServiceLevelCode = "SEPA";
            myPaymentInformationVO.LocalInstrumentCode = "COR1";
            myPaymentInformationVO.SequenceType = "RCUR";

              //myPaymentInformationVO.RequestedCollectionDate = mySepaDirectDebitRawDataVO[1].RequestedCollectionDate;
              //Datenfeld RequestedCollectionDate fehlt im DTA-Input
            myPaymentInformationVO.RequestedCollectionDate = mySepaDirectDebitRawDataVO[1].CreationDateTime;
            myPaymentInformationVO.CreditorName = mySepaDirectDebitRawDataVO[1].CreditorName;
            myPaymentInformationVO.CreditorAccountIBAN = new SepaIBAN(mySepaDirectDebitRawDataVO[1].CreditorAccountIBAN.TrimEnd());
            myPaymentInformationVO.CreditorAccountCurrency = "EUR";
            myPaymentInformationVO.CreditorAgentBIC = new SepaBIC(mySepaDirectDebitRawDataVO[1].CreditorAgentBIC.TrimEnd());
            myPaymentInformationVO.ChargeBearer = "SLEV";
            myPaymentInformationVO.CreditorSchemeIdentification = mySepaDirectDebitRawDataVO[1].CreditorIdentification.ToString();

            //          SchemeName/Priority fehlen noch

            #region BuildXmlStructure

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.NewLineChars = "\n";

            using (XmlWriter writer = XmlWriter.Create("c:\\tmp\\test.xml", settings))
            {

              //Namespace and Schema location
                writer.WriteStartDocument();
                    writer.WriteStartElement("Document", m_aSepaMessageInfo.XmlNamespace);
                        writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
            //                      writer.WriteAttributeString("schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", m_aSepaMessageInfo.XmlNamespace + " " + m_aSepaMessageInfo.XmlSchemaLocation);
                        writer.WriteAttributeString("schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", m_aSepaMessageInfo.XmlNamespace + " " + "C:\\Users\\Peter\\Documents\\SEPA\\pain.008.003.02.xsd");
                        writer.WriteStartElement("CstmrDrctDbtInitn");
                          //Groupheader
                            writer.WriteStartElement("GrpHdr");
                                writer.WriteElementString("MsgId", m_aGroupHeader.MessageIdentification);
                                writer.WriteElementString("CreDtTm", m_aGroupHeader.CreationDateTime.ToString());
                                writer.WriteElementString("NbOfTxs", m_aGroupHeader.NumberOfTransactions.ToString());
                                writer.WriteElementString("CtrlSum", GetControlSumFromDBTable(_sSequenceType).ToString().Replace(',','.'));
                                writer.WriteStartElement("InitgPty");
                                    writer.WriteElementString("Nm", m_aGroupHeader.InitiatingPartyName);
                                writer.WriteEndElement();
                            writer.WriteEndElement(); //End Groupheader
                          //PaymentInformation
                            writer.WriteStartElement("PmtInf");
                                writer.WriteElementString("PmtInfId", myPaymentInformationVO.PaymentInformationIdentification);
                                writer.WriteElementString("PmtMtd", myPaymentInformationVO.PaymentMethod);
                                writer.WriteElementString("BtchBookg", myPaymentInformationVO.BatchBooking);
                                writer.WriteElementString("NbOfTxs", myPaymentInformationVO.NumberOfTransactions.ToString());
                                writer.WriteElementString("CtrlSum", myPaymentInformationVO.ControlSum.ToString().Replace(',','.'));
                                writer.WriteStartElement("PmtTpInf");
                                    writer.WriteStartElement("SvcLvl");
                                        writer.WriteElementString("Cd", myPaymentInformationVO.ServiceLevelCode);
                                    writer.WriteEndElement();
                                    writer.WriteStartElement("LclInstrm");
                                        writer.WriteElementString("Cd", myPaymentInformationVO.LocalInstrumentCode);
                                    writer.WriteEndElement();
                                    writer.WriteElementString("SeqTp", myPaymentInformationVO.SequenceType);
                                writer.WriteEndElement();
                                writer.WriteElementString("ReqdColltnDt", myPaymentInformationVO.RequestedCollectionDate.ToString());
                                writer.WriteStartElement("Cdtr");
                                    writer.WriteElementString("Nm", myPaymentInformationVO.CreditorName);
                                writer.WriteEndElement();
                                writer.WriteStartElement("CdtrAcct");
                                    writer.WriteStartElement("Id");
                                        writer.WriteElementString("IBAN", myPaymentInformationVO.CreditorAccountIBAN.ToString());
                                    writer.WriteEndElement();
                                    writer.WriteElementString("Ccy", myPaymentInformationVO.CreditorAccountCurrency);
                                writer.WriteEndElement();
                                writer.WriteStartElement("CdtrAgt");
                                    writer.WriteStartElement("FinInstnId");
                                        writer.WriteElementString("BIC", myPaymentInformationVO.CreditorAgentBIC.ToString());
                                    writer.WriteEndElement();
                                writer.WriteEndElement();
                                writer.WriteElementString("ChrgBr", myPaymentInformationVO.ChargeBearer);
                                writer.WriteStartElement("CdtrSchmeId");
                                    writer.WriteStartElement("Id");
                                        writer.WriteStartElement("PrvtId");
                                            writer.WriteStartElement("Othr");
                                                writer.WriteElementString("Id", myPaymentInformationVO.CreditorSchemeIdentification);
                                            writer.WriteEndElement();
                                        writer.WriteEndElement();
                                    writer.WriteEndElement();
                                writer.WriteEndElement();
                            writer.WriteEndElement(); //End PaymentInformation

                          //DirectDebitTransactionInformation
                            writer.WriteStartElement("DrctDbtTxInf");
                            for (int i = 0; i < myPaymentInformationVO.NumberOfTransactions; i++)
                            {
                                writer.WriteStartElement("PmtId");
                                    writer.WriteElementString("InstrId", mySepaDirectDebitRawDataVO[i].InstructionID.ToString());
                                    writer.WriteElementString("EndToEndId", mySepaDirectDebitRawDataVO[i].EndToEndID.ToString());
                                writer.WriteEndElement();
                                writer.WriteStartElement("InstrAmt");
                                    writer.WriteAttributeString("Ccy", "EUR");
                                    writer.WriteString(mySepaDirectDebitRawDataVO[i].InstructedAmount.ToString().Replace(',','.'));
                                writer.WriteEndElement();
                                    writer.WriteElementString("ChrgBr", "SLEV");
                                writer.WriteStartElement("DrctDbtTx");
                                    writer.WriteStartElement("MndtRltdInf");
                                        writer.WriteElementString("MndtId", mySepaDirectDebitRawDataVO[i].MandateID);
                                        writer.WriteElementString("DtOfSgntr", mySepaDirectDebitRawDataVO[i].DateOfSignature);
                                    writer.WriteEndElement();
                                    writer.WriteStartElement("CdtrSchmeId");
                                        writer.WriteStartElement("Id");
                                            writer.WriteStartElement("PrvtId");
                                                writer.WriteStartElement("Othr");
                                                    writer.WriteElementString("Id", myPaymentInformationVO.CreditorSchemeIdentification);
                                                writer.WriteEndElement();
                                            writer.WriteEndElement();
                                        writer.WriteEndElement();
                                    writer.WriteEndElement();
                                writer.WriteEndElement();
                            }
                            writer.WriteEndElement(); //End DirectDebitTransactionInformation

                        writer.WriteEndElement(); //End CstmrDrctDbtInitn
                    writer.WriteEndElement(); //End Document
                writer.WriteEndDocument(); //End Namespace and Schema location
            }

            #endregion BuildXmlStructure

            for (int i = 0; i < mySepaDirectDebitRawDataVO.Length; i++)
            {
                mySepaDirectDebitTransactionInformation = new SepaDirectDebitTransactionInformation();
                mySepaDirectDebitTransactionInformation.EndToEndId = mySepaDirectDebitRawDataVO[i].EndToEndID;
                mySepaDirectDebitTransactionInformation.Amount = decimal.Parse(mySepaDirectDebitRawDataVO[i].InstructedAmount);
                mySepaDirectDebitTransactionInformation.MandateIdentification = mySepaDirectDebitRawDataVO[i].MandateID;
            }

            m_CurrentControlSumFromDBTable = GetControlSumFromDBTable(_sSequenceType);

            DirectDebitDetailsDataGridView.DataSource = mySepaDirectDebitRawDataVO;
            showDirectDebitDetailsList();

              //Dialog-Controls aktualisieren
            //          msgIDLabel.Text = m_aSepaDoc.Message.MessageIdentification;
            paymentInformationCreditorNameTextBox.Text = myCurrentOrganisationVO.Name;
            paymentInformationCreditorBicTextBox.Text = myCurrentOrganisationVO.BIC;
            paymentInformationCreditorIbanTextBox.Text = myCurrentOrganisationVO.IBAN;
            paymentInformationCreditorSchemeIdTextBox.Text = myCurrentOrganisationVO.GläubigerID;
            controlSumOutputLabel.Text = m_CurrentControlSumFromDBTable.ToString();

              //bindDirectDebitGridView(m_CurrentOrganisation, directDebitHistoryComboBox.SelectedItem.ToString());
        }