private void btnUpdate_Click(object sender, RoutedEventArgs e) { try { var process = new DanhMucProcess(); if (treViewUpdate) { if (obj.ID > 0) { obj.MA_DMUC_LOAI = txtMa.Text; obj.TEN_DMUC_LOAI = txtTen.Text; obj.NGUON_TAO_DL = lstSourceNguon.ElementAt(cmbNguon.SelectedIndex).KeywordStrings.First(); process.SuaDungChungLoai(obj); treViewUpdate = false; } } else { obj = new DM_DMUC_LOAI(); obj.MA_DMUC_LOAI = txtMa.Text; obj.TEN_DMUC_LOAI = txtTen.Text; obj.NGUON_TAO_DL = lstSourceNguon.ElementAt(cmbNguon.SelectedIndex).KeywordStrings.First(); process.ThemDungChungLoai(obj); } } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } }
private void tvwTree_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { var process = new DanhMucProcess(); DM_DMUC_LOAI loai = new DM_DMUC_LOAI(); loai.MA_DMUC_LOAI = ((RadTreeViewItem)tvwTree.SelectedItem).Tag.ToString(); obj = process.layDungChungLoai(loai); txtMa.Text = obj.MA_DMUC_LOAI; txtTen.Text = obj.TEN_DMUC_LOAI; setMaNguonDL(obj.NGUON_TAO_DL); treViewUpdate = true; txtMa.Focus(); } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } }