示例#1
0
        private void _modelTrain_GetListClassComplete(object sender, EntityResultsArgs <Vlu_LopHoc> e)
        {
            try
            {
                if (e.HasError)
                {
                    MessageCustomize.Show(e.Error.Message);
                    ErrorProcess();
                }
                else
                {
                    List <Vlu_LopHoc> lst = e.Results.Where(c => c.ParentID == null).ToList();
                    Vlu_LopHoc        obj = new Vlu_LopHoc();
                    obj.KhoaID = -1;
                    obj.MaLop  = "< Nhóm chính >";
                    obj.TenLop = "< Nhóm chính >";

                    lst.Insert(0, obj);
                    ListData = lst;
                    LoadInitComplete();
                }
            }
            catch (Exception ex)
            {
                MessageCustomize.Show(ex.Message);
                ErrorProcess();
            }
        }
示例#2
0
 public void ImportClassAsync(List <Vlu_LopHoc> lstData, List <CustomizeClass> lstImport)
 {
     foreach (var item in lstImport)
     {
         Vlu_LopHoc obj = lstData.FirstOrDefault(c => c.MaLop == item.MaLop);
         if (obj == null)
         {
             obj          = new Vlu_LopHoc();
             obj.LopID    = -1;
             obj.NgayTao  = DateTime.Now;
             obj.NguoiTao = SystemConfig.UserName;
         }
         else
         {
             obj.NgayCapNhat  = DateTime.Now;
             obj.NguoiCapNhat = SystemConfig.UserName;
         }
         obj.MaLop    = item.MaLop;
         obj.TenLop   = item.TenLop;
         obj.ParentID = item.ParentID;
         obj.KhoaID   = item.KhoaID;
         if (obj.LopID == -1)
         {
             Model.Vlu_LopHocs.Add(obj);
         }
     }
     PerformSubmitChanged(ImportClassComplete);
 }
示例#3
0
        public int ImportListTraining(List <ImportTraining> listImport)
        {
            //Check timeout import
            int result = 0;

            foreach (var item in listImport)
            {
                Vlu_MonHoc objMH   = ObjectContext.Vlu_MonHoc.FirstOrDefault(c => c.MonHocID == item.MonHocID);
                Vlu_Khoa   objKhoa = ObjectContext.Vlu_Khoa.FirstOrDefault(c => c.KhoaID == item.KhoaID);
                Vlu_LopHoc objLop  = ObjectContext.Vlu_LopHoc.FirstOrDefault(c => c.LopID == item.LopID);
                if (objMH != null && objKhoa != null && objLop != null)
                {
                    Vlu_ChuongTrinhDT obj = new Vlu_ChuongTrinhDT();
                    obj.ID           = -1;
                    obj.Vlu_MonHoc   = objMH;
                    obj.Vlu_Khoa     = objKhoa;
                    obj.Vlu_LopHoc   = objLop;
                    obj.NamHoc       = item.NamHoc;
                    obj.HocKy        = item.HocKy;
                    obj.NgayTao      = DateTime.Now;
                    obj.NguoiTao     = ServiceContext.User.Identity.Name;
                    obj.NgayCapNhat  = DateTime.Now;
                    obj.NguoiCapNhat = ServiceContext.User.Identity.Name;
                    result++;
                    ObjectContext.AddToVlu_ChuongTrinhDT(obj);
                }
            }
            if (result > 0)
            {
                ObjectContext.SaveChanges();
            }
            return(result);
        }
示例#4
0
 public void SaveClassAsync(Vlu_LopHoc obj)
 {
     if (obj.LopID == -1)
     {
         Model.Vlu_LopHocs.Add(obj);
     }
     PerformSubmitChanged(SaveClassComplete);
 }
示例#5
0
 public override void Cleanup()
 {
     if (_modelTrain != null)
     {
         _modelTrain.GetListClassComplete -= new EventHandler <EntityResultsArgs <Vlu_LopHoc> >(_modelTrain_GetListClassComplete);
         _modelTrain = null;
     }
     _listData     = null;
     _selectedItem = null;
     if (DialogSended != null)
     {
         DialogSended = null;
     }
     base.Cleanup();
 }
