private void LoadDGV() { try { _durationService = new DurationService(); List <Duration> durations = _durationService.GetAll(); SortableBindingList <Duration> sbl = new SortableBindingList <Duration>(durations); bs = new BindingSource(); bs.DataSource = sbl; adgv.DataSource = bs; adgv.Columns["Id"].Visible = false; adgv.Columns["StatusId"].Visible = false; adgv.Columns["CreateDate"].Visible = false; adgv.Columns["LastUpdateBy"].Visible = false; adgv.Columns["LastUpdateDate"].Visible = false; adgv.Columns["Length"].HeaderText = ADGVText.Duration; adgv.Columns["Length"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } catch (Exception ex) { throw; } finally { _durationService = null; } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (duration != null) { _durationService = new DurationService(); int result = _durationService.DeleteDuration(duration.Id); if (result == CRUDStatusCode.SUCCESS) { LoadDGV(); Utilities.ShowMessage(CommonMessage.DELETE_SUCESSFULLY); Logging.LogBusiness(string.Format("{0} {1} {2}", Common.Session.GetUserName(), Common.Constants.LogAction.Delete, "thời lượng " + duration.Length), Common.Constants.BusinessLogType.Delete); } } } catch (Exception ex) { throw; } finally { _durationService = null; } }
public async Task <ActionResult <TimelineResponse> > GetDuration(DsRequest request) { Stopwatch sw = new Stopwatch(); sw.Start(); var response = await DurationService.GetDuration(context, request); sw.Stop(); logger.LogInformation($"Get Timeline in {sw.ElapsedMilliseconds} ms"); return(response); }
private void btnSave_Click(object sender, EventArgs e) { int result = CRUDStatusCode.ERROR; try { _durationService = new DurationService(); if (model == null) { //Add model = new Duration() { Length = int.Parse(txtLength.Text) }; result = _durationService.AddDuration(model); if (result == CRUDStatusCode.SUCCESS) { Utilities.ShowMessage(CommonMessage.ADD_SUCESSFULLY); Logging.LogBusiness(string.Format("{0} {1} {2}", Common.Session.GetUserName(), Common.Constants.LogAction.Create, "thời lượng " + model.Length), Common.Constants.BusinessLogType.Create); } } else { //Edit model.Length = int.Parse(txtLength.Text); result = _durationService.EditDuration(model); if (result == CRUDStatusCode.SUCCESS) { Utilities.ShowMessage(CommonMessage.EDIT_SUCESSFULLY); Logging.LogBusiness(string.Format("{0} {1} {2}", Common.Session.GetUserName(), Common.Constants.LogAction.Update, "hợp đồng mã " + model.Length), Common.Constants.BusinessLogType.Update); } } } catch (Exception ex) { throw; } finally { _durationService = null; } }
public void LoadDurationComboBox() { try { _durationService = new DurationService(); Utilities.LoadComboBoxOptions(cboDuration, _durationService.Getoptions()); } catch (Exception) { throw; } finally { _durationService = null; } }
public void LoadCboDuration() { try { Cursor.Current = Cursors.WaitCursor; _durationService = new DurationService(); Utilities.LoadComboBoxOptions(cboDuration, _durationService.Getoptions()); } catch (Exception) { throw; } finally { CompleteLoadData = 1; _durationService = null; Cursor.Current = Cursors.Default; } }
public void LoadData() { try { if (model != null) { _durationService = new DurationService(); model = _durationService.GetById(model.Id); if (model != null) { txtLength.Text = model.Length.ToString(); } } } catch (Exception) { throw; } finally { _durationService = null; } }