Example #1
0
        public List <WarshaRequestDTO> GetAllRequestsCityPermission(int workshop)
        {
            OfferQuery offerQuery = new OfferQuery(language);

            System.Data.DataTable dataTable = conn_db.ReadTable(offerQuery.GetAllRequestsCityPermission(workshop));

            if (dataTable.Rows.Count == 0)
            {
                throw new EmptyViewException(language);
            }

            WarshaRequestDTO        workshopRequestDTO = new WarshaRequestDTO();
            List <WarshaRequestDTO> workshopRequests   = new List <WarshaRequestDTO>();

            foreach (System.Data.DataRow row in dataTable.Rows)
            {
                workshopRequestDTO              = new WarshaRequestDTO();
                workshopRequestDTO.ACCIDENT_ID  = Convert.ToInt32(row["ACCIDENT_ID"].ToString());
                workshopRequestDTO.FULLNAME     = row["FULLNAME"].ToString();
                workshopRequestDTO.PLATENUMBER  = row["PLATENUMBER"].ToString();
                workshopRequestDTO.MANUFACTURER = row["MANUFACTURER"].ToString();
                workshopRequestDTO.MODEL        = row["MODEL"].ToString();
                workshopRequestDTO.FOUNDDATE    = row["FOUNDDATE"].ToString();
                workshopRequestDTO.COLOR        = row["COLOR"].ToString();
                workshopRequestDTO.paper_NO     = row["paper_NO"].ToString();
                workshopRequestDTO.LocationX    = Convert.ToDouble(row["LocationX"].ToString());
                workshopRequestDTO.LocationY    = Convert.ToDouble(row["LocationY"].ToString());
                workshopRequestDTO.Image        = row["url"].ToString();
                try
                {
                    workshopRequestDTO.ACCIDENTDATE = Convert.ToDateTime(row["AccidentDate"].ToString()).ToString("dd-MM-yyyy h:mm tt");
                }
                catch
                {
                    workshopRequestDTO.ACCIDENTDATE = "01-01-2000";
                }

                workshopRequestDTO.Status       = Convert.ToInt32(row["Status"].ToString());
                workshopRequestDTO.statusNameAr = row["status_Name_Ar"].ToString();
                workshopRequestDTO.statusNameEn = row["status_Name_En"].ToString();

                workshopRequests.Add(workshopRequestDTO);
            }
            return(workshopRequests);
        }