public string CreateDiaChi(string tendangnhap, string duong, string tinhthanh) { TaiKhoan tk = new TaiKhoan(); //Kiểm tra tk = context.TaiKhoan.Where(t => t.TenDangNhap == tendangnhap).SingleOrDefault(); if (tk == null) { return("Tên tài khoản không tồn tại"); } List <DiaChi> listdiachi = context.DiaChi.Where(d => d.IdTaiKhoan == tk.Id && d.TinhTrang == "Không khoá").ToList(); if (listdiachi.Count == 5) { return("Khách hàng không được có hơn 5 địa chỉ"); } //Thêm DiaChi dc = new DiaChi(); dc.Id = Guid.Parse(Guid.NewGuid().ToString().ToUpper()); dc.IdTaiKhoan = tk.Id; dc.Duong = duong; dc.IdTinhThanh = Guid.Parse(tinhthanh); dc.TinhTrang = "Không khoá"; context.DiaChi.Add(dc); context.SaveChanges(); return("Thêm thành công"); }
public IActionResult GetPhiShip(string tendangnhap, string iddiachi) { string checktendangnhap = HttpContext.Session.GetString("TenDangNhap"); if (checktendangnhap != null && checktendangnhap != "") { List <DiaChi> listdiachi = new List <DiaChi>(); listdiachi = giohangbus.GetPhiShip(tendangnhap); DiaChi diachi = new DiaChi(); diachi = taikhoanbus.GetChoosenAddress(iddiachi); List <GiaShip> listgiaship = new List <GiaShip>(); listgiaship = giashipbus.GetGiaShips(); ViewBag.GiaShipNoiThanh = listgiaship.Where(gs => gs.Loai.Contains("Nội Thành")) .OrderByDescending(gs => gs.NgayCapNhat) .FirstOrDefault(); ViewBag.GiaShipNgoaiThanh = listgiaship.Where(gs => gs.Loai.Contains("Ngoại Thành")) .OrderByDescending(gs => gs.NgayCapNhat) .FirstOrDefault(); ViewBag.DiaChi = diachi; return(PartialView("pTienThanhToan", listdiachi)); } return(RedirectToAction("Index", "Home")); }
public IActionResult Index(string id) { string idd = id ?? "B77D9CF5-E9A2-4D31-9490-25E4E3971C61"; //BUS SanPhamBUS sanphambus = new SanPhamBUS(); SizeSanPhamBUS sizesanphambus = new SizeSanPhamBUS(); GioHangBUS giohangbus = new GioHangBUS(); DiaChiBUS diachibus = new DiaChiBUS(); SanPham sanpham = sanphambus.GetSanPham(idd); DiaChi diachi = diachibus.GetDiaChiMer(sanpham.IdTaiKhoanNavigation.TenDangNhap); ViewBag.DiaChiMerchant = diachi; List <SizeSanPham> listsizesanpham = sizesanphambus.GetSize(idd); ViewBag.ListSizeSanPham = listsizesanpham; List <HangSanPham> hang = ctx.HangSanPham.ToList(); ViewBag.Hang = hang; List <SanPham> spmoi = sanphambus.GetSanPhams("", "", 1, 4); ViewBag.SanPhamMoi = spmoi; return(View(sanpham)); }
private void SetThuocTinh(DiaChi dc, string thuocTinh) { var hoa = new List <ChiEnum> { ChiEnum.Dan, ChiEnum.Ngo, ChiEnum.Tuat }; var kim = new List <ChiEnum> { ChiEnum.Ty, ChiEnum.Dau, ChiEnum.Suu }; var thuy = new List <ChiEnum> { ChiEnum.Than, ChiEnum.Ti, ChiEnum.Thin }; var moc = new List <ChiEnum> { ChiEnum.Hoi, ChiEnum.Mao, ChiEnum.Mui }; if (hoa.Contains(dc.Ten)) { dc.AddThuocTinh(thuocTinh, NguHanhEnum.Hoa); } else if (kim.Contains(dc.Ten)) { dc.AddThuocTinh(thuocTinh, NguHanhEnum.Kim); } else if (thuy.Contains(dc.Ten)) { dc.AddThuocTinh(thuocTinh, NguHanhEnum.Thuy); } else if (moc.Contains(dc.Ten)) { dc.AddThuocTinh(thuocTinh, NguHanhEnum.Moc); } }
private void SetThuocTinh(DiaChi dc, string thuocTinh) { var xuan = new List <ChiEnum> { ChiEnum.Dan, ChiEnum.Mao, ChiEnum.Thin }; var ha = new List <ChiEnum> { ChiEnum.Ty, ChiEnum.Ngo, ChiEnum.Mui }; var thu = new List <ChiEnum> { ChiEnum.Than, ChiEnum.Dau, ChiEnum.Tuat }; var dong = new List <ChiEnum> { ChiEnum.Hoi, ChiEnum.Ti, ChiEnum.Suu }; if (xuan.Contains(dc.Ten)) { dc.AddThuocTinh(thuocTinh, NguHanhEnum.Moc); } else if (ha.Contains(dc.Ten)) { dc.AddThuocTinh(thuocTinh, NguHanhEnum.Hoa); } else if (thu.Contains(dc.Ten)) { dc.AddThuocTinh(thuocTinh, NguHanhEnum.Kim); } else if (dong.Contains(dc.Ten)) { dc.AddThuocTinh(thuocTinh, NguHanhEnum.Thuy); } }
public frmDetailKQKB(int KhamBenh_Id) { InitializeComponent(); var obj = new KQKBBUS(this).NVGetByKhamBenhId(KhamBenh_Id); if (obj != null) { TenBenhNhan.FormatTextFromTag(obj.TenBenhNhan); MaYTe.FormatTextFromTag(obj.MaYTe); Tuoi.FormatTextFromTag(obj.Tuoi); GioiTinh.FormatTextFromTag(obj.GioiTinh); DiaChi.FormatTextFromTag(obj.DiaChi); SDT.FormatTextFromTag(obj.SoDienThoai); THoiGianKham.FormatTextFromTag(obj.ThoiGianKham); NoiDungKham.FormatTextFromTag(obj.NoiDungKham); TrieuChungLamSang.FormatTextFromTag(obj.TrieuChungLamSang); ChuanDoanLamSang.FormatTextFromTag(obj.ChanDoanKhoaKham); TenPhongBan.FormatTextFromTag(obj.TenPhongBan); HuyeAp.FormatTextFromTag(obj.HuyetAp); Mach.FormatTextFromTag(obj.Mach); NhietDo.FormatTextFromTag(obj.NhietDo); NhipTho.FormatTextFromTag(obj.NhipTho); ChieuCao.FormatTextFromTag(obj.ChieuCao); CanNang.FormatTextFromTag(obj.CanNang); SoBHYT.FormatTextFromTag(obj.SoBHYT); NguoiLienHe.FormatTextFromTag(obj.NguoiLienHe); NgayhentaiKham.FormatTextFromTag(obj.NgayHenTaiKham); MaBenh.FormatTextFromTag(obj.MaBenh); MaBenhPhu.FormatTextFromTag(obj.MaBenhPhu); } }
private void KimDu() { var canNgay = this.TTM.LaSoCuaToi.TuTru[Constants.TRU_NGAY].ThienCan.Can; DiaChi dc = null; switch (canNgay) { case CanEnum.None: break; case CanEnum.Giap: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Thin); break; case CanEnum.At: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Ty); break; case CanEnum.Binh: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Mui); break; case CanEnum.Dinh: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Than); break; case CanEnum.Mau: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Mui); break; case CanEnum.Ky: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Than); break; case CanEnum.Canh: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Tuat); break; case CanEnum.Tan: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Hoi); break; case CanEnum.Nham: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Suu); break; case CanEnum.Quy: dc = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Dan); break; default: break; } if (dc != null) { dc.AddThanSat(Constants.ThanSat.KIM_DU); } }
public static CanChi GetCanChi(ComboBox canCombobox, ComboBox chiCombobox) { return(new CanChi { Can = ThienCan.GetCan(canCombobox.SelectedIndex + 1), Chi = DiaChi.GetChi(chiCombobox.SelectedIndex + 1), }); }
private CanChi GetCanChi(int canIndex, int chiIndex) { return(new CanChi { Can = ThienCan.GetCan(canIndex + 1), Chi = DiaChi.GetChi(chiIndex + 1), }); }
public string UnlockDiaChi(string id) { DiaChi dc = context.DiaChi.Where(d => d.Id == Guid.Parse(id)).SingleOrDefault(); dc.TinhTrang = "Không khoá"; context.SaveChanges(); return("Mở khoá thành công"); }
public DiaChi GetThongTinDiaChi(string tendangnhap, string diachi) { DiaChi dc = context.DiaChi.Where(d => d.IdTaiKhoanNavigation.TenDangNhap == tendangnhap && d.Duong == diachi) .Include(d => d.IdTaiKhoanNavigation) .Include(d => d.IdTinhThanhNavigation) .SingleOrDefault(); return(dc); }
public IActionResult GetThongTinDiaChi(string tendangnhap, string diachi) { DiaChiBUS dcbus = new DiaChiBUS(); TaiKhoanBUS tk = new TaiKhoanBUS(); DiaChi dc = dcbus.GetThongTinDiaChi(tendangnhap, diachi); ViewBag.TinhThanh = tk.GetTinhThanhs(); return(PartialView("SuaDiaChiPartialView", dc)); }
public static DiaChi Next(this DiaChi chi) { if (chi.Id == DiaChi.All.Count) { return(DiaChi.All[0]); } return(DiaChi.All[chi.Id]); }
public virtual void Delete(DiaChi _item) { if (_item == null) { throw new ArgumentNullException("DiaChi"); } _tableRepository.Delete(_item); }
public DiaChi GetFirstAddress(string tendangnhap) { DiaChi diachi = context.DiaChi.Where(dc => dc.IdTaiKhoanNavigation.TenDangNhap == tendangnhap) .Include(dc => dc.IdTaiKhoanNavigation) .Include(dc => dc.IdTinhThanhNavigation) .FirstOrDefault(); return(diachi); }
public IHttpActionResult update([FromBody] DiaChi diaChi) { try { DiaChiKhachHang dc = db.DiaChiKhachHangs.FirstOrDefault(e => e.id == diaChi.id); if (dc == null) { return(StatusCode(HttpStatusCode.NoContent)); } if (diaChi.idQuanHuyen != null) { dc.id_quan = diaChi.idQuanHuyen; } if (diaChi.idTinh != null) { dc.id_tinh = diaChi.idTinh; } if (diaChi.idXaPhuong != null) { dc.id_xa_phuong = diaChi.idXaPhuong; } if (diaChi.loai != null) { dc.loai = diaChi.loai; } if (diaChi.diaChi != null) { dc.dia_chi = diaChi.diaChi; } if (diaChi.tenKhachHang != null) { dc.ten_khach_hang = diaChi.tenKhachHang; } if (diaChi.soDT != null) { dc.so_dt = diaChi.soDT; } db.SubmitChanges(); var tam = new { id = dc.id, idKhachHang = dc.id_khach_hang, tenKhachHang = dc.ten_khach_hang, soDT = dc.so_dt, idQuan = dc.id_quan, idTinh = dc.id_tinh, idXaPhuong = dc.id_xa_phuong, diaChihi = dc.dia_chi, loai = dc.loai }; return(Ok(tam)); }catch (Exception ex) { return(BadRequest(ex.Message)); } }
public DiaChi GetChoosenAddress(string iddiachi) { DiaChi diachi = new DiaChi(); diachi = context.DiaChi.Where(dc => dc.Id == Guid.Parse(iddiachi)) .Include(dc => dc.IdTaiKhoanNavigation) .Include(dc => dc.IdTinhThanhNavigation) .SingleOrDefault(); return(diachi); }
public string EditDiaChiMer(string tendangnhap, string duong, string tinhthanh) { TaiKhoan taikhoan = context.TaiKhoan.Where(tk => tk.TenDangNhap == tendangnhap).SingleOrDefault(); DiaChi diachi = context.DiaChi.Where(dc => dc.IdTaiKhoan == taikhoan.Id).SingleOrDefault(); diachi.Duong = duong; diachi.IdTinhThanh = Guid.Parse(tinhthanh); context.SaveChanges(); return("Sửa thành công"); }
private void btnOk_Click(object sender, EventArgs e) { if (EventOk != null) { if (DiaChi.Trim() == "") { DiaChi = DiaChiTimKiem; } EventOk(btnOk, null); } }
public virtual void Update(DiaChi _item) { if (_item == null) { throw new ArgumentNullException("DiaChi"); } if (_item.QuanHuyenID == 0) { _item.QuanHuyenID = null; } _tableRepository.Update(_item); }
private void CheckTamHop(ChiEnum chi1, ChiEnum chi2, ChiEnum chi3) { int count = 0; DiaChi dc1 = null, dc2 = null, dc3 = null; var chi1Id = TatcaTru.FindIndex(u => u.DiaChi.Ten == chi1); var chi2Id = TatcaTru.FindIndex(u => u.DiaChi.Ten == chi2); var chi3Id = TatcaTru.FindIndex(u => u.DiaChi.Ten == chi3); if (chi1Id != -1) { count++; dc1 = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == chi1); } if (chi2Id != -1) { count++; dc2 = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == chi2); } if (chi3Id != -1) { count++; dc3 = TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == chi3); } string thuocTinh = string.Empty; if (count == 2) { thuocTinh = Constants.ThuocTinh.BAN_TAM_HOP; } if (count == 3) { thuocTinh = Constants.ThuocTinh.TAM_HOP; } if (dc1 != null) { this.SetThuocTinh(dc1, thuocTinh); } if (dc2 != null) { this.SetThuocTinh(dc2, thuocTinh); } if (dc3 != null) { this.SetThuocTinh(dc3, thuocTinh); } }
public string EditDiaChi(string id, string diachi, string tinhthanh) { DiaChi dc = context.DiaChi.Where(d => d.Id == Guid.Parse(id)).SingleOrDefault(); if (dc.Duong == diachi && dc.IdTinhThanh.ToString() == tinhthanh) { return("Thông tin địa chỉ không thay đổi"); } dc.Duong = diachi; dc.IdTinhThanh = Guid.Parse(tinhthanh); context.SaveChanges(); return("Sửa thành công"); }
private void VanXuong() { List <CanEnum> ngayNam = new List <CanEnum> { this.TTM.LaSoCuaToi.TuTru[Constants.TRU_NGAY].ThienCan.Can, this.TTM.LaSoCuaToi.TuTru[Constants.TRU_NAM].ThienCan.Can }; DiaChi dc = null; if (ngayNam.Contains(CanEnum.Giap)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Ty).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.At)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Ngo).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.Binh)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Than).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.Dinh)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Dau).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.Mau)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Than).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.Ky)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Dau).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.Canh)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Hoi).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.Tan)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Ti).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.Nham)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Dan).AddThanSat(Constants.ThanSat.VAN_XUONG); } if (ngayNam.Contains(CanEnum.Quy)) { TongHopCanChi.MuoiHaiDiaChi.Find(u => u.Ten == ChiEnum.Mao).AddThanSat(Constants.ThanSat.VAN_XUONG); } }
private void CheckNhiHinh() { var tiId = this.TuTru.FindIndex(u => u.DiaChi.Ten == ChiEnum.Ti); var maoId = this.TuTru.FindIndex(u => u.DiaChi.Ten == ChiEnum.Mao); DiaChi ti = null, mao = null; if (tiId != -1 && maoId != -1) { ti = this.TuTru[tiId].DiaChi; mao = this.TuTru[maoId].DiaChi; var thuocTinh = Constants.ThuocTinh.NHI_HINH; ti.AddThuocTinh(thuocTinh, Constants.DiaChiTuongHinh.NHI_HINH); mao.AddThuocTinh(thuocTinh, Constants.DiaChiTuongHinh.NHI_HINH); } }
public IActionResult GetDiaChi(string tendangnhap, string iddiachi) { string checktendangnhap = HttpContext.Session.GetString("TenDangNhap"); if (checktendangnhap != null && checktendangnhap != "") { DiaChi diachi = new DiaChi(); diachi = taikhoanbus.GetChoosenAddress(iddiachi); TaiKhoan taikhoan = new TaiKhoan(); taikhoan = taikhoanbus.CheckTaiKhoan(tendangnhap); ViewBag.TaiKhoan = taikhoan; return(PartialView("pDiaChi", diachi)); } return(RedirectToAction("Index", "Home")); }
/// <summary> /// Nếu chọn chi thì phải cập nhật lại can. /// </summary> /// <param name="combobox"></param> /// <param name="comboboxToUpdate"></param> private void CapNhatCan(ComboBox combobox, ComboBox comboboxToUpdate) { DiaChi selectedChi = DiaChi.All[combobox.SelectedIndex]; ThienCan firstCan = CanChi.GetCanDauTienHopLe(selectedChi); if (comboboxToUpdate.SelectedIndex < 0) { comboboxToUpdate.SelectedIndex = firstCan.Id - 1; } else { ThienCan currentCan = ThienCan.All[comboboxToUpdate.SelectedIndex]; // Cập nhật chi nếu khác loại âm dương. if (currentCan.Duong != firstCan.Duong) { comboboxToUpdate.SelectedIndex = firstCan.Id - 1; } } }
public static DiaChiInfoModel ToModel(this DiaChi model) { if (model == null) { return(new DiaChiInfoModel()); } DiaChiInfoModel destination = new DiaChiInfoModel(); destination.Id = model.Id; destination.DiaChi1 = model.DiaChi1; destination.DiaChi2 = model.DiaChi2; destination.DienThoai = model.DienThoai; destination.Fax = model.Fax; destination.MaBuuDien = model.MaBuuDien; destination.ProvinceID = model.ProvinceID; destination.QuanHuyenID = model.QuanHuyenID; destination.Latitude = model.Latitude.ToString().Replace(",", "."); destination.Longitude = model.Longitude.ToString().Replace(",", "."); return(destination); }
private void SetUIControls(AmLich amLich) { CanChi ngayAm = amLich.NgayAm; CanChi thangAm = amLich.ThangAm; CanChi namAm = amLich.NamAm; cbxNgayCan.SelectedIndex = ngayAm.Can.Id - 1; cbxNgayChi.SelectedIndex = ngayAm.Chi.Id - 1; cbxThangCan.SelectedIndex = thangAm.Can.Id - 1; cbxThangChi.SelectedIndex = thangAm.Chi.Id - 1; cbxNamCan.SelectedIndex = namAm.Can.Id - 1; cbxNamChi.SelectedIndex = namAm.Chi.Id - 1; DiaChi gioChi = DiaChi.All[cbxGioChi.SelectedIndex]; ThienCan gioCan = amLich.GetCanCuaGio(gioChi); cbxGioCan.SelectedIndex = gioCan.Id - 1; labelNgayDuongLich.Text = $"Ngày dương lịch: {amLich.SolarDate.Year}-{amLich.SolarDate.Month}-{amLich.SolarDate.Day}"; labelNgayAmLich.Text = $"Ngày âm lịch: {amLich.LunarYear}-{amLich.LunarMonth}-{amLich.LunarDay}"; }
public static DiaChi ToEntity(this DiaChiInfoModel model, DiaChi destination) { if (model == null) { return(null); } if (destination == null) { destination = new DiaChi(); } destination.Id = model.Id; destination.DiaChi1 = model.DiaChi1; destination.DiaChi2 = model.DiaChi2; destination.DienThoai = model.DienThoai; destination.Fax = model.Fax; destination.MaBuuDien = model.MaBuuDien; destination.ProvinceID = model.ProvinceID; destination.QuanHuyenID = model.QuanHuyenID; destination.Latitude = model.Latitude.ToDecimal(); destination.Longitude = model.Longitude.ToDecimal(); return(destination); }
public static string ToText(this DiaChi item) { if (item == null) { return(""); } string _diachi = item.DiaChi1; if (!string.IsNullOrEmpty(item.DiaChi2)) { _diachi = _diachi + " " + item.DiaChi2; } if (item.Quanhuyen != null) { return(string.Format("{0} - {1} - {2}", _diachi, item.Quanhuyen.Ten, item.Province.Name)); } if (item.Province != null) { return(string.Format("{0} - {1}", _diachi, item.Province.Name)); } return(_diachi); }