protected void DoEditSubmitRegistration(string regisID) { string paidMethod = Request.Form.Get("paid_method"); string note = Request.Form.Get("note"); DBManager db = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC); db.Connect(); db.BeginTransaction(IsolationLevel.ReadCommitted); theReg = new Registration(); theReg.LoadFromDB(db, " regis_id=" + regisID); // Save to DB theReg.UpdateToDB(db); db.Commit(); db.Close(); msgText = "แก้ไขข้อมูลเรียบร้อย"; }
protected void DoRefund(string regisID) { int status = Int32.Parse(Request.Form.Get("status")); int refundCost = Int32.Parse(Request.Form.Get("refund_cost")); string paidMethod = Request.Form.Get("paid_method"); string note = Request.Form.Get("note"); DBManager db = new MySQLDBManager(Config.DB_SERVER, Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_CHAR_ENC); db.Connect(); db.BeginTransaction(IsolationLevel.ReadCommitted); theReg = new Registration(); theReg._status = status; theReg.LoadFromDB(db, " regis_id=" + regisID); theReg.LoadCourse(db); // TODO: Check if the fund is paid to teacher? if (refundCost <= theReg._discountedCost) { theReg._discountedCost -= refundCost; } theReg._status = status; theReg._paidMethod = Int32.Parse(paidMethod); theReg._note = note; // Save to DB theReg.UpdateToDB(db); // Update payment Payment.UpdatePaymentByCourse(db, theReg._course); db.Commit(); db.Close(); if (refundCost > 0) { msgText = "คืนเงิน " + refundCost + " บาท เรียบร้อยแล้ว คงเหลือเงิน " + theReg._discountedCost + " บาท"; } else { msgText = "แก้ไขข้อมูลเรียบร้อย"; } }