static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            var giaoDichMenu = new GiaoDich();

            giaoDichMenu.Menu();
        }
        public async Task <IActionResult> CreateLsGiaoDich(GiaoDich giaoDich)
        {
            List <string> messages = new List <string>();

            try
            {
                if (!ModelState.IsValid)
                {
                    throw new Exception("Thông tin không hợp lệ");
                }
                await _context.GiaoDich.AddAsync(giaoDich);

                _context.SaveChanges();
                messages.Add("redirect");
                messages.Add(Url.Action("LsGiaoDich"));
            }
            catch (Exception err)
            {
                messages.Add(err.Message);
                foreach (var value in ModelState.Values)
                {
                    if (value.ValidationState == ModelValidationState.Invalid)
                    {
                        foreach (var modelErr in value.Errors)
                        {
                            messages.Add(modelErr.ErrorMessage);
                        }
                    }
                }
            }
            return(Json(messages.ToArray()));
        }
예제 #3
0
 protected void btnLeft20000_Click(object sender, EventArgs e)
 {
     try
     {
         string SoThe = Session["SoThe"].ToString();
         decimal tien = data.CheckTien(SoThe);
         if (tien < 1950000)
         {
             Response.Write("<script>alert('Tài khoản không đủ để rút tiền');</script>");
         }
         else
         {
             //xu ly rut tien
             GiaoDich gd = new GiaoDich();
             //mã giao dịch = mã giao dịch + 1 :3
             gd.MaGD = (data.GetMaxMaGD() + 1).ToString();
             gd.SoThe = SoThe;
             gd.MaLoaiGD = "ML002";
             gd.NgayGD = Convert.ToDateTime(DateTime.Now.ToString());
             gd.SoTienGD = 2000000;
             gd.ChiTietGD = "Rut tien 2,000,000 VND";
             data.AddGD(gd);
            // data.UpdateTien_TheoThe(2000000, SoThe);
             data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may1-MAY1-14'");
             data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may2-MAY2-15'");
             //data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may3-MAY3-12'");
            // data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may4-MAY4-16'");
             Response.Redirect("ThanhCong.aspx");
         }
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('" + ex.Message + "');</script>");
     }
 }
