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 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();
            }
        }
 private bool FilterVlu_KhoaChilds(Vlu_Khoa entity)
 {
     return (entity.ParentID == this.KhoaID);
 }
 private bool FilterVlu_Khoa(Vlu_Khoa entity)
 {
     return (entity.KhoaID == this.KhoaID);
 }
 private void AttachVlu_KhoaChilds(Vlu_Khoa entity)
 {
     entity.Vlu_KhoaParent = this;
 }
 private void DetachVlu_KhoaChilds(Vlu_Khoa entity)
 {
     entity.Vlu_KhoaParent = null;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Vlu_Khoa EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVlu_Khoa(Vlu_Khoa vlu_Khoa)
 {
     base.AddObject("Vlu_Khoa", vlu_Khoa);
 }
 /// <summary>
 /// Create a new Vlu_Khoa object.
 /// </summary>
 /// <param name="khoaID">Initial value of the KhoaID property.</param>
 /// <param name="maKhoa">Initial value of the MaKhoa property.</param>
 /// <param name="tenKhoa">Initial value of the TenKhoa property.</param>
 /// <param name="loai">Initial value of the Loai property.</param>
 /// <param name="sapXep">Initial value of the SapXep 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_Khoa CreateVlu_Khoa(global::System.Int32 khoaID, global::System.String maKhoa, global::System.String tenKhoa, global::System.Int32 loai, global::System.Int32 sapXep, global::System.DateTime ngayTao, global::System.String nguoiTao)
 {
     Vlu_Khoa vlu_Khoa = new Vlu_Khoa();
     vlu_Khoa.KhoaID = khoaID;
     vlu_Khoa.MaKhoa = maKhoa;
     vlu_Khoa.TenKhoa = tenKhoa;
     vlu_Khoa.Loai = loai;
     vlu_Khoa.SapXep = sapXep;
     vlu_Khoa.NgayTao = ngayTao;
     vlu_Khoa.NguoiTao = nguoiTao;
     return vlu_Khoa;
 }
Example #10
0
 public void DeleteDepartmentAsync(Vlu_Khoa obj)
 {
     Model.Vlu_Khoas.Remove(obj);
     PerformSubmitChanged(DeleteDepartmentComplete);
 }
Example #11
0
 public void SaveDepartmentAsync(Vlu_Khoa obj)
 {
     if (obj.KhoaID == -1)
         Model.Vlu_Khoas.Add(obj);
     PerformSubmitChanged(SaveDepartmentComplete);
 }
Example #12
0
 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;
         }
     }
 }