public List <Domain.CU> GetAllCU(string loginId, string pernr) { // RFC QueryUserAuthInClient client = new QueryUserAuthInClient(); client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_USERNAME"]; client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_PASSWORD"]; UserAuthQuery_sync param = new UserAuthQuery_sync(); param.PERNR = pernr; UserAuthResponse_sync response = client.UserAuthQueryResponse_In(param); string temp = string.Empty; List <Domain.CU> sapCUList = new List <Domain.CU>(); foreach (UserAuthList p in response.CUUserAuthList) { sapCUList.Add(new Domain.CU() { CUCode = p.VALUE, CUName = p.BNAME }); } // DB List <Domain.CU> dbCUList = new List <Domain.CU>(); dbCUList = cuDao.GetAllCU(loginId); // composition List <Domain.CU> resultList = new List <Domain.CU>(); resultList.Add(new Domain.CU { CUCode = "-1", CUName = "모든CU" }); string star = "*"; foreach (Domain.CU p in sapCUList) { if (p.CUCode == star) // [ * ] { resultList.AddRange(dbCUList); } else // [ a-z ] { resultList.AddRange(dbCUList.Where(t => t.CUCode == p.CUCode)); } } IEnumerable <Domain.CU> identifiedList = resultList.Distinct(); return(identifiedList.ToList <Domain.CU>()); }
public String GetWERKS(string pernr) { QueryUserAuthInClient client = new QueryUserAuthInClient(); client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_USERNAME"]; client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_PASSWORD"]; UserAuthQuery_sync param = new UserAuthQuery_sync(); param.PERNR = pernr; String werks = string.Empty; UserAuthResponse_sync response = client.UserAuthQueryResponse_In(param); werks = response.WERKS; string some = response.BNAME; return(werks); }
public List <Domain.Plant> GetAllPlant(string loginId, string pernr) { // RFC QueryUserAuthInClient client = new QueryUserAuthInClient(); client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_USERNAME"]; client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_PASSWORD"]; UserAuthQuery_sync param = new UserAuthQuery_sync(); param.PERNR = pernr; UserAuthResponse_sync response = client.UserAuthQueryResponse_In(param); string temp = string.Empty; List <Domain.Plant> sapPlantList = new List <Domain.Plant>(); foreach (UserAuthList p in response.PLANTUserAuthList) { sapPlantList.Add(new Domain.Plant() { PlantCode = p.VALUE, PlantName = p.BNAME }); } // DB List <Domain.Plant> dbPlantList = new List <Domain.Plant>(); dbPlantList = plantDao.GetAllPlant(loginId); // composition List <Domain.Plant> resultList = new List <Domain.Plant>(); resultList.Add(new Domain.Plant { PlantCode = "-1", PlantName = "전지점" }); string prefix = string.Empty; string star = "*"; foreach (Domain.Plant p in sapPlantList) { prefix = string.Empty; if (p.PlantCode == star) // [ * ] { resultList.AddRange(dbPlantList); } else if (p.PlantCode.Contains(star) == true) // [ 7* , 8*, 5* ] { prefix = p.PlantCode.Split(star.ToCharArray())[0]; resultList.AddRange(dbPlantList.Where(t => t.PlantCode.StartsWith(prefix))); } else // [ nnnn ] { ////resultList.Add(p); prefix = p.PlantCode; resultList.AddRange(dbPlantList.Where(t => t.PlantCode.Equals(prefix))); } } //resultList.AddRange(dbPlantList); IEnumerable <Domain.Plant> identifiedList = resultList.Distinct(); return(identifiedList.ToList <Domain.Plant>()); }