private void button3_Click(object sender, EventArgs e)
 {
     if (dataGridView4.SelectedRows.Count > 0)
     {
         List <Info_LopHocPhan> list = new List <Info_LopHocPhan>();
         foreach (DataGridViewRow rowInfo in dataGridView4.SelectedRows)
         {
             Info_LopHocPhan lhp = new Info_LopHocPhan();
             lhp.MaLopHocPhan = rowInfo.Cells[1].Value.ToString();
             lhp.TenMonHoc    = rowInfo.Cells[0].Value.ToString();
             list.Add(lhp);
         }
         foreach (Info_LopHocPhan lhpInfo in list)
         {
             for (int i = 0; i < realTimeNotify.LopHocPhanFilter.Count; i++)
             {
                 if (lhpInfo.Equals(realTimeNotify.LopHocPhanFilter[i]))
                 {
                     realTimeNotify.LopHocPhanFilter.RemoveAt(i);
                     break;
                 }
             }
         }
         button4_Click(button4, new EventArgs());
     }
 }
Ejemplo n.º 2
0
 public bool Equals(Info_LopHocPhan lopHocPhan)
 {
     if (lopHocPhan.MaLopHocPhan != this.MaLopHocPhan ||
         lopHocPhan.TenMonHoc != this.TenMonHoc
         )
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
                public static List <Info_LopHocPhan> ListLopHocPhan(string title)
                {
                    string separator = " , ";

                    List <Info_LopHocPhan> list = null;

                    try
                    {
                        list = new List <Info_LopHocPhan>();

                        title = title.Remove(0, title.IndexOf(" thông báo đến lớp: ") + " thông báo đến lớp: ".Length);
                        var sArray = title.Split(separator);

                        for (int i = 0; i < sArray.Length; i++)
                        {
                            if (sArray[i].Contains(".Nh"))
                            {
                                sArray[i] = sArray[i].Replace(".Nh", ".");
                            }

                            string beginStr   = " [";
                            string endStr     = "]";
                            int    beginIndex = sArray[i].IndexOf(beginStr);
                            int    endIndex   = sArray[i].IndexOf(endStr);

                            Info_LopHocPhan lhp = new Info_LopHocPhan();
                            lhp.TenMonHoc    = sArray[i].Substring(0, beginIndex);
                            lhp.MaLopHocPhan = sArray[i].Substring(
                                beginIndex + beginStr.Length,
                                endIndex - beginIndex - beginStr.Length
                                );
                            list.Add(lhp);
                        }
                    }
                    catch
                    {
                        list = null;
                    }

                    return(list);
                }