예제 #4
0
        private void bookTicket1_BookClick(object sender, EventArgs e)
        {
            if (!valid)
            {
                MessageBox.Show("Chưa nhập đủ trường");
                return;
            }
            try
            {
                GiaoDich giaodich = new GiaoDich();
                giaodich.MaKhachHang      = thongtinkhachhang.GetIDbyIDNum(bookTicket1.IDNumber);
                giaodich.MaLichBay        = bookTicket1.FlightID;
                giaodich.MaNhanVien       = EmployeeID;
                giaodich.SoTienGiaoDich   = int.Parse(bookTicket1.Total.Split(' ')[0]);
                giaodich.ThoiGianGiaoDich = DateTime.Now.ToString();

                thongtingiaodich.Insert(giaodich);

                Ve ve = new Ve();
                ve.MaLichBay = bookTicket1.FlightID;
                ve.MaHangVe  = GetClassID(bookTicket1.Class);
                int amount = bookTicket1.Amount;
                datve.Insert(ve, amount, thongtingiaodich.GetID(giaodich.MaNhanVien, giaodich.ThoiGianGiaoDich));

                MessageBox.Show("Đặt vé thành công");
                ReloadData();
            }
            catch
            {
                MessageBox.Show("Chưa nhập đủ trường");
                return;
            }
        }
        public async Task <ActionResult <GiaoDich> > PostGiaoDich(GiaoDich giaoDich)
        {
            _context.GiaoDiches.Add(giaoDich);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetGiaoDich", new { id = giaoDich.MaGD }, giaoDich));
        }
        public async Task <IActionResult> PutGiaoDich(int id, GiaoDich giaoDich)
        {
            if (id != giaoDich.MaGD)
            {
                return(BadRequest());
            }

            _context.Entry(giaoDich).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GiaoDichExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #7
0
 public DetailDonHang(string id)
 {
     using (BachHoaPTTdb_CNPMEntities2 db = new BachHoaPTTdb_CNPMEntities2())
     {
         int i = 0;
         ListGioHang = new List <GioHang>();
         GiaoDich giaoDich = db.GiaoDiches.Find(id);
         MaDon        = giaoDich.Id;
         MaKhachHang  = giaoDich.MaKhachHang;
         TongTien     = giaoDich.TongTien.GetValueOrDefault();
         ThoiGian     = giaoDich.ThoiGian.GetValueOrDefault();
         TenKhachHang = db.TaiKhoans.Find(MaKhachHang).HoVaTen;
         TinhTrang    = giaoDich.TrangThai;
         List <DonHang> listDon = new List <DonHang>();
         foreach (DonHang donHang in db.DonHangs)
         {
             if (donHang.Id == giaoDich.Id)
             {
                 listDon.Add(donHang);
             }
         }
         foreach (DonHang donHang in listDon)
         {
             GioHang gioHang = new GioHang();
             gioHang.Id         = i++;
             gioHang.MaSanPham  = donHang.MaSanPham;
             gioHang.TenSanPham = db.SanPhams.Find(gioHang.MaSanPham).TenSanPham;
             gioHang.Gia        = db.SanPhams.Find(gioHang.MaSanPham).Gia;
             gioHang.SoLuong    = donHang.SoLuong.GetValueOrDefault();
             gioHang.ThanhTien  = donHang.ThanhTien.GetValueOrDefault();
             ListGioHang.Add(gioHang);
         }
     }
 }
예제 #8
0
        public HttpResponseMessage Add([FromBody] GiaoDich gd)
        {
            var gdBus = new GiaoDichBUS();

            gdBus.AddGiaoDich(gd);
            return(Request.CreateResponse(HttpStatusCode.Created, gd));
        }
        public int Update(GiaoDich GiaoDich)
        {
            string sql = string.Format("Update GiaoDich Set SoTienGiaoDich='{1}', ThoiGianGiaoDich='{2}', GiaoDich.MaKhachHang='{3}', MaNhanVien='{4}', SoTaiKhoanChuyenDen='{5}', GiaoDich.MaLichBay='{6}'  Where MaGiaoDich={0}",
                                       GiaoDich.MaGiaoDich, GiaoDich.SoTienGiaoDich, GiaoDich.ThoiGianGiaoDich, GiaoDich.MaKhachHang, GiaoDich.MaNhanVien, GiaoDich.SoTaiKhoanChuyenDen, GiaoDich.MaLichBay);
            var rs = ProcessData.ExecuteNonQuery(sql);

            return(rs);
        }
예제 #10
0
 public ViewData(GiaoDich giaoDich)
 {
     this.InitializeComponent();
     _id         = giaoDich.ID;
     TieuDe.Text = giaoDich.Ten;
     SoTien.Text = giaoDich.SoTien.ToString();
     GhiChu.Text = giaoDich.GhiChu;
     Ngay.Text   = string.Format("{0}/{1}/{2}", giaoDich.Ngay.Day, giaoDich.Ngay.Month, giaoDich.Ngay.Year);
 }
예제 #11
0
        public GiaoDich getAccount(String username)
        {
            using (var db = new ManageHotelEntities())
            {
                GiaoDich khachhang = db.GiaoDiches.Where(gt => gt.TenDangNhap == username).FirstOrDefault();

                return(khachhang);
            }
        }
예제 #12
0
        public SeeTransactionInfo(GiaoDich giaodich)
        {
            InitializeComponent();

            lblTime.Text     = giaodich.ThoiGianGiaoDich;
            lblMoney.Text    = giaodich.SoTienGiaoDich.ToString();
            lblEmployee.Text = thongtin.GetManagerName(giaodich.MaNhanVien);
            lblCustomer.Text = khachhang.GetName(giaodich.MaKhachHang);

            grvData.DataSource = chitiet.Detail(giaodich.MaKhachHang);
        }
예제 #13
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.Clear();
                GiaoDich giaoDich = null;
                Console.WriteLine("Vui long lua chon kieu giao dich");
                Console.WriteLine("=============================");
                Console.WriteLine("1. Giao dich tren ngan hang SHB");
                Console.WriteLine("2. Giao dich tren ngan hang Blockchain");
                Console.WriteLine("===============");
                Console.WriteLine("Nhap lua chon: ");
                var choiceBank = int.Parse(Console.ReadLine());

                switch (choiceBank)
                {
                case 1:
                    giaoDich = new SHB();
                    break;

                case 2:
                    giaoDich = new BlockChain();
                    break;

                default:
                    Console.WriteLine("Sai phuong thuc dang nhap");
                    break;
                }

                // yeu cau nguoi dung dang nhap
                giaoDich.Login();
                if (currentLoggedInAccount != null)
                {
                    Console.WriteLine("Dang nhap thanh cong voi tai khoan.");
                    Console.WriteLine($"Tai khoan: {currentLoggedInAccount.Username}");
                    Console.WriteLine($"So du: {currentLoggedInAccount.Balance}");
                    Console.WriteLine("Pls enter any press");
                    Console.ReadLine();
                    GenerateTransactionMenu(giaoDich);
                }

                if (CurrentAddress != null)
                {
                    Console.WriteLine("Dang nhap thanh cong voi tai khoan address.");
                    Console.WriteLine($"Tai khoan: {CurrentAddress.Address}");
                    Console.WriteLine($"So du: {CurrentAddress.Balance}");
                    Console.WriteLine("Pls enter any press");
                    Console.ReadLine();
                    GenerateTransactionMenu(giaoDich);
                }
            }
        }
