private void ThemHangHoa() { EHangHoa eHangHoa = new EHangHoa(); eHangHoa.MaHang = txtMaHangHoa.Text.Trim(); eHangHoa.TenHang = txtTenHangHoa.Text.Trim(); eHangHoa.MaDVT = Convert.ToInt32(cbbDVT.SelectedValue.ToString()); //eHangHoa.MaNhomHangHoa = Convert.ToInt32(cbbNhomHang.SelectedValue.ToString()); //eHangHoa.MaKho = Convert.ToInt32(cbbKhoQuay.SelectedValue.ToString()); eHangHoa.MaKho = 1; eHangHoa.MaNhomHangHoa = 1; eHangHoa.GiaNhap = Convert.ToDouble(txtGiaNhapHang.Text.Trim()); eHangHoa.GiaBan = Convert.ToDouble(txtGiaBanHang.Text.Trim()); eHangHoa.MaVach = txtMaVachNSX.Text.Trim(); eHangHoa.CreateDate = UnixTime.GetUnixTime(DateTime.Now);// dùng unix time eHangHoa.CreateID = Session.MaNhanVien; eHangHoa.MaNCC = 1; eHangHoa.EditDate = UnixTime.GetUnixTime(DateTime.Now); eHangHoa.EditID = Session.MaNhanVien; try { BHangHoa.Insert(eHangHoa); MessageBox.Show("Thêm thành công"); } catch (Exception ex) { MessageBox.Show("Lỗi:" + ex.ToString()); } }
public void DateTime2106_02_07T06_28_15ZIsUnixTime4294967295() { DateTime dateTime = new DateTime(2106, 2, 7, 6, 28, 15, DateTimeKind.Utc); long unixTime = UnixTime.GetUnixTime(dateTime); Assert.AreEqual(4294967295, unixTime); }
public void DateTime2001_09_09T01_46_40ZIsUnixTime1000000000() { DateTime dateTime = new DateTime(2001, 9, 9, 1, 46, 40, DateTimeKind.Utc); long unixTime = UnixTime.GetUnixTime(dateTime); Assert.AreEqual(1000000000, unixTime); }
public void DateTimeEpochIsUnixTime0() { DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); long unixTime = UnixTime.GetUnixTime(epoch); Assert.AreEqual(0, unixTime); }
private void timer1_Tick(object sender, EventArgs e) { // update progress bar pbCurrentVerificationCode.PerformStep(); // check time to see if we need to cycle if (DateTime.UtcNow >= _nextCycleTime) { _nextCycleTime = TimeHelper.GetNextCycleTimeUtc(); var totp = new Totp(_secretKey, 6, 30); lblCurrentVerificationCode.Text = totp.GeneratePassword(UnixTime.GetUnixTime()); pbCurrentVerificationCode.Value = 0; } }
private void dtpNgayBan_TextChanged(object sender, EventArgs e) { string ngayBan = dtpNgayBan.Text; DateTime time = UnixTime.GetTimeUnix(1538835973); //1539993600 1540079999 int fromTime = UnixTime.GetUnixTime(Convert.ToDateTime(ngayBan + " 00:00:00 AM")); int toTime = UnixTime.GetUnixTime(Convert.ToDateTime(ngayBan + " 23:59:59 PM")); data = BPhieuBanHang.GetSumDay(fromTime, toTime); dtgvHoaDon.DataSource = data; SoHoaDon = data.Rows.Count; for (int i = 0; i < SoHoaDon; i++) { TongDoanhThu = TongDoanhThu + int.Parse(data.Rows[i]["TongTien"].ToString()); } txtTongDoanhThu.Text = TongDoanhThu.ToString(); txtSoHoaDon.Text = SoHoaDon.ToString(); }
private void SaveData() { eNhaCungCap.CreateDate = UnixTime.GetUnixTime(Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy"))); eNhaCungCap.CreateID = Session.MaNhanVien; eNhaCungCap.DiaChi = txtDiaChi.Text; eNhaCungCap.Email = txtEmail.Text; eNhaCungCap.GhiChu = txtGhiChu.Text; eNhaCungCap.NgayHopTac = Convert.ToDateTime(dtpkNgayHopTac.Text); eNhaCungCap.NguoiLienHe = txtNguoiLienHe.Text; eNhaCungCap.NhaCungCap = txtTenNhaCC.Text; eNhaCungCap.SDT = txtSDT.Text; try { BNhaCungCap.Insert(eNhaCungCap); } catch (Exception ex) { throw ex; } }
private void SaveData() { eKhachHang.CMT = txtCMND.Text; eKhachHang.CreateDate = UnixTime.GetUnixTime(DateTime.Now); eKhachHang.CreateID = Session.MaNhanVien; eKhachHang.MaKhachHang = txtMaKhach.Text; eKhachHang.NgaySinh = UnixTime.GetUnixTime(Convert.ToDateTime(dtpkNgaySinh.Text)); eKhachHang.TenKhachHang = txtTenKhach.Text; eKhachHang.SDT = txtSDT.Text; eKhachHang.ThongTinThem = txtGhiChu.Text; eKhachHang.DiaChi = txtDiaChi.Text; try { BKhachHang.Insert_V1(eKhachHang); } catch (Exception ex) { throw ex; } }
private void btnGenerate_Click(object sender, EventArgs e) { // get a 16 character random string that is base32 for secret // then decode the base32 to the real byte array secret key _encodedKey = RandomKey.GetRandomEncodedKey(); _secretKey = Base32.Decode(_encodedKey); // display lblSecretKey.Text = string.Format("{0} {1} {2} {3}", _encodedKey.Substring(0, 4), _encodedKey.Substring(4, 4), _encodedKey.Substring(8, 4), _encodedKey.Substring(12, 4)); // get qrcode IBarcodeWriter barcodeWriter = new BarcodeWriter { Format = BarcodeFormat.QR_CODE, Options = new QrCodeEncodingOptions { Width = 250, Height = 250, Margin = 1 } }; pbQRCode.Image = new Bitmap(barcodeWriter.Write(KeyUri.GetToptUri("TwoFactorNet", "TestUser", _encodedKey))); // generate code var totp = new Totp(_secretKey, 6, 30); lblCurrentVerificationCode.Text = totp.GeneratePassword(UnixTime.GetUnixTime()); // get next cycle time _nextCycleTime = TimeHelper.GetNextCycleTimeUtc(); // move progressbar to correct value pbCurrentVerificationCode.Value = (_nextCycleTime.Second == 0 ? 60 - DateTime.Now.Second : DateTime.Now.Second); // setup timer to display timer.Enabled = true; }
private void btnLuuVaIn_Click(object sender, EventArgs e) { //Check tiền nhận if (txtTienNhan.Text == "") { MessageBox.Show("Bạn chưa nhập tiền nhân"); return; } if (CheckTienNhan() == false) { MessageBox.Show("Tiền nhận nhỏ hơn tổng tiền"); return; } eThongTinHoaDon.MaPhieu = maPhieu; eThongTinHoaDon.NhanVien = "Thao"; eThongTinHoaDon.TongTien = double.Parse(txtThanhToan.Text); eThongTinHoaDon.KhachTra = double.Parse(txtTienNhan.Text); if (txtTienTraLai.Text == "") { eThongTinHoaDon.TraLaiKhach = 0; } else { eThongTinHoaDon.TraLaiKhach = double.Parse(txtTienTraLai.Text); } EPhieuBanHang ePhieuBanHang = new EPhieuBanHang(); ePhieuBanHang.MaNhanVien = Session.MaNhanVien; ePhieuBanHang.MaPhieu = maPhieu; DateTime date = DateTime.Now; ePhieuBanHang.NgayBan = UnixTime.GetUnixTime((date)); ePhieuBanHang.TongTien = Convert.ToDouble(txtThanhToan.Text); ePhieuBanHang.TongLoiNhuan = TingTongLoiNhuan(); // Lưu phiếu LuuPhieuBanHang_WithoutMaKhach(ePhieuBanHang); // In hóa đơn crystalReportViewer1.Visible = true; LoadReport(dtView, eThongTinHoaDon); }
/// <summary> /// Generates a Time-Based One-Time Password for a given DateTime /// </summary> /// <param name="dateTime">The date time.</param> /// <returns></returns> public string GeneratePassword(DateTime dateTime) { long givenUnixTime = UnixTime.GetUnixTime(dateTime); return(GeneratePassword(givenUnixTime)); }
/// <summary> /// Generates a Time-Based One-Time Password for the current time /// </summary> /// <returns></returns> public string GeneratePassword() { long currentUnixTime = UnixTime.GetUnixTime(); return(GeneratePassword(currentUnixTime)); }