protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string strID = Request.QueryString["id"]; if (strID == null) { if (!ApplicationSession.SalesMaster.IsEmpty()) { MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); CSalesMaster sm = new CSalesMaster(ApplicationSession.SalesMaster.ID, conn); if (!sm.IsEmpty()) { DisplayInfo(sm, conn); } } } else { bool isNumeric = int.TryParse(strID, out int iID); if (isNumeric) { MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); CSalesMaster sm = new CSalesMaster(iID, conn); if (!sm.IsEmpty()) { DisplayInfo(sm, conn); } } } } }
protected void btnCheckout_Click(object sender, EventArgs e) { if (ApplicationSession.QRcode == "") { Response.Redirect("Checkout.aspx"); } else { MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); CSalesMaster sm = ApplicationSession.SalesMaster; if (sm.IsEmpty()) { sm.CreateNewSales(ApplicationSession.StoreID, ApplicationSession.OutletID, ApplicationSession.SalesType.ID, 1, "", 0, (int)CSalesMaster.EFlagStatus.STATUS_ORDER, 0, "", "", 0, ApplicationSession.TableNo, false); if (sm.InsertRecord(conn)) { sm.SetSalesMasterID(sm.ID); } else { //kasih message error } } sm.Recalculate(ApplicationSession.SalesType); sm.UpdateRecord_SalesAmounts(conn); List <CSalesDetail> lst = sm.GetChildrenToBeSent; if (lst.Count > 0) { foreach (CSalesDetail sd in lst) { if (sd.isEmpty) { sd.SalesMasterID = sm.ID; sd.InsertRecord(conn, true); } else { sd.UpdateRecord_Send(conn); } } ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalConfirmed", "$(document).ready(function () {$('#ModalConfirmed').modal();});", true); } else { //kasih message no record } } }
private void InitFromTableNo(string sTableNo) { MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); CSalesMaster sm = new CSalesMaster(ApplicationSession.StoreID, ApplicationSession.OutletID, sTableNo, conn); if (!sm.IsEmpty()) { sm.RetrieveCollection(conn); } ApplicationSession.SalesMaster = sm; ApplicationSession.TableNo = sTableNo; }
private bool InitFromSMID(string sSMID) { bool bln = false; bool isNumeric = int.TryParse(sSMID, out int iSMID); if (isNumeric) { MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); CSalesMaster sm = new CSalesMaster(iSMID, conn); if (!sm.IsEmpty()) { sm.RetrieveCollection(conn); ApplicationSession.SalesMaster = sm; bln = true; } } else { MessageBox.Show("Sales Record is not found"); } return(bln); }