예제 #14
0
        public ActionResult XacnhanxoaGiaodich(int id)
        {
            GiaoDich gd = db.GiaoDiches.SingleOrDefault(n => n.MaGD == id);

            if (gd == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            db.GiaoDiches.DeleteOnSubmit(gd);
            db.SubmitChanges();
            return(RedirectToAction("QLGiaodich"));
        }
예제 #15
0
 public void InsertDeal(GiaoDich objInsert)
 {
     try
     {
         var ctx = new BankingContext();
         ctx.GiaoDich.Add(objInsert);
         ctx.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #16
0
 public void UpdateDeal(GiaoDich objUpdate)
 {
     try
     {
         var ctx = new BankingContext();
         ctx.Entry(objUpdate).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #17
0
        public ActionResult SuaGiaodich(FormCollection f)
        {
            GiaoDich gd = db.GiaoDiches.First(d => d.MaGD == int.Parse(f["MaGD"]));

            if (ModelState.IsValid)
            {
                gd.MaKH    = int.Parse(f["MaKH"]);
                gd.NgayMua = DateTime.Now;
                UpdateModel(gd);
                db.SubmitChanges();
            }
            return(RedirectToAction("QLGiaodich"));
        }
예제 #18
0
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var bus  = new Bus();
            var temp = 0;

            var giaoDich = new GiaoDich()
            {
                Ten    = TxtTenGd.Text,
                SoTien = int.Parse(TxtTien.Text),
                GhiChu = TxtGhiChu.Text,
                Ngay   = DateTime.Parse(DpNgay.Date.ToString()),
            };
        }
        // GET: Admin/GiaoDiches/Create
        //public ActionResult Create()
        //{
        //    return View();
        //}

        //// POST: Admin/GiaoDiches/Create
        //// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        //// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create([Bind(Include = "Id,MaDon,MaKhachHang,TongTien,ThoiGian,TrangThai")] GiaoDich giaoDich)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.GiaoDiches.Add(giaoDich);
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }

        //    return View(giaoDich);
        //}

        // GET: Admin/GiaoDiches/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GiaoDich giaoDich = db.GiaoDiches.Find(id);

            if (giaoDich == null)
            {
                return(HttpNotFound());
            }
            return(View(giaoDich));
        }
예제 #20
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.Clear();
                GiaoDich giaoDich = null;
                Console.WriteLine(" S H B B A N K ");
                Console.WriteLine("============================");
                Console.WriteLine("1. Giao dịch SHB bank.");
                Console.WriteLine("2. Giao dịch Blockchain.");
                Console.WriteLine("============================================");
                Console.WriteLine("Nhập lựa chọn của bạn: ");
                var ch = int.Parse(Console.ReadLine());
                switch (ch)
                {
                case 1:
                    giaoDich = new GiaoDichSHB();
                    break;

                case 2:
                    giaoDich = new GiaoDichBlockchain();
                    break;

                default:
                    Console.WriteLine("Sai phương thức đăng nhập.");
                    break;
                }

                giaoDich.Login();
                if (currentLoggedInAccount != null)
                {
                    Console.WriteLine("Đăng nhập thành công với tài khoản.");
                    Console.WriteLine($"Tài khoản: {currentLoggedInAccount.Username}");
                    Console.WriteLine($"Số dư: {currentLoggedInAccount.Balance}");
                    Console.WriteLine("Ấn phím bất kỳ để tiếp tục giao dịch.");
                    Console.ReadLine();
                    GenerateTransactionMenu(giaoDich);
                }

                if (currentLoggedInAddress != null)
                {
                    Console.WriteLine("Dang nhap thanh cong voi dia chi vi MyEtherWallet.");
                    Console.WriteLine($"Address: {currentLoggedInAddress.Address}");
                    Console.WriteLine($"So du: {currentLoggedInAddress.Balance}");
                    Console.WriteLine("Enter de tiep tuc.");
                    Console.ReadLine();
                    GenerateCryptoTransactionMenu(giaoDich);
                }
            }
        }
