Esempio n. 1
0
        public void SetCbbSearch()
        {
            GV s = new GV();

            foreach (var property in s.GetType().GetProperties())
            {
                cbb_search_type.Items.Add(property.Name);
            }
            cbb_Sort.Text = "Chọn kiểu tìm kiếm ";
        }
Esempio n. 2
0
        public void SetCbbSort()
        {
            GV s = new GV();

            foreach (var property in s.GetType().GetProperties())
            {
                cbb_Sort.Items.Add(property.Name);
            }
            cbb_Sort.Text = "Chọn kiểu sắp xếp";
        }
Esempio n. 3
0
 public static bool Compare_NgaySinh(GV o1, GV o2)
 {
     if (String.Compare(o1.NgaySinh.ToString(), o2.NgaySinh.ToString()) <= 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 4
0
 public static bool Compare_SDT(GV o1, GV o2)
 {
     if (String.Compare(o1.SDT, o2.SDT) <= 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 5
0
 public static bool Compare_MaCoSo(GV o1, GV o2)
 {
     if (String.Compare(o1.MaCoSo, o2.MaCoSo) <= 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 6
0
 public static bool Compare_TenGV(GV o1, GV o2)
 {
     if (String.Compare(o1.getName(), o2.getName()) < 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 7
0
 public static bool Compare_MaGV(GV o1, GV o2)
 {
     if (o1.MaGV <= o2.MaGV)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private GV set1GV(DataRow dr)
        {
            GV g = new GV();

            g.MaGV     = Convert.ToInt32(dr["MaGV"].ToString());
            g.TenGV    = dr["TenGV"].ToString();
            g.SDT      = dr["SDT"].ToString();
            g.NgaySinh = Convert.ToDateTime(dr["NgaySinh"].ToString());
            g.MaCoSo   = dr["MaCoSo"].ToString();
            return(g);
        }
        public GV setGV()
        {
            GV s = new GV();

            s.MaGV     = Convert.ToInt32(txt_magv.Text);
            s.TenGV    = txt_tengv.Text;
            s.SDT      = txt_SDT.Text;
            s.NgaySinh = dtp_ngaysinh.Value;
            s.MaCoSo   = ((CBB_Item)cbbCoSo.SelectedItem).Value;
            return(s);
        }
        public void updateGV(GV g)
        {
            List <GV> ListGV = setAllGV();
            int       index  = IndexOfGV(g.MaGV);
            GV        gv1    = ListGV[index];

            gv1.MaGV     = g.MaGV;
            gv1.TenGV    = g.TenGV;
            gv1.SDT      = g.SDT;
            gv1.NgaySinh = g.NgaySinh;
            gv1.MaCoSo   = g.MaCoSo;
            syncData(ListGV);
        }
        private void getInforEdit(int MaGV, string MaCoSo)
        {
            GV s = CSDL_OOP.Instance.get1GV(MaGV);

            txt_magv.Enabled   = false;
            txt_magv.Text      = s.MaGV.ToString();
            txt_tengv.Text     = s.TenGV;
            txt_SDT.Text       = s.SDT;
            dtp_ngaysinh.Value = Convert.ToDateTime(s.NgaySinh);
            int indexClass = CSDL_OOP.Instance.IndexOfCoSo(MaCoSo);

            cbbCoSo.SelectedIndex = indexClass + 1;
        }
        public bool addGV(GV s)
        {
            List <GV> ListGV = setAllGV();
            List <GV> l      = getGVbyMaCoSo(s.MaCoSo);
            int       SLGV   = Get1CoSo(s.MaCoSo).SLGV;

            if (!isExist(s.MaGV) && (l.Count < SLGV))
            {
                ListGV.Add(s);
                syncData(ListGV);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public List <GV> sortGV(string type, string MaCoSo)
        {
            List <GV> l = new List <GV>();

            if ("MaGV" == type)
            {
                cmp = GV.Compare_MaGV;
            }
            if ("MaCoSo" == type)
            {
                cmp = GV.Compare_MaCoSo;
            }
            if ("TenGV" == type)
            {
                cmp = GV.Compare_TenGV;
            }
            if ("SDT" == type)
            {
                cmp = GV.Compare_SDT;
            }
            if ("NgaySinh" == type)
            {
                cmp = GV.Compare_NgaySinh;
            }
            foreach (GV i in getGVbyMaCoSo(MaCoSo))
            {
                l.Add(i);
            }
            for (int i = 0; i < l.Count; i++)
            {
                for (int j = i + 1; j < l.Count; j++)
                {
                    if (cmp(l[j], l[i]))
                    {
                        GV temp = new GV();
                        temp = l[i];
                        l[i] = l[j];
                        l[j] = temp;
                    }
                }
            }
            return(l);
        }