private void _modelTrain_GetListDepartmentComplete(object sender, EntityResultsArgs <Vlu_Khoa> e) { try { if (e.HasError) { MessageCustomize.Show(e.Error.Message); ErrorProcess(); } else { List <Vlu_Khoa> lst = e.Results.Where(c => c.ParentID == null).ToList(); Vlu_Khoa obj = new Vlu_Khoa(); obj.KhoaID = -1; obj.MaKhoa = "< Nhóm chính >"; obj.TenKhoa = "< Nhóm chính >"; lst.Insert(0, obj); ListData = lst; LoadInitComplete(); } } catch (Exception ex) { MessageCustomize.Show(ex.Message); ErrorProcess(); } }
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); }
public void SaveDepartmentAsync(Vlu_Khoa obj) { if (obj.KhoaID == -1) { Model.Vlu_Khoas.Add(obj); } PerformSubmitChanged(SaveDepartmentComplete); }
public override void Cleanup() { if (_modelTrain != null) { _modelTrain.GetListDepartmentComplete -= new EventHandler <EntityResultsArgs <Vlu_Khoa> >(_modelTrain_GetListDepartmentComplete); _modelTrain = null; } _listData = null; _selectedItem = null; if (DialogSended != null) { DialogSended = null; } base.Cleanup(); }
public override void Cleanup() { if (_modelTrain != null) { _modelTrain.GetListAuthenticationFormComplete -= new EventHandler <ComplexResultsArgs <Authentication> >(_model_GetListAuthenticationFormComplete); _modelTrain.GetListDepartmentComplete -= new EventHandler <EntityResultsArgs <Vlu_Khoa> >(_modelTrain_GetListDepartmentComplete); _modelTrain.DeleteDepartmentComplete -= new EventHandler <SubmitOperationEventArgs>(_modelTrain_DeleteDepartmentComplete); _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); } }
public void GetDepartmentAsync(int id, int handlerType) { if (id == -1) { Vlu_Khoa obj = new Vlu_Khoa(); obj.KhoaID = id; obj.MaKhoa = string.Empty; obj.TenKhoa = string.Empty; obj.Loai = 0; obj.SapXep = 0; obj.NgayTao = DateTime.Now; obj.NguoiTao = SystemConfig.UserName; List <Vlu_Khoa> lst = new List <Vlu_Khoa>(); lst.Add(obj); switch (handlerType) { case 0: GetDepartmentComplete(this, new EntityResultsArgs <Vlu_Khoa>(lst.ToArray())); break; case 1: GetDepartmentParentComplete(this, new EntityResultsArgs <Vlu_Khoa>(lst.ToArray())); break; } } else { var query = from c in Model.GetVlu_KhoaQuery() where c.KhoaID == id select c; switch (handlerType) { case 0: PerformQuery(query, GetDepartmentComplete, false); break; case 1: PerformQuery(query, GetDepartmentParentComplete, 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); } }
public void DeleteDepartmentAsync(Vlu_Khoa obj) { Model.Vlu_Khoas.Remove(obj); PerformSubmitChanged(DeleteDepartmentComplete); }