public string[] GetCompanyList(string prefixText, int count, string contextKey) { JavaScriptSerializer serializer = new JavaScriptSerializer(); // AutoCompleteParameter is a ValueObject DTO that used in AutoComplete only DbCompany parameter = serializer.Deserialize <DbCompany>(contextKey); // Retreive Query Object from Spring //IDbCountryLangQuery dbCountryLangQuery = (IDbCountryLangQuery)ContextRegistry.GetContext().GetObject("DbCountryLangQuery"); //IList<CountryLang> CountryList = dbCountryLangQuery.FindAutoComplete(prefixText, parameter.CountryId ?? -1, parameter.LanguageId ?? -1); IDbCompanyQuery dbCompanyQuery = (IDbCompanyQuery)ContextRegistry.GetContext().GetObject("DbCompanyQuery"); IList <DbCompany> companyList = dbCompanyQuery.FindAutoComplete(prefixText, parameter.UseEcc, parameter.Active); List <string> items = new List <string>(companyList.Count); foreach (DbCompany company in companyList) { DbCompany com = new DbCompany(); com.CompanyCode = company.CompanyCode; com.CompanyID = company.CompanyID; com.CompanyName = company.CompanyName; string item = AutoCompleteExtender.CreateAutoCompleteItem(string.Format("[{0}] {1}", company.CompanyCode, company.CompanyName), serializer.Serialize(com)); items.Add(item); } return(items.ToArray()); }
public string[] GetUserList(string prefixText, int count, string contextKey) { JavaScriptSerializer serializer = new JavaScriptSerializer(); // AutoCompleteParameter is a ValueObject DTO that used in AutoComplete only UserAutoCompleteParameter parameter = serializer.Deserialize <UserAutoCompleteParameter>(contextKey); // Retreive Query Object from Spring ISuUserQuery SuUserQuery = (ISuUserQuery)ContextRegistry.GetContext().GetObject("SuUserQuery"); // Return type of FindAutoComplete method must be a ValueObject only IList <SuUser> userList = SuUserQuery.FindAutoComplete(prefixText, parameter); List <string> items = new List <string>(userList.Count); foreach (SuUser user in userList) { SuUserParameter u = new SuUserParameter(); u.UserID = user.Userid; u.UserName = user.UserName; u.EmployeeCode = user.EmployeeCode; u.EmployeeName = user.EmployeeName; // Serialize ValueObject to JSON String and set it to AutoCompleteItem's Value string item = AutoCompleteExtender.CreateAutoCompleteItem(String.Format("[{0}]{1}", user.UserName, user.EmployeeName), serializer.Serialize(u)); items.Add(item); } return(items.ToArray()); }
public string[] ObtenerProveedores(string prefixText, int count) { DataSet objDataResult = new DataSet(); string strQuery = "SELECT E.ID, E.proveedor as nombre " + " FROM proveedores E " + " WHERE E.proveedor LIKE '%" + prefixText + "%'" + " ORDER BY nombre " + " LIMIT " + count.ToString(); try { objDataResult = CComunDB.CCommun.Ejecutar_SP(strQuery); } catch { } List <string> items = new List <string>(); foreach (DataRow objRowResult in objDataResult.Tables[0].Rows) { string strProducto = AutoCompleteExtender.CreateAutoCompleteItem( objRowResult["nombre"].ToString(), objRowResult["ID"].ToString()); items.Add(strProducto); } return(items.ToArray()); }
public string[] BuscarProveedores(string prefixText) { List <string> items = new List <string>(50); List <Proveedor> listP; try { using (ControladorCompras c_compras = new ControladorCompras()) { listP = c_compras.BuscarListProveedores(prefixText); if (listP != null) { foreach (Proveedor p in listP) { // items.Add(p.Nombre); items.Add(AutoCompleteExtender.CreateAutoCompleteItem(p.Nombre, p.Idproveedor.ToString())); } } } } catch (ExcepcionPropia) { //items.Add("ASDASD"); } return(items.ToArray()); }
public static List <string> SearchService(string prefixText, int count, string contextKey) { IServiceRequest rMgr = (IServiceRequest)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BServiceRequest, BusinessProcess.Clinical"); int moduleId = Convert.ToInt32(contextKey); List <Service> services = rMgr.FindServiceByName(prefixText, moduleId); List <string> ar = new List <string>(); string custItem = string.Empty; if (services.Count > 0) { foreach (Service service in services) { try { custItem = AutoCompleteExtender.CreateAutoCompleteItem( string.Format("{0} {1}", service.Name, service.Description != "" ? "(" + service.Description + ")" : ""), String.Format("{0};{1};{2};{3}", service.Id, service.Name, service.ServiceAreaId, service.ServiceArea ) ); ar.Add(custItem); } catch { } } } return(ar); }
public static string[] GetCompletionList(string prefixText, int count) { using (SqlConnection con = new SqlConnection()) { con.ConnectionString = ConfigurationManager.ConnectionStrings["ShopDB"].ConnectionString; using (SqlCommand com = new SqlCommand()) { com.CommandText = "select ItemPrefix,ItemID from mItem where " + "ItemPrefix like @Search + '%' or ItemCode like @Search + '%'"; com.Parameters.AddWithValue("@Search", prefixText); com.Connection = con; con.Open(); Dictionary <Int32, string> objDictonr = new Dictionary <int, string>(); // List<string> ItemPrefix = new List<string>(); List <string> ItemPrefix = new List <string>(); string item = string.Empty; using (SqlDataReader sdr = com.ExecuteReader()) { while (sdr.Read()) { item = AutoCompleteExtender.CreateAutoCompleteItem(sdr[0].ToString(), sdr[1].ToString()); ItemPrefix.Add(item); //objDictonr.Add(Convert.ToInt32(sdr["ItemID"].ToString()), sdr["ItemPrefix"].ToString()); //ItemPrefix.Add(sdr["ItemPrefix"].ToString()); } } con.Close(); return(ItemPrefix.ToArray()); //return objDictonr; } } }
public string[] ObtenerConceptos(string prefixText, int count) { DataSet objDataResult = new DataSet(); string strQuery = "SELECT ID, nombre " + " FROM productos " + " WHERE (nombre LIKE '%" + prefixText + "%'" + " OR codigo = '" + prefixText + "'" + " ) AND tipo = 2" + " AND activo = 1" + " ORDER BY nombre " + " LIMIT " + count.ToString(); try { objDataResult = CComunDB.CCommun.Ejecutar_SP(strQuery); } catch { } List <string> items = new List <string>(); foreach (DataRow objRowResult in objDataResult.Tables[0].Rows) { string strProducto = AutoCompleteExtender.CreateAutoCompleteItem( objRowResult["nombre"].ToString(), objRowResult["ID"].ToString()); items.Add(strProducto); } return(items.ToArray()); }
public static List <string> SearchDrugs(string prefixText, int count) { DataTable theDT = (DataTable)HttpContext.Current.Session["theStocks"]; List <string> Drugsdetail = new List <string>(); var drugs = from DataRow tmp in theDT.AsEnumerable() where tmp["DrugName"].ToString().ToLower().Contains(prefixText.ToLower()) select tmp; // new { drugName = tmp["DrugName"].ToString(), drugID = tmp["Drug_pk"].ToString() }; foreach (DataRow c in drugs) { if (tranactionType == "Opening Stock") { Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c["drugname"].ToString(), c["drug_pk"].ToString())); } else { //StringBuilder test = new StringBuilder(); //test.Append(c["drugname"].ToString()).Append("\t").Append(c["BatchNo"].ToString()).Append("\t").Append(c["AvailQty"].ToString()).Append("\t").Append(c["ExpiryDate"].ToString()); //Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(test.ToString(), c["drug_pk"].ToString() + "," + c["BatchNo"].ToString())); Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c["drugname"].ToString() + " ------- " + c["BatchNo"].ToString() + " ------- " + c["AvailQty"].ToString() + " ------- " + c["ExpiryDate"].ToString(), c["drug_pk"].ToString() + "," + c["BatchNo"].ToString())); } } return(Drugsdetail); }
/// <summary> /// Gets the lab. /// </summary> /// <param name="prefixText">The prefix text.</param> /// <param name="count">The count.</param> /// <returns></returns> public static List <string> GetLab(string prefixText, int count) { List <Labs> items = new List <Labs>(); ILabFunctions LabTestsMgrDate; List <string> ar = new List <string>(); string custItem = string.Empty; LabTestsMgrDate = (ILabFunctions)ObjectFactory.CreateInstance("BusinessProcess.Laboratory.BLabFunctions, BusinessProcess.Laboratory"); string query = "Exec dbo.Laboratory_GetLabTestID @LabName='" + prefixText + "', @IncludeLabDepartment=8"; //filling data from database // dtLabResult = LabTestsMgrDate.ReturnLabQuery(sqlQuery); DataTable dt = new DataTable(); dt = LabTestsMgrDate.ReturnLabQuery(query); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { try { custItem = AutoCompleteExtender.CreateAutoCompleteItem(row["LabName"].ToString(), String.Format("{0};{1};{2}", row["LabTestID"], row["LabName"], row["labdepartmentname"])); ar.Add(custItem); } catch { } } } return(ar); //return items; }
public string[] GetCurrencyList(string prefixText, int count, string contextKey) { JavaScriptSerializer serializer = new JavaScriptSerializer(); // AutoCompleteParameter is a ValueObject DTO that used in AutoComplete only CurrencyAutoCompleteParameter parameter = serializer.Deserialize <CurrencyAutoCompleteParameter>(contextKey); // Retreive Query Object from Spring IDbCurrencyQuery dbCurrencyQuery = (IDbCurrencyQuery)ContextRegistry.GetContext().GetObject("DbCurrencyQuery"); IList <VOUCurrencySetup> currencyList = dbCurrencyQuery.GetCurrencyListItem(prefixText, parameter); List <string> items = new List <string>(); foreach (VOUCurrencySetup c in currencyList) { CurrencyAutoCompleteParameter currency = new CurrencyAutoCompleteParameter(); currency.CurrencyID = c.CurrencyID.Value; currency.Symbol = c.Symbol; currency.Desc = c.Description; string item = AutoCompleteExtender.CreateAutoCompleteItem(String.Format("[{0}]-{1}", c.Symbol, c.Description), serializer.Serialize(currency)); items.Add(item); } return(items.ToArray()); }
public string[] GetLocationList(string prefixText, int count, string contextKey) { JavaScriptSerializer serializer = new JavaScriptSerializer(); // AutoCompleteParameter is a ValueObject DTO that used in AutoComplete only Location parameter = serializer.Deserialize <Location>(contextKey); // Retreive Query Object from Spring IDbLocationQuery DbLocationQuery = (IDbLocationQuery)ContextRegistry.GetContext().GetObject("DbLocationQuery"); // Return type of FindAutoComplete method must be a ValueObject only IList <Location> locationList = DbLocationQuery.FindAutoComplete(prefixText, parameter); List <string> items = new List <string>(locationList.Count); foreach (Location location in locationList) { // Serialize ValueObject to JSON String and set it to AutoCompleteItem's Value Location locate = new Location(); locate.LocationID = location.LocationID; locate.LocationName = location.LocationName.Trim(); locate.LocationCode = location.LocationCode.Trim(); string item = AutoCompleteExtender.CreateAutoCompleteItem(String.Format("[{0}]{1}", locate.LocationCode, locate.LocationName), serializer.Serialize(locate)); items.Add(item); } return(items.ToArray()); }
public string[] GetDivisionList(string prefixText, int count, string contextKey) { JavaScriptSerializer serializer = new JavaScriptSerializer(); // AutoCompleteParameter is a ValueObject DTO that used in AutoComplete only AutoCompleteParameter parameter = serializer.Deserialize <AutoCompleteParameter>(contextKey); // Retreive Query Object from Spring ISuDivisionLangQuery suDivisionQuery = (ISuDivisionLangQuery)ContextRegistry.GetContext().GetObject("SuDivisionLangQuery"); // Return type of FindAutoComplete method must be a ValueObject only IList <SS.SU.DTO.ValueObject.DivisionLang> divisionList = suDivisionQuery.FindAutoComplete(prefixText, parameter.LanguageId ?? -1, parameter.OrganizationId ?? -1); List <string> items = new List <string>(divisionList.Count); foreach (SS.SU.DTO.ValueObject.DivisionLang division in divisionList) { //Serialize ValueObject to JSON String and set it to AutoCompleteItem's Value string item = AutoCompleteExtender.CreateAutoCompleteItem(division.DivisionName, serializer.Serialize(division)); items.Add(item); } //return lists; return(items.ToArray()); }
public static List <string> SearchConsumableItems(string prefixText, int count) { List <string> ar = new List <string>(); int consumableItemTypeID = -1; int.TryParse(System.Web.HttpContext.Current.Session["ConsumableTypeID"].ToString(), out consumableItemTypeID); DateTime issueDate = DateTime.Now; DateTime.TryParse(System.Web.HttpContext.Current.Session["SelectedDate"].ToString(), out issueDate); int?SCMFlag = null; if (System.Web.HttpContext.Current.Session["SCMModule"] != null) { SCMFlag = 1; } IItemMaster _iMGR = (IItemMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BItemMaster, BusinessProcess.Administration"); //DataTable dataTable = _iMGR.FindItems(prefixText, consumableItemTypeID, null, DateTime.Parse(issueDate.ToString("yyyy-MM-dd")), false); DataTable dataTable = _iMGR.FindItems(prefixText, consumableItemTypeID, null, DateTime.Parse(issueDate.ToString("dd-MMM-yyyy")), false, SCMFlag); //Bug ID 158... string custItem = string.Empty; foreach (DataRow theRow in dataTable.Rows) { custItem = AutoCompleteExtender.CreateAutoCompleteItem(theRow["ItemName"].ToString(), String.Format("{0};{1};{2}", theRow["ItemID"], theRow["ItemTypeID"], theRow["SellingPrice"])); ar.Add(custItem); } return(ar); }
public string[] ObtenerSucursales(string prefixText, int count) { DataSet objDataResult = new DataSet(); string strQuery = "SELECT S.ID, concat(negocio, ' - ', sucursal) as nombre " + " FROM sucursales S " + " INNER JOIN establecimientos E " + " ON S.establecimiento_ID = E.ID " + " WHERE (E.negocio LIKE '%" + prefixText + "%'" + " OR S.sucursal LIKE '%" + prefixText + "%')" + " AND E.ID <> 0" + " ORDER BY nombre " + " LIMIT " + count.ToString(); try { objDataResult = CComunDB.CCommun.Ejecutar_SP(strQuery); } catch { } List <string> items = new List <string>(); foreach (DataRow objRowResult in objDataResult.Tables[0].Rows) { string strProducto = AutoCompleteExtender.CreateAutoCompleteItem( objRowResult["nombre"].ToString(), objRowResult["ID"].ToString()); items.Add(strProducto); } return(items.ToArray()); }
public string[] BuscarArticulosVenta(string prefixText, string contextKey) { List <string> items = new List <string>(50); List <Articulo> listA; try { int idSucu = Convert.ToInt32(contextKey); using (ControladorArticulos c_artculos = new ControladorArticulos()) { listA = c_artculos.BuscarListArticuloVenta(prefixText, idSucu); } if (listA != null) { foreach (Articulo a in listA) { //items.Add(a.TipoArticulo.Descripcion+"-"+a.Descripcion+"-"+a.Marca.Descripcion); items.Add(AutoCompleteExtender.CreateAutoCompleteItem(a.TipoArticulo.Descripcion + "-" + a.Marca.Descripcion + "-" + a.Descripcion, a.Idarticulo.ToString())); } } } catch (ExcepcionPropia) { // items.Add("ASDASD"); } catch (NullReferenceException) { // items.Add("ASDASD"); } return(items.ToArray()); }
public string[] GetUserList(string prefixText, int count, string contextKey) { /* * JavaScriptSerializer serializer = new JavaScriptSerializer(); * * // AutoCompleteParameter is a ValueObject DTO that used in AutoComplete only * DbUserAutoCompleteParameter parameter = serializer.Deserialize<DbUserAutoCompleteParameter>(contextKey); * * // Retreive Query Object from Spring * IDbCountryLangQuery dbCountryLangQuery = (IDbCountryLangQuery)ContextRegistry.GetContext().GetObject("DbCountryLangQuery"); * * IList<CountryLang> CountryList = dbCountryLangQuery.FindAutoComplete(prefixText, parameter.CountryId ?? -1, parameter.LanguageId ?? -1); * * List<string> items = new List<string>(CountryList.Count); * * foreach (CountryLang Country in CountryList) * { * string item = AutoCompleteExtender.CreateAutoCompleteItem(Country.CountryName, serializer.Serialize(Country)); * items.Add(item); * } * * return items.ToArray(); */ JavaScriptSerializer serializer = new JavaScriptSerializer(); Getuser parameter = serializer.Deserialize <Getuser>(contextKey); System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.Add("UserName", typeof(string)); dt.Columns.Add("Name", typeof(string)); System.Data.DataRow dr = dt.NewRow(); dr["UserName"] = "******"; dr["Name"] = "Admin Administrator"; dt.Rows.Add(dr); //parameter.UserName = "******"; //parameter.Name = "Admin Administrator"; System.Data.DataRow[] getUser = dt.Select("Name Like '%" + prefixText + "%'"); IList <Getuser> getUserList = new List <Getuser>(); foreach (System.Data.DataRow r in getUser) { Getuser user = new Getuser(); user.Name = r["Name"].ToString(); user.UserName = r["UserName"].ToString(); getUserList.Add(user); } List <string> items = new List <string>(getUserList.Count); foreach (Getuser userList in getUserList) { string item = AutoCompleteExtender.CreateAutoCompleteItem(userList.Name, serializer.Serialize(userList)); items.Add(item); } return(items.ToArray()); }
public static List <string> SearchDrugs(string prefixText, int count) { List <string> Drugsdetail = new List <string>(); List <Drugs> lstDrugsDetail = GetDrugs(prefixText, count); JavaScriptSerializer serializer = new JavaScriptSerializer(); foreach (Drugs c in lstDrugsDetail) { Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c.DrugName, serializer.Serialize(c))); } return(Drugsdetail); }
/// <summary> /// Обслуживает Intellisense КЛАДР /// </summary> /// <param name="prefixText"> /// The prefix Text. /// </param> /// <param name="count"> /// The count. /// </param> /// <param name="contextKey"> /// The context Key. /// </param> /// <returns> /// The <see cref="List"/>. /// </returns> public static List <string> GetKladrList(string prefixText, int count, string contextKey) { // Убираем пробелы prefixText = prefixText.Trim(); if (!string.IsNullOrEmpty(prefixText)) { // подставляем знаки процентов var pr = string.Empty; if (prefixText.Length > 0) { pr = prefixText.First().ToString(CultureInfo.InvariantCulture) + "%"; pr = prefixText.Skip(1).Aggregate(pr, (akk, x) => string.Format("{0}{1}%", akk, x)); } var kladrService = ObjectFactory.GetInstance <IAddressService>(); if (string.IsNullOrEmpty(contextKey)) { // Регионы var completeList = kladrService.GetAddressList(null, pr, KladrLevel.Subject) .Select( x => AutoCompleteExtender.CreateAutoCompleteItem( string.Format("{0} {1}.", x.Name, x.Socr), x.Id.ToString())) .ToList(); return(completeList); } var parentKladrId = new Guid(contextKey); if (parentKladrId != Guid.Empty) { var completeList = kladrService.GetAddressList(parentKladrId, pr, null) .Select( x => AutoCompleteExtender.CreateAutoCompleteItem( x.Name + (!string.IsNullOrEmpty(x.Socr) ? string.Format(" {0}.", x.Socr) : string.Empty), x.Id.ToString())) .ToList(); return(completeList); } } return(new List <string>()); }
public static List <string> SearchItems(string prefixText) { List <string> Itemsdetail = new List <string>(); List <Items> lstItemsDetail = GetItems(prefixText); JavaScriptSerializer serializer = new JavaScriptSerializer(); foreach (Items c in lstItemsDetail) { Itemsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c.ItemName, serializer.Serialize(c))); } return(Itemsdetail); }
public static List <string> Searchlab(string prefixText, int count) { List <string> Labdetail = new List <string>(); List <Labs> lstDrugsDetail = GetLab(prefixText, count); JavaScriptSerializer serializer = new JavaScriptSerializer(); foreach (Labs c in lstDrugsDetail) { Labdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c.SubTestName, serializer.Serialize(c))); } return(Labdetail); }
public string[] listarProduto(string prefixText, int count) { Produto prod = new Produto(); List <string> items = new List <string>(); JavaScriptSerializer serializer = new JavaScriptSerializer(); foreach (Produto p in prod.listar(prefixText)) { items.Add(AutoCompleteExtender.CreateAutoCompleteItem (p.Nome + " : " + p.Valor, serializer.Serialize(p))); } return(items.ToArray()); }
/// <summary> /// Обслуживает Intellisense для ввода имени /// </summary> /// <param name="prefixText"> /// The prefix Text. /// </param> /// <param name="count"> /// The count. /// </param> /// <returns> /// The <see cref="List"/>. /// </returns> public static List <string> GetFirstNameAutoComplete(string prefixText, int count) { var regulatoryService = ObjectFactory.GetInstance <IRegulatoryService>(); IList <AutoComplete> firstNameList = regulatoryService.GetFirstNameAutoComplete(prefixText); var completeList = new List <string>(); foreach (var complete in firstNameList) { completeList.Add(AutoCompleteExtender.CreateAutoCompleteItem(complete.Name, complete.Id.ToString())); } return(completeList); }
public string[] GetPuntosEntrega(string prefixText, int count, string contextKey) { prefixText = prefixText.ToLower(); var parents = ParseContextKey(contextKey); var empresas = GetParentElement(parents, 0); var lineas = GetParentElement(parents, 1); var clientes = GetParentElement(parents, 2); return(DAOFactory.PuntoEntregaDAO.GetList(empresas, lineas, clientes, prefixText) .OrderBy(p => p.Descripcion) .Take(count) .Select(p => AutoCompleteExtender.CreateAutoCompleteItem(p.Descripcion, p.Id.ToString("#0"))) .ToArray()); }
public string[] AdIleAra(String prefixText) { int length = 10; string[] stringDizi = new string[length]; for (int i = 0; i < length; i++) { stringDizi[i] = AutoCompleteExtender.CreateAutoCompleteItem( prefixText + " " + i , i.ToString() ); } return(stringDizi); }
public string[] GetRutas(string prefixText, int count, string contextKey) { prefixText = prefixText.ToLower(); var parents = ParseContextKey(contextKey); var empresas = GetParentElement(parents, 0); var lineas = GetParentElement(parents, 1); var vehiculos = GetParentElement(parents, 2); var empleados = GetParentElement(parents, 3); return(DAOFactory.ViajeDistribucionDAO.GetList(empresas, lineas, vehiculos, empleados) .Where(v => v.Codigo.ToLower().Contains(prefixText)) .OrderBy(v => v.Codigo) .Take(count) .Select(v => AutoCompleteExtender.CreateAutoCompleteItem(v.Codigo, v.Id.ToString("#0"))) .ToArray()); }
public static List <string> SearchBorrower(string prefixText, int count) { DataSet theDS = (DataSet)HttpContext.Current.Session["theStocks"]; List <string> Drugsdetail = new List <string>(); var drugs = from DataRow tmp in theDS.Tables[0].AsEnumerable() where tmp["DrugName"].ToString().ToLower().Contains(prefixText.ToLower()) select tmp; // new { drugName = tmp["DrugName"].ToString(), drugID = tmp["Drug_pk"].ToString() }; foreach (DataRow c in drugs) { Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c[2].ToString(), c[1].ToString())); } return(Drugsdetail); }
public string[] GetEmpleados(string prefixText, int count, string contextKey) { prefixText = prefixText.ToLower(); var parents = ParseContextKey(contextKey); var empresas = GetParentElement(parents, 0); var lineas = GetParentElement(parents, 1); var tiposEmpleado = GetParentElement(parents, 2); var transportistas = GetParentElement(parents, 3); var centrosCosto = GetParentElement(parents, 4); var departamentos = GetParentElement(parents, 5); return(DAOFactory.EmpleadoDAO.GetList(empresas, lineas, tiposEmpleado, transportistas, centrosCosto, departamentos) .Where(e => e.Entidad.Descripcion.ToLower().Contains(prefixText)) .OrderBy(e => e.Entidad.Descripcion) .Take(count) .Select(e => AutoCompleteExtender.CreateAutoCompleteItem(e.Entidad.Descripcion, e.Id.ToString("#0"))) .ToArray()); }
public static List <string> SearchDrugs(string prefixText, int count) { DataTable theDT = (DataTable)HttpContext.Current.Session["theStocks"]; List <string> Drugsdetail = new List <string>(); if (theDT != null && theDT.Rows.Count > 0) { DataTable distinctTable = theDT.AsEnumerable() .GroupBy(x => x.Field <string>("drugname")) .Select(g => g.First()).CopyToDataTable(); var drugs = from DataRow tmp in distinctTable.AsEnumerable() where tmp["DrugName"].ToString().ToLower().Contains(prefixText.ToLower()) select tmp; // new { drugName = tmp["DrugName"].ToString(), drugID = tmp["Drug_pk"].ToString() }; foreach (DataRow c in drugs) { if (tranactionType == "Opening Stock") { Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c["drugname"].ToString(), c["drug_pk"].ToString())); } else if (sourceType == "Supplier") { Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c["drugname"].ToString(), c["drug_pk"].ToString())); } else { StringBuilder test = new StringBuilder(); test.Append(c["drugname"].ToString()); test.Append(" - "); test.Append(c["BatchNo"].ToString()); test.Append(" - "); test.Append(c["AvailQty"].ToString().PadRight(20)); test.Append(" - "); test.Append(c["ExpiryDate"].ToString()); Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(test.ToString(), c["drug_pk"].ToString() + "," + c["BatchNo"].ToString())); //Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c["drugname"].ToString() + " ------- " + c["BatchNo"].ToString() + " ------- " + c["AvailQty"].ToString() + " ------- " + c["ExpiryDate"].ToString(), c["drug_pk"].ToString() + "," + c["BatchNo"].ToString())); //Drugsdetail.Add(AutoCompleteExtender.CreateAutoCompleteItem(c["drugname"].ToString() , c["drug_pk"].ToString() + "," + c["BatchNo"].ToString())); } } } return(Drugsdetail); }
public string[] GetVehiculos(string prefixText, int count, string contextKey) { prefixText = prefixText.ToLower(); var parents = ParseContextKey(contextKey); var empresas = GetParentElement(parents, 0); var lineas = GetParentElement(parents, 1); var tiposVehiculo = GetParentElement(parents, 2); var transportistas = GetParentElement(parents, 3); var departamentos = GetParentElement(parents, 4); var centrosDeCosto = GetParentElement(parents, 5); var subCentrosDeCosto = GetParentElement(parents, 6); return(DAOFactory.CocheDAO.GetList(empresas, lineas, tiposVehiculo, transportistas, departamentos, centrosDeCosto, subCentrosDeCosto, true) .Where(c => c.CompleteDescripcion().ToLower().Contains(prefixText)) .OrderBy(c => c.CompleteDescripcion()) .Take(count) .Select(c => AutoCompleteExtender.CreateAutoCompleteItem(c.CompleteDescripcion(), c.Id.ToString("#0"))) .ToArray()); }
public string[] ObtenerProductos(string prefixText, int count) { DataSet objDataResult = new DataSet(); string strQuery = "SELECT R.*, IFNULL(D.existencia, 0) as existencia" + " FROM (" + " SELECT ID, concat(nombre, ' - ', sales) as nombre " + " FROM productos " + " WHERE (nombre LIKE '%" + prefixText + "%'" + " OR sales LIKE '%" + prefixText + "%'" + " OR descripcion LIKE '%" + prefixText + "%'" + " OR codigo = '" + prefixText + "'" + " OR codigo2 = '" + prefixText + "'" + " OR codigo3 = '" + prefixText + "'" + " ) AND tipo = 0" + " AND activo = 1" + " ORDER BY nombre " + " LIMIT " + count.ToString() + " ) R" + " LEFT JOIN producto_datos D" + " ON D.productoID = R.ID"; try { objDataResult = CComunDB.CCommun.Ejecutar_SP(strQuery); } catch { } List <string> items = new List <string>(); foreach (DataRow objRowResult in objDataResult.Tables[0].Rows) { string strProducto = AutoCompleteExtender.CreateAutoCompleteItem( objRowResult["nombre"].ToString() + "(" + ((decimal)objRowResult["existencia"]).ToString("0.##") + ")", objRowResult["ID"].ToString()); items.Add(strProducto); } return(items.ToArray()); }