public void loadAllNotifi() { string sqlQuery = "select IDThongBao,TieuDe,NoiDung,NgayDang, NguoiDang, HoThanhVien + ' ' + TenThanhVien as HoTen from ThongBao,ThanhVien where ThongBao.NguoiDang = ThanhVien.IDThanhVien and IDThongBao = " + caseData.DataTam.DuLieu.idTemp; DataTable dt = dalnotifi.getNotifi(sqlQuery); XuLyChuoi.checkLink checklink = new XuLyChuoi.checkLink(); List <checkLink> link = checklink.DetectLink(dt.Rows[0]["NoiDung"].ToString()); frmnotification.lb_PosterFullName.Text = dt.Rows[0]["HoTen"].ToString(); DateTime ngay = Convert.ToDateTime(dt.Rows[0]["NgayDang"].ToString()); frmnotification.lb_DateTime.Text = "Thời gian: " + ngay.ToString("dd/MM/yyyy hh:mm:ss tt"); frmnotification.lb_TieuDe.Text = dt.Rows[0]["TieuDe"].ToString(); frmnotification.tb_BaiViet.Text = dt.Rows[0]["NoiDung"].ToString(); int x = 5; for (int i = 0; i < link.Count; i++) { linklb_Link = new LinkLabel(); linklb_Link.AutoSize = true; linklb_Link.LinkColor = System.Drawing.Color.FromArgb(0, 0, 254); linklb_Link.Location = new System.Drawing.Point(x, 26); linklb_Link.Name = "linklb" + i; linklb_Link.TabIndex = i; linklb_Link.TabStop = true; linklb_Link.Text = link[i].getContent(); linklb_Link.Links.Add(0, link[i].getContent().Length, link[i].getContent()); linklb_Link.LinkClicked += new LinkLabelLinkClickedEventHandler(linkClick); frmnotification.pn_Link.Controls.Add(linklb_Link); x += linklb_Link.Size.Width + 10; } }
public void loadInfo() { string sqlMember = "select IDThanhVien,HoThanhVien + ' ' + TenThanhVien as HoTen, GioiTinh, NgaySinh,DiaChiCuThe,TenXa,TenHuyen,TenTinh,SDT,MSSV,Khoa,Lop,LinkFB,AnhDaiDien,TenChucVu from ChucVu,ThanhVien, DiaChi,Tinh,Huyen,Xa where ThanhVien.IDDiaChi = DiaChi.IDDiaChi and DiaChi.IDXa = Xa.IDXa and Xa.IDHuyen = Huyen.IDHuyen and Huyen.IDTinh = Tinh.IDTinh and ThanhVien.IDChucVu = ChucVu.IDChucVu and MSSV = '" + caseData.DataTam.DuLieu.idTemp + "';"; DataTable dtInfo = dalmember.getTable(sqlMember); XuLyChuoi.checkLink checklink = new XuLyChuoi.checkLink(); if (dtInfo.Rows.Count < 1) { caseData.txtRead txtread = new caseData.txtRead(); logical.GgSheetAPI ggsheet = new logical.GgSheetAPI(); string[] idTable = txtread.readfile(0); IList <IList <Object> > values = ggsheet.docfile(idTable[1], idTable[2]); int id = int.Parse(caseData.DataTam.DuLieu.idTemp); string sqlBirthDay = "SELECT * FROM [ThanhVien],[ChucVu] where ThanhVien.IDChucVu = ChucVu.IDChucVu and MSSV = '" + values[id][1].ToString() + "';"; DataTable dt = dalmember.getTable(sqlBirthDay); List <XuLyChuoi.checkLink> link = checklink.DetectLink(values[id][10].ToString()); frmMemberInfor.lb_HoTen.Text = (values[id][2].ToString() + " " + values[id][3].ToString()).ToUpper(); if (dt.Rows.Count > 0) { if (dt.Rows[0]["RoiCLB"].ToString() == "") { frmMemberInfor.lb_HoTen.Text += " - ĐÃ LÀ THÀNH VIÊN!"; } else { frmMemberInfor.lb_HoTen.Text += " - ĐÃ RỜI CLB NGÀY: " + dt.Rows[0]["RoiCLB"].ToString(); } try { XuLyAnh.MaHoaHinhAnh mhAnh = new XuLyAnh.MaHoaHinhAnh(); frmMemberInfor.pic_Avartar.Image = mhAnh.ChuoiSangAnh(dt.Rows[0]["AnhDaiDien"].ToString()); } catch { } frmMemberInfor.lb_HoTen.ForeColor = System.Drawing.Color.Red; frmMemberInfor.tb_ChucVu.Text = dt.Rows[0]["TenChucVu"].ToString(); } else { frmMemberInfor.tb_ChucVu.Text = "Chưa xét duyệt"; } frmMemberInfor.tb_mssv.Text = values[id][1].ToString(); frmMemberInfor.tb_Sdt.Text = values[id][4].ToString(); frmMemberInfor.tb_Khoa.Text = values[id][8].ToString(); frmMemberInfor.tb_Lop.Text = values[id][9].ToString(); frmMemberInfor.tb_DiaChi.Text = values[id][7].ToString(); frmMemberInfor.dtp_NgaySinh.Text = values[id][6].ToString(); frmMemberInfor.tb_Sdt.Text = values[id][4].ToString(); if (link.Count > 0) { frmMemberInfor.link_Facebook.Text = "Mở Facebook"; frmMemberInfor.link_Facebook.Links.Add(0, link[0].getContent().Length, link[0].getContent()); frmMemberInfor.link_Facebook.LinkClicked += new LinkLabelLinkClickedEventHandler(linkClick); } else { frmMemberInfor.link_Facebook.Text = values[id][10].ToString(); frmMemberInfor.link_Facebook.Links.Add(0, 0); } if (values[id][5].ToString() == "Nam") { frmMemberInfor.ra_Nam.Checked = true; } else { frmMemberInfor.ra_nu.Checked = true; } } else { frmMemberInfor.lb_HoTen.Text = dtInfo.Rows[0]["HoTen"].ToString(); frmMemberInfor.tb_mssv.Text = dtInfo.Rows[0]["MSSV"].ToString(); frmMemberInfor.tb_Sdt.Text = dtInfo.Rows[0]["SDT"].ToString(); frmMemberInfor.tb_Khoa.Text = dtInfo.Rows[0]["Khoa"].ToString(); frmMemberInfor.tb_Lop.Text = dtInfo.Rows[0]["Lop"].ToString(); frmMemberInfor.tb_DiaChi.Text = dtInfo.Rows[0]["DiaChiCuThe"].ToString() + " - " + dtInfo.Rows[0]["TenXa"].ToString() + " - " + dtInfo.Rows[0]["TenHuyen"].ToString() + " - " + dtInfo.Rows[0]["TenTinh"].ToString(); DateTime ngay = Convert.ToDateTime(dtInfo.Rows[0]["NgaySinh"].ToString()); frmMemberInfor.dtp_NgaySinh.Text = ngay.ToString("dd/MM/yyyy"); frmMemberInfor.tb_Sdt.Text = dtInfo.Rows[0]["SDT"].ToString(); frmMemberInfor.tb_ChucVu.Text = dtInfo.Rows[0]["TenChucVu"].ToString(); List <XuLyChuoi.checkLink> link = checklink.DetectLink(dtInfo.Rows[0]["LinkFB"].ToString()); if (link.Count > 0) { frmMemberInfor.link_Facebook.Text = "Mở Facebook"; frmMemberInfor.link_Facebook.Links.Add(0, link[0].getContent().Length, link[0].getContent()); frmMemberInfor.link_Facebook.LinkClicked += new LinkLabelLinkClickedEventHandler(linkClick); } else { frmMemberInfor.link_Facebook.Text = dtInfo.Rows[0]["LinkFB"].ToString(); frmMemberInfor.link_Facebook.Links.Add(0, 0); } if (Convert.ToBoolean(dtInfo.Rows[0]["GioiTinh"])) { frmMemberInfor.ra_Nam.Checked = true; } else { frmMemberInfor.ra_nu.Checked = true; } try { XuLyAnh.MaHoaHinhAnh mhAnh = new XuLyAnh.MaHoaHinhAnh(); frmMemberInfor.pic_Avartar.Image = mhAnh.ChuoiSangAnh(dtInfo.Rows[0]["AnhDaiDien"].ToString()); } catch { } } }