Пример #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (status == "NORMAL")
            {
                if (_webReg != null)
                {
                    try
                    {
                        //if (_phanQuyen == null || _phanQuyen.Xoa == false)
                        //{
                        //    MessageBox.Show("Không có quyền thực hiện chức năng này", "Phân quyền", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //    return;
                        //}
                        WebReg.Delete(long.Parse(txtMa.Text));

                        _ClearForm();

                        _LoadDSNHom();
                        _setFormStatus("NORMAL");
                    }
                    catch
                    {
                        MessageBox.Show("Không thể trang web đang sử dụng");
                    }
                }
                else
                {
                    MessageBox.Show("Chưa có trang web được chọn");
                }
            }
            else
            {
                _setFormStatus("NORMAL");
            }
        }
Пример #2
0
        private WebReg _getFormInfo()
        {
            WebReg nhom = null;

            if (txtTen.Text != "" || lookUpEditPage.EditValue != null)
            {
                nhom = new WebReg();
                //nhom.Ma = int.Parse(txtMa.Text);
                if (_Type == NumCode.WEB)
                {
                    nhom.Page = lookUpEditPage.EditValue.ToString();
                }
                else
                {
                    nhom.Page = txtTen.Text;
                }
                nhom.Note     = txtGhiChu.Text;
                nhom.UserName = txtUsername.Text;
                nhom.Password = txtPassword.Text;
                nhom.Type     = _Type;
            }
            else
            {
                MessageBox.Show("Nhập vào địa chỉ trang web");
                txtTen.Focus();
            }

            return(nhom);
        }
Пример #3
0
        private void Luu()
        {
            WebReg temp = _getFormInfo();

            if (temp != null)
            {
                if (status == "NEW") //thêm mới
                {
                    try
                    {
                        txtMa.Text = WebReg.Insert(temp).ToString();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
                else if (status == "EDIT")
                {
                    temp.ID = long.Parse(txtMa.Text);
                    WebReg.Update(temp);
                }
                _setFormStatus("NORMAL");
                _LoadDSNHom();
            }
        }
Пример #4
0
    void Start()
    {
        WebReg webReg = new WebReg();

        webReg.UserName = "******";
        webReg.Password = "******";
        webReg.Show();
    }
Пример #5
0
 private void lookUpEditPage_EditValueChanged(object sender, EventArgs e)
 {
     if (lookUpEditPage.EditValue != null)
     {
         WebReg webReg = WebReg.Get(long.Parse(lookUpEditPage.EditValue.ToString()));
         txtUsername.Text = webReg.UserName;
         txtPassword.Text = webReg.Password;
     }
 }
Пример #6
0
 private void _ClearForm()
 {
     txtMa.Enabled            = true;
     txtMa.Text               = "";
     txtTen.Text              = "";
     txtGhiChu.Text           = "";
     txtMa.Text               = "";
     txtUsername.Text         = "";
     txtPassword.Text         = "";
     lookUpEditPage.EditValue = null;
     _webReg = null;
 }
Пример #7
0
        private void _SetFormInfo()
        {
            txtID.Text = _cus.ID.ToString();
            WebReg webReg = WebReg.Get(_cus.Page);

            txtUsername.Text          = webReg.UserName;
            txtPassword.Text          = webReg.Password;
            txtTopic.Text             = _cus.Topic;
            txtIDTopic.Text           = _cus.IDTopic;
            txtUrlPost.Text           = _cus.UrlPost;
            txtNote.Text              = _cus.Note;
            lookUpEdit_Nhom.EditValue = int.Parse(_cus.Group.ToString());
            lookUpEditPage.EditValue  = int.Parse(_cus.Page.ToString());
        }
Пример #8
0
 private void gridView1_Click(object sender, EventArgs e)
 {
     try
     {
         int k = gridView1.SelectedRowsCount;
         if (k > 0)
         {
             int RowHandle = gridView1.FocusedRowHandle;
             if (RowHandle >= 0)
             {
                 _webReg          = new WebReg();
                 _webReg.ID       = int.Parse(gridView1.GetRowCellValue(RowHandle, colID).ToString());
                 _webReg.Page     = gridView1.GetRowCellValue(RowHandle, colPge).ToString();
                 _webReg.UserName = gridView1.GetRowCellValue(RowHandle, colUser).ToString();
                 _webReg.Password = gridView1.GetRowCellValue(RowHandle, colPass).ToString();
                 _webReg.Note     = gridView1.GetRowCellValue(RowHandle, colGhiChu).ToString();
                 _SetFormInfo();
                 _setFormStatus("NORMAL");
             }
         }
     }
     catch { }
 }
Пример #9
0
        private void _LoadWebPage()
        {
            DataTable NhomDT = WebReg.GetByType(_TypePage);

            lookUpEditPage.Properties.DataSource    = NhomDT;
            lookUpEditPage.Properties.DisplayMember = "Page";
            lookUpEditPage.Properties.ValueMember   = "ID";

            DevExpress.XtraEditors.Controls.LookUpColumnInfo colun0 = new DevExpress.XtraEditors.Controls.LookUpColumnInfo();
            colun0.Caption   = "Page";
            colun0.FieldName = "Page";
            lookUpEditPage.Properties.Columns.Add(colun0);

            DevExpress.XtraEditors.Controls.LookUpColumnInfo colun1 = new DevExpress.XtraEditors.Controls.LookUpColumnInfo();
            colun1.Caption   = "UserName";
            colun1.FieldName = "UserName";
            lookUpEditPage.Properties.Columns.Add(colun1);
            DevExpress.XtraEditors.Controls.LookUpColumnInfo colun2 = new DevExpress.XtraEditors.Controls.LookUpColumnInfo();
            colun2.Caption   = "Password";
            colun2.FieldName = "Password";
            colun2.Width     = 40;
            lookUpEditPage.Properties.Columns.Add(colun2);
        }
Пример #10
0
 public frmWebReg(string _type)
 {
     InitializeComponent();
     _webReg = null;
     _Type   = _type;
 }
Пример #11
0
        private void _LoadDSNHom()
        {
            DataTable list = WebReg.GetByType(_Type);

            gridControl1.DataSource = list;
        }