private void btnLayFile_Click(object sender, EventArgs e)
 {
     if (ofdMoFile.ShowDialog() == DialogResult.OK)
     {
         txtFileDuLieu.Text = ofdMoFile.FileName;
         ptbBanDo.Image     = XuLyAnh.Ve(ptbBanDo.Size, DocFileTxt.LayToaDo(txtFileDuLieu.Text), true);
     }
 }
Beispiel #2
0
        private void btn_anh_Click(object sender, EventArgs e)
        {
            XuLyAnh anh      = new XuLyAnh();
            string  duongdan = anh.ChonAnh();

            Anh = anh.C_Anh_Byte(duongdan);
            hINHANH_NVPictureEdit.Image = anh.C_Byte_Anh(Convert.ToBase64String(Anh));
        }
Beispiel #3
0
        public ActionResult ThucHienDangKy()
        {
            if (Session["role"] != "u")
            {
                return(Redirect("/TrangChu/Xem"));
            }
            NguoiDung_DTO nguoidung = new NguoiDung_DTO();

            try
            {
                nguoidung.Tendangnhap     = Request.Form["username"].ToString();
                nguoidung.Matkhau         = Request.Form["password"].ToString();
                nguoidung.Hovaten         = Request.Form["name"].ToString();
                nguoidung.Ngaysinh        = DateTime.Parse(Request.Form["date"].ToString());
                nguoidung.Diachi          = Request.Form["address"].ToString();
                nguoidung.Email           = Request.Form["mail"].ToString();
                nguoidung.Sodienthoai     = Request.Form["phone"].ToString();
                nguoidung.Motangan        = Request.Form["desc"].ToString();
                nguoidung.Gioitinh        = Request.Form["sex"].ToString();
                nguoidung.Manguoidung     = Request.Form["address"].ToString();
                nguoidung.Maloainguoidung = "2";
                nguoidung.Khoanguoidung   = "U";
                if (Request.Files["image_avatar"] != null && Request.Files["image_avatar"].ContentLength > 0)
                {
                    nguoidung.Anhdaidien = "Y";
                }
                string tenanhphailuu = NguoiDung_BUS.ThemNguoiDungMoi(nguoidung);
                if (Request.Files["image_avatar"] != null && Request.Files["image_avatar"].ContentLength > 0)
                {
                    Image  image       = Image.FromStream(Request.Files["image_avatar"].InputStream);
                    Bitmap anhfullsize = XuLyAnh.DoiKichThuocAnh(image, 300, 300);
                    anhfullsize.Save(System.AppDomain.CurrentDomain.BaseDirectory + "/Content/upload/avatar/" + tenanhphailuu);
                    Bitmap anhminisize = XuLyAnh.DoiKichThuocAnh(image, 100, 100);
                    anhminisize.Save(System.AppDomain.CurrentDomain.BaseDirectory + "/Content/upload/avatar/thumbnail/" + tenanhphailuu);
                }
            }
            catch (Exception ex)
            {
                ViewBag.message   = ex;
                ViewBag.nguoidung = nguoidung;
                return(View("~/Views/ThuVien/DangKy/NhapLaiThongTin.cshtml"));
            }
            return(Redirect("/DangNhap/NhapThongTin"));
        }
        private void ptbBanDo_MouseClick(object sender, MouseEventArgs e)
        {
            if (ckbSuDungFile.Checked)
            {
                MessageBox.Show("Chế độ đọc từ File ko hỗ trợ thêm điểm!"
                                , "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (btnDung.Text == "Stop")
            {
                MessageBox.Show("Chương Trình đang chạy, Phải Stop nó mới thêm điểm mới được!"
                                , "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Point p = new Point(e.X, e.Y);

            MangToaDoThanhPho.Add(p);
            ptbBanDo.Image = XuLyAnh.Ve(ptbBanDo.Size, MangToaDoThanhPho, false);
            BanDo.IsChange = true;
        }
        private void timDongHo_Tick(object sender, EventArgs e)
        {
            if (danKien == null)
            {
                //this.timDongHo.Enabled = false;
                return;
            }

            txtQuangDuongNgan.Text = danKien.QuangDuongNganNhat.ToString();
            txtVongLap.Text        = danKien.VongLapHienTai.ToString();

            string HanhTrinhACO = "";

            foreach (var tp in danKien.HanhTrinhNganNhat)
            {
                HanhTrinhACO += "->" + tp.Ten;
            }
            txtHanhTrinhACO.Text = HanhTrinhACO;

            txtCnn.Text = CacThongSo.Snn.ToString();
            string HanhTrinhTinhBangNN = "";

            foreach (var tp in CacThongSo.HanhTrinhTinhBangNN)
            {
                HanhTrinhTinhBangNN += "->" + tp.Ten;
            }
            txtHanhTrinhTinhBangNN.Text = HanhTrinhTinhBangNN;



            ptbBanDo.Image = XuLyAnh.VeHanhTrinh(ptbBanDo.Size, BanDo.DanhSachThanhPho, danKien.HanhTrinhNganNhat, ckbSuDungFile.Checked);
            //if (danKien.VongLapHienTai == CacThongSo.SoVongLap)
            //{
            //    timDongHo.Enabled = false;
            //}
        }