示例#6
0
 public override void Cleanup()
 {
     if (_modelTrain != null)
     {
         _modelTrain.GetListAuthenticationFormComplete -= new EventHandler <ComplexResultsArgs <Authentication> >(_model_GetListAuthenticationFormComplete);
         _modelTrain.GetListClassComplete -= new EventHandler <EntityResultsArgs <Vlu_LopHoc> >(_modelTrain_GetListClassComplete);
         _modelTrain.DeleteClassComplete  -= new EventHandler <SubmitOperationEventArgs>(_modelTrain_DeleteClassComplete);
         _modelTrain = null;
     }
     _listData     = null;
     _selectedItem = null;
     if (DialogSended != null)
     {
         DialogSended = null;
     }
     base.Cleanup();
 }
 private bool CheckInputData(CustomizeClass obj)
 {
     try
     {
         if (obj.MaLop.Trim() == string.Empty)
         {
             return(false);
         }
         if (obj.TenLop.Trim() == string.Empty)
         {
             return(false);
         }
         if (obj.MaKhoa.Trim() == string.Empty)
         {
             return(false);
         }
         Vlu_Khoa objKhoa = _listType.FirstOrDefault(c => c.MaKhoa == obj.MaKhoa);
         if (objKhoa != null)
         {
             obj.KhoaID  = objKhoa.KhoaID;
             obj.TenKhoa = objKhoa.TenKhoa;
         }
         if (obj.ParentKey.Trim() != string.Empty)
         {
             Vlu_LopHoc objLop = _listLopHoc.FirstOrDefault(c => c.MaLop == obj.ParentKey);
             if (objLop != null)
             {
                 obj.ParentID   = objLop.LopID;
                 obj.ParentName = objLop.TenLop;
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#8
0
        public void GetClassAsync(int id, int handlerType)
        {
            if (id == -1)
            {
                Vlu_LopHoc obj = new Vlu_LopHoc();
                obj.LopID    = id;
                obj.MaLop    = string.Empty;
                obj.TenLop   = string.Empty;
                obj.NgayTao  = DateTime.Now;
                obj.NguoiTao = SystemConfig.UserName;
                List <Vlu_LopHoc> lst = new List <Vlu_LopHoc>();
                lst.Add(obj);
                switch (handlerType)
                {
                case 0: GetClassComplete(this, new EntityResultsArgs <Vlu_LopHoc>(lst.ToArray()));
                    break;

                case 1: GetClassParentComplete(this, new EntityResultsArgs <Vlu_LopHoc>(lst.ToArray()));
                    break;
                }
            }
            else
            {
                var query = from c in Model.GetVlu_LopHocQuery()
                            where c.LopID == id
                            select c;
                switch (handlerType)
                {
                case 0: PerformQuery(query, GetClassComplete, false);
                    break;

                case 1: PerformQuery(query, GetClassParentComplete, false);
                    break;
                }
            }
        }
        private bool CheckInputData(ImportTraining obj)
        {
            try
            {
                if (obj.MaMonHoc.Trim() == string.Empty)
                {
                    return(false);
                }
                if (obj.MaLop.Trim() == string.Empty)
                {
                    return(false);
                }
                if (obj.MaKhoa.Trim() == string.Empty)
                {
                    return(false);
                }
                if (obj.TenNamHoc.Trim() == string.Empty)
                {
                    return(false);
                }
                if (obj.TenHocKy.Trim() == string.Empty)
                {
                    return(false);
                }
                try
                {
                    obj.NamHoc = Convert.ToInt32(obj.TenNamHoc);
                    obj.HocKy  = Convert.ToInt32(obj.TenHocKy);
                }
                catch
                {
                    return(false);
                }

                Vlu_Khoa objKhoa = _listKhoa.FirstOrDefault(c => c.MaKhoa == obj.MaKhoa);
                if (objKhoa != null)
                {
                    obj.KhoaID  = objKhoa.KhoaID;
                    obj.TenKhoa = objKhoa.TenKhoa;
                }
                else
                {
                    return(false);
                }

                Vlu_LopHoc objLop = _listLop.FirstOrDefault(c => c.MaLop == obj.MaLop);
                if (objLop != null)
                {
                    obj.LopID  = objLop.LopID;
                    obj.TenLop = objLop.TenLop;
                }
                else
                {
                    return(false);
                }

                Vlu_MonHoc objMonHoc = _listMonHoc.FirstOrDefault(c => c.MaMonHoc == obj.MaMonHoc);
                if (objMonHoc != null)
                {
                    obj.MonHocID  = objMonHoc.MonHocID;
                    obj.TenMonHoc = objMonHoc.TenMonHoc;
                    obj.ThuocNhom = objMonHoc.ThuocNhom;
                }
                else
                {
                    return(false);
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#10
0
 public void DeleteClassAsync(Vlu_LopHoc obj)
 {
     Model.Vlu_LopHocs.Remove(obj);
     PerformSubmitChanged(DeleteClassComplete);
 }