Exemplo n.º 1
0
        public void ThemLM(string MLM, string TLM)
        {
            CafeEntities cf = new CafeEntities();
            LOAIMON      lm = new LOAIMON();

            lm.MALOAIMON  = MLM;
            lm.TENLOAIMON = TLM;
            cf.LOAIMONs.Add(lm);
            cf.SaveChanges();
        }
Exemplo n.º 2
0
        public void XoaLM(string MLM)
        {
            CafeEntities cf = new CafeEntities();
            LOAIMON      lm = new LOAIMON();

            lm.MALOAIMON = MLM;
            cf.LOAIMONs.Attach(lm);
            cf.LOAIMONs.Remove(lm);
            cf.SaveChanges();
        }
Exemplo n.º 3
0
        public void XoaNV(string Manv)
        {
            CafeEntities cafe = new CafeEntities();
            NHANVIEN     nv   = new NHANVIEN();

            nv.MANHANVIEN = Manv;
            cafe.NHANVIENs.Attach(nv);
            cafe.NHANVIENs.Remove(nv);
            cafe.SaveChanges();
        }
Exemplo n.º 4
0
        public void SuaLM(string MLM, string TLM)
        {
            CafeEntities cf = new CafeEntities();
            var          lm = (from a in cf.LOAIMONs where a.MALOAIMON == MLM select a).SingleOrDefault();

            if (lm != null)
            {
                lm.TENLOAIMON = TLM;
                cf.SaveChanges();
            }
        }
Exemplo n.º 5
0
        public void ThemNV(string MNV, string HT, string PH, DateTime NS, string DC, string SDT, DateTime NVL, string LCB)
        {
            CafeEntities cf = new CafeEntities();
            NHANVIEN     nv = new NHANVIEN();

            nv.MANHANVIEN = MNV;
            nv.HOTEN      = HT;
            nv.PHAI       = PH;
            nv.NGAYSINH   = NS;
            nv.DIACHI     = DC;
            nv.SDT        = SDT;
            nv.NGAYVAOLAM = NVL;
            nv.LUONGCOBAN = int.Parse(LCB);
            cf.NHANVIENs.Add(nv);
            cf.SaveChanges();
        }
Exemplo n.º 6
0
        public void LayLuong(LabelControl lbCa, LabelControl lbLuong, string manv, int Luongcb)
        {
            DateTime     day  = System.DateTime.Now;
            int          tien = 0;
            CafeEntities nh   = new CafeEntities();
            var          ds   = (from p in nh.NHANVIENs
                                 join q in nh.CHAMCONGs on p.MANHANVIEN equals q.MANHANVIEN
                                 where p.MANHANVIEN == manv && q.NGAYLAM.Month == day.Month && q.NGAYLAM.Year == day.Year
                                 select new
            {
                p.MANHANVIEN
            }).ToList();

            lbCa.Text    = "Tổng Ca Tháng " + day.Month + ": " + ds.Count().ToString() + " Ca";
            tien         = ds.Count() * Luongcb;
            lbLuong.Text = "Tổng Lương: " + string.Format(new CultureInfo("vi-VN"), "{0:#,##0} VNĐ", tien);
        }
Exemplo n.º 7
0
        public void SuaNV(string MNV, string HT, string PH, DateTime NS, string DC, string SDT, DateTime NVL, string LCB)
        {
            CafeEntities snv = new CafeEntities();
            //var nv = (from a in snv.NHANVIENs where a.MANHANVIEN == MNV select a).SingleOrDefault();
            var nv1 = cf.NHANVIENs.Where(p => p.MANHANVIEN.Equals(MNV)).SingleOrDefault();

            if (nv1 != null)
            {
                nv1.HOTEN      = HT;
                nv1.PHAI       = PH;
                nv1.NGAYSINH   = NS;
                nv1.DIACHI     = DC;
                nv1.SDT        = SDT;
                nv1.NGAYVAOLAM = NVL;
                nv1.LUONGCOBAN = int.Parse(LCB);
                snv.SaveChanges();
            }
        }
Exemplo n.º 8
0
        public void TaoTenMon(ComboBoxEdit cbb)
        {
            for (int i = cbb.Properties.Items.Count - 1; i >= 0; i--)
            {
                cbb.Properties.Items.RemoveAt(i);
            }
            CafeEntities nh     = new CafeEntities();
            var          tenmon = from a in nh.LOAIMONs
                                  group a by a.TENLOAIMON into g
                                  select new
            {
                tenloai = g.Key
            };

            foreach (var x in tenmon)
            {
                cbb.Properties.Items.Add(x.tenloai.Trim());
            }
        }
Exemplo n.º 9
0
        public void LayLoaiMon(DataGridView dtgvLM)
        {
            CafeEntities nh = new CafeEntities();
            var          LM = (from p in nh.LOAIMONs
                               select new
            {
                p.MALOAIMON,
                p.TENLOAIMON
            }).ToList();

            DataTable dt = new DataTable();

            dt.Columns.Add("Mã Loại Món");
            dt.Columns.Add("Tên Loại Món");
            foreach (var m in LM)
            {
                dt.Rows.Add(m.MALOAIMON.Trim(), m.TENLOAIMON.Trim());
            }
            dtgvLM.DataSource = dt;
        }