using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

using SCAN.Data.DataModel;
namespace SCAN.Data.DataAccess
{
    public class GetAccess
    {
        public static GetAccess Instant
        {
            get
            {
                return (new GetAccess());
            }
        }


        public string getduplicatemodel(string _model, string _serialproduct)
        {
            string ItemCodeCount = string.Empty;
            StringBuilder strQuery = new StringBuilder();
            strQuery.Append(" select count(model) from ProductMatching ");
            strQuery.Append(" where model = '" + _model + "'" + " and serialatproduct = '" + _serialproduct + "'  ");



            lib.LogWriter logger = lib.LogWriter.getInstance();
            logger.Log(strQuery.ToString());

            List<string[]> rows = new List<string[]>();
            lib.SqliteDb.query(strQuery.ToString(), ref rows);
            if (rows.Count > 0)
            {
                foreach (string[] row in rows)
                {
                    ItemCodeCount = row[0].ToString();


                }
            }

            return ItemCodeCount;

        }

        public string getreport()
        {
            string ItemCodeCount = string.Empty;
            StringBuilder strQuery = new StringBuilder();
            strQuery.Append(" select count(PartsNo) from ProductMatching ");
   

            lib.LogWriter logger = lib.LogWriter.getInstance();
            logger.Log(strQuery.ToString());

            List<string[]> rows = new List<string[]>();
            lib.SqliteDb.query(strQuery.ToString(), ref rows);
            if (rows.Count > 0)
            {
                foreach (string[] row in rows)
                {
                    ItemCodeCount = row[0].ToString();


                }
            }
            else
            {
                ItemCodeCount = "0";
            }
            
            return ItemCodeCount;

        }


    }

}
