public List <AttachFileView> CreateAttachFile(AttachFileView model) { using (var ctx = new ConXContext()) { using (var scope = new TransactionScope()) { AttachFile newModel = new Models.AttachFile() { attachDate = DateTime.Now, attachFileTypeId = model.attachFileTypeId, createUser = model.createUser, docCode = model.docCode, fileName = model.fileName, refTransactionId = model.refTransactionId, urlPath = model.urlPath }; ctx.AttachFiles.Add(newModel); ctx.SaveChanges(); var result = InquiryAttachFile(ctx, model.refTransactionId, model.docCode); scope.Complete(); return(result); } } }
public List <cust_mast> InquiryCustomerByText(CustomerAutoCompleteSearchView model) { using (var ctx = new ConXContext()) { string sql = "select top 20 * from cust_mast"; if (model.type == "name") { sql += " where cust_name like @txt_name"; sql += " order by cust_name asc"; } else { sql += " where tel like @txt_tel"; sql += " order by tel asc"; } List <cust_mast> customer = ctx.Database.SqlQuery <cust_mast>(sql, new SqlParameter("@txt_name", "%" + model.txt + "%"), new SqlParameter("@txt_tel", "%" + model.txt + "%") ).ToList(); return(customer); } }
public RawMatitemView searchRawScan(RawMatScanSerchView model) { using (var ctx = new ConXContext()) { String[] strlist = model.qr.Split('|'); string vdoc_no = strlist[0]; string vprod_code = strlist[1]; string sqlp = "select prod_tname from product where prod_code = :p_prod_code"; string vprod_name = ctx.Database.SqlQuery <string>(sqlp, new OracleParameter("p_prod_code", vprod_code)) .FirstOrDefault(); if (vprod_name == null) { throw new Exception("ข้อมูลไม่ถูกต้อง"); } RawMatitemView view = new ModelViews.RawMatitemView() { process_tag_no = model.process_tag_no, doc_no = vdoc_no, prod_code = vprod_code, prod_name = vprod_name }; return(view); } }
public long Create(cust_mast customer) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { cust_mast newCust = new cust_mast() { cust_name = customer.cust_name, //surname = customer.surname, address1 = customer.address1, //address2 = customer.address2, subDistrict = customer.subDistrict, district = customer.district, province = customer.province, zipCode = customer.zipCode, status = "A", fax = customer.fax, tel = customer.tel, sex = customer.sex, line = customer.line, }; ctx.CustMasts.Add(newCust); ctx.SaveChanges(); scope.Complete(); return(newCust.customerId); } } }
public bool Kill(string tokenId) { //_unitOfWork.TokenRepository.Delete(x => x.AuthToken == tokenId); //_unitOfWork.Save(); //var isNotDeleted = _unitOfWork.TokenRepository.GetMany(x => x.AuthToken == tokenId).Any(); //if (isNotDeleted) { return false; } using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { var tokenRemove = ctx.Tokens.Where(x => x.AuthToken == tokenId).SingleOrDefault(); if (tokenRemove != null) { ctx.Tokens.Remove(tokenRemove); ctx.SaveChanges(); scope.Complete(); } var isNotDeleted = ctx.Tokens.Where(x => x.AuthToken == tokenId).Any(); if (isNotDeleted) { return(false); } } } return(true); }
public Token GenerateToken(String userId) { string token = Guid.NewGuid().ToString(); DateTime issuedOn = DateTime.Now; DateTime expiredOn = DateTime.Now.AddMinutes(Convert.ToDouble(ConfigurationManager.AppSettings["AuthTokenExpiry"])); var tokendomain = new Token { UserId = userId, UserName = "", AuthToken = token, IssuedOn = issuedOn, ExpiredOn = expiredOn }; using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { ctx.Tokens.Add(tokendomain); ctx.SaveChanges(); scope.Complete(); } } return(tokendomain); }
public string ValidateToken(string tokenId) { using (var ctx = new ConXContext()) { //using (TransactionScope scope = new TransactionScope()) //{ Token token = ctx.Tokens.Where(x => x.AuthToken == tokenId).SingleOrDefault(); if (token != null) //pass { if (token.ExpiredOn > DateTime.Now) { double timeDiff = (DateTime.Now - token.ExpiredOn).TotalMinutes; if (timeDiff < 10) { token.ExpiredOn = token.ExpiredOn.AddMinutes(10); ctx.SaveChanges(); } return("success"); } else { return("expired"); } } else //not found token { return("notFound"); } } }
public Token CheckToken(string tokenId) { using (var ctx = new ConXContext()) { Token ckToken = new Token(); try { ckToken = ctx.Tokens.Where(t => t.AuthToken == tokenId).SingleOrDefault(); if (ckToken != null) { if (ckToken.ExpiredOn < DateTime.Today) { throw new System.Exception("Token Activated"); } else { throw new System.Exception("Token Expired"); } } else { throw new System.Exception("Token not found"); } } catch (Exception ex) { throw new Exception(ex.Message); } return(ckToken); } }
public void Update(CustomerView model) { using (var ctx = new ConXContext()) { //string imagePath = @model.pic_file_path; //string imgBase64String = Util.Util.GetBase64StringForImage(imagePath); using (TransactionScope scope = new TransactionScope()) { cust_mast updateObj = ctx.CustMasts.Where(z => z.customerId == model.customerId).SingleOrDefault(); updateObj.cust_name = model.cust_name; updateObj.address1 = model.address1; updateObj.subDistrict = model.subDistrict; updateObj.district = model.district; updateObj.province = model.province; updateObj.zipCode = model.zipCode; updateObj.tel = model.tel; ctx.SaveChanges(); scope.Complete(); } } }
public void Update(MasterMenuView model) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { string strConn = ConfigurationManager.ConnectionStrings["OracleDbContext"].ConnectionString; var dataConn = new OracleConnectionStringBuilder(strConn); OracleConnection conn = new OracleConnection(dataConn.ToString()); conn.Open(); OracleCommand oraCommand = conn.CreateCommand(); OracleParameter[] param = new OracleParameter[] { new OracleParameter("p_menu_id", model.menuFunctionId), new OracleParameter("p_menu_name", model.menuFunctionName), new OracleParameter("p_main_menu", model.menuFunctionGroupId), new OracleParameter("p_link_name", model.menuURL), new OracleParameter("p_icon_name", model.iconName), }; oraCommand.BindByName = true; oraCommand.Parameters.AddRange(param); oraCommand.CommandText = "update su_menu set menu_name = :p_menu_name , main_menu =:p_main_menu , link_name = :p_link_name , icon_name =:p_icon_name where menu_id = :p_menu_id"; oraCommand.ExecuteNonQuery(); conn.Close(); scope.Complete(); } } }
public BranchView GetBranchInfo(long branchId) { using (var ctx = new ConXContext()) { Branch branch = ctx.Branchs .Include("branchGroup") .Where(x => x.branchId == branchId) .SingleOrDefault(); BranchView view = new BranchView { branchId = branch.branchId, branchCode = branch.branchCode, branchNameThai = branch.branchNameThai, branchNameEng = branch.branchNameEng, branchGroupId = branch.branchGroupId, branchGroupCode = branch.branchGroup.branchGroupCode, branchGroupName = branch.branchGroup.branchGroupName, status = branch.status, statusTxt = branch.statusTxt, entityCode = branch.entityCode, email = branch.email, docRunningPrefix = branch.docRunningPrefix }; return(view); } }
public void delete(MasterFormUserRoleData userRoleView) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { UserRole userRole = ctx.UserRoles .Where(z => z.userRoleId == userRoleView.userRoleId) .SingleOrDefault(); List <UserRoleFunctionAuthorization> functions = ctx.UserRoleFunctionAuthorizations .Where(z => z.userRoleId == userRoleView.userRoleId) .ToList(); foreach (UserRoleFunctionAuthorization function in functions) { ctx.UserRoleFunctionAccesses.RemoveRange(ctx.UserRoleFunctionAccesses .Where(z => z.userRoleFunctionAuthorizationId == function.userRoleFunctionAuthorizationId)); ctx.SaveChanges(); } ctx.UserRoleFunctionAuthorizations.RemoveRange(ctx.UserRoleFunctionAuthorizations .Where(z => z.userRoleId == userRoleView.userRoleId)); ctx.SaveChanges(); ctx.UserRoles.Remove(userRole); ctx.SaveChanges(); scope.Complete(); } } }
public List <AttachFileView> InquiryAttachFile(long refId, string docCode) { using (var ctx = new ConXContext()) { var result = InquiryAttachFile(ctx, refId, docCode); return(result); } }
public CommonSearchView <MasterInquiryUserData> InquiryUsers(MasterInquiryUserParam model) { using (var ctx = new ConXContext()) { //define model view CommonSearchView <MasterInquiryUserData> view = new ModelViews.CommonSearchView <ModelViews.MasterInquiryUserData>() { pageIndex = model.pageIndex - 1, itemPerPage = model.itemPerPage, totalItem = 0, datas = new List <ModelViews.MasterInquiryUserData>() }; //query data List <User> users = ctx.Users .Include("userRole") .Include("department") .Include("userBranchPrvlgList") .Where(x => (x.username.Contains(model.username) || model.username == null) && (x.name.Contains(model.name) || model.name == null) && (x.userRoleId == model.userrole || model.userrole == 0) && (x.statusId == model.statusId || model.statusId == null) && (x.userBranchPrvlgList.Any(y => model.branchList.Contains(y.branchId)) || model.branchList.Count == 0) //&& (x.userBranchPrvlgList.Any(y => y.branchId == model.branchId)) && x.isPC == model.isPC //&& (x.createUser == model.createUser || model.createUser.ToLower() == "admin") ) .OrderBy(o => o.username) .ToList(); //count , select data from pageIndex, itemPerPage view.totalItem = users.Count; users = users.Skip(view.pageIndex * view.itemPerPage) .Take(view.itemPerPage) .ToList(); //prepare model to modelView foreach (var i in users) { view.datas.Add(new ModelViews.MasterInquiryUserData() { username = i.username, name = i.name, isPC = i.isPC, userRoleDesc = i.userRole != null ? i.userRole.roleName : null, createUser = i.createUser, createdDate = i.createDatetime, statusId = i.statusId, departmentDesc = i.department != null ? i.department.departmentName : null }); } //return data to contoller return(view); } }
//public void SyncUpdate(cust_mast customer) //{ // using (var ctx = new ConXContext()) // { // using (TransactionScope scope = new TransactionScope()) // { // } // } //} public void Update(cust_mast customer) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { } } }
public void SyncUpdate(MasterDepartmentView product) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { } } }
public void SyncUpdate(MasterBranchGroupView model) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { } } }
public void createUserRole(MasterFormUserRoleData data) { using (var ctx = new ConXContext()) { using (TransactionScope scope = new TransactionScope()) { UserRole userRole = new UserRole() { roleName = data.roleName, isPC = data.isPC, createUser = data.createUser, createDatetime = DateTime.Now, updateDatetime = DateTime.Now, updateUser = data.createUser, status = "A" }; userRole.userRoleFunctionAuthorizationList = new List <UserRoleFunctionAuthorization>(); string functionId = ""; UserRoleFunctionAuthorization functionAuth = new UserRoleFunctionAuthorization(); foreach (MasterFormUserRoleFunctionData function in data.functions) { if (!functionId.Equals(function.functionId)) { functionId = function.functionId; functionAuth = new UserRoleFunctionAuthorization() { menuFunctionId = function.functionId, createDatetime = DateTime.Now, createUser = data.createUser }; functionAuth.userRoleFunctionAccessList = new List <UserRoleFunctionAccess>(); userRole.userRoleFunctionAuthorizationList.Add(functionAuth); } UserRoleFunctionAccess action = new UserRoleFunctionAccess() { menuFunctionActionId = function.actionId, createDatetime = DateTime.Now, createUser = data.createUser }; functionAuth.userRoleFunctionAccessList.Add(action); } ctx.UserRoles.Add(userRole); ctx.SaveChanges(); scope.Complete(); } } }
public bool CanInactive(long departmentId) { using (var ctx = new ConXContext()) { //List<PCSale> pcs = ctx.PcSales.Where(z => z.departmentId == departmentId).Take(1).ToList(); List <User> pcs = ctx.Users.Where(z => z.departmentId == departmentId).Take(1).ToList(); return(pcs.Count == 0); } }
public JobInProcessScanFinView SerachFinPcs(JobInProcessSearchView model) { using (var ctx = new ConXContext()) { //define model view JobInProcessScanFinView view = new ModelViews.JobInProcessScanFinView() { pageIndex = model.pageIndex - 1, itemPerPage = model.itemPerPage, totalItem = 0, datas = new List <ModelViews.JobInProcessScanView>() }; string sql = "select a.PCS_BARCODE , a.PROD_CODE , b.PROD_TNAME PROD_NAME, b.PDMODEL_DESC PDMODEL_CODE"; sql += " from MPS_DET_IN_PROCESS a , PRODUCT b"; sql += " where a.prod_code = b.prod_code"; sql += " and a.mps_st = 'Y'"; sql += " and a.entity = :p_entity"; sql += " and a.fin_by = :p_user_id"; sql += " and trunc(a.fin_date) = trunc(SYSDATE)"; sql += " and a.wc_code = :p_wc_code"; sql += " and a.mc_code = :p_mc_code"; sql += " and a.req_date = to_date(:p_req_date,'dd/mm/yyyy')"; sql += " and a.spring_grp = :p_spring_grp"; sql += " and a.pdsize_code = :p_pdsize_code"; List <JobInProcessScanView> scan = ctx.Database.SqlQuery <JobInProcessScanView>(sql, new OracleParameter("p_entity", model.entity), new OracleParameter("p_user_id", model.user_id), new OracleParameter("p_wc_code", model.wc_code), new OracleParameter("p_mc_code", model.mc_code), new OracleParameter("p_req_date", model.req_date), new OracleParameter("p_spring_grp", model.spring_grp), new OracleParameter("p_pdsize_code", model.size_code)).ToList(); view.totalItem = scan.Count; scan = scan.Skip(view.pageIndex * view.itemPerPage) .Take(view.itemPerPage) .ToList(); ////prepare model to modelView foreach (var i in scan) { view.datas.Add(new ModelViews.JobInProcessScanView() { pcs_barcode = i.pcs_barcode, pdmodel_code = i.pdmodel_code, prod_code = i.prod_code, prod_name = i.prod_name }); } //return data to contoller return(view); } }
public CommonSearchView <BranchView> SearchBranch(BranchSearchView model) { using (var ctx = new ConXContext()) { //define model view CommonSearchView <BranchView> view = new ModelViews.CommonSearchView <ModelViews.BranchView>() { pageIndex = model.pageIndex, itemPerPage = model.itemPerPage, totalItem = 0, datas = new List <ModelViews.BranchView>() }; //query data List <Branch> branches = ctx.Branchs .Include("branchGroup") .Where(x => (x.branchCode.Contains(model.branchDesc) || x.branchNameThai.Contains(model.branchDesc)) && x.entityCode.Contains(model.entityCode) && (x.branchGroupId == model.branchGroupId || model.branchGroupId == 0) //&& (model.branchGroupId.Contains(x.branchGroupId) || model.branchGroupId.Count == 0) && (model.status.Contains(x.status) || model.status.Count == 0) ) .OrderBy(o => o.branchCode) .ToList(); //count , select data from pageIndex, itemPerPage view.totalItem = branches.Count; branches = branches.Skip((view.pageIndex - 1) * view.itemPerPage) .Take(view.itemPerPage) .ToList(); //prepare model to modelView foreach (var i in branches) { view.datas.Add(new ModelViews.BranchView() { branchId = i.branchId, branchCode = i.branchCode, branchName = i.branchNameThai, branchGroupId = i.branchGroupId, branchGroupCode = i.branchGroup.branchGroupCode, branchGroupName = i.branchGroup.branchGroupName, status = i.status, statusTxt = i.statusTxt, entityCode = i.entityCode, docRunningPrefix = i.docRunningPrefix, }); } //return data to contoller return(view); } }
public bool CheckDupplicateEntityCode(long branchId, string entityCode) { using (var ctx = new ConXContext()) { Branch branch = ctx.Branchs .Where(x => (x.branchId != branchId || branchId == 0) && x.entityCode == entityCode) .SingleOrDefault(); return(branch != null); } }
public ScanSendFinView SerachCanPcs(ScanSendFinSearchView model) { using (var ctx = new ConXContext()) { //define model view ScanSendFinView view = new ModelViews.ScanSendFinView() { pageIndex = model.pageIndex - 1, itemPerPage = model.itemPerPage, totalItem = 0, datas = new List <ModelViews.ScanSendDataView>() }; string sql = "select a.PCS_BARCODE , a.PROD_CODE ,a.PROD_NAME , a.MODEL_NAME model_desc"; sql += " from MPS_DET_WC a , PDMODEL_MASt b "; sql += " where a.pddsgn_code = b.pdmodel_code"; sql += " and a.mps_st = 'N'"; sql += " and a.fin_by = :p_user_id"; sql += " and trunc(a.fin_date) = trunc(SYSDATE)"; sql += " and a.entity = :p_entity"; sql += " and a.wc_code = :p_wc_code"; sql += " and a.pdsize_code = :p_pdsize_code"; sql += " and b.spring_type = :p_springtype_code"; List <ScanSendDataView> scan = ctx.Database.SqlQuery <ScanSendDataView>(sql, new OracleParameter("p_user_id", model.user_id), new OracleParameter("p_entity", model.entity), new OracleParameter("p_wc_code", model.wc_code), new OracleParameter("p_pdsize_code", model.pdsize_code), new OracleParameter("p_springtype_code", model.springtype_code)).ToList(); view.totalItem = scan.Count; scan = scan.Skip(view.pageIndex * view.itemPerPage) .Take(view.itemPerPage) .ToList(); ////prepare model to modelView foreach (var i in scan) { view.datas.Add(new ModelViews.ScanSendDataView() { pcs_barcode = i.pcs_barcode, model_desc = i.model_desc, prod_code = i.prod_code, prod_name = i.prod_name }); } //return data to contoller return(view); } }
public CommonSearchView <MasterMenuView> Search(MasterMenuSearchView model) { using (var ctx = new ConXContext()) { //define model view CommonSearchView <MasterMenuView> view = new ModelViews.CommonSearchView <ModelViews.MasterMenuView>() { pageIndex = model.pageIndex - 1, itemPerPage = model.itemPerPage, totalItem = 0, datas = new List <ModelViews.MasterMenuView>() }; //query data //List<su_menu> menu = ctx.menu // .Where(x => (x.MENU_ID.Contains(model.menuFunctionId) || model.menuFunctionId == "") // && (x.MENU_NAME.Contains(model.menuFunctionName) || model.menuFunctionName == "") // && (x.MENU_ID.Contains("MOB")) // ) // .OrderBy(o => o.MENU_ID) // .ToList(); string sql = "select menu_id, menu_name , menu_type, link_name , main_menu , icon_name from su_menu where menu_id like '%'||:p_menu_id||'%' and menu_name like '%'||:p_menu_name||'%' and menu_id like 'MOB%' order by menu_id"; List <menuView> menu = ctx.Database.SqlQuery <menuView>(sql, new OracleParameter("p_menu_id", model.menuFunctionId), new OracleParameter("p_menu_name", model.menuFunctionName)).ToList(); //count , select data from pageIndex, itemPerPage view.totalItem = menu.Count; menu = menu.Skip(view.pageIndex * view.itemPerPage) .Take(view.itemPerPage) .ToList(); //prepare model to modelView foreach (var i in menu) { view.datas.Add(new ModelViews.MasterMenuView() { menuFunctionId = i.menu_id, menuFunctionGroupId = i.main_menu, menuFunctionName = i.menu_name, iconName = i.icon_name, menuURL = i.link_name, }); } //return data to contoller return(view); } }
public List <menuFunctionGroupView> getUserRole(string userId) { using (var ctx = new ConXContext()) { //List<su_menu> menu = ctx.menu.SqlQuery("select LEVEL , MENU_ID, MENU_NAME , MENU_TYPE, LINK_NAME , MAIN_MENU , ICON_NAME from su_menu where EXISTS (select MENU_ID from su_role_menu WHERE MENU_ID= SU_MENU.MENU_ID AND EXISTS (select role_id from su_user_role WHERE ROLE_ID= SU_ROLE_MENU.ROLE_ID and user_id = :param1)) CONNECT BY PRIOR MENU_ID = MAIN_MENU START WITH menu_id ='MOB0000000' ORDER BY MENU_ID", new OracleParameter("param1", userId)).ToList(); string sql = "select level , menu_id, menu_name , menu_type, main_menu , icon_name , link_name from su_menu where EXISTS (select MENU_ID from su_role_menu WHERE MENU_ID= SU_MENU.MENU_ID AND EXISTS (select role_id from su_user_role WHERE ROLE_ID= SU_ROLE_MENU.ROLE_ID and user_id = :param1)) CONNECT BY PRIOR MENU_ID = MAIN_MENU START WITH menu_id ='MOB0000000' ORDER BY MENU_ID"; List <menuView> menu = ctx.Database.SqlQuery <menuView>(sql, new OracleParameter("param1", userId)).ToList(); List <menuFunctionView> functionViews = new List <menuFunctionView>(); foreach (var x in menu) { menuFunctionView view = new menuFunctionView() { menuFunctionGroupId = x.main_menu, menuFunctionId = x.menu_id, menuFunctionName = x.menu_name, iconName = x.icon_name, menuURL = x.link_name, }; functionViews.Add(view); } List <menuFunctionGroupView> groupView = new List <menuFunctionGroupView>(); foreach (var x in menu) { menuFunctionGroupView view = new menuFunctionGroupView() { menuFunctionGroupId = x.menu_id, menuFunctionGroupName = x.menu_name, iconName = x.icon_name, menuFunctionList = functionViews .Where(o => o.menuFunctionGroupId == x.menu_id) .ToList() }; if (x.menu_type == "M" && x.menu_id != "MOB0000000") { groupView.Add(view); } } return(groupView); } }
public List <Department> InquiryDepartment() { using (var ctx = new ConXContext()) { //query data List <Department> departments = ctx.Departments .OrderBy(o => o.departmentName) .ToList(); //return data to contoller return(departments); } }
public List <User> InquiryAllUser() { using (var ctx = new ConXContext()) { //query data List <User> users = ctx.Users .OrderBy(o => o.name) .ToList(); //return data to contoller return(users); } }
public CommonSearchView <CustomerView> Search(CustomerSearchView model) { using (var ctx = new ConXContext()) { //define model view CommonSearchView <CustomerView> view = new ModelViews.CommonSearchView <ModelViews.CustomerView>() { pageIndex = model.pageIndex - 1, itemPerPage = model.itemPerPage, totalItem = 0, datas = new List <ModelViews.CustomerView>() }; //query data List <cust_mast> CustMasts = ctx.CustMasts .Where(x => (x.cust_name.Contains(model.name) || model.name == "") || (x.address1.Contains(model.name)) || (x.address2.Contains(model.name)) ) .OrderBy(o => o.customerId) .ToList(); //count , select data from pageIndex, itemPerPage view.totalItem = CustMasts.Count; CustMasts = CustMasts.Skip(view.pageIndex * view.itemPerPage) .Take(view.itemPerPage) .ToList(); //prepare model to modelView foreach (var i in CustMasts) { view.datas.Add(new ModelViews.CustomerView() { customerId = i.customerId, cust_name = i.cust_name, address1 = i.address1, address2 = i.address2, subDistrict = i.subDistrict, district = i.district, province = i.province, zipCode = i.zipCode, tel = i.tel }); } //return data to contoller return(view); } }
public List <Dropdownlists> GetDdlDocStatus() { using (var ctx = new ConXContext()) { List <Dropdownlists> ddl = ctx.DocStatus .OrderBy(o => o.statusId) .Select(x => new Dropdownlists() { key = x.statusId, value = x.statusName }) .ToList(); return(ddl); } }
public List <Dropdownlist> GetDdlBranchGroup() { using (var ctx = new ConXContext()) { List <Dropdownlist> ddl = ctx.BranchGroups .OrderBy(o => o.branchGroupCode) .Select(x => new Dropdownlist() { key = x.branchGroupId, value = x.branchGroupCode + " " + x.branchGroupName }) .ToList(); return(ddl); } }