Exemple #1
0
        static void Main(string[] args)
        {

            Employee employee = new Employee("Treele", "Grumbus", DateTime.Now);
            Console.Write("Full Name:");
            Console.WriteLine(employee.GetFullName());
            Console.WriteLine("Hire Date:");
            employee.ShowHireDate();

            //explicit interface example
            Parcel parcel = new Parcel();
            IJapan toJapan = (IJapan)parcel;
            IMexico toMexico = (IMexico)parcel;

            const decimal WEIGHT = 3.89m;

            Console.WriteLine("Mailing to Mexico costs " + toMexico.Cost(WEIGHT).ToString("C")) ;
            Console.WriteLine("Mailing to Japan costs " + toJapan.Cost(WEIGHT).ToString("C"));

            Inspection<float> airTest = new Inspection<float>();
            airTest.Items.Add(290.0f);
            airTest.Items.Add(287.0f);

            Console.WriteLine("Sample Date: " + airTest.Time.ToString("m"));

            foreach (float sample in airTest.Items)
            {
                Console.WriteLine(sample + " parts per million.");
            }
            Console.ReadLine();
        }
        /// <summary>
        /// Saves the space ship inspection.
        /// </summary>
        /// <param name="inspection">The inspection.</param>
        /// <param name="inspectionDetails">The inspection details.</param>
        public void SaveSpaceShipInspection(Inspection inspection, IEnumerable<InspectionDetail> inspectionDetails)
        {
            using (var scope = new TransactionScope())
            {
                DataContext.Inspections.InsertOnSubmit(inspection);
                foreach (var inspectionDetail in inspectionDetails)
                {
                    DataContext.InspectionDetails.InsertOnSubmit(inspectionDetail);
                }

                DataContext.SubmitChanges();
                scope.Complete();
            }
        }
Exemple #3
0
        // GET: Inspections/Edit/5
        public ActionResult Edit(int?id)
        {
            ViewBag.Warning = "Please be patient, as this page is undergoing layout and style fixes.";
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Inspection inspection = db.Inspections.Find(id);

            if (inspection == null)
            {
                return(HttpNotFound());
            }
            ViewBag.HiveID   = new SelectList(db.Hives, "Id", "HiveName", inspection.HiveID);
            ViewBag.WorkerID = new SelectList(db.Workers, "Id", "WorkerName", inspection.WorkerID);
            return(View(inspection));
        }
Exemple #4
0
        private static async Task getInspectionLabels(MeterageRepository mR, Inspection fromSqlsInspection, JournalInspection journalInspection)
        {
            var labels        = new List <JournalInspectionLabel>();
            var labelsFromSql = await mR.GetLabels(fromSqlsInspection.Id);

            foreach (var labelFromSql in labelsFromSql)
            {
                labels.Add(new JournalInspectionLabel
                {
                    CarriageName  = CreateCarriageName(labelFromSql.Label.Carriage.Train.Name, labelFromSql.Label.Carriage.Number),
                    EquipmentName = labelFromSql.Label.EquipmentModel.Equipment.Name,
                    LabelSerial   = labelFromSql.Label.Rfid,
                    TimeStamp     = labelFromSql.Date
                });
            }
            journalInspection.Tabs.Labels = labels.ToArray();
        }
        /// <summary>
        ///
        /// </summary>

        /// <param name="id">id of Inspection to fetch</param>
        /// <response code="200">OK</response>
        /// <response code="404">Inspection not found</response>

        public virtual IActionResult InspectionsIdPutAsync(int id, Inspection body)
        {
            var exists = _context.Inspections.Any(a => a.Id == id);

            if (exists && id == body.Id)
            {
                _context.Inspections.Update(body);
                // Save the changes
                _context.SaveChanges();
                return(new ObjectResult(body));
            }
            else
            {
                // record not found
                return(new StatusCodeResult(404));
            }
        }
Exemple #6
0
        public bool AddEmployee(Employee empl)
        {
            _container.Employees.Add(empl);
            int rows = 0;

            try
            {
                rows = _container.SaveChanges();
            }
            catch (Exception ex)
            {
                Inspection.CurrentException = ex;
                Inspection.NotifyError(log, ex.Message);
                return(false);
            }
            return(rows > 0);
        }
