public DataSet EIDTestedSummary(int facility, int user_id, string role, string ReceiveFrom, string ReceiveTo, string CollectFrom, string CollectTo, string TestedFrom, string TestedTo, string ProvinceId, string FacilityType1, string LabCode)
        {
            string connstring = TechnicalSettings.Decrypt(TechnicalConfig.GetConfiguration()["ConnectionString"].ToString());

            using (SqlConnection cn = new SqlConnection(connstring))
            {
                cn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "GetRptEIDTestedSummary";
                cmd.Parameters.AddWithValue("@facility", facility);
                cmd.Parameters.AddWithValue("@type", role);
                cmd.Parameters.AddWithValue("@user_id", user_id);
                cmd.Parameters.AddWithValue("@provinceIDs", ProvinceId);
                cmd.Parameters.AddWithValue("@facilityTypes", FacilityType1);
                cmd.Parameters.AddWithValue("@ReceiveFrom", ReceiveFrom);
                cmd.Parameters.AddWithValue("@ReceiveTo", ReceiveTo);
                cmd.Parameters.AddWithValue("@CollectFrom", CollectFrom);
                cmd.Parameters.AddWithValue("@CollectTo", CollectTo);
                cmd.Parameters.AddWithValue("@TestedFrom", TestedFrom);
                cmd.Parameters.AddWithValue("@TestedTo", TestedTo);
                cmd.Parameters.AddWithValue("@LabCode", LabCode);
                var da = new SqlDataAdapter(cmd);
                var ds = new DataSet();
                da.Fill(ds);
                cn.Close();
                return(ds);
            }
        }
        public DataSet GetRptARTMonthlyByIndicators(int user_id, string role, int year, int month, string ProvinceId, string FacilityType1, string LabCode)
        {
            string connstring = TechnicalSettings.Decrypt(TechnicalConfig.GetConfiguration()["ConnectionString"].ToString());

            using (SqlConnection cn = new SqlConnection(connstring))
            {
                cn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "GetRptARTMonthlyByIndicators";
                cmd.Parameters.AddWithValue("@type", role);
                cmd.Parameters.AddWithValue("@user_id", user_id);
                cmd.Parameters.AddWithValue("@provinceIDs", ProvinceId);
                cmd.Parameters.AddWithValue("@facilityTypes", FacilityType1);
                cmd.Parameters.AddWithValue("@Year", year);
                cmd.Parameters.AddWithValue("@Month", month);
                cmd.Parameters.AddWithValue("@LabCode", LabCode);
                var da = new SqlDataAdapter(cmd);
                var ds = new DataSet();
                da.Fill(ds);
                cn.Close();
                return(ds);
            }
        }
        public IList GetLaboratories()
        {
            string connstring = TechnicalSettings.Decrypt(ConfigurationManager.ConnectionStrings["LISReportConnectionString"].ToString());

            using (SqlConnection cn = new SqlConnection(connstring))
            {
                cn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "GetLaboratories";

                var da = new SqlDataAdapter(cmd);
                var ds = new DataSet();
                da.Fill(ds);
                cn.Close();

                var testResult = ds.Tables[0].AsEnumerable().Select(
                    dataRow => new ArrayList {
                    dataRow.Field <int>("Id"),
                    dataRow.Field <string>("LabCode"),
                    dataRow.Field <string>("LaboratoryName"),
                    dataRow.Field <string>("Description")
                }).ToList();
                return(testResult);
            }
        }
        public DataSet GetLabDataEntryPerformanceList()
        {
            string connstring = TechnicalSettings.Decrypt(ConfigurationManager.ConnectionStrings["LISReportConnectionString"].ToString());

            using (SqlConnection cn = new SqlConnection(connstring))
            {
                cn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "GetLabDataEntryPerformanceList";

                var da = new SqlDataAdapter(cmd);
                var ds = new DataSet();
                da.Fill(ds);
                cn.Close();
                return(ds);
            }
        }
        //Added by ZaySoe on 19_Dec_2018
        public DataSet VLReport(int ProvinceId, int FacilityId, string Test,
                                string CollectedDateFrom, string CollectedDateTo, string ReceivedDateFrom, string ReceivedDateTo,
                                string specimenStatus, int NumberOfTests, string LabNumber, string LabNumberTo, string PatientCode, int Year,
                                string ARTNumber, string patientType, string labCode)
        {
            string connstring = TechnicalSettings.Decrypt(ConfigurationManager.ConnectionStrings["LISReportConnectionString"].ToString());

            using (SqlConnection cn = new SqlConnection(connstring))
            {
                cn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "VLGetAllListforDetailByCriteria";
                cmd.Parameters.AddWithValue("@ProvinceId", ProvinceId);
                cmd.Parameters.AddWithValue("@FacilityId", FacilityId);
                cmd.Parameters.AddWithValue("@Test", Test);
                cmd.Parameters.AddWithValue("@CollectedDateFrom", CollectedDateFrom);
                cmd.Parameters.AddWithValue("@CollectedDateTo", CollectedDateTo);
                cmd.Parameters.AddWithValue("@RecievedDateFrom", ReceivedDateFrom);
                cmd.Parameters.AddWithValue("@RecievedDateTo", ReceivedDateTo);
                cmd.Parameters.AddWithValue("@SpecimenStatus", specimenStatus);
                cmd.Parameters.AddWithValue("@NumberOfTests", NumberOfTests);
                cmd.Parameters.AddWithValue("@LabNumber", LabNumber);
                cmd.Parameters.AddWithValue("@LabNumberTo", LabNumberTo);
                cmd.Parameters.AddWithValue("@PatientCode", PatientCode);
                cmd.Parameters.AddWithValue("@Year", Year);
                cmd.Parameters.AddWithValue("@ARTNumber", ARTNumber);
                cmd.Parameters.AddWithValue("@PatientType", patientType);
                cmd.Parameters.AddWithValue("@LabCode", labCode);

                var da = new SqlDataAdapter(cmd);
                var ds = new DataSet();
                da.Fill(ds);
                int rows = ds.Tables[0].Rows.Count;
                cn.Close();
                return(ds);
            }
        }
        public DataSet GetUserLocationsInfo(int userId)
        {
            string connstring = TechnicalSettings.Decrypt(ConfigurationManager.ConnectionStrings["LISReportConnectionString"].ToString());

            using (SqlConnection cn = new SqlConnection(connstring))
            {
                cn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "GetUserLocationInfo";
                cmd.Parameters.AddWithValue("@user_id", userId);
                var da = new SqlDataAdapter(cmd);
                var ds = new DataSet();
                da.Fill(ds);
                cn.Close();
                //var eidIntialPCR = ds.Tables[0].AsEnumerable().Select(
                //    dataRow => new ArrayList {
                //        dataRow.Field<int>("UserId"),
                //        dataRow.Field<string>("UserName"),
                //        //dataRow.Field<int>("ProvinceId"),
                //        //dataRow.Field<string>("ProvinceName"),
                //        //dataRow.Field<int>("DistrictId"),
                //        //dataRow.Field<string>("DistrictName"),
                //        //dataRow.Field<int>("LLGId"),
                //        //dataRow.Field<string>("LLGName"),
                //        //dataRow.Field<int>("FacilityId"),
                //        //dataRow.Field<string>("FacilityName"),
                //        //dataRow.Field<int>("LabId"),
                //        //dataRow.Field<string>("LaboratoryName"),
                //        //dataRow.Field<bool>("IsFacility")
                //    }).ToList();
                //return eidIntialPCR;
                return(ds);
            }
        }