Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAddNhaCungCap f = new frmAddNhaCungCap();

            f.ShowDialog(this);
            gridControl1.DataSource = NhaCungCapControlller.GetList();
        }
Example #2
0
 private void lookUpEditNhaCungCap_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (e.Button.Caption.ToUpper().Equals("ADD"))
     {
         frmAddNhaCungCap f = new frmAddNhaCungCap();
         f.ShowDialog(this);
         lookUpEditNhaCungCap.Properties.DataSource = NhaCungCapControlller.GetList();
         if (f.strNewNhaCungCapID != string.Empty)
         {
             lookUpEditNhaCungCap.EditValue = f.strNewNhaCungCapID;
         }
         f.Dispose();
     }
 }
Example #3
0
        //private void KhoiTaoDuLieuSearch()
        //{
        //    int i = 0;
        //    txtSanPham.Properties.Columns[i].Caption = "Mã sản phẩm";
        //    txtSanPham.Properties.Columns[i].FieldName = "SanPhamID";

        //    i++;
        //    txtSanPham.Properties.Columns[i].Caption = "Tên sản phẩm";
        //    txtSanPham.Properties.Columns[i].FieldName = "TenSanPham";

        //    i++;
        //    txtSanPham.Properties.Columns[i].Caption = "Giá bán";
        //    txtSanPham.Properties.Columns[i].FieldName = "GiaBan";
        //    txtSanPham.Properties.Columns[i].FormatType = DevExpress.Utils.FormatType.Numeric;
        //    txtSanPham.Properties.Columns[i].FormatString = "# ##0";

        //    i++;
        //    txtSanPham.Properties.Columns[i].Caption = "Tồn kho";
        //    txtSanPham.Properties.Columns[i].FieldName = "SLTonKho";
        //    //txtSearch.Properties.
        //    txtSanPham.Properties.AutoSearchColumnIndex = 1;
        //    txtSanPham.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
        //    txtSanPham.Properties.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;

        //    txtSanPham.Properties.DisplayMember = "SanPhamID";
        //    txtSanPham.Properties.ValueMember = "SanPhamID";
        //    txtSanPham.Properties.NullValuePrompt = "Nhập mã sản phẩm hoặc tên";
        //}

        private void KhoiTaoDSNhaCungCap()
        {
            lookUpEditNhaCungCap.Properties.DataSource    = NhaCungCapControlller.GetList();
            lookUpEditNhaCungCap.Properties.DisplayMember = "TenNhaCungCap";
            lookUpEditNhaCungCap.Properties.ValueMember   = "NhaCungCapID";
            lookUpEditNhaCungCap.Properties.NullText      = "Chưa chọn nhà cung cấp";
            lookUpEditNhaCungCap.Text = string.Empty;
            lookUpEditNhaCungCap.Properties.Columns[0].Caption   = "Mã nhà cung cấp";
            lookUpEditNhaCungCap.Properties.Columns[0].FieldName = "NhaCungCapID";
            lookUpEditNhaCungCap.Properties.Columns[1].Caption   = "Tên nhà cung cấp";
            lookUpEditNhaCungCap.Properties.Columns[1].FieldName = "TenNhaCungCap";
            lookUpEditNhaCungCap.Properties.SearchMode           = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;
            lookUpEditNhaCungCap.Properties.TextEditStyle        = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
        }
Example #4
0
        private void gr_btn_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            int    intRow          = gridView1.FocusedRowHandle;
            string strNhaCungCapID = gridView1.GetRowCellValue(intRow, "NhaCungCapID").ToString();

            if ((e.Button.Caption.ToUpper().Equals("DEL")) && (strNhaCungCapID != string.Empty))
            {
                if (MessageBox.Show("Bạn muốn xóa nhà cung cấp này không", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    NhaCungCapControlller.DelItem(strNhaCungCapID);
                    gridControl1.DataSource = NhaCungCapControlller.GetList();
                }
            }
        }
Example #5
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            int intRow = gridView1.FocusedRowHandle;

            if (intRow >= 0)
            {
                string     strNhaCungCapID = gridView1.GetRowCellValue(intRow, "NhaCungCapID").ToString();
                NhaCungCap item            = NhaCungCapControlller.GetItem(strNhaCungCapID);
                if (item != null)
                {
                    frmAddNhaCungCap f = new frmAddNhaCungCap();
                    f.frmMode  = "edit";
                    f.EditItem = item;
                    if (f.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        gridControl1.DataSource    = NhaCungCapControlller.GetList();
                        gridView1.FocusedRowHandle = intRow;
                    }
                }
            }
        }
Example #6
0
 private void frmNhaCungCap_Load(object sender, EventArgs e)
 {
     KhoiTaoLuoi();
     gridControl1.DataSource = NhaCungCapControlller.GetList();
 }