Exemple #7
0
        public async Task <InspectionDto> CreateInspectionAsync(InspectionDto createDto)
        {
            var vehicle = _dbContext.Vehicles.SingleOrDefault(v => v.Id == createDto.VehicleId);

            if (vehicle == null)
            {
                throw new ArgumentException("A valid vehicle entry is required!");
            }
            var inspection = new
                             Inspection(createDto.InspectorName, createDto.InspectionLocation, createDto.InspectionDate, vehicle);

            _dbContext.Inspections.Add(inspection);

            await _dbContext.SaveChangesAsync();

            return(MapToDto(inspection));
        }
Exemple #8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Inspection = await _context.Inspections.FindAsync(id);

            if (Inspection != null)
            {
                _context.Inspections.Remove(Inspection);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemple #9
0
        public static string ModifySave(string preinspcode, int modifyflag)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("[]");
            }
            bool bf      = Inspection.saveModifyFlag(preinspcode, modifyflag, user);
            var  jsonstr = "false";

            if (bf)
            {
                jsonstr = "success";
            }
            return(jsonstr);
        }
        public Inspection Analyze(SyntaxNode node)
        {
            if (!(node is ForEachStatementSyntax root))
            {
                return(null);
            }

            var enumerable = root.Expression.ToString();

            if (!(enumerable.Contains(".ToArray()") ||
                  enumerable.Contains(".ToList()")))
            {
                return(null);
            }

            return(Inspection.Create(this, node.LineNumber() + 1, node.Parent.ToFullString()));
        }
