コード例 #1
0
        public void toastnotifiManager()
        {
            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]);

            for (int i = values.Count - 1; i >= 0; i--)
            {
                var row = values[i];
                if (row.Count < 13 && row.Count > 0)
                {
                    DateTime sigupTime = Convert.ToDateTime(row[0]);
                    DateTime datenow   = DateTime.Now;
                    TimeSpan timeSpan  = datenow - sigupTime;
                    if (timeSpan.TotalSeconds < 30)
                    {
                        DevExpress.XtraBars.ToastNotifications.ToastNotification toastNotification1 = new DevExpress.XtraBars.ToastNotifications.ToastNotification();
                        toastNotifiManager = new DevExpress.XtraBars.ToastNotifications.ToastNotificationsManager(this.components);
                        toastNotifiManager.ApplicationId   = row[0].ToString();
                        toastNotifiManager.ApplicationName = "CLB Tình nguyện Sinh viên Duy Tân";
                        toastNotification1.Body            = row[2].ToString() + " " + row[3].ToString();
                        toastNotification1.Header          = "Đăng ký thành viên mới";
                        toastNotification1.ID       = "faf7a0e2-d33b-46fb-8b40-6eb35e31192a";
                        toastNotification1.Image    = global::CDIO_QLCLB.Properties.Resources.logo;
                        toastNotification1.Template = DevExpress.XtraBars.ToastNotifications.ToastNotificationTemplate.ImageAndText03;
                        toastNotification1.Body2    = "https://www.facebook.com/CLBTinhNguyenSinhVienDuyTan";
                        toastNotifiManager.Notifications.AddRange(new DevExpress.XtraBars.ToastNotifications.IToastNotificationProperties[] { toastNotification1 });

                        toastNotifiManager.ShowNotification(toastNotifiManager.Notifications[0]);
                    }
                }
                else
                {
                    break;
                }
            }
        }
コード例 #2
0
ファイル: BLL_Home.cs プロジェクト: ThanhHaiii/TB
        public void loadSignUpMember()
        {
            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 dem = 0;

            for (int i = 0; i < values.Count; i++)
            {
                var row = values[i];
                if (row.Count < 13 && row.Count > 0)
                {
                    pn_SignUpMember[dem]   = new Panel();
                    lb_MSSV[dem]           = new Label();
                    lb_SignUpDateTime[dem] = new Label();
                    lb_SignUpFullName[dem] = new Label();
                    lb_Sex[dem]            = new Label();

                    pn_SignUpMember[dem].BackColor   = System.Drawing.SystemColors.ControlLightLight;
                    pn_SignUpMember[dem].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                    pn_SignUpMember[dem].Cursor      = System.Windows.Forms.Cursors.Hand;
                    pn_SignUpMember[dem].Dock        = System.Windows.Forms.DockStyle.Top;
                    pn_SignUpMember[dem].Location    = new System.Drawing.Point(0, 0);
                    pn_SignUpMember[dem].Size        = new System.Drawing.Size(frmhome.pn_DKMoi.Size.Width, 100);
                    pn_SignUpMember[dem].TabIndex    = i;
                    pn_SignUpMember[dem].Tag         = i;
                    pn_SignUpMember[dem].Click      += new System.EventHandler(SignUp_Click);

                    lb_SignUpFullName[dem].Font      = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    lb_SignUpFullName[dem].Location  = new System.Drawing.Point(17, 5);
                    lb_SignUpFullName[dem].Size      = new System.Drawing.Size(frmhome.pn_DKMoi.Size.Width - 30, 40);
                    lb_SignUpFullName[dem].TabIndex  = i;
                    lb_SignUpFullName[dem].TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    lb_SignUpFullName[dem].Anchor    = (AnchorStyles)(AnchorStyles.Left);
                    lb_SignUpFullName[dem].Text      = row[2] + " " + row[3] + " - " + row[1];
                    lb_SignUpFullName[dem].Tag       = i;
                    lb_SignUpFullName[dem].Click    += new System.EventHandler(SignUp_Click);

                    lb_SignUpDateTime[dem].Font     = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    lb_SignUpDateTime[dem].Location = new System.Drawing.Point(0, 72);
                    lb_SignUpDateTime[dem].Size     = new System.Drawing.Size(frmhome.pn_DKMoi.Size.Width - 30, 23);
                    lb_SignUpDateTime[dem].TabIndex = 0;
                    DateTime ngay = Convert.ToDateTime(row[0]);
                    lb_SignUpDateTime[dem].Text      = "Thời gian: " + ngay.ToString("dd/MM/yyyy hh:mm:ss tt");
                    lb_SignUpDateTime[dem].TextAlign = System.Drawing.ContentAlignment.MiddleRight;
                    lb_SignUpDateTime[dem].Tag       = i;
                    lb_SignUpDateTime[dem].Anchor    = (AnchorStyles)(AnchorStyles.Left);
                    lb_SignUpDateTime[dem].Click    += new System.EventHandler(SignUp_Click);

                    lb_Sex[dem].Font      = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    lb_Sex[dem].Location  = new System.Drawing.Point(0, 45);
                    lb_Sex[dem].Size      = new System.Drawing.Size(frmhome.pn_DKMoi.Size.Width - 30, 23);
                    lb_Sex[dem].TabIndex  = 0;
                    lb_Sex[dem].Text      = "Giới tính: " + row[5] + "    Khoa: " + row[8] + "    Lớp: " + row[9];
                    lb_Sex[dem].TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    lb_Sex[dem].Tag       = i;
                    lb_Sex[dem].Anchor    = (AnchorStyles)(AnchorStyles.Left);
                    lb_Sex[dem].Click    += new System.EventHandler(SignUp_Click);

                    frmhome.pn_DKMoi.Controls.Add(pn_SignUpMember[dem]);
                    pn_SignUpMember[dem].Controls.Add(lb_SignUpFullName[dem]);
                    pn_SignUpMember[dem].Controls.Add(lb_SignUpDateTime[dem]);
                    pn_SignUpMember[dem].Controls.Add(lb_Sex[dem]);
                    dem++;
                }
            }
            frmhome.lb_DemDK.Text = dem.ToString();
        }
