Esempio n. 1
0
        private List<ToolDTO> GetServiceDate()
        {
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SP_GetServiceDate";
            cmd.Parameters.Clear();

            cmd.Transaction = trans.GetTransaction();
            cmd.Connection = trans.GetTransaction().Connection;
            SqlDataReader datareader = cmd.ExecuteReader();
            ToolDTO toolDTO;
            List<ToolDTO> dates = new List<ToolDTO>();
            while(datareader.Read() == true)
            {
                toolDTO = new ToolDTO();
                toolDTO.ToolID = (int)datareader["FK_ToolID"];

                //toolDTO.ServiceDate = Convert.ToDateTime(datareader["Service_Date"]);

                //DateTime date1;
                //DateTime.TryParse((string)datareader["Service_Date"], out date1);
                //toolDTO.ServiceDate = date1;

                //toolDTO.ServiceDate = datareader.GetDateTime(1);
                toolDTO.ServiceDate = (DateTime)datareader["Service_Date"];
                dates.Add(toolDTO);
            }
            datareader.Close();
            cmd.ExecuteNonQuery();
            return dates;
        }
Esempio n. 2
0
        private List<ToolDTO> GetTools()
        {
            ToolDTO toolDTO;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SP_GetAllTools";
            cmd.Parameters.Clear();

            cmd.Transaction = trans.GetTransaction();
            cmd.Connection = trans.GetTransaction().Connection;
            SqlDataReader datareader = cmd.ExecuteReader();

            List<ToolDTO> tools = new List<ToolDTO>();

            while (datareader.Read() == true)
            {
                toolDTO = new ToolDTO();
                toolDTO.ToolID = (int)datareader["ToolID"];
                toolDTO.Type = (string)datareader["Type"];
                toolDTO.ServiceDate = null;
                tools.Add(toolDTO);
            }
            datareader.Close();
            cmd.ExecuteNonQuery();
            return tools;
        }
Esempio n. 3
0
        private List<ToolDTO> GetMileage()
        {
            ToolDTO toolDTO;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SP_GetAllMileage";
            cmd.Parameters.Clear();

            cmd.Transaction = trans.GetTransaction();
            cmd.Connection = trans.GetTransaction().Connection;
            SqlDataReader datareader = cmd.ExecuteReader();

            List<ToolDTO> miles = new List<ToolDTO>();

            while (datareader.Read() == true)
            {
                toolDTO = new ToolDTO();
                toolDTO.ToolID = (int)datareader["FK_ToolID"];
                toolDTO.HoursToService = (int)datareader["Service_Mileage"];
                toolDTO.ActualHours = (int)datareader["Actual_Mileage"];
                toolDTO.HoursPerDay = (int)datareader["Miles_Per_Day"];
                miles.Add(toolDTO);
            }
            datareader.Close();
            cmd.ExecuteNonQuery();
            return miles;
        }