Exemple #11
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Inspection = await _context.Inspections
                         .Include(i => i.Agent)
                         .Include(i => i.Establishment).FirstOrDefaultAsync(m => m.Id == id);

            if (Inspection == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public string GenerateReport(string fileName, Inspection inspectionResult)
        {
            switch (inspectionResult.pass.ToLower())
            {
            case "pass":
                reportHandler = ReportFactory.GetReportHandler(ReportType.Pass);
                break;

            case "fail":
                reportHandler = ReportFactory.GetReportHandler(ReportType.Fail);
                break;
            }

            var path = reportHandler.GenerateReport(fileName, inspectionResult);

            return(path);
        }
Exemple #13
0
        public ActionResult Create([Bind(Include = "ID,AddressID,CustomerID,InspectorID,RealtorID,InspectionDate,InspectionStatusID,Price,InspectionReportID")] Inspection inspection)
        {
            if (ModelState.IsValid)
            {
                db.Inspections.Add(inspection);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AddressID          = new SelectList(db.Addresses, "ID", "Address1", inspection.AddressID);
            ViewBag.CustomerID         = new SelectList(db.Customers, "ID", "FirstName", inspection.CustomerID);
            ViewBag.InspectorID        = new SelectList(db.Inspectors, "ID", "FirstName", inspection.InspectorID);
            ViewBag.InspectionStatusID = new SelectList(db.InspectionStatus, "ID", "Name", inspection.InspectionStatusID);
            ViewBag.RealtorID          = new SelectList(db.Realtors, "ID", "FirstName", inspection.RealtorID);
            ViewBag.InspectionReportID = new SelectList(db.InspectionReports, "ID", "Name", inspection.InspectionReportID);
            return(View(inspection));
        }
Exemple #14
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (this.comboBox1.SelectedItem == null)
     {
         this.comboBox1.SelectedItem = this.comboBox1.Items[0];
     }
     this.inspection = InspectionMgr.Instance.FindBy((int)this.comboBox1.SelectedItem);
     if (this.inspection == null)
     {
         return;
     }
     this.inspection.SetImage(
         Machine.Instance.Camera.Executor.CurrentBytes,
         Machine.Instance.Camera.Executor.ImageWidth,
         Machine.Instance.Camera.Executor.ImageHeight);
     this.inspection.ShowEditWindow();
 }
 public void Delete(InspectionsBindingModel model)
 {
     using (var context = new Database())
     {
         Inspection element = context.Inspections.FirstOrDefault(rec => rec.Id ==
                                                                 model.Id);
         if (element != null)
         {
             context.Inspections.Remove(element);
             context.SaveChanges();
         }
         else
         {
             throw new Exception("Элемент не найден");
         }
     }
 }
        public int UpdateInspectionTransaction(Inspection inspection)
        {
            int result = 0;

            try
            {
                var inspectionID = GetInspectionTransactions().Where(i => i.inspectionID == inspection.inspectionID && i.projectID == inspection.projectID).FirstOrDefault().ID;
                inspection.ID = inspectionID;
                InspectionTransactionDO inspectionTransactionDO = Converter.GetInspectionTransactionDO(inspection);
                result = inspectionTransactionRepository.UpdateEntity(inspectionTransactionDO);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception Occured in UpdateInspectionTransaction method due to " + ex.Message);
            }
            return(result);
        }
        public async Task <List <Inspection> > Search(string grade, string facilityType, string county)
        {
            using (var http = new HttpClient())
            {
                var response = await http.GetAsync("http://www.scdhec.gov/Apps/Environment/FoodGrades/rate.aspx?pg=" + grade + "&ft=" + facilityType + "&cy=" + county);

                response.EnsureSuccessStatusCode();

                var responseContent = await response.Content.ReadAsStringAsync();

                var doc = new HtmlDocument();
                doc.LoadHtml(responseContent);

                var rows = doc.DocumentNode.SelectNodes("//table/tbody/tr");

                var inspections = new List <Inspection>();
                foreach (var row in rows)
                {
                    var cells = row.SelectNodes("./td");

                    var name        = cells[0].InnerText;
                    var street      = cells[1].InnerText;
                    var city        = cells[2].InnerText;
                    var gradeResult = cells[3].InnerText;
                    var date        = cells[4].InnerText;
                    var type        = cells[5].InnerText;

                    var inspectionUrl = cells[6].SelectSingleNode(".//a").GetAttributeValue("href", "");

                    var inspection = new Inspection()
                    {
                        City = city,
                        EstablishmentName = name,
                        FullReportUrl     = new Uri(inspectionUrl),
                        Grade             = gradeResult,
                        InspectionDate    = DateTime.Parse(date),
                        Street            = street,
                        Type = type,
                    };

                    inspections.Add(inspection);
                }

                return(inspections);
            }
        }
Exemple #18
0
        private void InitViewBag(Inspection info)
        {
            var Country = this._countryService.GetAll().OrderBy(x => x.NQ_Sort).ToList();
            var Store   = this._storeService.GetAll().Where(x => x.ID_Country == info.ID_Country).OrderBy(x => x.NQ_Sort).ToList();

            ViewBag.CountryList = new SelectList(Country, "ID_Country", "CX_Country", info.ID_Country);
            ViewBag.SotreList   = new SelectList(Store, "ID_Store", "CX_Store_Name", info.ID_Store);

            ViewBag.WrokPlaceList = new SelectList(this._workplaceService.GetAll().OrderBy(x => x.NQ_Sort), "ID_Workplace", "CX_Workplace", info.ID_Workplace);
            ViewBag.FeedBackList  = new SelectList(this._feedbackService.GetAll().OrderBy(x => x.NQ_Sort), "ID_Feedback", "CX_Feedback", info.ID_Feedback);

            ViewBag.ObservationList = new SelectList(this._observationService.GetAll().OrderBy(x => x.NQ_Sort), "ID_Observation", "CX_Observation", info.ID_Observation);

            ViewBag.TrackList = new SelectList(this._trackService.GetAll().OrderBy(x => x.NQ_Sort), "ID_Track", "CX_Track", info.ID_Track);

            ViewBag.StatusList = new SelectList(Status.GetAll().OrderBy(x => x.Value), "Value", "Text", info?.ID_Status);
        }
Exemple #19
0
        public async void SaveInspection(Inspection inspection)
        {
            Action action = new Action(() =>
            {
                lock (dbSync)
                {
                    database.InsertOrReplace(inspection, typeof(Inspection));
                    foreach (ScoredQuestion score in inspection.scores)
                    {
                        score.InspectionId = inspection.Id;
                        SaveScore(score);
                    }
                    foreach (Comment comment in inspection.comments)
                    {
                        comment.InspectionId = inspection.Id;
                        SaveComment(comment);
                    }
                    foreach (Inspector inspector in inspection.inspectors)
                    {
                        IEnumerable <InspectorInspections> linksAlreadyExist = database.Table <InspectorInspections>()
                                                                               .Where(l => l.InspectionId == inspection.Id && l.InspectorId == inspector.Id);
                        if (linksAlreadyExist.Any())
                        {
                            continue;
                        }
                        InspectorInspections link = new InspectorInspections();
                        link.InspectionId         = inspection.Id;
                        link.InspectorId          = inspector.Id;
                        database.InsertOrReplace(link);
                    }

                    //Remove any inspectors that are no longer on the inspection.
                    List <InspectorInspections> linksToDelete = new List <InspectorInspections>();
                    foreach (Inspector inspector in LoadAllInspectors())
                    {
                        if (!inspection.inspectors.Contains(inspector))
                        {
                            linksToDelete.AddRange(database.Table <InspectorInspections>()
                                                   .Where(link => link.InspectionId == inspection.Id && link.InspectorId == inspector.Id));
                        }
                    }
                    database.DeleteAll(linksToDelete);
                }
            });
            await Task.Run(action);
        }
Exemple #20
0
        private void inspection_button_result_Click(object sender, EventArgs e)
        {
            if (this.select_inspection == null)
            {
                return;
            }

            List <FileDescription>  files = new List <FileDescription>();
            List <TableLayoutPanel> lists = inspection_list.Controls.OfType <TableLayoutPanel>().ToList();

            foreach (TableLayoutPanel control in lists)
            {
                ComboBox        cb     = control.Controls.OfType <ComboBox>().ElementAt(0);
                Label           label  = control.Controls.OfType <Label>().ElementAt(0);
                string          path   = label.Text;
                int             action = cb.SelectedIndex;
                FileDescription file   = new FileDescription();
                file.path = path;
                switch (action)
                {
                case 1:
                    file.state = FileDescription.FilesStates.ToQuarantine;
                    break;

                case 2:
                    file.state = FileDescription.FilesStates.Delete;
                    break;

                default:
                    file.state = FileDescription.FilesStates.Allow;
                    break;
                }
                files.Add(file);
            }
            ServiceClient client = create_client();

            client.handle_files(files.ToArray(), this.select_inspection);

            client.remove_inspection(this.select_inspection);
            client.Close();
            inspection_list.Controls.Clear();
            inspection_label.Text  = "";
            this.select_inspection = null;
            inspections_update();
        }
        public async Task <IActionResult> Update(int id, [FromBody] Inspection inspection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Model invalid"));
            }

            if (id != inspection.Id)
            {
                return(BadRequest());
            }

            try
            {
                var inspectionDB = await repository.GetAsync(id);

                if (inspectionDB == null)
                {
                    return(NotFound());
                }

                if (inspectionDB.InspectionDate != inspection.InspectionDate)
                {
                    var result = await service.ValidateOnCreate(inspection.InspectorId, inspection.InspectionDate);

                    if (!result)
                    {
                        throw new ApplicationException("Only one Inspection per Inspector and Day could be created.");
                    }
                }

                repository.Update(inspection);
                await unitOfWork.CommitAsync();

                return(Ok(inspection));
            }
            catch (ApplicationException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                return(BadRequest("An error was thrown while trying to update inspection."));
            }
        }
