protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnLogin.CausesValidation = false; int iStoreID = 0; string strID = Request.QueryString["id"]; if (strID == null) { iStoreID = ApplicationSession.StoreID; } else { bool isNumeric = int.TryParse(strID, out int iID); if (isNumeric) { iStoreID = iID; } } 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.QRcode = ""; btnLogin.CausesValidation = true; } string sEmail = Request.QueryString["email"]; //txtUserID.Text = (sEmail == null) ? txtUserID.Text = "" : txtUserID.Text = sEmail; //txtPassword.Text = ""; } //lblMessage.Text = ""; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //ApplicationSession.SalesMaster.CollectionSalesDetail() = new SalesDetailCollection(); CStore store = CMain.GetStoreRecord(ApplicationSession.StoreID); if (store.IsEmpty()) { MessageBox.Show("Fail to retrieve Store Record"); } else { MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); List <COutlet> lst = store.ListOfOutlets(conn); lvwOutlet.DataSource = lst; lvwOutlet.DataBind(); } } }
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); }