コード例 #1
0
        private void SendSmsAndMail(shop shop, transaction_category tran, debt debt, debt_transaction dtran, debt_lodgement_reimbursment newmlr)
        {
            try
            {
                bool mailvalidity = new Utilities.Mail_Validity_Helper().getMailSendingStatus();
                SMS_Vendor_Validity_Helper valhelp = new SMS_Vendor_Validity_Helper();
                sms_vendor vendor = valhelp.getVendorsByName("50kobo");

                bool smsvalidity = (DateTime.Today <= vendor.expiry_date) ? true : false;

                if (shop.agent != null)
                {
                    sms message;
                    if (tran.code == "DL")
                    {
                        if (smsvalidity)
                        {
                            sm mm = new CRUD.sms_crud().findByCode("DL");
                            message = new sms();

                            if (message.initializeDebtParameters(shop, debt, dtran, newmlr, mm.subject.Trim() + "\r\n" + mm.content.Trim() + "\r\n" + mm.conclusion.Trim()))
                            {
                                message.CustomizeAndSendSMS();
                            }
                        }
                        if (mailvalidity)
                        {
                            mail       mail   = new CRUD.mail_crud().findByCode("DL");
                            MailClient client = new MailClient();
                            client.SendDebtLodgement(shop, mail, debt, dtran);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #2
0
        private void AddnewLodgementReimbursementTransaction(shop shop, transaction_category tran, PaymentNotificationRequest pnr, BettingSuiteDataContext db)
        {
            DateTime             date          = DateTime.Today;
            master_balance_sheet masterbalance = new CRUD.master_balance_sheet_crud().getMasterBalanceByShopId(shop.id);

            if (masterbalance == null)
            {
                masterbalance = new master_balance_sheet
                {
                    shop           = shop.id,
                    credit_balance = 0,
                    online_credit  = 0,
                    sales_balance  = 0,
                    netbalance     = 0,
                };
                masterbalance = new CRUD.master_balance_sheet_crud(masterbalance).insert_master_balance_sheet();
            }

            master_transaction reversalmastertransaction = new master_transaction();


            master_lodgement_reimbursment newmlr = new master_lodgement_reimbursment
            {
                amount               = pnr.Amount,
                bank                 = 0,//interswitch id,
                date                 = date,
                shop                 = shop.id,
                teller_number        = pnr.PaymentLogId.ToString(),
                islocked             = true,
                isverified           = true,
                payment_type         = 5,
                transaction_category = tran.id,
            };

            login lodin = db.logins.Single(a => a.username == "InterSwitch");
            master_transaction newmastertransaction = new master_transaction
            {
                amount          = Math.Abs(pnr.Amount),
                balance_before  = (masterbalance != null) ? masterbalance.sales_balance : 0,
                balance_after   = (masterbalance != null) ? getbal(masterbalance.sales_balance, pnr.Amount, tran) : pnr.Amount,
                shop            = shop.id,
                trans_category  = tran.id,
                trans_timestamp = DateTime.Now,
                trans_type      = (tran.type == true) ? 1 : 0,
                posted_by       = lodin.id,// interswitch id,
                description     = pnr.PaymentReference + " Posted For " + date.ToShortDateString(),
                details         = (tran.code == "L") ? "Lodgement For " + date.ToShortDateString() : "Lodgement Reversal For " + date.ToShortDateString()
            };

            masterbalance.sales_balance = (masterbalance != null) ? getbal(masterbalance.sales_balance, newmastertransaction.amount, tran) : newmastertransaction.amount;
            masterbalance.netbalance    = (masterbalance != null) ? getbal(masterbalance.netbalance, newmastertransaction.amount, tran) : newmastertransaction.amount;

            bool loadtran = new Utilities.TransactionHelper().SaveMasterLodgementTransaction(newmlr, newmastertransaction, masterbalance);

            if (loadtran)
            {
                try
                {
                    bool mailvalidity = new Utilities.Mail_Validity_Helper().getMailSendingStatus();
                    SMS_Vendor_Validity_Helper valhelp = new SMS_Vendor_Validity_Helper();
                    sms_vendor vendor = valhelp.getVendorsByName("50kobo");

                    bool smsvalidity = (DateTime.Today <= vendor.expiry_date) ? true : false;

                    if (newmlr.bank1.code != "CASH")
                    {
                        sms message;
                        if (tran.code == "L")
                        {
                            if (smsvalidity)
                            {
                                sm mm = new CRUD.sms_crud().findByCode("CA");
                                message = new sms();

                                if (message.initializeParameters(shop, mm.subject.Trim() + "\r\n" + mm.content.Trim() + "\r\n" + mm.conclusion.Trim(), newmlr))
                                {
                                    message.CustomizeAndSendSMS();
                                }
                            }
                            if (mailvalidity)
                            {
                                mail       mail   = new CRUD.mail_crud().findByCode("LA");
                                MailClient client = new MailClient();
                                client.SendLodgementReimbursementMail(shop, mail, newmastertransaction);
                            }
                        }
                        else if (tran.code == "R")
                        {
                            if (smsvalidity)
                            {
                                sm mm = new CRUD.sms_crud().findByCode("DA");
                                message = new sms();
                                if (message.initializeParameters(shop, mm.subject + "\r\n" + mm.content + "\r\n" + mm.conclusion, newmlr))
                                {
                                    message.CustomizeAndSendSMS();
                                }
                            }
                            if (mailvalidity)
                            {
                                mail       mail   = new CRUD.mail_crud().findByCode("RA");
                                MailClient client = new MailClient();
                                client.SendLodgementReimbursementMail(shop, mail, newmastertransaction);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            else
            {
            }
        }
コード例 #3
0
        private bool savePaymentDetails(PaymentNotificationRequestHelper pnr)
        {
            BettingSuiteDataContext db = new BettingSuiteDataContext();

            if (iSNotDuplicate(pnr.getPaymentLogId(), db))
            {
                try
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        PaymentNotificationRequest pr = setPaymentRequestObjAndSave(pnr, db);
                        shop shop = new CRUD.shop_crud().find_shop_By_ID(pr.CustReference);
                        foreach (PaymentItemHelper it in pnr.getPaymentItems())
                        {
                            if (it.getItemCode().Equals(ConfigurationManager.AppSettings["SalesCode"].ToString()))
                            {
                                AddSalesTransaction(shop, pr, db);
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["LeaseDebtCode"].ToString()))
                            {
                                AddDebtTransaction(shop, pr, db);
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["OperationalDebtCode"].ToString()))
                            {
                                AddDebtTransaction(shop, pr, db);
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["Online Agency"].ToString()))
                            {
                                //sendmail
                                MailClient mc   = new MailClient();
                                mail       mail = new CRUD.mail_crud().findByCode("OL");
                                string     body = mail.content;
                                body = body.Replace("{shop_code}", shop.shop_code);
                                body = body.Replace("{account_name}", pnr.getCustomerName());
                                body = body.Replace("{amount}", "₦" + pr.Amount.ToString());
                                body = body.Replace("{amount_to_lodge}", "₦" + (decimal.Multiply(pr.Amount, decimal.Parse("1.10"))).ToString());
                                body = body.Replace("{payment_method}", "InterSwitch");

                                mc.SendBulkMail(ConfigurationManager.AppSettings["ONLINE SENDING MAIL"].ToString(), shop.shop_code + " (₦" + pr.Amount.ToString() + ") ", body);
                                //send sms to agent
                                SMS_Vendor_Validity_Helper valhelp = new SMS_Vendor_Validity_Helper();
                                sms_vendor vendor = valhelp.getVendorsByName("50kobo");

                                bool smsvalidity = (DateTime.Today <= vendor.expiry_date) ? true : false;

                                if (smsvalidity)
                                {
                                    sms message = new sms();
                                    if (message.initializeParameters(shop, "Online Lodgement Confirmation" + "\r\n" + "Your lodgement of " + pr.Amount.ToString() + " for online agency has being confirmed. You would be credited with " + (decimal.Multiply(pr.Amount, decimal.Parse("1.10"))).ToString() + "\r\n" + "", pr.PaymentDate))
                                    {
                                        message.CustomizeAndSendSMS();
                                    }
                                }
                                //send online dept updates on online user
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["Online User"].ToString()))
                            {
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["Payment Commision"].ToString()))
                            {
                                //futute implementation
                            }
                            else
                            {
                                SMS_Vendor_Validity_Helper valhelp = new SMS_Vendor_Validity_Helper();
                                sms_vendor vendor = valhelp.getVendorsByName("50kobo");

                                bool smsvalidity = (DateTime.Today <= vendor.expiry_date) ? true : false;

                                if (smsvalidity)
                                {
                                    sms message = new sms();
                                    if (message.initializeParameters(shop, "Payment Confirmation" + "\r\n" + "Your lodgement of " + pr.Amount.ToString() + " for " + it.getItemName() + " has being confirmed and would be processed shortly" + "\r\n" + "call 014609630 for info/complaints", pr.PaymentDate))
                                    {
                                        message.CustomizeAndSendSMS();
                                    }
                                }
                            }
                        }

                        db.SubmitChanges();
                        scope.Complete();

                        return(true);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
            }
            return(false);
        }