public string GetEmployeeInitials(string employeeCode) { Error = ""; string initials = ""; try { using (var context = new NewSalesAward.Models.FxPLMEntities()) { var query = (from u in context.Users where u.UserCode == employeeCode select u); foreach (var item in query) { initials = item.Initials; } } } catch (Exception ex) { Error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message; } return(initials); }
public void GetEmployees() { Error = ""; try { SignOffEmployeesList = new List <QtSignOffEmployees>(); QtSignOffEmployees dataModel; using (var context = new NewSalesAward.Models.FxPLMEntities()) { var query = (from u in context.Users orderby u.UserName select u); foreach (var item in query) { dataModel = new QtSignOffEmployees(); dataModel.Initials = item.Initials; dataModel.EmployeeCode = item.UserCode; dataModel.EmployeeName = item.UserName; SignOffEmployeesList.Add(dataModel); } } } catch (Exception ex) { Error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message; } }