private void ListViewCTreatStatus_OnLoaded(object sender, RoutedEventArgs e)
 {
     //throw new NotImplementedException();
     try
     {
         using (var treatStatusDao = new TreatStatusDao())
         {
             Datalist.Clear();
             var condition = new Dictionary <string, object>();
             var list      = treatStatusDao.SelectTreatStatus(condition);
             foreach (var type in list)
             {
                 var treatStatusData = new TreatStatusData
                 {
                     Id          = type.Id,
                     Activated   = type.Activated,
                     Name        = type.Name,
                     Description = type.Description
                 };
                 Datalist.Add(treatStatusData);
             }
         }
         if (Datalist.Count != 0)
         {
             ListViewTreatType.SelectedIndex = 0;
         }
     }
     catch (Exception ex)
     {
         MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:ListViewCInfectType_OnLoaded exception messsage: " + ex.Message);
     }
 }
        //private void AddButton_OnClick(object sender, RoutedEventArgs e)
        //{
        //    //throw new NotImplementedException();
        //    try
        //    {
        //        if (this.NameTextBox.Text.Equals("") || !CheckNameIsExist(this.NameTextBox.Text))
        //        {
        //            var a = new RemindMessageBox1();
        //            a.remindText.Text = (string)FindResource("Message1001"); ;
        //            a.ShowDialog();
        //            return;
        //        }
        //        using (var treatStatusDao = new TreatStatusDao())
        //        {
        //            var treatStatus = new TreatStatus();
        //            treatStatus.Name = this.NameTextBox.Text;
        //            treatStatus.Activated = (bool) this.CheckBox1.IsChecked;
        //            treatStatus.Description = this.DescriptionTextBox.Text;
        //            int lastInsertId = -1;
        //            treatStatusDao.InsertTreatStatus(treatStatus, ref lastInsertId);
        //            //UI
        //            var treatStatusData = new TreatStatusData();
        //            treatStatusData.Id = treatStatus.Id;
        //            treatStatusData.Name = treatStatus.Name;
        //            treatStatusData.Activated = treatStatus.Activated;
        //            treatStatusData.Description = treatStatus.Description;
        //            Datalist.Add(treatStatusData);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message);
        //    }
        //}

        //private void UpdateButton_OnClick(object sender, RoutedEventArgs e)
        //{
        //    if (ListViewTreatType.SelectedIndex == -1) return;

        //    if (this.NameTextBox.Text.Equals(""))
        //    {
        //        var a = new RemindMessageBox1();
        //        a.remindText.Text = (string)FindResource("Message1001"); ;
        //        a.ShowDialog();
        //        return;
        //    }
        //    //throw new NotImplementedException();
        //    using (var treatStatusDao = new TreatStatusDao())
        //    {
        //        var condition = new Dictionary<string, object>();
        //        condition["ID"] = Datalist[ListViewTreatType.SelectedIndex].Id;

        //        var fileds = new Dictionary<string, object>();
        //        fileds["NAME"] = NameTextBox.Text;
        //        fileds["DESCRIPTION"] = DescriptionTextBox.Text;
        //        treatStatusDao.UpdateTreatStatus(fileds, condition);
        //        RefreshData();
        //    }
        //}

        private void RefreshData()
        {
            try
            {
                using (var treatStatusDao = new TreatStatusDao())
                {
                    Datalist.Clear();

                    var condition = new Dictionary <string, object>();
                    var list      = treatStatusDao.SelectTreatStatus(condition);
                    foreach (var pa in list)
                    {
                        var treatStatusData = new TreatStatusData();
                        treatStatusData.Id          = pa.Id;
                        treatStatusData.Name        = pa.Name;
                        treatStatusData.Activated   = pa.Activated;
                        treatStatusData.Description = pa.Description;
                        Datalist.Add(treatStatusData);
                    }
                }
            }
            catch (Exception ex)
            {
                MainWindow.Log.WriteInfoConsole("In CInfectType.xaml.cs:AddButton_OnClick exception messsage: " + ex.Message);
            }
        }