예제 #21
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.Clear();
                GiaoDich giaoDich = null;
                Console.WriteLine("Vui lòng lựa chọn phương thức giao dịch: ");
                Console.WriteLine("============================================");
                Console.WriteLine("1. Giao dịch trên ngân hàng SHB - Spring Hero Bank.");
                Console.WriteLine("2. Giao dịch blockchain.");
                Console.WriteLine("============================================");
                Console.WriteLine("Nhập lựa chọn của bạn: ");
                var choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    giaoDich = new GiaodichNganhang();
                    break;

                case 2:
                    giaoDich = new GiaodichBlockchain();
                    break;

                default:
                    Console.WriteLine("Sai phương thức đăng nhập.");
                    break;
                }

                // yêu cầu người dùng đăng nhập.
                giaoDich.login();
                if (currentLoggedInAccount != null)
                {
                    Console.WriteLine("Đăng nhập thành công với tài khoản.");
                    Console.WriteLine($"Tài khoản: {currentLoggedInAccount.Username}");
                    Console.WriteLine($"Số dư: {currentLoggedInAccount.Balance}");
                    Console.WriteLine("Ấn phím bất kỳ để tiếp tục giao dịch.");
                    Console.ReadLine();
                    GenerateTransactionMenu(giaoDich);
                }
                if (currentLoggedInAccountblock != null)
                {
                    Console.WriteLine("Đăng nhập thành công với tài khoản.");
                    Console.WriteLine($"Tài khoản: {currentLoggedInAccountblock.Accountaddress}");
                    Console.WriteLine($"Số dư: {currentLoggedInAccountblock.Balane}");
                    Console.WriteLine("Ấn phím bất kỳ để tiếp tục giao dịch.");
                    Console.ReadLine();
                    GenerateTransactionMenu(giaoDich);
                }
            }
        }
