private void repositoryItemButton_them_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { PhieuThu_KhoanKhacDTO _new = new PhieuThu_KhoanKhacDTO(); _new.stt = this.lstKhoanKhac.Count + 1; this.lstKhoanKhac.Add(_new); gridControlKhoanKhac.DataSource = null; gridControlKhoanKhac.DataSource = this.lstKhoanKhac; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void LoadKhoanKhacMacDinh() { try { this.lstKhoanKhac = new List <PhieuThu_KhoanKhacDTO>(); PhieuThu_KhoanKhacDTO _new = new PhieuThu_KhoanKhacDTO(); _new.stt = 1; this.lstKhoanKhac.Add(_new); gridControlKhoanKhac.DataSource = this.lstKhoanKhac; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void repositoryItemButton_Xoa_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { if (gridViewKhoanKhac.RowCount > 1) { var rowHandle = gridViewKhoanKhac.FocusedRowHandle; int _stt = O2S_Common.TypeConvert.Parse.ToInt32(gridViewKhoanKhac.GetRowCellValue(rowHandle, "stt").ToString()); PhieuThu_KhoanKhacDTO _delete = this.lstKhoanKhac.Where(o => o.stt == _stt).FirstOrDefault(); this.lstKhoanKhac.Remove(_delete); gridControlKhoanKhac.DataSource = null; gridControlKhoanKhac.DataSource = this.lstKhoanKhac; } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }