public void ClearPanelQDDG(QuyDinhDocGiaBUS qddgBUS, ref TextBoxX txtMaQDDG, ref TextBoxX txtQDDGHanThe, ref TextBoxX txtQDDGTuoiToiThieu, ref TextBoxX txtQDDGTuoiToiDa)
 {
     txtMaQDDG.Text           = "QDDG" + qddgBUS.GetNewSTT().ToString();
     txtQDDGHanThe.Text       = "0";
     txtQDDGTuoiToiThieu.Text = "0";
     txtQDDGTuoiToiDa.Text    = "0";
 }
예제 #2
0
        //只允许输入数字/小数点/删除键
        private void textBox_CommandKeyDown(object sender, KeyEventArgs e)
        {
            TextBoxX tbx = sender as TextBoxX;

            if ((e.KeyValue < 48 || e.KeyValue > 57) &&
                e.KeyValue != 8 &&
                (e.KeyValue < 96 || e.KeyValue > 105) &&
                e.KeyValue != 110 &&
                e.KeyValue != 13)
            {
                e.Handled = true;
            }
            if (e.KeyValue == 110) //小数点
            {
                if (tbx.Text.Length <= 0)
                {
                    e.Handled = true;//小数点不能在第一位
                }
                else
                {
                    bool b1 = false;
                    b1 = tbx.Text.Contains(".");
                    if (b1)
                    {
                        e.Handled = true;
                    }
                }
            }
            if (e.KeyValue == 13)
            {
                superGridControl1.Focus();
            }
        }
예제 #3
0
        public bool DangNhap(TextBoxX user, TextBoxX pass)
        {
            NguoiDungCtrl nguoidungctrl = new NguoiDungCtrl();

            QLKTX.BusinessObject.NguoiDungInfo nguoidung = new QLKTX.BusinessObject.NguoiDungInfo();
            nguoidung.Password = nguoidungctrl.Md5(pass.Text);
            nguoidung.Username = user.Text;
            QLKTX.DataLayer.DangNhapData dangnhap = new QLKTX.DataLayer.DangNhapData();
            DataTable table = dangnhap.DangNhap(nguoidung);

            if (table.Rows.Count == 1)
            {
                //System.Windows.Forms.MessageBox.Show(table.Rows[0][0] + " " + table.Rows[0][1]);
                string s = table.Rows[0]["PASS"].ToString();
                if (s == nguoidungctrl.Md5(pass.Text))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        public void ProcessLogin(CheckBoxX ckb_ghinho, TextBoxX txt_id, TextBoxX txt_password, Form login, Form main)
        {
            string result;

            result = DAO_QL_NguoiDung.Instances.Check_User(txt_id.Text, txt_password.Text);
            if (result == "Invalid")
            {
                MessageBox.Show("Sai tài khoảng đăng nhập hoặc password", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            if (result == "Disabled")
            {
                MessageBox.Show("tài khoản bị khóa");
                return;
            }
            if (ckb_ghinho.Checked == true)
            {
                bientoancuc.pass      = txt_password.Text;
                bientoancuc.trangthai = true;
            }
            else
            {
                bientoancuc.trangthai = false;
            }
            //bientoancuc.manhanvien = nhan_Vien1TableAdapter.GetNhanVienTheoTenDN(txt_id.Text).Rows[0][0].ToString();
            bientoancuc.tendn = txt_id.Text;
            login.Hide();
            main.ShowDialog();
        }
예제 #5
0
        public void HienThiHopDong(string manv, TextBoxX txtMa, ComboBoxEx cmbnv, DateTimePicker dteNgayBD, DateTimePicker dteNgayKT, NumericUpDown numlanky, TextBoxX txtNoiDung, DateTimePicker dteNgayKy, ComboBoxEx cmbNguoiKy, TextBoxX txtGhiChu, DataGridViewX dtg, BindingNavigator bn)
        {
            BindingSource bs = new BindingSource();

            bs.DataSource    = hopdong.LayHopDongTheoNhanVien(manv);
            dtg.DataSource   = bs;
            bn.BindingSource = bs;

            txtMa.DataBindings.Clear();
            txtMa.DataBindings.Add("Text", bs, "mahopdong");

            cmbnv.DataBindings.Clear();
            cmbnv.DataBindings.Add("SelectedValue", bs, "manv");

            dteNgayBD.DataBindings.Clear();
            dteNgayBD.DataBindings.Add("Text", bs, "ngaybatdau");

            dteNgayKT.DataBindings.Clear();
            dteNgayKT.DataBindings.Add("Text", bs, "ngayketthuc");

            numlanky.DataBindings.Clear();
            numlanky.DataBindings.Add("Text", bs, "lanky");

            txtNoiDung.DataBindings.Clear();
            txtNoiDung.DataBindings.Add("Text", bs, "noidung");

            dteNgayKy.DataBindings.Clear();
            dteNgayKy.DataBindings.Add("Text", bs, "ngayky");

            cmbNguoiKy.DataBindings.Clear();
            cmbNguoiKy.DataBindings.Add("SelectedValue", bs, "manguoiky");

            txtGhiChu.DataBindings.Clear();
            txtGhiChu.DataBindings.Add("Text", bs, "ghichu");
        }
예제 #6
0
        private void txtbx_TextChanged(object sender, System.EventArgs e)
        {
            TextBoxX txtbx = (TextBoxX)sender;

            if (updatingColor || handlingError)
            {
                return;
            }

            if (String.IsNullOrEmpty(txtbx.Text))
            {
                txtbx.Text = "0";
                return;
            }

            if (txtbx.Text == "0")
            {
                txtbx.SelectAll();
            }

            if (ValueInRange(txtbx.Text, false) == 0) // Value is in range if 0.
            {
                short r = (String.IsNullOrEmpty(txtbxR.Text) ? (short)0 : Convert.ToInt16(txtbxR.Text)),
                      g = (String.IsNullOrEmpty(txtbxG.Text) ? (short)0 : Convert.ToInt16(txtbxG.Text)),
                      b = (String.IsNullOrEmpty(txtbxB.Text) ? (short)0 : Convert.ToInt16(txtbxB.Text));

                updatingText           = true;
                cpbColor.SelectedColor = System.Drawing.Color.FromArgb(r, g, b);
                updatingText           = false;
            }
        }
예제 #7
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaLop,
                            TextBoxX txtTenLop,
                            ComboBoxEx cmbKhoiLop,
                            ComboBoxEx cmbNamHoc,
                            IntegerInput iniSiSo,
                            ComboBoxEx cmbGiaoVien)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_LopData.LayDsLop();

            bN.BindingSource = bS;
            dGV.DataSource   = bS;

            txtMaLop.DataBindings.Clear();
            txtMaLop.DataBindings.Add("Text", bS, "MaLop");

            txtTenLop.DataBindings.Clear();
            txtTenLop.DataBindings.Add("Text", bS, "TenLop");

            cmbKhoiLop.DataBindings.Clear();
            cmbKhoiLop.DataBindings.Add("SelectedValue", bS, "MaKhoiLop");

            cmbNamHoc.DataBindings.Clear();
            cmbNamHoc.DataBindings.Add("SelectedValue", bS, "MaNamHoc");

            iniSiSo.DataBindings.Clear();
            iniSiSo.DataBindings.Add("Text", bS, "SiSo");

            cmbGiaoVien.DataBindings.Clear();
            cmbGiaoVien.DataBindings.Add("SelectedValue", bS, "MaGiaoVien");
        }
예제 #8
0
        private bool KiemTra(LabelX maktx, DateTimePicker ngay, ComboBoxEx hoatdong, TextBoxX ghichu)
        {
            if (maktx.Text == "")
            {
                MessageBox.Show("Mã KTX không hợp lệ", "ky Luat");
                return(false);
            }
            if (ngay.Value > DateTime.Now)
            {
                MessageBox.Show("Ngày không hợp lệ", "ky Luat");
                ngay.Value = DateTime.Now;
                ngay.Focus();
                return(false);
            }

            if (hoatdong.SelectedIndex < 0)
            {
                MessageBox.Show("Chưa chọn Hoạt động", "ky Luat");
                hoatdong.Focus();
                return(false);
            }
            if (ghichu.Text == "")
            {
                MessageBox.Show("Chưa nhập Lý do kỹ luật", "ky Luat");
                ghichu.Focus();
                return(false);
            }
            return(true);
        }
        public bool MapDataQDNVFromGUI(ref QuyDinhNhanVienDTO qdnvDTO, TextBoxX txtMaQDNV, TextBoxX txtQDNVTuoiToiThieu, TextBoxX txtQDNVTuoiToiDa, QuyDinhNhanVienBUS qdnvBUS)
        {
            qdnvDTO.Maqd = txtMaQDNV.Text;

            if (qdnvBUS.IsOnlyNumber(txtQDNVTuoiToiThieu.Text))
            {
                qdnvDTO.Tuoitoithieu = int.Parse(txtQDNVTuoiToiThieu.Text);
            }
            else
            {
                return(false);
            }

            if (qdnvBUS.IsOnlyNumber(txtQDNVTuoiToiDa.Text))
            {
                qdnvDTO.Tuoitoida = int.Parse(txtQDNVTuoiToiDa.Text);
            }
            else
            {
                return(false);
            }

            qdnvDTO.Ngayra      = DateTime.Today;
            qdnvDTO.Ngayketthuc = DateTime.MaxValue;
            return(true);
        }
        public void Them(ref DataGridViewX dgvQDPM, ref TextBoxX txtMaQDPM, ref TextBoxX txtQDPMSoSachMax, ref TextBoxX txtQDPMSoNgayMuonMax, QuyDinhPhieuMuonBUS qdpmBUS)
        {
            QuyDinhPhieuMuonDTO qdpmDTO = new QuyDinhPhieuMuonDTO();

            if (!qdpmBUS.MapDataQDPMFromGUIQDPM(ref qdpmDTO, txtMaQDPM, txtQDPMSoSachMax, txtQDPMSoNgayMuonMax, qdpmBUS))
            {
                MessageBox.Show("Dữ liệu không hợp lệ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (qdpmBUS.IsTrungKhopKhoaChinh(qdpmDTO.Maqd.ToString(), dgvQDPM))
            {
                MessageBox.Show("Trùng mã quy định phiếu mượn", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (dgvQDPM.RowCount != 0)
            {
                QuyDinhPhieuMuonDTO temp = new QuyDinhPhieuMuonDTO();
                qdpmBUS.UpdatePreviousDataRowQDPM(ref temp, dgvQDPM);
                qdpmBUS.Sua(temp);
                qdpmDTO.Ngayra = qdpmDTO.Ngayra.AddDays(1);
            }

            if (qdpmBUS.Them(qdpmDTO))
            {
                MessageBox.Show("Thêm thành công");
                qdpmBUS.LoadTabQDPM(ref dgvQDPM, ref txtMaQDPM, ref txtQDPMSoSachMax, ref txtQDPMSoNgayMuonMax, qdpmBUS);
            }
            else
            {
                MessageBox.Show("Thêm không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void InitializeComponent()
 {
     this.txtSearch = new TextBoxX();
     base.SuspendLayout();
     this.txtSearch.AcceptsTab            = true;
     this.txtSearch.AccessibleDescription = "";
     this.txtSearch.BackColor             = SystemColors.Control;
     this.txtSearch.get_Border().set_CornerType(1);
     this.txtSearch.set_DisabledBackColor(SystemColors.Control);
     this.txtSearch.set_FocusHighlightColor(Color.Empty);
     this.txtSearch.Font        = new Font("Segoe UI", 9f);
     this.txtSearch.ForeColor   = Color.FromArgb(38, 47, 57);
     this.txtSearch.Location    = new Point(0, 7);
     this.txtSearch.Margin      = new Padding(0);
     this.txtSearch.MaximumSize = new Size(160, 15);
     this.txtSearch.MinimumSize = new Size(160, 15);
     this.txtSearch.Name        = "txtSearch";
     this.txtSearch.Size        = new Size(160, 15);
     this.txtSearch.TabIndex    = 35;
     this.txtSearch.WordWrap    = false;
     base.AutoScaleDimensions   = new SizeF(96f, 96f);
     base.AutoScaleMode         = AutoScaleMode.Dpi;
     this.BackColor             = SystemColors.ActiveCaption;
     base.Controls.Add(this.txtSearch);
     base.Name = "FilterBoxUserControl";
     base.Size = new Size(160, 30);
     base.ResumeLayout(false);
 }
예제 #12
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtMaNhanVien,
                            TextBoxX txtTenNhanVien,
                            TextBoxX txtGioiTinh,
                            RadioButton opbNam,
                            RadioButton opbNu,
                            DateTimeInput dtpNgaySinh,

                            ComboBoxEx cmbChucVu)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_NhanVienData.LayDsNhanVien();

            txtMaNhanVien.DataBindings.Clear();
            txtMaNhanVien.DataBindings.Add("Text", bS, "MaNhanVien");

            txtTenNhanVien.DataBindings.Clear();
            txtTenNhanVien.DataBindings.Add("Text", bS, "TenNhanVien");

            dtpNgaySinh.DataBindings.Clear();
            dtpNgaySinh.DataBindings.Add("Value", bS, "NgaySinh");

            txtGioiTinh.DataBindings.Clear();
            txtGioiTinh.DataBindings.Add("Text", bS, "GioiTinh");


            cmbChucVu.DataBindings.Clear();
            cmbChucVu.DataBindings.Add("SelectedValue", bS, "MaChucVu");

            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
        public void HienThiKhenThuong(TextBoxX txtMa, ComboBoxEx cmbSQD, ComboBoxEx cmbNV, DateTimePicker NgayKhen, TextBoxX txtLyDo, TextBoxX txtHinhThuc, TextBoxX txtGhichu, string manv, DataGridViewX dtg, BindingNavigator bn)
        {
            BindingSource bs = new BindingSource();

            bs.DataSource    = kt.LayKhenThuongTheoNhanVien(manv);
            dtg.DataSource   = bs;
            bn.BindingSource = bs;

            //ten.DataBindings.Clear();
            //ten.DataBindings.Add("Text", bs, "tenboiduong");

            txtMa.DataBindings.Clear();
            txtMa.DataBindings.Add("Text", bs, "makhenthuong");

            cmbSQD.DataBindings.Clear();
            cmbSQD.DataBindings.Add("SelectedValue", bs, "masoquyetdinh");

            cmbNV.DataBindings.Clear();
            cmbNV.DataBindings.Add("SelectedValue", bs, "manv");

            NgayKhen.DataBindings.Clear();
            NgayKhen.DataBindings.Add("Text", bs, "ngaykhen");

            //NgayKT.DataBindings.Clear();
            //NgayKT.DataBindings.Add("Text", bs, "ngayketthuc");

            txtLyDo.DataBindings.Clear();
            txtLyDo.DataBindings.Add("Text", bs, "lydokhen");

            txtHinhThuc.DataBindings.Clear();
            txtHinhThuc.DataBindings.Add("Text", bs, "hinhthuc");

            txtGhichu.DataBindings.Clear();
            txtGhichu.DataBindings.Add("Text", bs, "ghichu");
        }
        public bool MapDataQDDGFromGUI(ref QuyDinhDocGiaDTO qddgDTO, TextBoxX txtMaQDDG, TextBoxX txtQDDGHanThe, TextBoxX txtQDDGTuoiToiThieu, TextBoxX txtQDDGTuoiToiDa, QuyDinhDocGiaBUS qddgBUS)
        {
            qddgDTO.Maqd = txtMaQDDG.Text;
            if (qddgBUS.IsOnlyNumber(txtQDDGHanThe.Text))
            {
                qddgDTO.Thoihanthe = int.Parse(txtQDDGHanThe.Text);
            }
            else
            {
                return(false);
            }

            if (qddgBUS.IsOnlyNumber(txtQDDGTuoiToiThieu.Text))
            {
                qddgDTO.Tuoitoithieu = int.Parse(txtQDDGTuoiToiThieu.Text);
            }
            else
            {
                return(false);
            }

            if (qddgBUS.IsOnlyNumber(txtQDDGTuoiToiDa.Text))
            {
                qddgDTO.Tuoitoida = int.Parse(txtQDDGTuoiToiDa.Text);
            }
            else
            {
                return(false);
            }

            qddgDTO.Ngayra      = DateTime.Today;
            qddgDTO.Ngayketthuc = DateTime.MaxValue;
            return(true);
        }
예제 #15
0
        public void Sua(ref DataGridViewX dgvLoaiSach, ref TextBoxX txtMaLoaiSachQDS, ref TextBoxX txtTenLoaiSachQDS, QDLoaiSachBUS lsBUS)
        {
            if (string.IsNullOrEmpty(txtMaLoaiSachQDS.Text) == false || string.IsNullOrEmpty(txtTenLoaiSachQDS.Text) == false)
            {
                QDLoaiSachDTO lsDTO = new QDLoaiSachDTO();
                lsBUS.MapDataLSFromGUILoaiSach(ref lsDTO, txtMaLoaiSachQDS, txtTenLoaiSachQDS);
                if (lsBUS.IsTrungKhopKhoaChinh(lsDTO.Matheloai, dgvLoaiSach))
                {
                    MessageBox.Show("Trùng mã quy định sách", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }

                if (lsBUS.Sua(lsDTO))
                {
                    MessageBox.Show("Cập nhật thành công");
                    lsBUS.LoadPanelLoaiSach(ref dgvLoaiSach, ref txtMaLoaiSachQDS, ref txtTenLoaiSachQDS, lsBUS);
                }

                else
                {
                    MessageBox.Show("Cập nhật không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Dữ liệu không đầy đủ", "Asterrisk", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
예제 #16
0
        public void Them(ref DataGridViewX dgvQDS, ref TextBoxX txtMaQDS, ref TextBoxX txtQDThoiHanSach, QuyDinhSachBUS qdsBUS)
        {
            QuyDinhSachDTO qdsDTO = new QuyDinhSachDTO();

            if (!qdsBUS.MapDataQDSFromGUI(ref qdsDTO, txtMaQDS, txtQDThoiHanSach, qdsBUS))
            {
                MessageBox.Show("Dữ liệu không hợp lệ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (qdsBUS.IsTrungKhopKhoaChinh(qdsDTO.Maqd, dgvQDS))
            {
                MessageBox.Show("Trùng mã quy định sách", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (dgvQDS.RowCount != 0)
            {
                QuyDinhSachDTO temp = new QuyDinhSachDTO();
                qdsBUS.UpdatePreviousDataRowQDS(ref temp, dgvQDS);
                qdsBUS.Sua(temp);
                qdsDTO.Ngayra = qdsDTO.Ngayra.AddDays(1);
            }

            if (qdsBUS.Them(qdsDTO))
            {
                MessageBox.Show("Thêm thành công");
                qdsBUS.LoadPanelQDS(ref dgvQDS, ref txtMaQDS, ref txtQDThoiHanSach, qdsBUS);
            }
            else
            {
                MessageBox.Show("Thêm không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public bool KT(ComboBoxEx cmb, TextBoxX text, string ThongBao)
 {
     if (cmb.SelectedIndex >= 0)
     {
         if (cmb.SelectedItem.ToString() != "None")
         {
             if (text.Text == "" || text == null)
             {
                 MessageBox.Show("Chưa nhập " + ThongBao);
                 text.Focus();
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
     }
     else
     {
         MessageBox.Show("Chưa chọn " + ThongBao);
         cmb.Focus();
         return(false);
     }
     return(true);
 }
예제 #18
0
        private bool SetLimit(TextBoxX x1, ErrorProvider ep, string ErrorString)
        {
            bool k = true;

            if (!string.IsNullOrEmpty(x1.Text.Trim()))
            {
                if (tool.StringIsInt_Bool(x1.Text.Trim()))
                {
                    ep.SetError(x1, null);
                    k = true;
                }
                else
                {
                    ep.SetError(x1, ErrorString);
                    k = false;
                }
            }
            else
            {
                ep.SetError(x1, null);
                k = true;
            }

            return(k);
        }
예제 #19
0
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtSTT,
                            ComboBoxEx cmbNamHoc,
                            ComboBoxEx cmbLop,
                            ComboBoxEx cmbMonHoc,
                            ComboBoxEx cmbGiaoVien)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_PhanCongData.LayDsPhanCong();

            txtSTT.DataBindings.Clear();
            txtSTT.DataBindings.Add("Text", bS, "STT");

            cmbNamHoc.DataBindings.Clear();
            cmbNamHoc.DataBindings.Add("SelectedValue", bS, "MaNamHoc");

            cmbLop.DataBindings.Clear();
            cmbLop.DataBindings.Add("SelectedValue", bS, "MaLop");

            cmbMonHoc.DataBindings.Clear();
            cmbMonHoc.DataBindings.Add("SelectedValue", bS, "MaMonHoc");

            cmbGiaoVien.DataBindings.Clear();
            cmbGiaoVien.DataBindings.Add("SelectedValue", bS, "MaGiaoVien");

            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
예제 #20
0
 private void ButtonLimpiar_Click(object sender, EventArgs e)
 {
     TextBoxX.Clear();
     TextBoxY.Clear();
     TextBoxX.Focus();
     PictureBoxPizarra.Image = null;
 }
예제 #21
0
 public void login(CheckBoxX ckb_ghinho, TextBoxX txt_id, TextBoxX txt_password, Form login, Form main)
 {
     if (string.IsNullOrEmpty(txt_id.Text.Trim()))
     {
         MessageBox.Show("Không được bỏ trống ID" + txt_id.Text.ToLower(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txt_id.Focus();
         return;
     }
     if (string.IsNullOrEmpty(txt_password.Text))
     {
         MessageBox.Show("Không được bỏ trống PassWord" + txt_password.Text.ToLower(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txt_password.Focus();
         return;
     }
     if (DAO_QL_NguoiDung.Instances.Check_Config() == 0)
     {
         ProcessLogin(ckb_ghinho, txt_id, txt_password, login, main);// Cấu hình phù hợp xử lý đăng nhập
     }
     if (DAO_QL_NguoiDung.Instances.Check_Config() == 1)
     {
         MessageBox.Show("Chuỗi cấu hình không tồn tại");// Xử lý cấu hình
     }
     if (DAO_QL_NguoiDung.Instances.Check_Config() == 2)
     {
         MessageBox.Show("Chuỗi cấu hình không phù hợp");// Xử lý cấu hình
     }
 }
        public static void setroles(TextBoxX textBoxX1, TextBoxX textBoxX2, TextBoxX textBoxX3, RichTextBox richTextBox1)
        {
            Type          tNetFwPolicy2   = Type.GetTypeFromProgID("HNetCfg.FwPolicy2");
            INetFwPolicy2 fwPolicy2       = (INetFwPolicy2)Activator.CreateInstance(tNetFwPolicy2);
            var           currentProfiles = fwPolicy2.CurrentProfileTypes;
            INetFwRule    firewallRule    = fwPolicy2.Rules.OfType <INetFwRule>().Where(
                x => x.Name == textBoxX2.Text)
                                            .FirstOrDefault(); // Koymak istediğiniz kural ile kayıtlı kayıt var mı diye kontrol ediyoruz

            if (firewallRule == null)
            {
                INetFwRule2 inboundRule = (INetFwRule2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
                inboundRule.Enabled         = true;
                inboundRule.Action          = NET_FW_ACTION_.NET_FW_ACTION_ALLOW;
                inboundRule.Protocol        = 6;              // TCP Protokol Numarası
                inboundRule.LocalPorts      = textBoxX1.Text; // Açmak istediğiniz port
                inboundRule.Name            = textBoxX2.Text; // Kural ismi
                inboundRule.ApplicationName = textBoxX3.Text;
                inboundRule.Description     = richTextBox1.Text;
                inboundRule.Profiles        = currentProfiles;
                INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
                firewallPolicy.Rules.Add(inboundRule);
                MessageBox.Show("Kural Başarılı Bir Şekilde Oluşturuldu.");
            }
            else
            {
                MessageBox.Show("Bu Kural Mevcut.");
            }
        }
        private void SetControlEnabled(ControlsState State)
        {
            foreach (Control item in groupPanel1.Controls)
            {
                if (item.GetType() == typeof(TextBoxX))
                {
                    switch (State)
                    {
                    case ControlsState.Normal:
                        TextBoxX controll = item as TextBoxX;
                        controll.ReadOnly = false;
                        controll.Enabled  = true;
                        break;

                    case ControlsState.Disabled:
                        item.Enabled = false;
                        break;

                    case ControlsState.ReadOnly:
                        TextBoxX c = item as TextBoxX;
                        c.ReadOnly = true;
                        break;

                    default:
                        break;
                    }
                }
            }
        }
예제 #24
0
        private void revise_Click_1(object sender, EventArgs e)
        {
            string path = listSys5.Text; //用户设置的path

            try
            {
                if (Directory.Exists(path))
                { //如果存在
                    List <string> list = new List <string>();
                    for (int i = 0; i < 6; i++)
                    {
                        TextBoxX C = (TextBoxX)this.Controls.Find("listSys" + (i + 1), true)[0];
                        list.Add(C.Text.Trim());
                    }
                    if (SySetHeip.SysetInfo(list) > 0)
                    {
                        Common.Msg.Warning("修改成功");
                        SySetHeip.ConfigurationInfo(SySetHeip.GetSysConfig().Tables[0]);
                    }
                    else
                    {
                        Common.Msg.Warning("修改失败");
                    }
                }
                //不存在,用用户设置path创建路径
                DirectoryInfo di = Directory.CreateDirectory(path);
            }//创建不成功
            catch
            {
                Common.Msg.Warning("修改失败,请检查");
            }
        }
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            TextBoxX txtSoGiaoDich,
                            TextBoxX txtSoButToan,
                            ComboBoxEx cmbSoHieuCo,
                            ComboBoxEx cmbSoHieuNo,
                            TextBoxX txtSoTien)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_ChiTietPhatSinhGDData.LayChiTietPhatSinhGD();

            txtSoGiaoDich.DataBindings.Clear();
            txtSoGiaoDich.DataBindings.Add("Text", bS, "SoGiaoDich");

            txtSoButToan.DataBindings.Clear();
            txtSoButToan.DataBindings.Add("Text", bS, "SoButToan");

            cmbSoHieuCo.DataBindings.Clear();
            cmbSoHieuCo.DataBindings.Add("SelectedValue", bS, "SoHieuTaiKhoanCo");

            cmbSoHieuNo.DataBindings.Clear();
            cmbSoHieuNo.DataBindings.Add("SelectedValue", bS, "SoHieuTaiKhoanNo");

            txtSoTien.DataBindings.Clear();
            txtSoTien.DataBindings.Add("Text", bS, "SoTien");


            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
        public void Sua(ref DataGridViewX dgvChucVu, ref TextBoxX txtMaChucVuQDNV, ref TextBoxX txtTenChucVuQDNV, QDChucVuNhanVienBUS cvnvBUS)
        {
            if (string.IsNullOrEmpty(txtMaChucVuQDNV.Text) == false || string.IsNullOrEmpty(txtTenChucVuQDNV.Text) == false)
            {
                QDChucVuNhanVienDTO cvnvDTO = new QDChucVuNhanVienDTO();
                cvnvBUS.MapDataCVNVFromGUICVNV(ref cvnvDTO, txtMaChucVuQDNV, txtTenChucVuQDNV);
                if (cvnvBUS.IsTrungKhopKhoaChinh(cvnvDTO.Macv, dgvChucVu))
                {
                    MessageBox.Show("Trùng khớp mã chức vụ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }

                if (cvnvBUS.Sua(cvnvDTO))
                {
                    MessageBox.Show("Cập nhật thành công");
                    cvnvBUS.LoadPanelCVNV(ref dgvChucVu, ref txtMaChucVuQDNV, ref txtTenChucVuQDNV, cvnvBUS);
                }

                else
                {
                    MessageBox.Show("Cập nhật không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Dữ liệu không đầy đủ", "Asterrisk", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
예제 #27
0
        /// <summary>
        /// 2门控件赋值
        /// </summary>
        private void RefleTwo()
        {
            ConstantTemperature.Text = PlcQueryHelp.ConstantTime2.ToString();

            for (int i = 0; i < PlcQueryHelp.listAddressTime2.Length; i++)
            {
                TextBoxX C = (TextBoxX)this.Controls.Find("TextBox" + (i + 1), true)[0];

                C.Text = PlcQueryHelp.listAddressTime2[i].ToString("0.0");
            }
            for (int i = 0; i < PlcQueryHelp.BitStatus2.Length; i++)
            {
                if (PlcQueryHelp.BitStatus2[i])
                {
                    PictureBox C = (PictureBox)this.Controls.Find("lamp" + (i + 1), true)[0];

                    C.Image = ND.Properties.Resources.greenlight;//显示绿色灯
                }
                else
                {
                    PictureBox C = (PictureBox)this.Controls.Find("lamp" + (i + 1), true)[0];

                    C.Image = ND.Properties.Resources.redlight;//显示红色灯
                }
            }
        }
        public void HienThi(DataGridViewX dGV,
                            BindingNavigator bN,
                            DateTimeInput dtNgayCapNhat,
                            TextBoxX txtSoDuDauNgay,
                            TextBoxX txtSoPhatSinhNo,
                            TextBoxX txtSoPhatSinhCo,
                            ComboBoxEx cmbSoHieuTaiKhoan)
        {
            BindingSource bS = new BindingSource();

            bS.DataSource = m_TaiKhoanData.LayTaiKhoan();

            txtSoDuDauNgay.DataBindings.Clear();
            txtSoDuDauNgay.DataBindings.Add("Text", bS, "SoDuDauNgay");

            txtSoPhatSinhNo.DataBindings.Clear();
            txtSoPhatSinhNo.DataBindings.Add("Text", bS, "SoPhatSinhNo");

            txtSoPhatSinhCo.DataBindings.Clear();
            txtSoPhatSinhCo.DataBindings.Add("Text", bS, "SoPhatSinhCo");

            dtNgayCapNhat.DataBindings.Clear();
            dtNgayCapNhat.DataBindings.Add("Value", bS, "NgayCapNhat");

            cmbSoHieuTaiKhoan.DataBindings.Clear();
            cmbSoHieuTaiKhoan.DataBindings.Add("SelectedValue", bS, "SoHieuTaiKhoan");


            bN.BindingSource = bS;
            dGV.DataSource   = bS;
        }
        public bool KiemTra(TextBoxX user, TextBoxX pass)
        {
            if (user.Text != "")
            {
                if (user.Text.Contains("'"))
                {
                    MessageBox.Show("Tên đăng nhập không hợp lệ !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    user.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show("Chưa nhập tên người dùng !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                user.Focus();
                return(false);
            }

            if (pass.Text != "")
            {
                if (pass.Text.Contains("'"))
                {
                    MessageBox.Show("Mật khẩu không hợp lệ !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    pass.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show("Chưa nhập mật khẩu !", "Chú ý", MessageBoxButtons.OK, MessageBoxIcon.Information);
                pass.Focus();
                return(false);
            }
            return(true);
        }
 public void GetDataWhenClickDGVQDDG(DataGridViewRow row, ref TextBoxX txtMaQDDG, ref TextBoxX txtQDDGHanThe, ref TextBoxX txtQDDGTuoiToiThieu, ref TextBoxX txtQDDGTuoiToiDa)
 {
     txtMaQDDG.Text           = row.Cells["MAQD"].Value.ToString();
     txtQDDGHanThe.Text       = row.Cells["THOIHANTHE"].Value.ToString();
     txtQDDGTuoiToiThieu.Text = row.Cells["TUOITOITHIEU"].Value.ToString();
     txtQDDGTuoiToiDa.Text    = row.Cells["TUOITOIDA"].Value.ToString();
 }