예제 #22
0
        public ReturnObjValueBackEnd SearchDealDetailByCondition(GiaoDich sc)
        {
            List <GiaoDich> lst = new List <GiaoDich>();

            retObjValueBackEnd = new ReturnObjValueBackEnd();

            try
            {
                var ctx   = new BankingContext();
                var query = from ct in ctx.GiaoDich
                            select ct;

                if (sc != null)
                {
                    if (sc.MaGD != null)
                    {
                        query = query.Where(p => p.MaGD.Equals(sc.MaGD));
                    }

                    if (sc.MaKH != null)
                    {
                        query = query.Where(p => p.MaKH.Equals(sc.MaKH));
                    }

                    if (sc.SoTien != null)
                    {
                        query = query.Where(p => p.SoTien.Equals(sc.SoTien));
                    }

                    if (sc.NgayCapNhat != null)
                    {
                        query = query.Where(p => p.NgayCapNhat.Equals(sc.NgayCapNhat));
                    }
                }

                lst = query.ToList();
                retObjValueBackEnd.Success = true;
                retObjValueBackEnd.Data    = lst.ToArray();
                return(retObjValueBackEnd);
            }
            catch (Exception ex)
            {
                retObjValueBackEnd.Success = false;
                retObjValueBackEnd.Message = ex.ToString();
                return(retObjValueBackEnd);

                throw ex;
            }
        }
예제 #23
0
        public ActionResult XoaGiaodich(int id)
        {
            if (Session["TaikhoanAdmin"] != null)
            {
                GiaoDich gd = db.GiaoDiches.SingleOrDefault(n => n.MaGD == id);

                if (gd == null)
                {
                    Response.StatusCode = 404;
                    return(null);
                }
                return(View(gd));
            }
            return(RedirectToAction("Login", "Nguoidung"));
        }
예제 #24
0
파일: DataBank.cs 프로젝트: midi9x/csdlpt
 public void AddGD(GiaoDich gd)
 {
     string sql = @"INSERT INTO GiaoDich(MaGD,SoThe,MaLoaiGD,NgayGD,SoTienGD,ChiTietGD)
                                         VALUES(@MaGD,@SoThe,@MaLoaiGD,@NgayGD,@SoTienGD,@ChiTietGD)";
     con.Open();
     SqlCommand cmd = new SqlCommand(sql, con);
     cmd.Parameters.AddWithValue("@MaGD", gd.MaGD);
     cmd.Parameters.AddWithValue("@SoThe", gd.SoThe);
     cmd.Parameters.AddWithValue("@MaLoaiGD", gd.MaLoaiGD);
     cmd.Parameters.AddWithValue("@NgayGD", gd.NgayGD);
     cmd.Parameters.AddWithValue("@SoTienGD", gd.SoTienGD);
     cmd.Parameters.AddWithValue("@ChiTietGD", gd.ChiTietGD);
     cmd.ExecuteNonQuery();
     con.Close();
 }
예제 #25
0
        private void checkTransaction1_DetailClick(object sender, EventArgs e)
        {
            GiaoDich giaodich = new GiaoDich();

            giaodich.MaGiaoDich          = checkTransaction1.GridView.CurrentRow.Cells[0].Value.ToString();
            giaodich.ThoiGianGiaoDich    = checkTransaction1.GridView.CurrentRow.Cells[1].Value.ToString();
            giaodich.SoTienGiaoDich      = (int)checkTransaction1.GridView.CurrentRow.Cells[2].Value;
            giaodich.MaKhachHang         = checkTransaction1.GridView.CurrentRow.Cells[3].Value.ToString();
            giaodich.MaNhanVien          = checkTransaction1.GridView.CurrentRow.Cells[4].Value.ToString();
            giaodich.SoTaiKhoanChuyenDen = checkTransaction1.GridView.CurrentRow.Cells[5].Value.ToString();
            giaodich.MaLichBay           = checkTransaction1.GridView.CurrentRow.Cells[6].Value.ToString();

            SeeTransactionInfo frm = new SeeTransactionInfo(giaodich);

            frm.ShowDialog();
        }
