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"); } }
private void cmd_Delete_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show(" Are You Sure ? ", "Warning !", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (dialogResult == DialogResult.Yes) { Database.DBPostpaidBill.DBPostpaidBill del = new Database.DBPostpaidBill.DBPostpaidBill(); del.Delete(Id); this.Close(); } }
private void cmd_Save_Click(object sender, EventArgs e) { Database.DBPostpaidBill.DBPostpaidBill up = new Database.DBPostpaidBill.DBPostpaidBill(); up.Update( Id, CategoryCode, BillerTag, Description, FirstField, FirstFieldFormat, FirstFieldWidth, SecondField, SecondFieldFormat, SecondFieldWidth, ServiceCharge, Date ); }
private void cmd_Add_Click(object sender, EventArgs e) { Database.DBPostpaidBill.DBPostpaidBill add = new Database.DBPostpaidBill.DBPostpaidBill(); add.Add( CategoryCode, BillerTag, Description, FirstField, FirstFieldFormat, FirstFieldWidth, SecondField, SecondFieldFormat, SecondFieldWidth, ServiceCharge, Date ); this.Close(); }
public bool PostpaidBillParsing(string mess, string sender) { string message = mess.ToUpper(); string[] words = message.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); Array arr = words; if (words[0] == "PAY") { Database.DBRetailers ret = Database.DBRetailers.GetDataByWallet(sender); if (ret != null) { Database.DBPostpaidBill.DBPostpaidBill postBill = Database.DBPostpaidBill.DBPostpaidBill.GetDataByCode(words[1].ToUpper()); if (postBill != null) { if (arr.Length >= 5) { try { if ((float)(ret.Balance) >= (float)(Convert.ToDouble(words[2]) + postBill.ServiceCharge)) { if ((ParameterParsingWithSlash(ParameterStringParsing(mess))) == true) { string[] parameter = ParameterStringParsing(mess).Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); Array parameters = parameter; string param2; try { param2 = parameter[1]; } catch (Exception ex) { ex.ToString(); param2 = ""; } PostBillTransaction(parameter[0].ToUpper(), param2.ToUpper(), words[1], sender, (float)(Convert.ToDouble(words[2])), ret.Balance, FullNameStringParsing(mess, ParameterIntParsing(mess)), PhoneNumberParsing(words[arr.Length - 1])); return(true); } AddtoOutBox(DateTime.Now, sender, "Invalid Parameter / " + ret.Balance + " None enough", "Pending"); return(false); } //youWallet is none enough AddtoOutBox(DateTime.Now, sender, "Your balance is " + ret.Balance + " None enough", "Pending"); return(false); } catch (Exception ex) { ex.ToString(); //No Code Amount Detected AddtoOutBox(DateTime.Now, sender, "Invalid Code ! must be a Number Amount : " + words[2], "Pending"); return(false); } } AddtoOutBox(DateTime.Now, sender, "Incomplete Command, please check your message format.", "Pending"); return(false); } //**sendPending/***Invalid first Primary Code AddtoOutBox(DateTime.Now, sender, "Invalid Primary Bill Code, please check your message format.", "Pending"); return(false); } //Invalid Sender Unregistered Wallet //No reply... return(false); } return(false); }