Esempio n. 1
0
 private void mnThietLapThongSoFTP_Click(object sender, EventArgs e)
 {
     bool flag = this.frmKetNoiFTP == null;
     if (flag)
     {
         this.frmKetNoiFTP = new FormKetNoiFTP();
     }
     this.frmKetNoiFTP.ShowDialog();
 }
Esempio n. 2
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary.Add("Data Source", this.txtServerName.Text.Trim());
            dictionary.Add("Database", this.txtDatabasename.Text.Trim());
            dictionary.Add("User ID", this.txtUsernameSQL.Text.Trim());
            dictionary.Add("Password", this.txtPasswordSQL.Text.Trim());
            string text = ProcessConfigXML.Dictionary2ConfigString(dictionary);
            bool   flag = ManageBase.IsConnectDatabase(text);

            if (flag)
            {
                DataAccessAdapterManagerBase.SetCustomConnectString(text);
                string          text2           = Util.Encrypt(this.txtLISloginPassword.Text.Trim());
                NguoiDungEntity nguoiDungEntity = ManageBase.SelectNguoiDung(this.txtLISloginUserName.Text.Trim(), text2);
                bool            flag2           = nguoiDungEntity != null;
                if (flag2)
                {
                    Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
                    bool @checked = this.chkLoginRemember.Checked;
                    if (@checked)
                    {
                        dictionary2.Add("User", this.txtLISloginUserName.Text.Trim());
                        dictionary2.Add("Pass", text2);
                        dictionary2.Add("Remember", this.chkLoginRemember.Checked ? "true" : "false");
                    }
                    else
                    {
                        dictionary2.Add("User", "");
                        dictionary2.Add("Pass", "");
                        dictionary2.Add("Remember", "false");
                    }
                    GlobalVariable.NguoiDungId      = nguoiDungEntity.NguoiDungId;
                    GlobalVariable.TenDangNhap      = nguoiDungEntity.TenDangNhap;
                    GlobalVariable.HoTenNguoiDung   = nguoiDungEntity.HoTenNguoiDung;
                    GlobalVariable.MatKhau          = nguoiDungEntity.MatKhau;
                    GlobalVariable.LaQuanTriHeThong = (nguoiDungEntity.VaiTro == 1);
                    dictionary["Password"]          = Util.Encrypt(this.txtPasswordSQL.Text.Trim());
                    text = ProcessConfigXML.Dictionary2ConfigString(dictionary);
                    string strValue = ProcessConfigXML.Dictionary2ConfigString(dictionary2);
                    ProcessConfigXML.SaveData("ConnectiontString", text);
                    ProcessConfigXML.SaveData("Account", strValue);
                    bool flag3 = GlobalVariable.CreateFTP();
                    if (flag3)
                    {
                        base.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        bool laQuanTriHeThong = GlobalVariable.LaQuanTriHeThong;
                        if (laQuanTriHeThong)
                        {
                            FormKetNoiFTP formKetNoiFTP = new FormKetNoiFTP();
                            formKetNoiFTP.ShowDialog();
                            bool flag4 = GlobalVariable.FTPLib != null;
                            if (flag4)
                            {
                                base.DialogResult = DialogResult.OK;
                                base.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Hiện tại không thể kết nối tới FTP. Hãy liên hệ quản trị hệ thống thiết lập lại thông số kết nối.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    this.txtLISloginUserName.Focus();
                }
            }
            else
            {
                MessageBox.Show("Không kết nối được cơ sở dữ liệu. Kiểm tra lại thông số kết nối!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtServerName.Focus();
            }
            this.Cursor = Cursors.Default;
        }