コード例 #3
0
ファイル: BLL_MemberInfo.cs プロジェクト: ThanhHaiii/TB
        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 { }
            }
        }
コード例 #4
0
ファイル: BLL_MemberInfo.cs プロジェクト: ThanhHaiii/TB
        public void pheDuyet()
        {
            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    sqlquery = "SELECT * FROM [ThanhVien],[ChucVu] where ThanhVien.IDChucVu = ChucVu.IDChucVu and MSSV = '" + values[id][1].ToString() + "';";
            DataTable dt       = dalmember.getTable(sqlquery);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["RoiCLB"].ToString() == "")
                {
                    MessageBox.Show("Người này đang là thành viên của CLB", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    deleteMember();
                }
                else
                {
                    DateTime ngay = Convert.ToDateTime(dt.Rows[0]["RoiCLB"].ToString());
                    if (MessageBox.Show("Thành viên này đã rời CLB ngày: " + string.Format("dd/MM/yyyy") + " bạn có muốn duyệt lại thành viên này?",
                                        "Xác nhận phê duyệt", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        string sqlUpdate = "update ThanhVien set RoiCLB = null,IDChucVu = 8 where MSSV = " + frmMemberInfor.tb_mssv.Text;
                        if (dalmember.updateTable(sqlUpdate) > 0)
                        {
                            frmMemberInfor.lb_PheDuyet.Show();
                            frmMemberInfor.lb_PheDuyet.BackColor = Color.FromArgb(120, Color.Black);
                            Thread.Sleep(2000);
                            frmMemberInfor.lb_PheDuyet.Hide();
                            logical.APIeSMS     eSMS   = new logical.APIeSMS();
                            XuLyChuoi.checkKyTu chkstr = new XuLyChuoi.checkKyTu();
                            string message             = "Chúc mừng bạn <HoTen>, MSSV: <MSSV> đã chính thức trở thành CTV của CLB Tình nguyện Sinh viên Duy Tân. Mời bạn truy cập link: https://www.facebook.com/groups/CLBTinhNguyenSinhVienDuyTan để vào group của CLB nhằm theo dõi các thông báo mới nhất. CLB Tình nguyện Sinh viên Duy Tân xin cám ơn bạn vì đã tham gia cùng chúng tôi";
                            eSMS.SendSMS(frmMemberInfor.tb_Sdt.Text, chkstr.DetectChar(message, dt.Rows[0]["IDThanhVien"].ToString()));
                            sqlquery = "select IDThanhVien from ThanhVien where MSSV = " + frmMemberInfor.tb_mssv.Text;
                            caseData.DataTam.DuLieu.client.Send(Serialize("volunteeraddmember:" + dalmember.layID(sqlquery)));
                        }
                    }
                }
            }
            else
            {
                string   idDiaChi = addAddress(frmMemberInfor.tb_DiaChi.Text);
                DateTime ngay     = frmMemberInfor.dtp_NgaySinh.Value;
                string   ngaySinh = string.Format("{0:u}", ngay).Substring(0, 10);
                string   gioitinh;
                if (values[int.Parse(caseData.DataTam.DuLieu.idTemp)][5].ToString() == "Nam")
                {
                    gioitinh = "true";
                }
                else
                {
                    gioitinh = "false";
                }
                string sqlQuery = "insert into ThanhVien(HoThanhVien,TenThanhVien,GioiTinh,NgaySinh,IDDiaChi,SDT,MSSV,Khoa,Lop,LinkFB,IDChucVu,NgayGiaNhap) values(N'" +
                                  values[int.Parse(caseData.DataTam.DuLieu.idTemp)][2] + "',N'" + values[int.Parse(caseData.DataTam.DuLieu.idTemp)][3] + "', '" + gioitinh + "','" +
                                  ngaySinh + "'," + idDiaChi + ",'" + frmMemberInfor.tb_Sdt.Text + "','" + frmMemberInfor.tb_mssv.Text + "',N'" + frmMemberInfor.tb_Khoa.Text + "',N'" +
                                  frmMemberInfor.tb_Lop.Text + "',N'" + values[int.Parse(caseData.DataTam.DuLieu.idTemp)][10] + "',8,getdate())";
                if (dalmember.updateTable(sqlQuery) > 0)
                {
                    sqlQuery = "select max(IDThanhVien) from ThanhVien";
                    string idThanhVien = dalmember.layID(sqlQuery);
                    sqlQuery = "insert into DuyetThanhVien(IDThanhVien,NgayDuyet,NguoiDuyet) values(" + idThanhVien + ",getdate()," + caseData.DataTam.DuLieu.ID + ")";
                    dalmember.updateTable(sqlQuery);
                    frmMemberInfor.lb_PheDuyet.Show();
                    frmMemberInfor.lb_PheDuyet.BackColor = Color.FromArgb(120, Color.Black);
                    string message = "Chúc mừng bạn <HoTen>, MSSV: <MSSV> đã chính thức trở thành CTV của CLB Tình nguyện Sinh viên Duy Tân. Mời bạn truy cập link: https://www.facebook.com/groups/CLBTinhNguyenSinhVienDuyTan để vào group của CLB nhằm theo dõi các thông báo mới nhất. CLB Tình nguyện Sinh viên Duy Tân xin cám ơn bạn vì đã tham gia cùng chúng tôi";

                    logical.APIeSMS     eSMS   = new logical.APIeSMS();
                    XuLyChuoi.checkKyTu chkstr = new XuLyChuoi.checkKyTu();
                    eSMS.SendSMS(frmMemberInfor.tb_Sdt.Text, chkstr.DetectChar(message, values[id][1].ToString()));
                    Thread.Sleep(3000);
                    deleteMember();
                    frmMemberInfor.lb_PheDuyet.Hide();
                    caseData.DataTam.DuLieu.client.Send(Serialize("volunteeraddmember:" + idThanhVien));
                    memberlist.addNewMember(idThanhVien, caseData.DataTam.DuLieu.mbList);
                }
            }
        }