/// <summary>
 /// Create a new Vlu_MonHoc object.
 /// </summary>
 /// <param name="monHocID">Initial value of the MonHocID property.</param>
 /// <param name="maMonHoc">Initial value of the MaMonHoc property.</param>
 /// <param name="tenMonHoc">Initial value of the TenMonHoc property.</param>
 /// <param name="thuocNhom">Initial value of the ThuocNhom property.</param>
 /// <param name="duyet">Initial value of the Duyet property.</param>
 /// <param name="tinhTrang">Initial value of the TinhTrang property.</param>
 /// <param name="ngayTao">Initial value of the NgayTao property.</param>
 /// <param name="nguoiTao">Initial value of the NguoiTao property.</param>
 public static Vlu_MonHoc CreateVlu_MonHoc(global::System.Int32 monHocID, global::System.String maMonHoc, global::System.String tenMonHoc, global::System.Int32 thuocNhom, global::System.Boolean duyet, global::System.Int32 tinhTrang, global::System.DateTime ngayTao, global::System.String nguoiTao)
 {
     Vlu_MonHoc vlu_MonHoc = new Vlu_MonHoc();
     vlu_MonHoc.MonHocID = monHocID;
     vlu_MonHoc.MaMonHoc = maMonHoc;
     vlu_MonHoc.TenMonHoc = tenMonHoc;
     vlu_MonHoc.ThuocNhom = thuocNhom;
     vlu_MonHoc.Duyet = duyet;
     vlu_MonHoc.TinhTrang = tinhTrang;
     vlu_MonHoc.NgayTao = ngayTao;
     vlu_MonHoc.NguoiTao = nguoiTao;
     return vlu_MonHoc;
 }
 private bool FilterVlu_MonHoc(Vlu_MonHoc entity)
 {
     return (entity.MonHocID == this.MonHocID);
 }
 public override void Cleanup()
 {
     if (_modelTrain != null)
     {
         _modelTrain.GetListSubjectComplete -= new EventHandler<EntityResultsArgs<Vlu_MonHoc>>(_modelTrain_GetListSubjectComplete);
         _modelTrain = null;
     }
     _listData = null;
     _selectedItem = null;
     if (DialogSended != null)
         DialogSended = null;
     base.Cleanup();
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Vlu_MonHoc EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVlu_MonHoc(Vlu_MonHoc vlu_MonHoc)
 {
     base.AddObject("Vlu_MonHoc", vlu_MonHoc);
 }
Beispiel #5
0
 public void SaveSubjectAsync(Vlu_MonHoc obj)
 {
     if (obj.MonHocID == -1)
         Model.Vlu_MonHocs.Add(obj);
     PerformSubmitChanged(SaveSubjectComplete);
 }
Beispiel #6
0
 public void DeleteSubjectAsync(Vlu_MonHoc obj)
 {
     Model.Vlu_MonHocs.Remove(obj);
     PerformSubmitChanged(DeleteSubjectComplete);
 }
Beispiel #7
0
 public void GetSubjectAsync(int id)
 {
     if (id == -1)
     {
         Vlu_MonHoc obj = new Vlu_MonHoc();
         obj.MonHocID = id;
         obj.MaMonHoc = string.Empty;
         obj.TenMonHoc = string.Empty;
         obj.NgayTao = DateTime.Now;
         obj.NguoiTao = SystemConfig.UserName;
         List<Vlu_MonHoc> lst = new List<Vlu_MonHoc>();
         lst.Add(obj);
         GetSubjectComplete(this, new EntityResultsArgs<Vlu_MonHoc>(lst.ToArray()));
     }
     else
     {
         var query = from c in Model.GetVlu_MonHocQuery()
                     where c.MonHocID == id
                     select c;
         PerformQuery(query, GetSubjectComplete, false);
     }
 }
 public override void Cleanup()
 {
     if (_modelTrain != null)
     {
         _modelTrain.GetListAuthenticationFormComplete -= new EventHandler<ComplexResultsArgs<Authentication>>(_model_GetListAuthenticationFormComplete);
         _modelTrain.GetListSubjectComplete -= new EventHandler<EntityResultsArgs<Vlu_MonHoc>>(_modelTrain_GetListSubjectComplete);
         _modelTrain.DeleteSubjectComplete -= new EventHandler<SubmitOperationEventArgs>(_modelTrain_DeleteSubjectComplete);
         _modelTrain = null;
     }
     _listData = null;
     _selectedItem = null;
     if (DialogSended != null)
         DialogSended = null;
     base.Cleanup();
 }
 private bool CheckInputData(Vlu_MonHoc obj)
 {
     try
     {
         if (obj.MaMonHoc.Trim() == string.Empty)
             return false;
         if (obj.TenMonHoc.Trim() == string.Empty)
             return false;
         int iCheck = Convert.ToInt32(obj.DVHT);
         iCheck = Convert.ToInt32(obj.TS);
         iCheck = Convert.ToInt32(obj.LT);
         iCheck = Convert.ToInt32(obj.BT);
         iCheck = Convert.ToInt32(obj.TH);
         iCheck = Convert.ToInt32(obj.BTL);
         iCheck = Convert.ToInt32(obj.DA);
         iCheck = Convert.ToInt32(obj.LA);
         return true;
     }
     catch
     {
         return false;
     }
 }
 public void OnGetFileClickComplete(FileInfo fileOpen)
 {
     try
     {
         Stream s = fileOpen.OpenRead();
         StreamReader reader = new StreamReader(s);
         var xml = reader.ReadToEnd();
         s.Close();
         var doc = XDocument.Parse(xml);
         List<string> listColName = doc.Descendants().Where(c => c.Name.LocalName == "Row").First().Descendants().
             Where(c => c.Name.LocalName == "Data").Select(c => c.Value).ToList();
         List<Vlu_MonHoc> lst = new List<Vlu_MonHoc>();
         if (CheckColumns(listColName))
         {
             int indexRow = 0;
             string strError = string.Empty;
             foreach (var row in doc.Descendants().Where(c => c.Name.LocalName == "Row"))
             {
                 if (indexRow > 0)
                 {
                     List<string> lstData = row.Descendants().Where(c => c.Name.LocalName == "Data").Select(c => c.Value).ToList();
                     if (lstData.Count > 0)
                     {
                         bool checkDaiCuong = true;
                         if (lstData.Count > listColName.IndexOf("DaiCuong"))
                         {
                             try
                             {
                                 int i = Convert.ToInt32(lstData[listColName.IndexOf("DaiCuong")]);
                             }
                             catch
                             {
                                 checkDaiCuong = false;
                             }
                         }
                         else
                             checkDaiCuong = false;
                         if (checkDaiCuong)
                         {
                             Vlu_MonHoc obj = new Vlu_MonHoc
                             {
                                 MaMonHoc = (lstData.Count > listColName.IndexOf("MaMH")) ? lstData[listColName.IndexOf("MaMH")].Trim() : string.Empty,
                                 TenMonHoc = (lstData.Count > listColName.IndexOf("TenMH")) ? lstData[listColName.IndexOf("TenMH")].Trim() : string.Empty,
                                 DVHT = (lstData.Count > listColName.IndexOf("DVHT")) ? lstData[listColName.IndexOf("DVHT")].Trim() : string.Empty,
                                 TS = (lstData.Count > listColName.IndexOf("TS")) ? lstData[listColName.IndexOf("TS")].Trim() : string.Empty,
                                 LT = (lstData.Count > listColName.IndexOf("LT")) ? lstData[listColName.IndexOf("LT")].Trim() : string.Empty,
                                 BT = (lstData.Count > listColName.IndexOf("BT")) ? lstData[listColName.IndexOf("BT")].Trim() : string.Empty,
                                 TH = (lstData.Count > listColName.IndexOf("TH")) ? lstData[listColName.IndexOf("TH")].Trim() : string.Empty,
                                 BTL = (lstData.Count > listColName.IndexOf("BTL")) ? lstData[listColName.IndexOf("BTL")].Trim() : string.Empty,
                                 DA = (lstData.Count > listColName.IndexOf("DA")) ? lstData[listColName.IndexOf("DA")].Trim() : string.Empty,
                                 LA = (lstData.Count > listColName.IndexOf("LA")) ? lstData[listColName.IndexOf("LA")].Trim() : string.Empty,
                                 ThuocNhom = (lstData.Count > listColName.IndexOf("DaiCuong")) ? Convert.ToInt32(lstData[listColName.IndexOf("DaiCuong")]) : 0
                             };
                             if (CheckInputData(obj))
                             {
                                 lst.Add(obj);
                             }
                             else
                                 strError += (indexRow + 1).ToString() + ", ";
                         }
                         else
                         {
                             strError += (indexRow + 1).ToString() + ", ";
                         }
                     }
                 }
                 indexRow++;
             }
             if (strError == string.Empty)
             {
                 ListData = lst;
                 TotalRecord = "Tổng: " + lst.Count.ToString();
             }
             else
                 MessageCustomize.Show("Kiểm tra dòng " + strError.Substring(0, strError.Length - 2));
         }
     }
     catch (Exception ex)
     {
         MessageCustomize.Show(ex.Message);
     }
 }
Beispiel #11
0
 public void ImportSubjectAsync(List<Vlu_MonHoc> lstData, List<Vlu_MonHoc> lstImport)
 {
     foreach (var item in lstImport)
     {
         Vlu_MonHoc obj = lstData.FirstOrDefault(c => c.MaMonHoc == item.MaMonHoc);
         if (obj == null)
         {
             obj = new Vlu_MonHoc();
             obj.MonHocID = -1;
             obj.NgayTao = DateTime.Now;
             obj.NguoiTao = SystemConfig.UserName;
             obj.TinhTrang = 0;
             obj.Duyet = true;
         }
         else
         {
             obj.NgayCapNhat = DateTime.Now;
             obj.NguoiCapNhat = SystemConfig.UserName;
         }
         obj.MaMonHoc = item.MaMonHoc;
         obj.TenMonHoc = item.TenMonHoc;
         obj.DVHT = item.DVHT;
         obj.TS = item.TS;
         obj.LT = item.LT;
         obj.BT = item.BT;
         obj.TH = item.TH;
         obj.BTL = item.BTL;
         obj.DA = item.DA;
         obj.LA = item.LA;
         obj.ThuocNhom = item.ThuocNhom;
         if (obj.MonHocID == -1)
             Model.Vlu_MonHocs.Add(obj);
     }
     PerformSubmitChanged(ImportSubjectComplete);
 }