Exemple #22
0
        private Inspection ToInspection(AccelaSDKModels.Inspection inspectionRecord)
        {
            var inspection = new Inspection
            {
                Id        = inspectionRecord.id.ToString(),
                Inspector = inspectionRecord.inspectorFullName,
                PermitNum = inspectionRecord.recordId.customId,

                // TODO verify this
                ScheduledDate = inspectionRecord.scheduledDate,
                DesiredDate   = inspectionRecord.scheduleDate,
                RequestDate   = inspectionRecord.requestDate,
                InspectedDate = inspectionRecord.completedDate,
            };

            if (inspectionRecord.type != null)
            {
                inspection.InspType = inspectionRecord.type.text;
            }

            if (this.config.InspectionType != null)
            {
                var mapping = this.config.InspectionType.SingleOrDefault <InspectionTypeMapping>(m => m.InspectionType == inspection.InspType);
                inspection.InspTypeMapped = mapping.InspectionTypeMapped;
            }

            if (inspectionRecord.status != null)
            {
                inspection.Result = inspectionRecord.status.text;
            }

            if (this.config.InspectionResult != null)
            {
                var mapping = this.config.InspectionResult.SingleOrDefault <InspectionResultMapping>(m => m.Result == inspection.Result);
                inspection.ResultMapped = mapping.ResultMapped;
            }

            if (inspectionRecord.resultComment != null && inspectionRecord.commentDisplay == "Y")
            {
                // TODO How to deal correctly with comment permission via inspectionRecord.commentPublicVisible?
                inspection.InspectionNotes = inspectionRecord.resultComment;
            }

            return(inspection);
        }
