Esempio n. 1
0
        private void SendSms(bonushelper bhelp, master_balance_sheet balancesheet, transaction_category btran)
        {
            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 (bhelp.shop.agent != null)
                {
                    sms message = new sms();
                    if (btran.code == "B")
                    {
                        if (smsvalidity)
                        {
                            sm mm = new CRUD.sms_crud().findByCode("BA");
                            message = new sms();

                            if (message.initialisebonusparams(bhelp.shop, mm.subject + "\r\n" + mm.content + "\r\n" + mm.conclusion, bhelp.Bonus, balancesheet.sales_balance.Value))
                            {
                                ;
                            }
                            message.CustomizeAndSendSMS();
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 2
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)
            {
            }
        }
Esempio n. 3
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
            {
            }
        }