public static string now(string number, string message) { db = new SMSDataClassesDataContext(); string bayanihan = check_If_open(config.current_DateTime()); if (IsSender_Exist(number)) { if (bayanihan == "Closed" || bayanihan == "NULL") { process.save(number, "U hav reached the cut offtime to donate. ur entry isn't valid. try donating after 11pm 4 da nxt draw. Thank you!"); return "OK"; } string[] x = message.Split(' '); string[] y = x[1].Split('/'); Donation = Convert.ToDouble(y[0]); Combination = y[1]; string refCode = config.current_DateTime().ToString("MMdd") + config.generateReferenceNo(4); if (balance.current_amount(number) >= Donation) { SMS_Bayanihan b = new SMS_Bayanihan(); b.refNo = refCode; b.bayanihan_ref = bayanihan; b.donator = number; b.combination = Combination; b.donation = (decimal)Donation; b.date_danated = config.current_DateTime(); b.status = "-"; try { db.SMS_Bayanihans.InsertOnSubmit(b); db.SubmitChanges(); sqlServer.Update("UPDATE SMS_BayanihanSum SET played = '" + count_donators(bayanihan) + "', " + "donation = '" + total_donation(bayanihan) + "' " + "WHERE bayanihan_ref = '" + bayanihan + "' AND status = 'Open';"); balance.Transaction(number, refCode, (decimal)Donation, false, 24); process.save(number, reply("OK").Replace("[AMOUNT]", Donation.ToString()).Replace("[COMBINATION]", Combination).Replace("[BALANCE]", config.format_currency((decimal)balance.current_amount(number))).Replace("[REFNO]", refCode)); return "OK"; } catch (Exception ex) { process.save(number, "The system is not available at this time, please try again later"); return "OK"; } } process.save(number, "Transaction cannot be processed because do to insufficient funds, to donate please reload now."); return "OK"; } process.save(number, "You are not registerd in our record, please register first! thank you..."); return "OK"; }
partial void UpdateSMS_Bayanihan(SMS_Bayanihan instance);
partial void DeleteSMS_Bayanihan(SMS_Bayanihan instance);
partial void InsertSMS_Bayanihan(SMS_Bayanihan instance);