Beispiel #1
0
 public static DataTable GetTypes(string pType_ID = "", string pType_Name = "")
 {
     try
     {
         cConnect lConnect = new cConnect();
         string   lSql     = "Select * From Type";
         if (pType_ID != "" || pType_Name != "")
         {
             lSql += " Where ";
         }
         if (pType_Name != "")
         {
             lSql += " Name like '%" + pType_Name + "%'";
         }
         else if (pType_Name != "" && pType_ID != "")
         {
             lSql += " And ID_Sumo=" + pType_ID;
         }
         else if (pType_Name == "" && pType_ID != "")
         {
             lSql += " ID_Sumo=" + pType_ID;
         }
         return(lConnect.ReadDataTable(lSql));
     }
     catch (Exception lEx)
     {
         cNonServiceLogic.ThrowNapaka(new StackTrace().GetFrame(1).GetMethod().Name, lEx.Message);
         return(null);
     }
 }
Beispiel #2
0
        public static DataTable GetVehiclesDB(string pType_ID = "", string pRouteID = "", string pOsebaID = "", string pSerijskaStevilka = "")
        {
            try
            {
                cConnect lConnect = new cConnect();
                string   lSql     = "Select * From Vozilo";
                if (pType_ID != "" || pRouteID != "" || pOsebaID != "" || pSerijskaStevilka != "")
                {
                    lSql += " Where ";
                }
                if (pType_ID != "")
                {
                    lSql += " TypeID=" + pType_ID;
                }

                if (pRouteID != "" && pType_ID == "")
                {
                    lSql += " RouteID=" + pRouteID;
                }
                else if (pRouteID != "" && pType_ID != "")
                {
                    lSql += " And RouteID=" + pRouteID;
                }

                if (pOsebaID != "" && (pType_ID == "" && pRouteID == ""))
                {
                    lSql += " OsebaID=" + pOsebaID;
                }
                else if (pOsebaID != "" && (pRouteID != "" || pType_ID != ""))
                {
                    lSql += " And OsebaID=" + pOsebaID;
                }

                if (pSerijskaStevilka != "" && (pOsebaID == "" && pRouteID == "" && pType_ID == ""))
                {
                    lSql += " SerijskaStevilka=" + pSerijskaStevilka;
                }
                else if (pSerijskaStevilka != "" && (pOsebaID != "" || pRouteID != "" || pType_ID != ""))
                {
                    lSql += " AND SerijskaStevilka=" + pSerijskaStevilka;
                }
                return(lConnect.ReadDataTable(lSql));
            }
            catch (Exception lEx)
            {
                cNonServiceLogic.ThrowNapaka(new StackTrace().GetFrame(1).GetMethod().Name, lEx.Message);
                return(null);
            }
        }
Beispiel #3
0
 //not implemented
 public static DataTable GetRoutes(string pID = "", string pStart = "", string pStop = "", string pVia = "")
 {
     try
     {
         cConnect lConnect = new cConnect();
         string   lSql     = "Select * From Route";
         if (pID != "" || pStart != "" || pStop != "" || pVia != "")
         {
             lSql += " Where ";
         }
         return(null);
     }
     catch (Exception lEx)
     {
         cNonServiceLogic.ThrowNapaka(new StackTrace().GetFrame(1).GetMethod().Name, lEx.Message);
         return(null);
     }
 }
Beispiel #4
0
 public static DataTable GetPersons(string pImePriimek = "", string pTRR = "")
 {
     try
     {
         cConnect lConnect = new cConnect();
         string   lSql     = "Select * From Oseba";
         if (pImePriimek != "" || pTRR != "")
         {
             lSql += " Where ";
         }
         if (pImePriimek != "")
         {
             string lIme     = "";
             string lPriimek = "";
             if (pImePriimek.Split(' ').Count() > 0)
             {
                 lIme = lPriimek.Split(' ')[0];
                 if (pImePriimek.Split(' ').Count() > 1)
                 {
                     lPriimek = pImePriimek.Split(' ')[1];
                 }
             }
             lSql += " Ime like '%" + lIme + "%'";
             if (lPriimek != "")
             {
                 lSql += " Priimek like '%" + lPriimek + "%'";
             }
         }
         else if (pImePriimek != "" && pTRR != "")
         {
             lSql += " And ID_Sumo=" + pTRR;
         }
         else if (pImePriimek == "" && pTRR != "")
         {
             lSql += " ID_Sumo=" + pTRR;
         }
         return(lConnect.ReadDataTable(lSql));
     }
     catch (Exception lEx)
     {
         cNonServiceLogic.ThrowNapaka(new StackTrace().GetFrame(1).GetMethod().Name, lEx.Message);
         return(null);
     }
 }