Ejemplo n.º 1
0
    protected void SortButton_Click(object sender, EventArgs e)
    {
        table1.Visible = false;
        DataSet ds;
        string  whereclout = "";
        string  str        = "qwertyuiopasdfghjkl;zxcvbnm|,./'[]{}\\`!@#$%^&*()_-+=*.<>QWERTYUIOPASDFGHJKLZXCVBNM";

        if (MoneyFrom.Text != "" || MoneyTo.Text != "")
        {
            for (int i = 0; i < str.Length; i++)
            {
                if (MoneyFrom.Text.IndexOf(str[i]) != -1)
                {
                    Response.Write("<script>alert('טווח מחירים לא תקין')</script>");
                    return;
                }
                if (MoneyTo.Text.IndexOf(str[i]) != -1)
                {
                    Response.Write("<script>alert('טווח מחירים לא תקין')</script>");
                    return;
                }
            }
        }
        //init
        SearchReasultGrid.Visible = true;
        CloseMedicineGrid.Visible = true;
        //end init
        //creating the sort SQL line
        int pro = ProducerDDL.SelectedIndex + 1;
        int cat = DropDownListMedicineCatagory.SelectedIndex + 1;

        if (pro > 1)
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicineProducer=" + pro;
        }
        if (cat > 1)
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicineCatagory=" + cat;
        }
        if (MoneyFrom.Text != "")
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicinePrice> " + Convert.ToInt32(MoneyFrom.Text);
        }
        if (MoneyTo.Text != "")
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicinePrice< " + Convert.ToInt32(MoneyTo.Text);
        }
        string man = ManualSearch.Text;

        if (man != "")
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "(MedicineName LIKE '%" + man + "%')";
        }
        if (WithPresRB.Checked == true)
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicineNeedPrescription=true";
        }
        if (WithoutPresRB.Checked == true)
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicineNeedPrescription=false";
        }
        if (whereclout != "")
        {
            whereclout = whereclout + " and ";
        }
        else
        {
            whereclout = " where ";
        }
        whereclout = whereclout + "MedicineProducer=MedicineProducerId and MedicineCatagoryId=MedicineCatagory";

        Pharmcy.PharmcyWS web = new Pharmcy.PharmcyWS();
        ds = web.SortMedicine(whereclout);
        if (ds.Tables[0].Rows.Count == 0)
        {
            CloseMedicineGrid.Visible = false;
            Response.Write("<script>alert('לא נמצאו תרופות')</script>");
            CloseMedicineGrid_Click(sender, e);
            return;
        }
        SearchReasultGrid.DataSource = ds;
        SearchReasultGrid.DataBind();
        table1.Visible = true;
    }
Ejemplo n.º 2
0
    protected void SortButton_Click(object sender, EventArgs e)
    {
        CloseButton_Click(sender, e);
        DataSet       ds;
        string        sex;
        DoctorService docs       = new DoctorService();
        int           spec       = DropDownListSpec.SelectedIndex + 1;
        int           gen        = DropDownListGen.SelectedIndex + 1;
        int           city       = DropDownListCity.SelectedIndex + 1;
        string        manual     = ManualSearch.Text;
        string        wherestate = "";

        if (spec > 1)
        {
            if (wherestate != "")
            {
                wherestate = wherestate + " and ";
            }
            else
            {
                wherestate = " where ";
            }

            wherestate = wherestate + "DoctorSpecailty = " + spec;
        }
        if (gen > 1)
        {
            if (gen == 2)
            {
                sex = "זכר";
            }
            else
            {
                sex = "נקבה";
            }

            if (wherestate != "")
            {
                wherestate = wherestate + " and ";
            }
            else
            {
                wherestate = " where ";
            }
            wherestate = wherestate + "DoctorGender='" + sex + "'";
        }
        if (city > 1)
        {
            if (wherestate != "")
            {
                wherestate = wherestate + " and ";
            }
            else
            {
                wherestate = " where ";
            }
            wherestate = wherestate + "DoctorCity=" + city;
        }
        if (wherestate == "")
        {
            wherestate = " where CityId=DoctorCity and SpecialityId=DoctorSpecailty";
        }
        else
        {
            wherestate = wherestate + " and CityId=DoctorCity and SpecialityId=DoctorSpecailty";
        }
        if (manual != "")
        {
            if (wherestate != "")
            {
                wherestate = wherestate + " and ";
            }
            else
            {
                wherestate = " where ";
            }
            wherestate = wherestate + "(DoctorName LIKE '%" + manual + "%')";
        }
        ds = docs.SortDoctor(wherestate);
        if (ds.Tables[0].Rows.Count != 0)
        {
            SearchReasultGrid.Visible    = true;
            SearchReasultGrid.DataSource = ds;
            SearchReasultGrid.DataBind();
            CloseButton.Visible = true;
        }
        else
        {
            Response.Write("<script>alert('לא נמצאו רופאים')</script>");
        }
    }