public void PostBillTransaction(string param1, string param2, string billsCode, string wallet, float amount, float balance, string fullname, string customerNum) { Database.DBRetailers upd = new Database.DBRetailers(); Database.DBPostpaidBill.DBPostpaidBill postbills = Database.DBPostpaidBill.DBPostpaidBill.GetDataByCode(billsCode); float deduct = postbills.ServiceCharge + amount; float bal = balance - deduct; upd.UpdateBalance(wallet, bal); Database.DBMessages.DBOutbox add = new Database.DBMessages.DBOutbox(); Database.DBTransactions.DBPostpaidBillTransaction billtrans = new Database.DBTransactions.DBPostpaidBillTransaction(); billtrans.Add(DateTime.Now, billsCode, param1, param2, amount, wallet, "Pending", "", fullname, postbills.ServiceCharge, deduct, customerNum); Database.DBTransactions.DBPostpaidBillTransaction retrieve = Database.DBTransactions.DBPostpaidBillTransaction.GetDataLast(); add.Add(DateTime.Now, wallet, "A1+ Payment System : Your " + billsCode + " bill has been accepted, payment posting is w/in 24hrs. Pls keep your tracking #" + retrieve.Id.ToString("D6") + ". Current bal " + bal + ".", "Pending"); if (customerNum != "") { add.Add(DateTime.Now, customerNum, "Thank you using A1+ System. Your " + billsCode + " bill has been accepted, payment posting is w/in 24hrs. Pls keep yout tracking#" + retrieve.Id.ToString("D6") + ".", "Pending"); } }
public void AddtoOutBox(DateTime date, string sender, string message, string status) { DBOutbox.Add(date, sender, message, status); }
public static void PrepaidCableConfirmationCustomer() { try{ string mess, mess1; mess = mess1 = ""; Database.DBTransactions.DBPrepaidCableTransactions trs = Database.DBTransactions.DBPrepaidCableTransactions.GetDataSendingStatus("Sending"); Database.DBMessages.DBOutbox add = new Database.DBMessages.DBOutbox(); if (trs != null) { Database.DBPrepaidCable.DBPrepaidCable preCable = Database.DBPrepaidCable.DBPrepaidCable.GetDataByCode(trs.Code); Database.DBMessages.DBOutboxLog outbl1 = Database.DBMessages.DBOutboxLog.GetDataMessage(trs.Code + " " + trs.Box_number + " " + trs.Pin); Database.DBMessages.DBOutboxLog outbl2 = Database.DBMessages.DBOutboxLog.GetDataMessage(trs.Code + " " + trs.Pin + " " + trs.Box_number); Database.DBMessages.DBOutbox outb1 = Database.DBMessages.DBOutbox.GetDataMessage(trs.Code + " " + trs.Pin + " " + trs.Box_number, "Unsuccessful"); Database.DBMessages.DBOutbox outb2 = Database.DBMessages.DBOutbox.GetDataMessage(trs.Code + " " + trs.Box_number + " " + trs.Pin, "Unsuccessful"); if (outbl1 != null || outbl2 != null) { Database.DBPrepaidCable.DBPrepaidCable cabletype = Database.DBPrepaidCable.DBPrepaidCable.GetDataByCode(trs.Code); Database.DBPrepaidCable.DBPrepaidCards cards = Database.DBPrepaidCable.DBPrepaidCards.GetDataByAmount(Convert.ToInt32(trs.Amount), cabletype.Code); Database.DBPrepaidCable.DBPrepaidCardslog cardslog = new Database.DBPrepaidCable.DBPrepaidCardslog(); Database.DBPrepaidCable.DBPrepaidCards cards1 = new Database.DBPrepaidCable.DBPrepaidCards(); cardslog.Add(cabletype.Code, cards.Amount, cards.Pin, DateTime.Now, "Used"); cards1.Delete(Convert.ToString(cards.Id)); Database.DBRetailers wallet = Database.DBRetailers.GetDataByWallet(trs.Wallet_id); Database.DBRetailers upd = new Database.DBRetailers(); float balance = wallet.Balance + trs.Discount - trs.Amount; upd.UpdateBalance(wallet.Wallet_Id, balance); var chars = trs.Pin.ToCharArray(); for (int x = chars.Length - 4; x >= 0; x--) { mess1 = chars[x] + mess1; } if (trs.Code == "CIGNAL" || trs.Code == "DREAM") { mess = trs.Code + " " + mess1 + "*** " + trs.Box_number; } if (trs.Code == "SKY" || trs.Code == "GSAT") { mess = trs.Code + " " + trs.Box_number + " " + mess1 + "***"; } add.Add(DateTime.Now, trs.Wallet_id, "A1+ : Successfully Transact ref#:" + trs.Id.ToString("D6") + " to " + trs.Customer_number + ". Current bal " + balance + ". \n" + mess + ".", "Pending"); Database.DBTransactions.DBPrepaidCableTransactions update = new Database.DBTransactions.DBPrepaidCableTransactions(); update.Update(trs.Id, "status", "Sent"); } else if (outb1 != null || outb2 != null) { Database.DBTransactions.DBPrepaidCableTransactions update = new Database.DBTransactions.DBPrepaidCableTransactions(); update.Update(trs.Id, "status", "Failed"); add.Add(DateTime.Now, trs.Wallet_id, " Transaction Failed !", "Pending"); } } } catch (Exception ex) { ex.ToString(); MessageBox.Show("Error Processing !"); } }