예제 #26
0
        public ActionResult SuaGiaodich(int id)
        {
            if (Session["Taikhoanadmin"] != null)
            {
                GiaoDich gd = db.GiaoDiches.SingleOrDefault(n => n.MaGD == id);

                if (gd == null)
                {
                    Response.StatusCode = 404;
                    return(null);
                }
                ViewBag.MaKh = new SelectList(db.KhachHangs.ToList().OrderBy(n => n.HoTen), "MaKh", "HoTen", gd.MaKH);
                return(View(gd));
            }
            return(RedirectToAction("Login", "Nguoidung"));
        }
예제 #27
0
        private static void GenerateCryptoTransactionMenu(GiaoDich giaoDich)
        {
            while (true)
            {
                Console.WriteLine("Vui lòng lựa chọn kiểu giao dịch: ");
                Console.WriteLine("============================================");
                Console.WriteLine("1. Rút tiền.");
                Console.WriteLine("2. Gửi tiền.");
                Console.WriteLine("3. Mua.");
                Console.WriteLine("4. Bán.");
                Console.WriteLine("5. Thoát.");
                Console.WriteLine("============================================");
                Console.WriteLine("Nhập lựa chọn của bạn: ");
                var choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    giaoDich.RutTien();
                    break;

                case 2:
                    giaoDich.GuiTien();
                    break;

                case 3:
                    giaoDich.Mua();
                    break;

                case 4:
                    giaoDich.Ban();
                    break;

                case 5:
                    Console.WriteLine("Thoát giao diện giao dịch.");
                    break;

                default:
                    Console.WriteLine("Lựa chọn sai.");
                    break;
                }

                if (choice == 5)
                {
                    break;
                }
            }
        }