Exemple #23
0
 public CarEntity(
     int id,
     string name,
     int rundist,
     DateTime firstregist,
     int enginetype,
     int inspection,
     int isrepair
     )
 {
     Id          = id;
     Name        = new Name(name);
     RunDist     = new RunDist(rundist);
     FirstRegist = new FirstRegist(firstregist);
     EngineType  = new EngineType(enginetype);
     Inspection  = new Inspection(inspection);
     IsRepair    = new IsRepair(isrepair);
 }
Exemple #24
0
        public void InspectionTransformTest_AnonymousType()
        {
            var a = new { str1 = Guid.NewGuid().ToString(), str2 = Guid.NewGuid().ToString() };

            var res = (from i in Enumerable.Range(0, 2)
                       select a).ToList();

            Message message       = new Message(Guid.NewGuid().ToString(), SerializationOption.BinarySerializer, res.GetType());
            string  linqToCompare = string.Format(AnonymousListLinqScript, message.TruckId);


            Inspection linqQuery     = new Inspection(message);
            string     linqQueryText = linqQuery.TransformText();

            bool linqIsEqual = CompareNormalizedString(linqQueryText, linqToCompare);

            Assert.IsTrue(linqIsEqual);
        }
        public Inspection GetInspectionTransaction(int id)
        {
            Inspection inspectionTransaction = new Inspection();

            try
            {
                InspectionTransactionDO inspectionTransactionDO = inspectionTransactionRepository.GetEntity(id);
                if (inspectionTransactionDO != null)
                {
                    inspectionTransaction = Converter.GetInspectionTransaction(inspectionTransactionDO);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception Occured in GetInspectionTransaction method due to " + ex.Message);
            }
            return(inspectionTransaction);
        }
Exemple #26
0

        
        public void ShouldOnlyAddNewInfractions()
        {
            var actual = new Inspection("Pass", DateTime.Now);

            var infractions = new List <Infraction>
            {
                new Infraction("M - Minor", "Ticket", DateTime.Now.AddHours(-2), "", 0m)
            };

            actual.AddNewInfractions(infractions);

            infractions.Add(new Infraction("M - Minor", "Ticket", DateTime.Now, "", 0m));

            actual.AddNewInfractions(infractions);

            Assert.Equal(2, actual.Infractions.Count);
            Assert.Equal(infractions, actual.Infractions);
        }
        public async Task ShouldCompleteCompletedInspection()
        {
            // Given
            Inspection inspection = GetFinishedInspectionInstance();

            // repository containing the started inspection...
            var inspectionRepo = GetMockInspectionRepo(inspection);
            var testRepo       = MockMatchingTestRepo(inspection);
            var employeeRepo   = MockMatchingEmployeeRepo(inspection);

            var service = GetServiceInstance(inspectionRepo, testRepo, employeeRepo);

            // When // Act
            await service.CompleteInspectionAsync(inspection.Id, DateTime.Now, default(CancellationToken));

            // Then // Assert
            // not exception is thrown;
        }
Exemple #29
0
 public IActionResult Edit(InspectionViewModel obj)
 {
     //check for valid view model
     if (ModelState.IsValid)
     {
         using (InspectionDBContext db = new InspectionDBContext())
         {
             //object for view model
             Inspection i = obj.NewInspection;
             //retrieve primary key/id from route data
             i.InspectionId = Guid.Parse(RouteData.Values["id"].ToString());
             //update record status
             db.Entry(i).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     return(RedirectToAction("Index"));
 }
Exemple #30
0
        // GET: Schedule/Details/5
        public ActionResult Details(int?id)
        {
            int userId = Convert.ToInt16(Session["UserID"]); // Get employeeID from sessiondata

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Inspection inspection = db.Inspections.Where(f => f.QuestionList.Festival.Id == id)
                                    .Where(e => e.EmployeeId == userId)
                                    .FirstOrDefault();

            if (inspection == null)
            {
                return(HttpNotFound());
            }
            return(View(inspection));
        }
Exemple #31
0

        
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Inspection MyInspection = new Inspection();

        MyInspection.INSPTRANS    = hidInspTransNo.Value;
        MyInspection.MasterID     = Request.QueryString["MasterID"];
        MyInspection.NoticeNo     = HiddenNoticeNo.Value;
        MyInspection.INSPDATE     = InspDate.Text;
        MyInspection.EmployeeID   = ddInspectedBy.SelectedValue;
        MyInspection.CodeID       = ddInspectionType.SelectedValue;
        MyInspection.INSPTIME     = InspTime.Text;
        MyInspection.INSPCOMMENTS = Comments.Text;
        MyInspection.SortOrder    = Int32.Parse(SortOrder.Text);
        //   @INSPTIME REAL= null,
        //@INSPFinished BIT = 0,
        //@InspStatus VARCHAR(50)= null,
        //@InspComp BIT = 0,
        //@SystemToolName VARCHAR(50)= null,
        //@NoticeNo VARCHAR(50)= null,
        //@Refered BIT = 0,
        //@ReferedTo VARCHAR(50)= null,
        //@PresentedTo VARCHAR(50)= null,
        //@ReIinspection BIT = 0,
        //@ReInspectionPeriod INT= null,
        //@MethodOfDelivery VARCHAR(50)= null,
        //@FormType VARCHAR(50) = 'MAINT',
        //@StartDate SMALLDATETIME= null,
        //@FinishDate SMALLDATETIME= null,
        //@TenentImprovment BIT = 0,
        //@PresentedToPhone VARCHAR(50)= null,
        //@PresentedToAddr1 VARCHAR(150)= null,
        //@PresentedToAddr2 VARCHAR(150)= null,
        //@InspApproved BIT = 0,
        //@OKToCover BIT = 0,
        //@Temp_FinalOccApproved INT= null,
        //@SortOrder INT= null,
        //@FinalNotice BIT = 0,
        //@UpdatedBy VARCHAR(30)= null



        MyInspection.AddUpdateInspection();
    }
        static public void PopulateTestDB(TestContext ctx)
        {
            Database db = new Database("openpermit");
            string[] types = new string[] { "BLDG", "FIRE", "ELEC", "MECH", "PLUM" };
            string[] currStatus = new string[] { "APPLIED", "ISSUED", "CLOSED", "EXPIRED" };
            string[] statusMapped = new string[] { "Application Accepted", "Permit Issued", "Permit Finaled", "Permit Cancelled" };
            string[] applied = new string[] { "01/01/2012", "01/01/2013", "01/01/2014", "01/01/2015" };
            string[] issued = new string[] { "01/02/2012", "01/02/2013", "01/02/2014", "01/02/2015" };
            string[] closed = new string[] { "03/01/2012", "03/01/2013", "03/01/2014", "03/01/2015" };
            string[] expired = new string[] { "06/01/2012", "06/01/2013", "06/01/2014", "06/01/2015" };
            for (int i = 0; i < 30; i++)
            {
                Permit permit = new Permit();
                permit.AddedSqFt = i;
                permit.MasterPermitNum = (i % 2).ToString();
                permit.AppliedDate = Convert.ToDateTime(applied[i % 4]);
                permit.COIssuedDate = DateTime.Now;
                permit.CompletedDate = Convert.ToDateTime(closed[i % 4]);
                permit.ContractorAddress1 = String.Format("29{0} SW {1} Ave", i, i + 6);
                permit.ContractorAddress2 = "Address2_" + i.ToString();
                permit.ContractorCity = "Miami";
                permit.ContractorCompanyDesc = "Company Description " + i.ToString();
                permit.ContractorCompanyName = "Company Name " + i.ToString();
                permit.ContractorEmail = String.Format("Contractor_{0}@aecosoft.com", i);
                permit.ContractorFullName = "ContractorName_" + i.ToString();
                permit.ContractorLicNum = "34RT568903" + i.ToString();
                permit.ContractorPhone = "305-444-55" + (i + 10).ToString();
                permit.ContractorState = "FL";
                permit.ContractorStateLic = "FL5467021";
                permit.ContractorTrade = "ContractorTrade_" + i.ToString();
                permit.ContractorTradeMapped = "ContractrorTradeMapped_" + i.ToString();
                permit.ContractorZip = "331" + (i + 40).ToString();
                permit.Description = "PermitDescription_" + i.ToString();
                permit.EstProjectCost = 30000 + i;
                permit.ExpiresDate = Convert.ToDateTime(expired[i % 4]);
                permit.ExtraFields = "{'blah': 'blue'}";
                permit.Fee = 30 + i;
                permit.HoldDate = DateTime.Now;
                permit.HousingUnits = i;
                permit.IssuedDate = Convert.ToDateTime(issued[i % 4]);
                permit.Jurisdiction = "Miami-Dade";
                permit.Latitude = 25.700189 - (double)i/100;
                permit.Link = String.Format("http://permiturl{0}.com", i);
                permit.Longitude = -80.288020 - (double)i/100;
                permit.OriginalAddress1 = String.Format("8{0} NW 1{1}th Ave", i, i + 4);
                permit.OriginalAddress2 = "OrgAddress2_" + i.ToString();
                permit.OriginalCity = "Miami";
                permit.OriginalState = "FL";
                permit.OriginalZip = "331" + (i + 57).ToString();
                permit.PermitClass = "PERM_" + i.ToString();
                permit.PermitClassMapped = "PERM_" + i.ToString() + "_CLASS";
                permit.PermitNum = "PERMNUM_" + i.ToString();
                permit.PermitType = types[i % 5];
                permit.PermitTypeDesc = "TYPEDESC_" + i.ToString();
                permit.PermitTypeMapped = "TYPEMAPPEDDESC_" + i.ToString();
                permit.PIN = "456" + (10 + i).ToString();
                permit.ProjectId = "PROJID_" + i.ToString();
                permit.ProjectName = "PROJNAME_" + i.ToString();
                permit.ProposedUse = "PORPUSE_" + i.ToString();
                permit.Publisher = "PUBLISH_" + i.ToString();
                permit.RemovedSqFt = i;
                permit.StatusCurrent = currStatus[i % 4];
                permit.StatusCurrentMapped = statusMapped[i % 4];
                permit.StatusDate = DateTime.Now;
                permit.TotalAccSqFt = 10000 + i;
                permit.TotalFinishedSqFt = 5000 + i;
                permit.TotalHeatedSqFt = 5000 + i;
                permit.TotalSprinkledSqFt = 4000 + i;
                permit.TotalSqFt = 2500 + i;
                permit.TotalUnfinishedSqFt = 500 + i;
                permit.TotalUnheatedSqFt = 1000 + i;
                permit.VoidDate = DateTime.Now;
                permit.WorkClass = "WORKCLASS_" + i.ToString();
                permit.WorkClassMapped = "WORKCLASS_" + i.ToString();

                db.Insert("Permit", "PermitNum", false, permit);

                db.Execute("UPDATE Permit SET Location=geography::Point(Latitude, Longitude, 4326)");

            }

            for (int j = 0; j < 10; j++)
            {
                PermitStatus status = new PermitStatus();
                status.PermitNum = "PERMNUM_15";
                status.StatusPrevious = "STATUS_" + j;
                status.StatusPreviousDate = DateTime.Now;
                status.StatusPreviousMapped = "STATUSMAPPED_" + j;
                status.Comments = "COMMENTS_" + j;

                db.Insert("PermitStatus", "id", true, status);

            }

            for (int j = 0; j < 10; j++)
            {
                Inspection inspection = new Inspection();
                inspection.PermitNum = "PERMNUM_15";
                inspection.InspectedDate = DateTime.Now;
                inspection.InspectionNotes = "MYNOTES_" + j;
                inspection.Inspector = "INSPECTOR_" + j;
                inspection.InspType = "TYPE_" + j;
                inspection.InspTypeMapped = "TYPEMAPPED_" + j;
                inspection.ReInspection = 0;
                inspection.RequestDate = DateTime.Now;
                inspection.Result = "PASSED";
                inspection.ResultMapped = "PASSED_MAPPED";
                inspection.ScheduledDate = DateTime.Now;
                inspection.Description = "DESCRIPTION_" + j;
                inspection.DesiredDate = DateTime.Now;
                inspection.ExtraFields = "{'blah': 'blue'}";
                inspection.Final = 1;

                db.Insert("Inspection", "Id", true, inspection);

            }

        }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     Inspection ds = new Inspection();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "InspectionYearlySheduleDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
 public virtual int Update(Inspection dataSet) {
     return this.Adapter.Update(dataSet, "InspectionReplies");
 }
 public virtual int Update(Inspection.InspectionRepliesDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
 public virtual int Update(Inspection dataSet) {
     return this.Adapter.Update(dataSet, "InspectionItenary");
 }
 public virtual int Update(Inspection.InspectionItenaryDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
 public virtual int Update(Inspection dataSet) {
     return this.Adapter.Update(dataSet, "InspectionYearlyScheduleDetail");
 }
 public virtual int Update(Inspection.InspectionYearlyScheduleDetailDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
 public virtual int Fill(Inspection.InspectionYearlyScheduleDetailDataTable dataTable) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     Inspection ds = new Inspection();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Exemple #43
0
        private static List<Inspection> getMDCInspections( string relURL, List<Inspection> current )
        {
            HtmlDocument doc = new HtmlDocument();

            string addressUrl = ConfigurationManager.AppSettings.Get("OP.MDC.Web.Url");
            addressUrl = addressUrl + relURL;

            string content = DoGet(addressUrl);
            if (content == null)
            {
                return current;
            }
            //This patch is need to fix html syntax error
            content = content.Replace("<b>Permit Status</b>           \r\n  <td",
                "<b>Permit Status</b></a></font></td>           \r\n  <td");
            doc.LoadHtml(content);

            List<Inspection> result = current;

            string permitNumber = "";
            string inspectorName = "";
            string inspectionType = "";
            string disposition = "";
            string clerkName = "";
            string requestDate = "";
            string inspectionDate = "";
            string resultDate = "";
            string inspectionTime = "";
            string comments = "";

            string prevText = "";

            foreach(HtmlNode td in doc.DocumentNode.SelectNodes("//table/tr/td"))
            {
                string inText = td.InnerText;
                inText = inText.Trim().Replace("&nbsp;", "");

                switch (prevText)
                {
                    case "Permit Number:":
                        permitNumber = inText;
                        break;
                    case "Inspector Name:":
                        inspectorName = inText;
                        break;
                    case "Inspection Type:":
                        inspectionType = inText;
                        break;
                    case "Disposition:":
                        disposition = inText;
                        break;
                    case "Clerk Name:":
                        clerkName = inText;
                        break;
                    case "Request Date:":
                        requestDate = inText;
                        break;
                    case "Inspection Date:":
                        inspectionDate = inText;
                        break;
                    case "Result Date:":
                        resultDate = inText;
                        break;
                    case "Inspection Time:":
                        inspectionTime = inText;
                        break;
                    case "Comments:":
                        comments = inText;
                        Inspection inspection = new Inspection();
                        inspection.PermitNum = permitNumber;
                        if (requestDate != "")
                            inspection.RequestDate = Convert.ToDateTime(requestDate);
                        inspection.InspType = inspectionType;
                        if (inspectionDate != "")
                            inspection.ScheduledDate = Convert.ToDateTime(inspectionDate);
                        if (resultDate != "")
                            inspection.InspectedDate = Convert.ToDateTime(resultDate);
                        inspection.Inspector = inspectorName;
                        inspection.Result = disposition;
                        inspection.InspectionNotes = comments;
                        inspection.ExtraFields = String.Format("ClerkName:{0},InspectionTime:{1}", clerkName, inspectionTime);
                        result.Add(inspection);
                        inspectorName = "";
                        inspectionType = "";
                        disposition = "";
                        clerkName = "";
                        requestDate = "";
                        inspectionDate = "";
                        resultDate = "";
                        inspectionTime = "";
                        comments = "";
                        break;                    
                }

                if (inText == "Next Page")
                {
                    string nextURL = td.FirstChild.LastChild.GetAttributeValue("href", "");
                    if (nextURL != "")
                    {
                        return getMDCInspections(nextURL, result);
                    }
                }

                prevText = inText;
            }

            return result;

        }