Hi
Logicall y everthing is going wrong
i am trying to filter records based on the experience of the doctor
say i have a table
which retrieved
cs_Id months cs_ConsultationFee DoctorName
1 120 100 Dr Palle
2 100 200 Dr Skora
3 109 300 Dr Luki
4 24 400 Dr Azun
5 60 100 Dr Kamalio
I have 5 check box which filters out expirence according to the checkboxes checked
check box 1 ("Months >= 120 AND Months <= 240 ")
check box 2 ("Months >= 60 AND Months <= 120 ");
check box 3 ("Months >= 24 AND Months <= 60 ");
check box 4 ("Months >= 12 AND Months <= 24 ");
check box 5 ("dt.Select("Months <= 12")");
if i select check box 1 it must filter our all docotrs who have experience between 120 and 240 one can select all check box also
I have another 5 check box which filters out Consulting fees according to the checkboxes checked
check box 1 ("Months >= 120 AND Months <= 240 ")
check box 2 ("fees>= 60 AND fees<= 120 ");
check box 3 ("fees>= 24 AND fees<= 60 ");
check box 4 ("fees>= 12 AND fees<= 24 ");
check box 5 ("dt.Select("Months <= 12")");
if i select check box 2 it must filter our all docotrs who have fees between 24 and 60one can select all check box also
#region CHECK YEARS
DataTable dt = obj.BindClinic_details(Doctormlid, city, Locality, lblProblem, speciality);
DataTable dtFilter = dt.Clone();
int chkcount = 0;
if (chk10to20years.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("Months >= 120 AND Months <= 240 ");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
if (chk5to10years.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("Months >= 60 AND Months <= 120 ");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
if (chk2to5years.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("Months >= 24 AND Months <= 60 ");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
if (chk_1to2years.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("Months >= 12 AND Months <= 24 ");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
if (chk_0to1years.Checked == true)
{
DataRow[] drs = dt.Select("Months <= 12");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
#endregion
#region CONSULTING FEES
if (chkabove1000.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("cs_ConsultationFee >= 1000");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
if (chk700to1000.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("cs_ConsultationFee >= 700 AND cs_ConsultationFee <= 1000 ");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
if (chk400to699.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("cs_ConsultationFee >= 400 AND cs_ConsultationFee <= 699 ");
drs = dtFilter.Select("cs_ConsultationFee >= 400 AND cs_ConsultationFee <= 699 ");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
if (chk200to399.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("cs_ConsultationFee >= 200 AND cs_ConsultationFee <= 399 ");
drs = dtFilter.Select("cs_ConsultationFee >= 200 AND cs_ConsultationFee <= 399 ");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
if (chk0to199.Checked == true)
{
DataRow[] drs = null;
drs = dt.Select("cs_ConsultationFee <= 199");
foreach (DataRow d in drs)
{
if (dtFilter.Rows.Count != 0)
{
int cnt = (from i in dt.AsEnumerable()
where i.Field<int>("cs_Id").ToString() == d["cs_Id"].ToString()
select i).Count();
if (cnt == 0)
{
dtFilter.ImportRow(d);
}
}
else
{
dtFilter.ImportRow(d);
}
}
chkcount++;
}
#endregion