private void PopulatePosition() { using (var position = new PositionCore()) { var source = position.Get <IPositionModel>(); positionName.DisplayMember = "PositionName"; positionName.ValueMember = "Id"; if (source != null) { positionName.DataSource = source.OrderBy(a => a.PositionName).ToList(); } } }
private void PopulateInterfaceFromModel(int id) { using (var facade = new PositionCore()) { var positionModel = facade.Get <IPositionModel>(WhereTerm.DefaultParam(id, "ID")).FirstOrDefault(); if (positionModel == null || !facade.IsSuccess) { MsgHelpers.ShowError(this, string.IsNullOrEmpty(facade.Message) ? "Employee Position not found" : facade.Message); return; } createdBy.Text = positionModel.CreatedBy; createdDate.Value = positionModel.CreatedDate; recordId.Text = positionModel.Id.ToString(); positionName.Text = positionModel.PositionName; createdBy.Text = positionModel.CreatedBy; createdDate.Value = positionModel.CreatedDate; modifiedBy.Text = positionModel.ModifiedBy; modifiedDate.Value = positionModel.ModifiedDate.HasValue ? positionModel.ModifiedDate.Value : DateTime.Now; } }