コード例 #1
0
ファイル: frmConfig.cs プロジェクト: chuxuantinh/CHBK2014-N9
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            Class.RegistryWriter rg = new Class.RegistryWriter();
            try
            {
                rg.WriteKey("server", txtServer.Text);
                rg.WriteKey("database", txtDatabaseName.Text);
                string _user = Class.App.EncryptString(txtUser.Text, "UserID");
                string _pass = Class.App.EncryptString(txtPass.Text, "PasswordID");
                rg.WriteKey("user", _user);
                rg.WriteKey("pass", _pass);
                if (checkAutoUpdate.Checked)
                {
                    rg.WriteKey("autoupdate", "1");
                }
                else
                {
                    rg.WriteKey("autoupdate", "0");
                }

                MessageBox.Show("Lưu cấu hình thành công !");
                this.Close();
            }
            catch
            {
                MessageBox.Show("Lưu cấu hình thất bại !");
            }
        }
コード例 #2
0
 private void btnmedia4_ItemClick(object sender, ItemClickEventArgs e)
 {
     Class.RegistryWriter rg = new Class.RegistryWriter();
     rg.WriteKey("media", "yodel.wav");
     Class.App.media = "yodel.wav";
     if (File.Exists(@"media/" + Class.App.media))
     {
         SoundPlayer simpleSound = new SoundPlayer(@"media/" + Class.App.media);
         simpleSound.Play();
     }
 }
コード例 #3
0
 private void btnThongBao_CheckedChanged(object sender, ItemClickEventArgs e)
 {
     Class.RegistryWriter rg = new Class.RegistryWriter();
     if (btnThongBao.Checked)
     {
         rg.WriteKey("alert", "1");
     }
     else
     {
         rg.WriteKey("alert", "0");
     }
 }
コード例 #4
0
        private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (_bFullScreenMode == true)
            {
                ShowTaskbar();
            }
            string skin = defaultGiaoDien.LookAndFeel.SkinName;

            Class.RegistryWriter rg = new Class.RegistryWriter();
            rg.WriteKey("style", skin);
            //try
            //{
            //    ribbon.SaveLayoutToXml(template_grid);
            //}
            //catch { }
            Application.Exit();
        }
コード例 #5
0
        //    public string _taikhoan;


        private void frmDangnhap_Load(object sender, EventArgs e)
        {
            //txtTaiKhoan.Text = "admin";
            //txtMatkhau.Text = "123456";
            Class.RegistryWriter rg = new Class.RegistryWriter();
            string user             = rg.valuekey("user_client");

            if (user != "Blue" & user != "")
            {
                txtTaiKhoan.Text     = user;
                checkLuuPass.Checked = true;
            }
            else
            {
                txtTaiKhoan.Text     = "admin";
                checkLuuPass.Checked = false;
            }
        }
コード例 #6
0
        private void btnDangNhap_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (txtTaiKhoan.Text.Length < 1 || txtMatkhau.Text.Length < 1)
            {
                MessageBox.Show("Bạn chưa nhập tài khoản hoặc mật khẩu ");
                return;
            }

            Class.S_TaiKhoan tk = new Class.S_TaiKhoan();
            tk.UserName = txtTaiKhoan.Text;
            tk.Password = Class.S_TaiKhoan.md5(txtMatkhau.Text);
            try
            {
                DataTable dt = tk.CheckLogin();
                if (dt.Rows.Count > 0)
                {
                    // MessageBox.Show(" Đăng nhập thành công !");
                    if (checkLuuPass.Checked)
                    {
                        Class.RegistryWriter rg = new Class.RegistryWriter();
                        rg.WriteKey("user_client", txtTaiKhoan.Text);
                    }
                    else
                    {
                        Class.RegistryWriter rg = new Class.RegistryWriter();
                        rg.WriteKey("user_client", "");
                    }
                    (this.Owner as frmMain)._taiKhoan = txtTaiKhoan.Text;
                    this.Close();
                }
                else
                {
                    MessageBox.Show(" Tài khoản hoặc mật khẩu không đúng !");
                    (this.Owner as frmMain)._taiKhoan = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #7
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            //  Permission_Hide_Menu(); // call permission hide

            this.Text = this.Text + " " + config("Config.xml", "company") + " V" + config("Config.xml", "version");

            Class.RegistryWriter rg = new Class.RegistryWriter();
            //   this.defaultGiaoDien.LookAndFeel.SkinName = "Xmas 2008 Blue";
            this.defaultGiaoDien.LookAndFeel.SkinName = rg.valuekey("style");
            string sv = rg.valuekey("server");

            if (sv == "Blue")
            {
                btnCauHinh_ItemClick(null, null);
            }
            else
            {
                btnDangNhap_ItemClick(null, null);
            }

            //// timechechSv.Enabled = true;
            SkinHelper.InitSkinPopupMenu(barSubItem2);
            SkinHelper.InitSkinPopupMenu(barSubItem4);
        }
コード例 #8
0
ファイル: DbAccess.cs プロジェクト: chuxuantinh/CHBK2014-N9
        public static string get_config(string _id)
        {
            RegistryWriter rg = new RegistryWriter();

            return(rg.valuekey(_id));
        }
コード例 #9
0
        //string template_grid = Application.StartupPath + @"\Templates\Templates_Menu.xml";

        private void btnDangNhap_ItemClick(object sender, ItemClickEventArgs e)
        {
            frmDangNhap frm = new frmDangNhap();

            frm.Owner = this;
            frm.ShowDialog();
            if (_taiKhoan != "")
            {
                Waiting.ShowWaitForm();
                Waiting.SetWaitFormDescription("Đang tải thông tin tài khoản..");
                Permission_Show_Menu(_taiKhoan);
                //hien thi btndoimatkhau
                btnDoiMatKhau.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
                // goi chuc nang thong bao
                this.btnThongBao.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
                Class.RegistryWriter rg = new Class.RegistryWriter();
                lblFullname.Caption = "Đang sử dụng: " + _taiKhoan + "  | Thời gian: " + DateTime.Now.ToString("dd/MM/yyyy h:m tt") + "   |  Máy chủ: " + rg.valuekey("server");
                sv_host             = rg.valuekey("server");

                // goi thong tin de luu Log phan mem
                Class.S_Log.Call_PcInfo();
                Class.S_Log.UserName = _taiKhoan.ToLower();
                ribbon.SelectedPage  = Menu_Hrm;
                Class.S_Log.Insert("Hệ thống", "Đăng nhập");
                Class.App.client_User = _taiKhoan;
                if (rg.valuekey("alert") == "Blue")
                {
                    btnThongBao.Enabled = true;
                }
                else if (rg.valuekey("alert") == "1")
                {
                    btnThongBao.Enabled = true;
                    Class.ThongKe tk = new Class.ThongKe();
                    DataTable     dt = tk.CT_EMPLOYEE_GetListBirthday();
                    if (dt.Rows.Count > 0)
                    {
                        dt.Columns.Add("Day", Type.GetType("System.String"));
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            string txt = ((DateTime)dt.Rows[i]["BirthDay"]).Day.ToString();
                            if (txt.Length == 1)
                            {
                                txt = "0" + txt;
                            }
                            dt.Rows[i]["Day"] = txt;
                        }
                        DataView dv = dt.DefaultView;
                        dv.Sort = "Day ASC";
                        dt      = dv.ToTable();

                        // xuat thong bao sinh nhat sap den
                        string tb = "";
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            tb += (i + 1).ToString() + ". " + dt.Rows[i]["FirstName"].ToString() + " " + dt.Rows[i]["LastName"].ToString() + ": <i>" + ((DateTime)dt.Rows[i]["Birthday"]).ToString("dd/MM/yyyy") + "</i>\n";
                        }
                        alertControl.Show(this, "Danh sách sắp đến ngày sinh nhật:", tb);
                        //-------------
                        // xuat danh sach sap phai ky lai hop dong
                        Class.DanhMuc_HopDong hd   = new Class.DanhMuc_HopDong();
                        DataTable             dthd = hd.CT_CONTRACT_GetListJustExpiration();
                        if (dthd.Rows.Count > 0)
                        {
                            DataView _dv = new DataView();
                            _dv      = dthd.DefaultView;
                            _dv.Sort = "ToDate ASC";


                            string tb2 = "";
                            for (int i = 0; i < _dv.Count; i++)
                            {
                                tb2 += (i + 1).ToString() + ". " + _dv[i]["FirstName"].ToString() + " " + _dv[i]["LastName"].ToString() + " -<i> " + ((DateTime)_dv[i]["ToDate"]).ToString("dd/MM/yyyy") + "</i>\n";;
                            }
                            alertControl.Show(this, "Danh sách sắp ký lại hợp đồng :", tb2);
                        }
                        ////-----------------=================
                        if (File.Exists(@"media/" + Class.App.media))
                        {
                            SoundPlayer simpleSound = new SoundPlayer(@"media/" + Class.App.media);
                            simpleSound.Play();
                        }
                    }
                }
                else
                {
                    btnThongBao.Enabled = false;
                }

                Waiting.CloseWaitForm();
            }
        }