private void SearchLab_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (SearchLab.GetItemText(SearchLab.SelectedItem) != "" && searchKeyword.Text != "")
     {
         DoSearch();
     }
     if (SearchLab.GetItemText(SearchLab.SelectedItem) != "" && OrderBy.GetItemText(OrderBy.SelectedItem) != "")
     {
         DoSearch();
     }
     if (searchKeyword.Text != "" && SearchLab.GetItemText(SearchLab.SelectedItem) == "" && OrderBy.GetItemText(OrderBy.SelectedItem) == "")
     {
         DoSearch();
     }
 }
Exemplo n.º 2
0
 private void ValuesCambo(List <Label> labels, String action)
 {
     foreach (var lbl in labels)
     {
         if (lbl.Name.StartsWith("lab") && action == "load")
         {
             SearchLab.Items.Add(lbl.Text);
         }
         if (lbl.Text == SearchLab.GetItemText(SearchLab.SelectedItem) && action == "search")
         {
             //.GetItemText(this.ComboBox.SelectedItem)
             var tmp = lbl.Name.Substring(3);
             this.searchLbTxt = tmp;
         }
     }
 }
Exemplo n.º 3
0
        public ActionResult searchlabs(string LaboratoryName)
        {
            int count = 0;

            if (LaboratoryName != null)
            {
                if (LaboratoryName == string.Empty)
                {
                    return(RedirectToAction("Index", "Laboratories"));
                }
                else
                {
                    var Labs = (from Lab in db.Laboratories
                                select Lab).Distinct();

                    if (!string.IsNullOrEmpty(LaboratoryName))
                    {
                        Labs = Labs.Where(x => x.LaboratoryName.StartsWith(LaboratoryName));
                        foreach (AgroNet.Models.Laboratories L in Labs)
                        {
                            count = count + 1;
                        }
                        ViewData["Count"] = count;
                    }
                    SearchLab SearchLab = new SearchLab(LaboratoryName);
                    Session["SearchLab"] = SearchLab;
                    return(View("Index", Labs));
                }
            }
            else
            {
                SearchLab s    = (SearchLab)Session["SearchLab"];
                var       Labs = (from Lab in db.Laboratories
                                  select Lab).Distinct();
                if (!string.IsNullOrEmpty(s.LaboratoryName))
                {
                    Labs = Labs.Where(x => x.LaboratoryName.StartsWith(s.LaboratoryName));
                    foreach (AgroNet.Models.Laboratories L in Labs)
                    {
                        count = count + 1;
                    }
                    ViewData["Count"] = count;
                }
                return(View("Index", Labs));
            }
        }
Exemplo n.º 4
0
 private void ValuesCambo(List <Label> labels, String action)
 {
     foreach (var lbl in labels)
     {
         if (lbl.Name.StartsWith("lab") && action == "load")
         {
             SearchLab.Items.Add(lbl.Text);
         }
         if (lbl.Text == SearchLab.GetItemText(SearchLab.SelectedItem) && action == "search")
         {
             //.GetItemText(this.ComboBox.SelectedItem)
             var    tmp    = lbl.Name.Substring(3);
             int    Place  = tmp.IndexOf("_");
             string result = tmp.Remove(Place, 1).Insert(Place, ".");
             this.searchLbTxt = result;
         }
     }
 }