예제 #28
0
        public bool checkLoginUserName(String username, String Password)
        {
            GiaoDich user = this.getAccount(username);

            if (user == null)
            {
                return(false);
            }
            else
            {
                if (user.MatKhau == Password)
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #29
0
 public bool Update(GiaoDich GiaoDich)
 {
     try
     {
         var _GiaoDich = _dbContext.GiaoDichs.FirstOrDefault(x => x.Id == GiaoDich.Id);
         _GiaoDich.UserId      = GiaoDich.UserId;
         _GiaoDich.CreatedDate = GiaoDich.CreatedDate;
         _GiaoDich.Content     = GiaoDich.Content;
         _GiaoDich.SoTien      = GiaoDich.SoTien;
         _GiaoDich.Notes       = GiaoDich.Notes;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #30
0
        public IActionResult LsGiaoDich()
        {
            GiaoDich giaoDichCuoi   = _context.GiaoDich.LastOrDefault();
            string   lastGiaoDichId = null;

            if (giaoDichCuoi != null)
            {
                lastGiaoDichId = giaoDichCuoi.MaGiaoDich;
            }
            else
            {
                lastGiaoDichId = "GD00000000";
            }
            ViewBag.NextGiaoDichId = String.Concat("GD", IncrementString(lastGiaoDichId.Substring(2)));
            ViewBag.MaNhaXes       = _context.NhaXe.ToArray();
            return(View(_context.GiaoDich.ToArray()));
        }
        public ActionResult Edit([Bind(Include = "Id,MaDon,MaKhachHang,TongTien,ThoiGian,TrangThai")] GiaoDich giaoDich)
        {
            GiaoDich tk = db.GiaoDiches.Find(giaoDich.Id);

            if (String.IsNullOrWhiteSpace(giaoDich.TrangThai))
            {
                ModelState.AddModelError("", "Vui lòng nhập chính xác");
                return(View(tk));
            }


            tk.TrangThai = giaoDich.TrangThai;
            //if (ModelState.IsValid)
            //{
            db.SaveChanges();
            ModelState.AddModelError("", "Sửa trạng thái thành công!");
            return(View(tk));
        }
예제 #32
0
        private static void GenerateTransactionMenu(GiaoDich giaoDich)
        {
            while (true)
            {
                Console.WriteLine("Please select the transaction type.");
                Console.WriteLine("==================================");
                Console.WriteLine("1. Withdraw.");
                Console.WriteLine("2. Deposit.");
                Console.WriteLine("3. Transfer.");
                Console.WriteLine("4. Exit.");
                Console.WriteLine("===================================");
                Console.WriteLine("Please enter your choice: ");
                var choice1 = int.Parse(Console.ReadLine());
                switch (choice1)
                {
                case 1:
                    giaoDich.Withdraw();
                    break;

                case 2:
                    giaoDich.Deposit();
                    break;

                case 3:
                    giaoDich.Transfer();
                    break;

                case 4:
                    break;

                default:
                    Console.WriteLine("Wrong choice, please try again!");
                    break;
                }

                if (choice1 == 4)
                {
                    Console.WriteLine("Bye! see you again!");
                    currentLoggedInAccount = null;
                    currentLoggedInAddress = null;
                    break;
                }
            }
        }
예제 #33
0
    protected void btnRight2_Click(object sender, EventArgs e)
    {
        try
        {
            decimal tiennap = Convert.ToDecimal(txtTienNap.Text);
            if (tiennap >= 50000 && tiennap % 50000 == 0)
            {
                //data.NapTien(tiennap, Session["SoThe"].ToString());
                string SoThe = Session["SoThe"].ToString();
                GiaoDich gd = new GiaoDich();
                //mã giao dịch = mã giao dịch + 1 :3
                gd.MaGD = (data.GetMaxMaGD() + 1).ToString();
                gd.SoThe = SoThe;
                gd.MaLoaiGD = "ML003";
                gd.NgayGD = Convert.ToDateTime(DateTime.Now.ToString());
                gd.SoTienGD = tiennap;
                gd.ChiTietGD = "Nap " + string.Format("{0:C}", tiennap) + " vao tai khoan";
                data.AddGD(gd);
                //data.UpdateTien_TheoThe(500000, SoThe);
                data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may1-MAY1-14'");
                data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may2-MAY2-15'");
                //data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may3-MAY3-12'");
                //data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may4-MAY4-16'");
                Response.Redirect("ThanhCong.aspx");

            }
            else
            {
                txtTienNap.Text = "";
                Response.Write("<script>alert('Số tiền nạp không hợp lệ');</script>");
            }

        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('" + ex.Message + "');</script>");
        }
    }
예제 #34
0
 protected void btnRight2_Click(object sender, EventArgs e)
 {
     try
     {
         string SoThe = Session["SoThe"].ToString();
         decimal tienchuyen = Convert.ToDecimal(Session["tien"].ToString());
         decimal tienco = data.CheckTien(SoThe);
         TaiKhoan tk = (TaiKhoan)Session["tk"];
         if (tienco < tienchuyen - 50000)
         {
             Response.Write("<script>alert('Tài khoản không đủ để chuyển tiền');</script>");
         }
         else
         {
             GiaoDich gd = new GiaoDich();
             //mã giao dịch = mã giao dịch + 1 :3
             gd.MaGD = (data.GetMaxMaGD() + 1).ToString();
             gd.SoThe = SoThe;
             gd.MaLoaiGD = "ML001";
             gd.NgayGD = Convert.ToDateTime(DateTime.Now.ToString());
             gd.SoTienGD = tienchuyen;
             gd.ChiTietGD = "Chuyen " + string.Format("{0:C}", tienchuyen) + " den tai khoan " + tk.SoTK;
             data.AddGD(gd);
             //data.UpdateTien_TheoTK(tienchuyen,tk.SoTK);
             //data.UpdateTien_TheoThe(tienchuyen, SoThe);
             data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may1-MAY1-14'");
             data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may2-MAY2-15'");
             //data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may3-MAY3-12'");
             //data.DongBo("exec msdb.dbo.sp_start_job N'MINHDINH-bank-may4-MAY4-16'");
             Response.Redirect("ThanhCong.aspx");
         }
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('" + ex.Message + "');</script>");
     }
 }