Example #1
0
        public int createNewUserAgentStringEntry()
        {
            int newUserAgentStringID;
            SQLDataConnectionHelper sqlConnHelper = new SQLDataConnectionHelper();

            try
            {
                using (var scope = new TransactionScope())
                {
                    sqlConnHelper.setSqlConnectionStringUsingConfiguration();
                    sqlConnHelper.openConnection();
                    string sql_connStr = new TruckScheduleConfigurationKeysHelper().sql_connStr;

                    newUserAgentStringID = Convert.ToInt32(SqlHelper.ExecuteScalar(sql_connStr, CommandType.StoredProcedure, "sp_truckscheduleapp_insertNewUserAgentString", new SqlParameter("@pUserAgentString", this.userAgentString)));
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                string strErr = " Exception Error in UserAgentString getUserAgentStringID(). Details: " + ex.ToString();
                ErrorLogging.WriteEvent(strErr, EventLogEntryType.Error);
                throw ex;
            }

            finally
            {
                if (sqlConnHelper.doesConnectionExist())
                {
                    sqlConnHelper.closeConnection();
                }
            }

            return(newUserAgentStringID);
        }
        public List <InspectionList> getMainscheduleInspectionLists()
        {
            List <InspectionList>   inspList      = new List <InspectionList>();
            SQLDataConnectionHelper sqlConnHelper = new SQLDataConnectionHelper();

            try
            {
                sqlConnHelper.setSqlConnectionStringUsingConfiguration();
                sqlConnHelper.openConnection();
                SqlCommand sqlCmd = new SqlCommand("sp_truckschedapp_getMainScheduleInspectionListsForMSID", sqlConnHelper.getConnection());
                sqlCmd.CommandType = CommandType.StoredProcedure;

                SqlParameter pHidden = new SqlParameter("@pIsHidden", SqlDbType.Bit);
                SqlParameter pMSID   = new SqlParameter("@pMSID", SqlDbType.Int);
                pHidden.Value = 0;
                sqlCmd.Parameters.Add(pHidden);

                DataSet   dsMSILists  = new DataSet();
                DataTable tblMSILists = new DataTable();
                System.Data.SqlClient.SqlDataReader sqlReader = sqlCmd.ExecuteReader();
                dsMSILists.Tables.Add(tblMSILists);
                dsMSILists.Load(sqlReader, LoadOption.OverwriteChanges, tblMSILists);
                //populate return object
                foreach (System.Data.DataRow row in dsMSILists.Tables[0].Rows)
                {
                    //InspectionList nIL = new InspectionList();
                    //nIL.setMSInspectionListID(Convert.ToInt32(row["MSInspectionListID"]));
                    //nIL.setMSID(Convert.ToInt32(row["MSID"]));
                    //nIL.setInspectionListID(Convert.ToInt32(row["InspectionListID"]));
                    //nIL.setInspectionListName(row["InspectionListName"].ToString());
                    //nIL.setProductID_CMS(row["ProductID_CMS"].ToString());
                    //nIL.setRunNumber(Convert.ToInt32(row["RunNumber"]));

                    //inspList.Add(nIL);
                }
            }

            catch (Exception ex)
            {
                string strErr = " Exception Error in ScheduledTruck getMainscheduleInspectionLists(). Details: " + ex.ToString();
                ErrorLogging.WriteEvent(strErr, EventLogEntryType.Error);
                throw ex;
            }


            return(inspList);
        }