Пример #1
0
        public BE_PaymentAuthDetail CreatePaymentAuthDetail(BE_PaymentAuthDetail _BePaymentAuthDetail)
        {
            _database = new MySQLDatabase(connectionString);



            BE_PaymentAuthDetail        _BePAD                  = new DA_Payment(_database).createPaymentAuthDetail(_BePaymentAuthDetail);
            List <VE_PaymentAuth>       _lstVePaymentAuth       = getPaymentsAuthById(_BePAD.paymentAuthId);
            List <VE_PaymentAuthDetail> _lstVePaymentAuthDetail = GetValueUserByPaymentAuthId(_BePAD.paymentAuthId);



            BL_Usuario _blUsuario = new BL_Usuario();

            _blUsuario.connectionString = connectionString;
            List <VE_UserCompany> _lstVeUserCompany = _blUsuario.GetUserNameByCompanyCode(_lstVePaymentAuth[0].companyCode, _lstVePaymentAuth[0].paymentAuthId);

            if (_lstVeUserCompany.Count > 0)
            {
                if (_lstVePaymentAuthDetail.Count == _lstVeUserCompany[0].quantityAuth)
                {
                    UpdatePaymentAuthStatus(2, _lstVePaymentAuth[0].paymentAuthId);
                }
                else
                {
                    UpdatePaymentAuthStatus(1, _lstVePaymentAuth[0].paymentAuthId);
                }
            }
            List <VE_Payment>    _lstVePayments  = getPaymentsByAuthId(_BePAD.paymentAuthId);
            VE_PaymentAuthDetail _VePADUserAudit = GetUserAuditByPaymentAuthId(_BePAD.paymentAuthId);

            /*
             * int idMail = 4;
             * BE_Mail _BeMail = GetMailInfo(idMail);*/


            foreach (VE_UserCompany _veUserCompany in _lstVeUserCompany)
            {
                foreach (VE_PaymentAuthDetail _vePaymentAuthDetail in _lstVePaymentAuthDetail)
                {
                    if (_veUserCompany.quantityAuth != _lstVePaymentAuthDetail.Count)
                    {
                        if (_veUserCompany.userName != _vePaymentAuthDetail.userAudit)
                        {
                            string amounttotal = (_veUserCompany.amountTotal).ToString();
                            string paymentsQ   = (_lstVePayments.Count).ToString();
                            string paid        = (_BePAD.paymentAuthId).ToString();
                            //string paydate = (_lstVePaymentAuth[0].payDate).ToString();

                            /*
                             * string body = _BeMail.bodyMail;
                             * body = body.Replace("@FirstName", _veUserCompany.firstName);
                             * body = body.Replace("@LastName", _veUserCompany.lastName);
                             * body = body.Replace("@AmountTotal", amounttotal);
                             * body = body.Replace("@PayDate", _lstVePaymentAuth[0].payDateFormat);
                             * body = body.Replace("@PaymentsQ", paymentsQ);
                             * body = body.Replace("@Generator", _vePaymentAuthDetail.userAudit);
                             * body = body.Replace("@PAID", paid);
                             * body = body.Replace("@Banco", _lstVePaymentAuth[0].bankName);
                             * body = body.Replace("@shortBank", _lstVePaymentAuth[0].bankShortName);
                             * body = body.Replace("@tipoMoneda", _lstVePaymentAuth[0].currency);
                             */

                            //body = body.Replace("@n", "<br>");
                            //string body = "<em> HRTDASDASDASD!!</em>";

                            /*
                             * if (_veUserCompany.authorize==1){
                             *
                             *
                             *           BL_Mail _BlMail = new BL_Mail();
                             *              try
                             *              {
                             *
                             *                  _BlMail.SendEmail("*****@*****.**", _veUserCompany.email, _BeMail.subjectMail, body);
                             *              } catch                                { }
                             *        }*/
                        }
                    }
                    else
                    {
                        BL_Bank _blBank = new BL_Bank();
                        _blBank.connectionString = connectionString;
                        VE_BankAccount _updateBalaceBankAccount = _blBank.UpdateBalanceBankAccount(_lstVePaymentAuth[0].paymentAuthId);
                        return(_BePaymentAuthDetail);
                    }
                }
            }
            return(_BePaymentAuthDetail);
        }