protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sOutletID = Request.QueryString["oid"]; if (sOutletID != null) { bool isNumeric = int.TryParse(sOutletID, out int iOutletID); if (isNumeric) { CMain.InitParams(iOutletID); } } MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); List <CSalesType> lst = COutlet.ListOfSalesTypes(conn, ApplicationSession.StoreID, ApplicationSession.OutletID); lvwSalesType.DataSource = lst; lvwSalesType.DataBind(); } }
private void GoToOptionPages(MySqlConnection conn) { List <int> lst = CStore.ListOfOutletIDs(conn, ApplicationSession.StoreID); switch (lst.Count) { case 0: MessageBox.Show("No Record of Outlet"); break; case 1: CMain.InitParams(lst[0]); //lgs masuk ke itemgroup page: string url = "SalesTypePage.aspx"; Response.Redirect(url); break; default: Response.Redirect("HomePage.aspx"); break; } }
private bool InitFromQRCode(string sQR) { bool bln = false; int iStoreID = 0; int iOutletID = 0; int iSalesTypeID = 0; if (sQR.Length == 6) { //char 1&2: StoreID string sStoreID = sQR.Substring(0, 2); bool isNumeric = int.TryParse(sStoreID, out int storeID); if (isNumeric) { iStoreID = storeID; } if (iStoreID == 0) { iStoreID = CMain.STOREID; } CStore store = CMain.GetStoreRecord(iStoreID); if (store.IsEmpty()) { MessageBox.Show("Store Record is not found"); } else { ApplicationSession.DBName = store.DBName; ApplicationSession.StoreID = iStoreID; ApplicationSession.member = new CMiniMember("walk-in", 0, ""); //char 3&4: OutletID string sOutletID = sQR.Substring(2, 2); isNumeric = int.TryParse(sOutletID, out int outletID); if (isNumeric) { iOutletID = outletID; } if (iOutletID == 0) { iOutletID = CMain.OUTLETID; } CMain.InitParams(iOutletID); //char 5&6: SalesTypeID string sSalesTypeID = sQR.Substring(4, 2); isNumeric = int.TryParse(sSalesTypeID, out int stID); if (isNumeric) { iSalesTypeID = stID; } if (iSalesTypeID == 0) { iSalesTypeID = CMain.SALESTYPEID; } MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); ApplicationSession.SalesType = CSalesType.FetchSalesType(conn, iSalesTypeID); bln = true; } } else { MessageBox.Show("Parameter is not in the right format"); } return(bln); }