protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region GENERATE STORE KEY using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext()) { StoreKey_Class ClassStoreKey = new StoreKey_Class(db, true); ClassStoreKey.Generate(); EnumAlert enumAlert = ClassStoreKey.Validasi(); if (enumAlert == EnumAlert.danger) { LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, ClassStoreKey.MessageDanger); } else if (enumAlert == EnumAlert.warning) { LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Warning, ClassStoreKey.MessageWarning); } else { LiteralWarning.Text = ""; } } #endregion TextBoxStoreKey.Focus(); } }
//CASE 6 private string GenerateStoreKey() { try { using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext()) { StoreKey_Class ClassStoreKey = new StoreKey_Class(db, true); Store_Class ClassStore = new Store_Class(db); ClassStoreKey.Generate(); return(JsonConvert.SerializeObject(new WebServiceResult { EnumWebService = (int)EnumWebService.Success, Pesan = "[BERHASIL GENERATE STORE KEY] : " + ClassStore.Data().Nama }, Formatting.Indented)); } } catch (Exception ex) { LogError_Class Error = new LogError_Class(ex, "WebServiceTomahawk_GenerateStoreKey"); return(JsonConvert.SerializeObject(new WebServiceResult { EnumWebService = (int)EnumWebService.Exception, Pesan = ex.Message }, Formatting.Indented)); } }
protected void ButtonVerifikasi_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(TextBoxStoreKey.Text)) { throw new Exception("Store Key harus diisi"); } using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext()) { StoreKey_Class ClassStoreKey = new StoreKey_Class(db, true); LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Success, ClassStoreKey.Verifikasi(TextBoxStoreKey.Text)); #region GENERATE STORE KEY ClassStoreKey.Generate(); #endregion TextBoxStoreKey.Text = ""; } } catch (Exception ex) { LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region GENERATE STORE KEY using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext()) { StoreKey_Class ClassStoreKey = new StoreKey_Class(db, true); ClassStoreKey.Generate(); EnumAlert enumAlert = ClassStoreKey.Validasi(); if (enumAlert == EnumAlert.danger) { LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, ClassStoreKey.MessageDanger); } else if (enumAlert == EnumAlert.warning) { LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Warning, ClassStoreKey.MessageWarning); } else { LiteralWarning.Text = ""; } } #endregion TextBoxUsername.Focus(); if (Request.QueryString["do"] == "logout") { PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"]; if (Pengguna != null) { //menambah LogPengguna tipe Logout : 2 LogPengguna.Tambah(2, Pengguna.IDPengguna); //MENGHAPUS SESSION Session.Abandon(); //MENGHAPUS COOKIES Response.Cookies["WITEnterpriseSystem"].Value = string.Empty; Response.Cookies["WITEnterpriseSystem"].Expires = DateTime.Now.AddDays(-1); if (Pengguna.PointOfSales == TipePointOfSales.Retail) //RETAIL KEMBALI KE HALAMAN LOGIN { Response.Cookies["WMSLogin"].Value = string.Empty; Response.Cookies["WMSLogin"].Expires = DateTime.Now.AddDays(-1); } else if (Pengguna.PointOfSales == TipePointOfSales.Restaurant) //RESTAURANT KEMBALI KE HALAMAN LOGIN PIN { //JIKA VALUE COOKIES ADA MELAKUKAN ENCRYPT string[] value = EncryptDecrypt.Decrypt(Request.Cookies["WMSLogin"].Value).Split('|'); //AMBIL VALUE TANGGAL DAN TANGGAL HARI INI HARUS LEBIH KECIL DARI VALUE COOKIES if (DateTime.Now <= value[0].ToDateTime()) { Response.Redirect("LoginPIN.aspx"); } } } } else { Redirect(); } } }