Exemple #1
0
    public ArrayList GetMostrePaged(int pageIndex, int pageSize)
    {
        int       startIdx = pageSize * pageIndex + 1;
        int       endIdx   = pageSize * (pageIndex + 1);
        ArrayList values   = new ArrayList();

        SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
        SqlCommand    cmd = new SqlCommand();

        cmd.Connection     = cnn;
        cmd.CommandText    = GetSelectStatement(startIdx, endIdx);
        cmd.CommandTimeout = 300;
        cnn.Open();
        SqlDataReader reader = cmd.ExecuteReader();

        while (reader.Read())
        {
            VMostre vm = new VMostre();
            vm.id       = Convert.ToString(reader["ID"]);
            vm.codbare  = Convert.ToString(reader["CodBare"]);
            vm.idzilnic = Convert.ToString(reader["IdZilnic"]);
            vm.datat    = Convert.ToString(reader["DataTestare"]);


            vm.grasime  = Convert.ToString(reader["Grasime"]);
            vm.proteina = Convert.ToString(reader["ProcentProteine"]);
            vm.lactoza  = Convert.ToString(reader["ProcentLactoza"]);
            vm.substu   = Convert.ToString(reader["SubstantaUscata"]);
            vm.pcti     = Convert.ToString(reader["PunctInghet"]);
            vm.apaad    = "";
            if (!string.IsNullOrEmpty(vm.pcti) && vm.pcti != "0" && vm.pcti.IndexOf(".") < 0)
            {
                vm.apaad = UMostre.ApaAdaugata(vm.pcti);
            }
            vm.antib = Convert.ToString(reader["Antibiotice"]);
            if (vm.antib == "-1" || vm.antib == "1")
            {
                vm.antib = "Pozitiv";
            }
            else if (vm.antib == "0")
            {
                vm.antib = "Negativ";
            }
            vm.ncs        = Convert.ToString(reader["NumarCeluleSomatice"]);
            vm.ntg        = Convert.ToString(reader["IncarcaturaGermeni"]);
            vm.urea       = Convert.ToString(reader["Urea"]);
            vm.ph         = Convert.ToString(reader["PH"]);
            vm.casein     = Convert.ToString(reader["Caseina"]);
            vm.validat    = Convert.ToString(reader["Validat"]);
            vm.bvalidat   = Convert.ToBoolean(reader["Validat"]);
            vm.bdefinitiv = Convert.ToBoolean(reader["Definitiv"]);
            vm.definitiv  = Convert.ToString(reader["Definitiv"]);
            vm.dataf      = Convert.ToString(reader["DataTestareFinala"]);
            values.Add(vm);
        }
        reader.Close();
        cnn.Close();
        return(values);
    }