예제 #1
0
        public void xoa()
        {
            Console.Clear();
            Console.WriteLine("XOA THONG TIN BANG LUONG ");
            List <tinhluong> list = spDLL.GetAlltinhluong();
            string           ma;

            Console.Write("Nhap ma bang luong :");
            ma = Console.ReadLine();
            int i = 0;

            for (i = 0; i < list.Count; ++i)
            {
                if (list[i].Matl == ma)
                {
                    break;
                }
            }

            if (i < list.Count)
            {
                tinhluong b = new tinhluong(list[i]);
                spDLL.xoatinhluong(b);
            }
            else
            {
                Console.WriteLine("Khong co bang luong ");
            }
        }
예제 #2
0
        public List <tinhluong> Timtinhluong(tinhluong tl)
        {
            List <tinhluong> list = lhtl.GetAlltinhluong();
            List <tinhluong> kq   = new List <tinhluong>();

            //Voi gai tri ngam dinh ban dau
            if (tl.Matl == null && tl.Songaylv == 0 && tl.Thuong == 0 && tl.Luongcoban == 0 && tl.Thanhtien == 0)
            {
                kq = list;
            }
            //Tim theo ho ten
            if (tl.Matl != null)
            {
                for (int i = 0; i < list.Count; ++i)
                {
                    if (list[i].Matl.IndexOf(tl.Matl) >= 0)
                    {
                        kq.Add(new tinhluong(list[i]));
                    }
                }
            }

            //Cac truong hop khac cac ban tu lam
            else
            {
                kq = null;
            }
            return(kq);
        }
예제 #3
0
        //Chèn một bản ghi tinh luong vào tệp
        public void themtinhluong(tinhluong tl)
        {
            string       matl   = DateTime.Now.ToString("ss");
            StreamWriter fwrite = File.AppendText(txtfile);

            fwrite.WriteLine();
            fwrite.Write(matl + "#" + tl.Songaylv + "#" + tl.Thuong + "#" + tl.Luongcoban + "#" + tl.Thanhtien);
            fwrite.Close();
        }
예제 #4
0
 public void themtinhluong(tinhluong tl)
 {
     if (tl.Luongcoban > 0)
     {
         lhtl.themtinhluong(tl);
     }
     else
     {
         throw new Exception("Du lieu sai");
     }
 }
예제 #5
0
        public void Nhap()
        {
            Console.Clear();
            Console.WriteLine("           NHAP THONG TIN TINH LUONG  ");
            tinhluong sp = new tinhluong();

            Console.Write(" Nhap so ngay lam viec:"); sp.Songaylv = float.Parse(Console.ReadLine());
            Console.Write(" Nhap thuong :"); sp.Thuong            = double.Parse(Console.ReadLine());
            Console.Write(" Nhap luong co ban:"); sp.Luongcoban   = double.Parse(Console.ReadLine());

            spDLL.themtinhluong(sp);
        }
예제 #6
0
        public void Sua()
        {
            Console.Clear();
            Console.WriteLine("SUA THONG TIN BANG LUONG");
            List <tinhluong> list = spDLL.GetAlltinhluong();
            string           ma;

            Console.Write("Nhap ma bang luong can sua:");
            ma = Console.ReadLine();
            int i = 0;

            for (i = 0; i < list.Count; ++i)
            {
                if (list[i].Matl == ma)
                {
                    break;
                }
            }

            if (i < list.Count)
            {
                tinhluong sp = new tinhluong(list[i]);

                //Console.Write("nhap so ngay lam viec : ");
                //float lv =float.Parse( Console.ReadLine());
                //if (lv >=0) sp.Songaylv = lv;
                Console.Write("Nhap thuong:");
                double nt = double.Parse(Console.ReadLine());
                if (nt >= 0)
                {
                    sp.Thuong = nt;
                }
                Console.Write("Nhap luong co ban:");
                double cb = double.Parse(Console.ReadLine());
                if (cb >= 0)
                {
                    sp.Luongcoban = cb;
                }



                spDLL.suatinhluong(sp);
            }
            else
            {
                Console.WriteLine("Khong co bang luong ");
            }
        }
예제 #7
0
        public void Hientimkiem(tinhluong tl)
        {
            int i;
            List <tinhluong> list = lhtl.GetAlltinhluong();

            Console.WriteLine("matinhluong" + "\t" + "songaylamviec" + "\t" + "thuong" + "\t" + "luongcoban" + "\t" + "thanhtien");
            for (i = 0; i < list.Count; ++i)
            {
                if (list[i].Matl == tl.Matl)
                {
                    Console.WriteLine(tl.Matl + "\t" + tl.Songaylv + "\t\t" + tl.Thuong + "\t\t" + tl.Luongcoban + "\t\t" + tl.Thanhtien);
                }

                else
                {
                    throw new Exception("Khong ton tai hs nay");
                }
            }
        }
예제 #8
0
        public void suatinhluong(tinhluong tl)
        {
            int i;
            List <tinhluong> list = lhtl.GetAlltinhluong();

            for (i = 0; i < list.Count; ++i)
            {
                if (list[i].Matl == tl.Matl)
                {
                    break;
                }
            }
            if (i < list.Count)
            {
                list.RemoveAt(i);
                list.Add(tl);
                lhtl.update(list);
            }
            else
            {
                throw new Exception("Khong ton tai hs nay");
            }
        }
예제 #9
0
        public void xoatinhluong(tinhluong xtl)//Những cái nài ra  rồi
        //nhân viên,giá bán,hh,ncc
        {
            int i;
            List <tinhluong> list = lhtl.GetAlltinhluong();

            for (i = 0; i < list.Count; ++i)
            {
                if (list[i].Matl == xtl.Matl)
                {
                    break;
                }
            }
            if (i < list.Count)
            {
                list.RemoveAt(i);
                lhtl.update(list);
            }
            else
            {
                throw new Exception("Khong ton tai ma nay");
            }
        }
예제 #10
0
        public void Hientimkiem()
        {
            Console.Clear();
            Console.WriteLine("HIEN THONG TIN TIM KIEM");
            List <tinhluong> list = spDLL.GetAlltinhluong();
            string           ma;

            Console.Write("Nhap ma hoa don ban can hien thi:");
            ma = Console.ReadLine();
            int i;

            for (i = 0; i < list.Count; ++i)
            {
                if (list[i].Matl == ma)
                {
                    break;
                }
            }
            if (i < list.Count)
            {
                tinhluong b = new tinhluong(list[i]);
                spDLL.Hientimkiem(b);
            }
        }