Example #1
0
    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());
    }
Example #2
0
    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());
    }
Example #3
0
    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());
    }
Example #4
0
        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());
        }
Example #5
0
        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());
        }
Example #6
0
    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());
    }
        /// <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;
        }
Example #8
0
        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 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());
        }
Example #10
0
        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);
        }
Example #11
0
        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 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());
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            hiddenField    = new HiddenField();
            hiddenField.ID = "hiddenFieldID";
            Controls.Add(hiddenField);
            hiddenField.ValueChanged += HiddenField_OnValueChanged;

            textBox    = new TextBoxExt();
            textBox.ID = "textBoxID";
            Controls.Add(textBox);

            autoCompleteExtender    = new AutoCompleteExtender();
            autoCompleteExtender.ID = "autoCompleteExtenderID";
            Controls.Add(autoCompleteExtender);
            autoCompleteExtender.TargetControlID = textBox.ID;

            autoCompleteExtender.ServicePath            = "~/autocomplete.asmx";
            autoCompleteExtender.ServiceMethod          = "GetCompletionList";
            autoCompleteExtender.UseContextKey          = true;
            autoCompleteExtender.MinimumPrefixLength    = 1;
            autoCompleteExtender.CompletionListCssClass = "autocomplete_completionListElement";
            autoCompleteExtender.CompletionListHighlightedItemCssClass = "autocomplete_highlightedListItem";
            autoCompleteExtender.CompletionListItemCssClass            = "autocomplete_listItem";
            autoCompleteExtender.FirstRowSelected = true;
            autoCompleteExtender.EnableCaching    = false;
        }
Example #14
0
        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);
        }
Example #15
0
        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;
                }
            }
        }
Example #16
0
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            foreach (FilterControl fc in FilterGroup)
            {
                this.Controls.Add(fc);
                if (fc.AutoCompletePrefixLength > 0)
                {
                    AutoCompleteExtender ace = new AutoCompleteExtender();
                    ace.ID                                    = "ACE_" + fc.ID;
                    ace.Enabled                               = true;
                    ace.TargetControlID                       = fc.ID;
                    ace.ServiceMethod                         = "AutoCompleteFilter";
                    ace.ServicePath                           = this.dmdService;
                    ace.MinimumPrefixLength                   = fc.AutoCompletePrefixLength;
                    ace.CompletionInterval                    = 750;
                    ace.ContextKey                            = this.DirectoryName + "," + fc.Filter;
                    ace.EnableCaching                         = false;
                    ace.CompletionSetCount                    = 100;
                    ace.CompletionListCssClass                = fc.CompletionListCssClass;
                    ace.CompletionListItemCssClass            = fc.CompletionListItemCssClass;
                    ace.CompletionListHighlightedItemCssClass = fc.CompletionHighlightedListItemCssClass;
                    this.Controls.Add(ace);
                }
            }
        }
Example #17
0
    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());
    }
Example #18
0
    protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        AutoCompleteExtender ACE = (AutoCompleteExtender)e.Row.FindControl("AssetSubTypePropertyValueTextBox_AutoCompleteExtender");

        if (ACE != null)
        {
            ACE.ContextKey = e.Row.Cells[2].Text;
        }
    }
Example #19
0
    private void Creat_Order(int?i)
    {
        if (i == null)
        {
            i = 0;
        }
        TableRow  TR  = new TableRow();
        TableCell TC1 = new TableCell();
        TableCell TC2 = new TableCell();
        TableCell TC3 = new TableCell();
        TableCell TC4 = new TableCell();
        TableCell TC5 = new TableCell();
        TableCell TC6 = new TableCell();
        TextBox   TB  = new TextBox()
        {
            ID = "TB" + i.ToString()
        };
        EventHandler EH = new EventHandler(TextChangged);

        TB.TextChanged += EH;
        TB.AutoPostBack = true;
        AutoCompleteExtender AC = new AutoCompleteExtender()
        {
            TargetControlID     = TB.ID,
            ServiceMethod       = "GetSpecificationList",
            MinimumPrefixLength = 1,
            UseContextKey       = true
        };

        TC1.Controls.Add(new Label()
        {
            Text = "商品名:"
        });
        TC3.Controls.Add(new Label()
        {
            Text = "进货数量:"
        });
        TC5.Controls.Add(new Label()
        {
            Text = "生产厂家:"
        });
        TC2.Controls.Add(TB);
        TC2.Controls.Add(AC);
        TC4.Controls.Add(new TextBox());
        TC6.Controls.Add(new DropDownList()
        {
            Width = 150
        });
        TR.Controls.Add(TC1);
        TR.Controls.Add(TC2);
        TR.Controls.Add(TC3);
        TR.Controls.Add(TC4);
        TR.Controls.Add(TC5);
        TR.Controls.Add(TC6);
        Table1.Controls.Add(TR);
        //this.ClientScript.RegisterStartupScript(this.GetType(), "1", "<script>readybind(){$('.ProName').bind('focusout', function (event) {event = event || window.event;var obj = event.target;JudgeProName(obj)}</script>");
    }
Example #20
0
        private void Instance_TargetControlLoaded(Control targetControl)
        {
            AutoCompleteExtender auto = targetControl as AutoCompleteExtender;

            if (auto != null)
            {
                auto.GetDataSource += new AutoCompleteExtender.GetDataSourceDelegate(ctrlAutoCompleteExtender_GetDataSource);
            }
        }
Example #21
0
        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());
        }
Example #22
0
    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);
    }
Example #23
0
        /// <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);
        }
Example #25
0
    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());
    }
Example #27
0
    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());
    }
Example #28
0
        /// <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[] 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);
    }
Example #30
0
    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());
    }