Ejemplo n.º 1
0
        private void XuatHang_Load(object sender, EventArgs e)
        {
            var i2nKHO = new Id2Name(textBoxMAKHO, comboBoxKho);
            var i2nKH  = new Id2Name(textBoxKHACHHANG, comboBoxKHACH_HANG);
            var i2nHH  = new Id2Name(textBoxHANGHOA, comboBoxHANGHOA);



            if (MKho.Get(MKho.KHO_HANG).Count() == 0 || MHangHoa.Get().Count() == 0)
            {
                MessageBox.Show("CẦN TẠO KHO VÀ HÀNG HÓA TRƯỚC KHI XUẤT HÀNG");
                this.Close();
                return;
            }

            comboBoxKho.DataSource    = MKho.Get(MKho.KHO_HANG).OrderBy(u => u.NAME);
            comboBoxKho.DisplayMember = "NAME";
            comboBoxKho.ValueMember   = "ID";

            comboBoxKHACH_HANG.DataSource    = dbContext.KHACH_HANG.OrderBy(u => u.NAME);
            comboBoxKHACH_HANG.DisplayMember = "NAME";
            comboBoxKHACH_HANG.ValueMember   = "ID";

            comboBoxHANGHOA.DataSource    = dbContext.HANG_HOA.OrderBy(u => u.NAME);
            comboBoxHANGHOA.DisplayMember = "NAME";
            comboBoxHANGHOA.ValueMember   = "ID";
            dataGridView1.DataSource      = bs;
            comboBoxHANGHOA_SelectedIndexChanged(sender, e);

            dataGridView1.AutoResizeColumns();
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            textBoxMAKHO.Select();
            textBoxMAKHO.SelectAll();
        }
Ejemplo n.º 2
0
        private void NhapHang_Load(object sender, EventArgs e)
        {
            if (MKho.Get(MKho.KHO_HANG).Count() == 0 || MHangHoa.Get().Count() == 0 || MNcc.Get().Count() == 0)
            {
                MessageBox.Show("CẦN TẠO KHO, HÀNG HÓA VÀ NHÀ CUNG CẤP TRƯỚC KHI NHẬP HÀNG");
                this.Close();
                return;
            }

            var i2nKHO = new Id2Name(textBoxMAKHO, comboBoxKho);
            var i2nKH  = new Id2Name(textBoxNCC, comboBoxNCC);
            var i2nHH  = new Id2Name(textBoxHANGHOA, comboBoxHANGHOA);

            comboBoxKho.DataSource    = T_Manager.Modal.MKho.Get(MKho.KHO_HANG).OrderBy(u => u.NAME);//dbContext.KHOes.Where(u => u.TYPE == 0);
            comboBoxKho.DisplayMember = "NAME";
            comboBoxKho.ValueMember   = "ID";

            comboBoxNCC.DataSource    = T_Manager.Modal.MNcc.Get().OrderBy(u => u.NAME);//dbContext.NHA_CUNG_CAP;
            comboBoxNCC.DisplayMember = "NAME";
            comboBoxNCC.ValueMember   = "ID";

            comboBoxHANGHOA.DataSource    = dbContext.HANG_HOA.OrderBy(u => u.NAME);
            comboBoxHANGHOA.DisplayMember = "NAME";
            comboBoxHANGHOA.ValueMember   = "ID";
            dataGridView1.DataSource      = bs;
            comboBoxHANGHOA_SelectedIndexChanged(sender, e);
            dataGridView1.AutoResizeColumns();
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            textBoxMAKHO.Select();
            textBoxMAKHO.SelectAll();
        }
Ejemplo n.º 3
0
 private void FTonKho_Load(object sender, EventArgs e)
 {
     if (MKho.Get(MKho.KHO_HANG).Count() == 0 || MHangHoa.Get().Count() == 0)
     {
         MessageBox.Show("CẦN TẠO KHO, HÀNG HÓA TRƯỚC KHI NHẬP");
         this.Close();
         return;
     }
     Reload();
 }
Ejemplo n.º 4
0
        private void FBanHang_Load(object sender, EventArgs e)
        {
            comboBoxKHO.DataSource    = MKho.Get(MKho.KHO_HANG);
            comboBoxKHO.DisplayMember = "NAME";
            comboBoxKHO.ValueMember   = "ID";

            comboBoxHANGHOA.DataSource    = MHangHoa.Get();
            comboBoxHANGHOA.DisplayMember = "NAME";
            comboBoxHANGHOA.ValueMember   = "ID";

            DateTime now = DateTime.Now.Date;

            comboBoxKHO_SelectedIndexChanged(sender, e);

            textBoxDONGIABAN.Select();
            textBoxDONGIABAN.SelectAll();
        }
Ejemplo n.º 5
0
        private void comboBoxDULIEU_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                long          l  = long.Parse(comboBoxDULIEU.SelectedValue.ToString());
                List <object> ls = new List <object>();
                IQueryable    lst;
                switch (l)
                {
                case 0:
                    lst = MKho.Get(MKho.KHO_HANG).OrderBy(u => u.ID);
                    foreach (KHO k in lst)
                    {
                        ls.Add(new
                        {
                            ID   = k.ID,
                            NAME = k.ID.ToString() + " - " + k.NAME
                        });
                    }
                    break;

                case 1:
                    lst = MKho.Get(MKho.KHO_TK_NGANHANG);
                    foreach (KHO k in lst)
                    {
                        ls.Add(new
                        {
                            ID   = k.ID,
                            NAME = k.ID.ToString() + " - " + k.NAME
                        });
                    }
                    break;

                case 2:
                    lst = MHangHoa.Get();
                    foreach (HANG_HOA k in lst)
                    {
                        ls.Add(new
                        {
                            ID   = k.ID,
                            NAME = k.ID.ToString() + " - " + k.NAME
                        });
                    }
                    break;

                case 3:
                    lst = MNcc.Get();
                    foreach (NHA_CUNG_CAP k in lst)
                    {
                        ls.Add(new
                        {
                            ID   = k.ID,
                            NAME = k.ID.ToString() + " - " + k.NAME
                        });
                    }
                    break;

                case 4:
                    lst = db.NHAN_VIEN;
                    foreach (NHAN_VIEN k in lst)
                    {
                        ls.Add(new
                        {
                            ID   = k.ID,
                            NAME = k.ID.ToString() + " - " + k.NAME
                        });
                    }
                    break;

                case 5:
                    lst = db.XEs;
                    foreach (XE k in lst)
                    {
                        ls.Add(new
                        {
                            ID   = k.ID,
                            NAME = k.ID.ToString() + " - " + k.BIEN_SO
                        });
                    }
                    break;

                case 6:
                    lst = db.NGUON_VAY;
                    foreach (NGUON_VAY k in lst)
                    {
                        ls.Add(new
                        {
                            ID   = k.ID,
                            NAME = k.ID.ToString() + " - " + k.NAME
                        });
                    }
                    break;

                case 7:
                    lst = db.KHACH_HANG;
                    foreach (KHACH_HANG k in lst)
                    {
                        ls.Add(new
                        {
                            ID   = k.ID,
                            NAME = k.ID.ToString() + " - " + k.NAME
                        });
                    }
                    break;
                }
                listBoxKHO.DataSource    = ls;
                listBoxKHO.DisplayMember = "NAME";
                listBoxKHO.ValueMember   = "ID";
            }
            catch (Exception ex)
            {
            }
        }