コード例 #1
0
        public IHttpActionResult PutSurveyor(int id, Surveyor surveyor)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != surveyor.fSurveyor_id)
            {
                return(BadRequest());
            }

            db.Entry(surveyor).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SurveyorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public Result PutSurveyor([FromRoute] string account, [FromBody] Surveyor surveyor)
        {
            var data =
                ServerConfig.ApiDb.Query <Surveyor>("SELECT * FROM `surveyor` WHERE Account = @Account;", new { Account = account }).FirstOrDefault();

            if (data == null)
            {
                return(Result.GenError <Result>(Error.SurveyorNotExist));
            }

            //var cnt =
            //    ServerConfig.ApiDb.Query<int>("SELECT COUNT(1) FROM `surveyor` WHERE SurveyorName = @SurveyorName;", new { surveyor.SurveyorName }).FirstOrDefault();
            //if (cnt > 0)
            //{
            //    if (!surveyor.SurveyorName.IsNullOrEmpty() && data.SurveyorName != surveyor.SurveyorName)
            //    {
            //        return Result.GenError<Result>(Error.SurveyorIsExist);
            //    }
            //}

            surveyor.Id             = data.Id;
            surveyor.MarkedDateTime = DateTime.Now;
            ServerConfig.ApiDb.Execute(
                "UPDATE surveyor SET `MarkedDateTime` = @MarkedDateTime, `MarkedDelete` = @MarkedDelete, " +
                "`ModifyId` = @ModifyId, `SurveyorName` = @SurveyorName WHERE `Id` = @Id;", surveyor);

            return(Result.GenError <Result>(Error.Success));
        }
コード例 #3
0
            public static Role Build(string roleName, MyIni config, Program program = null)
            {
                Role builtRole;

                switch (roleName)
                {
                case "miner":
                    builtRole = new Miner(config);
                    break;

                case "drone_controller":
                    builtRole = new DroneController(config);
                    break;

                case "tester":
                    builtRole = new Tester(config);
                    break;

                case "network_tester":
                    builtRole = new NetworkTester(config);
                    break;

                case "surveyor":
                    builtRole = new Surveyor(config);
                    break;

                default:
                    throw new Exception($"Unable to build role: {roleName}");
                    break;
                }

                return(builtRole);
            }
コード例 #4
0
 public IActionResult Results(Surveyor submittedResults)
 {
     ViewBag.UsersName    = submittedResults.UsersName;
     ViewBag.DojoLocation = submittedResults.DojoLocation;
     ViewBag.FavLanguage  = submittedResults.FavLanguage;
     ViewBag.Comments     = submittedResults.Comments;
     return(View());
 }
コード例 #5
0
        /// <summary>
        /// Runs the test sequence.
        /// </summary>
        public async Task Run()
        {
            Console.WriteLine("Writing 'ViewCase' event...");
            var newCase = new Case()
            {
                SysRef = "QU123456"
            };
            var viewCaseRequest = AuditRequest
                                  .AsViewOf(newCase, c => c.SysRef)
                                  .WithData(newCase, c => c.SysRef)
                                  .AsEvent("ViewCase")
                                  .WithDescription("View case");

            await this.auditClient.AuditAsync(viewCaseRequest);

            Console.WriteLine("Writing 'ChangeCase' event...");
            var changeCaseRequest = AuditRequest
                                    .AsChangeTo(newCase, c => c.SysRef)
                                    .WithData(newCase, c => c.SysRef)
                                    .AsEvent("ChangeCase")
                                    .WithDescription("Change case");

            await this.auditClient.AuditAsync(changeCaseRequest);

            Console.WriteLine("Writing 'AddApplicant' event...");
            var newApplicant         = new Applicant();
            var addAttachmentRequest = AuditRequest
                                       .AsChangeTo(typeof(Case), "sysref123")
                                       .WithData(newApplicant, c => Guid.NewGuid().ToString())
                                       .AsEvent("AddApplicant")
                                       .WithDescription("Add applicant");

            await this.auditClient.AuditAsync(addAttachmentRequest);

            Console.WriteLine("Writing 'SurveyorAssigned' event...");
            var surveyor = new Surveyor()
            {
                Code = "AB123"
            };
            var surveyorAssignedRequest = AuditRequest
                                          .AsActionOn(newCase, c => c.SysRef)
                                          .WithData(surveyor, n => n.Code.ToString())
                                          .AsEvent("SurveyorAssigned")
                                          .WithDescription("Surveyor assigned");

            await this.auditClient.AuditAsync(surveyorAssignedRequest);

            Console.WriteLine("Writing 'PaymentConfirmationMessageNotSent' event...");
            var notSentRequest = AuditRequest
                                 .AsStatementAbout(newCase, c => c.SysRef)
                                 .WithNoData()
                                 .AsEvent("PaymentConfirmationMessageNotSent")
                                 .WithDescription("Payment confirmation message not sent");

            await this.auditClient.AuditAsync(notSentRequest);
        }
コード例 #6
0
        public IHttpActionResult GetSurveyor(int id)
        {
            Surveyor surveyor = db.Surveyors.Find(id);

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

            return(Ok(surveyor));
        }
コード例 #7
0
        public Result PostSurveyor([FromBody] Surveyor surveyor)
        {
            surveyor.CreateUserId   = Request.GetIdentityInformation();
            surveyor.MarkedDateTime = DateTime.Now;
            ServerConfig.ApiDb.Execute(
                "INSERT INTO surveyor (`CreateUserId`, `MarkedDateTime`, `MarkedDelete`, `ModifyId`, `SurveyorName`, `Account`) " +
                "VALUES (@CreateUserId, @MarkedDateTime, @MarkedDelete, @ModifyId, @SurveyorName, @Account);",
                surveyor);

            return(Result.GenError <Result>(Error.Success));
        }
コード例 #8
0
 public IActionResult Process(Surveyor surveyor)
 {
     if (ModelState.IsValid)
     {
         return(RedirectToAction("Results", "SurveyValidate"));
     }
     else
     {
         return(View("Index", surveyor));
     }
 }
コード例 #9
0
        public IHttpActionResult DeleteSurveyor(int id)
        {
            Surveyor surveyor = db.Surveyors.Find(id);

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

            db.Surveyors.Remove(surveyor);
            db.SaveChanges();

            return(Ok(surveyor));
        }
コード例 #10
0
        public IActionResult CreateSurveyor(CreateSurveyorViewModel model)
        {
            if (ModelState.IsValid)
            {
                Surveyor surveyor = new Surveyor
                {
                    Name           = model.Name,
                    IdentityNumber = model.IdentityNumber,
                    ISDeactivated  = false,
                };

                var result = _surveyorRepository.Add(surveyor);
                if (result != null)
                {
                    return(RedirectToAction("ListSurveyors", "Surveyor"));
                }
            }
            return(View(model));
        }
コード例 #11
0
        public void AuditAnActionWorks()
        {
            var surveyor = new Surveyor()
            {
                Code = "AB123"
            };
            var surveyorAssignedRequest = AuditRequest
                                          .AsActionOn(@case, c => c.SysRef)
                                          .WithData(surveyor, n => n.Code.ToString())
                                          .AsEvent("SurveyorAssigned")
                                          .WithDescription("Surveyor assigned");

            Func <Task> act = async() =>
            {
                await this.auditClient.AuditAsync(surveyorAssignedRequest);
            };

            act.Should().NotThrow();
        }
コード例 #12
0
        public Result PutSurveyor([FromRoute] int id, [FromBody] Surveyor surveyor)
        {
            var cnt =
                ServerConfig.FlowCardDb.Query <int>("SELECT COUNT(1) FROM `surveyor` WHERE Id = @id AND MarkedDelete = 0;", new { id }).FirstOrDefault();

            if (cnt == 0)
            {
                return(Result.GenError <Result>(Error.SurveyorNotExist));
            }

            surveyor.Id             = id;
            surveyor.CreateUserId   = Request.GetIdentityInformation();
            surveyor.MarkedDateTime = DateTime.Now;
            ServerConfig.FlowCardDb.Execute(
                "UPDATE surveyor SET `CreateUserId` = @CreateUserId, `MarkedDateTime` = @MarkedDateTime, `MarkedDelete` = @MarkedDelete, " +
                "`ModifyId` = @ModifyId, `SurveyorName` = @SurveyorName WHERE `Id` = @Id;", surveyor);

            return(Result.GenError <Result>(Error.Success));
        }
コード例 #13
0
    protected void btnShowReport_Click(object sender, EventArgs e)
    {
        try
        {
            lblFeedback.Text = "";
            lblTotal.Visible = false;

            if (radAreas.Checked)
            {
                if (raddtpFrom.SelectedDate == null)
                {
                    throw new Exception("الرجاء تحديد التاريخ");
                }

                lblTotal.Text    = new JpmmsCharting().GetDailyDataEntryTotalArea(raddtpFrom.SelectedDate).ToString("N2");
                lblTotal.Visible = true;
            }
            else if (radLENGTH.Checked)
            {
                if (ddlRegions.SelectedValue == "0")
                {
                    throw new Exception("الرجاء اختيار المنطقة");
                }

                lblTotal.Text    = new Region().GetRegionSamplesTotalLength(int.Parse(ddlRegions.SelectedValue)).ToString();
                lblTotal.Visible = true;
            }
            else if (radNetworkArea.Checked)
            {
                PavementStatusReport total = new JpmmsCharting().GetWholeNetworkArea();
                lblTotal.Text = string.Format("مقاطع: {0} م2 \n  تقاطعات: {1} م2 \n مناطق فرعية: {2} م2 \n المجموع: {3} م2", total.MainStSectionsTotal.ToString("N2"),
                                              total.MainStIntersectsTotal.ToString("N2"), total.RegionsTotal.ToString("N2"), total.WholeNetworkTotal.ToString("N2"));

                lblTotal.Visible = true;
            }
            else if (radIntersectTypes.Checked)
            {
                DataTable dt = new GeneralPmmsReporting().GetIntersectionTypes();
                Session.Add("option", "radIntersectTypes");
                Session.Add("ReportData", dt);
                string url = "ViewOtherReports.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else if (radMaintDeciding.Checked)
            {
                DataTable dt = new MaintDeciding().GetAllMaintDeciding();
                Session.Add("option", "radMaintDeciding");
                Session.Add("ReportData", dt);
                string url = "ViewOtherReports.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else if (radSurveyors.Checked)
            {
                DataTable dt = new Surveyor().GetAllSurveyors();
                Session.Add("option", "radSurveyors");
                Session.Add("ReportData", dt);
                string url = "ViewOtherReports.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else if (radMaintDecisions.Checked)
            {
                DataTable dt = new MaintDecision().GetAllDecisions();
                Session.Add("option", "radMaintDecisions");
                Session.Add("ReportData", dt);
                string url = "ViewOtherReports.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else if (radFWD.Checked)
            {
                lblTotal.Text    = " Point " + new MaintDecision().GetAllDecisionsFWD_HAFRIAT();
                lblTotal.Visible = true;
            }
            else if (radGPR.Checked)
            {
                lblTotal.Text = " km/Lane " + new MainStreet().TOTALSUMGPR().Rows[0][0].ToString();
                //lblTotal.Text = "1510.21 km/Lane";
                lblTotal.Visible = true;
            }
            else if (radSKID.Checked)
            {
                lblTotal.Text    = " km/Lane " + new MainStreet().TOTALSUMSKID().Rows[0][0].ToString();
                lblTotal.Visible = true;
            }
            else if (radIRI.Checked)
            {
                lblTotal.Text    = " km/Lane " + new MaintDecision().GetAllDecisionsIRI();
                lblTotal.Visible = true;
            }
            else if (radDIST.Checked)
            {
                lblTotal.Text    = " km/Lane " + new MaintDecision().GetAllDecisionsDDF();
                lblTotal.Visible = true;
            }
            else if (radAssets.Checked)
            {
                lblTotal.Text    = " km/direction " + new MaintDecision().GetAllDecisionsAssets();
                lblTotal.Visible = true;
            }
            else if (radRegionsALL.Checked)
            {
                lblTotal.Text    = " m2 " + new MaintDecision().GetAllSURVEYORS_REGIONS();
                lblTotal.Visible = true;
            }
        }
        catch (Exception ex)
        {
            lblFeedback.Text = ex.Message;
        }
    }
コード例 #14
0
 public Surveyor Add(Surveyor surveyor)
 {
     context.Surveyors.Add(surveyor);
     context.SaveChanges();
     return(surveyor);
 }
コード例 #15
0
    protected void btnShowReport_Click(object sender, EventArgs e)
    {
        try
        {
            lblFeedback.Text = "";
            lblTotal.Visible = false;

            if (radAreas.Checked)
            {
                if (raddtpFrom.SelectedDate == null)
                {
                    throw new Exception("الرجاء تحديد التاريخ");
                }

                lblTotal.Text    = new JpmmsCharting().GetDailyDataEntryTotalArea(raddtpFrom.SelectedDate).ToString("N2");
                lblTotal.Visible = true;
            }
            else if (radNetworkArea.Checked)
            {
                PavementStatusReport total = new JpmmsCharting().GetWholeNetworkArea();
                lblTotal.Text = string.Format("مقاطع: {0} م2 \n  تقاطعات: {1} م2 \n مناطق فرعية: {2} م2 \n المجموع: {3} م2", total.MainStSectionsTotal.ToString("N2"),
                                              total.MainStIntersectsTotal.ToString("N2"), total.RegionsTotal.ToString("N2"), total.WholeNetworkTotal.ToString("N2"));

                lblTotal.Visible = true;
            }
            else if (radIntersectTypes.Checked)
            {
                DataTable dt = new GeneralPmmsReporting().GetIntersectionTypes();
                Session.Add("option", "radIntersectTypes");
                Session.Add("ReportData", dt);
                string url = "ViewOtherReports.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else if (radMaintDeciding.Checked)
            {
                DataTable dt = new MaintDeciding().GetAllMaintDeciding();
                Session.Add("option", "radMaintDeciding");
                Session.Add("ReportData", dt);
                string url = "ViewOtherReports.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else if (radSurveyors.Checked)
            {
                DataTable dt = new Surveyor().GetAllSurveyors();
                Session.Add("option", "radSurveyors");
                Session.Add("ReportData", dt);
                string url = "ViewOtherReports.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else if (radMaintDecisions.Checked)
            {
                DataTable dt = new MaintDecision().GetAllDecisions();
                Session.Add("option", "radMaintDecisions");
                Session.Add("ReportData", dt);
                string url = "ViewOtherReports.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
        }
        catch (Exception ex)
        {
            lblFeedback.Text = ex.Message;
        }
    }
コード例 #16
0
        // POST: api/Surveyors
        public HttpResponseMessage PostSurveyor([FromBody] string surveyor)
        {
            if (!ModelState.IsValid)
            {
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
            SurveyorsModel sm = JsonConvert.DeserializeObject <SurveyorsModel>(surveyor);

            EMI emi = new EMI()
            {
                EmisCode     = sm.Generalmodel.Emi.EmisCode,
                NameOfSchool = sm.Generalmodel.Emi.NameOfSchool,
                CreatedOn    = DateTime.UtcNow,
                ModifiedOn   = DateTime.UtcNow
            };

            db.EMIS.Add(emi);
            db.SaveChanges();
            Comment c = new Comment()
            {
                Entity     = sm.Generalmodel.Comment.Entity,
                SurveyID   = sm.Generalmodel.Comment.SurveyID,
                Section    = sm.Generalmodel.Comment.Section,
                CreatedOn  = DateTime.UtcNow,
                ModifiedOn = DateTime.UtcNow,
                Comments   = sm.Generalmodel.Comment.Comments
            };

            db.Comments.Add(c);
            db.SaveChanges();
            SpecialFacility sf = new SpecialFacility()
            {
                Entity     = sm.Generalmodel.Specialfacility.Entity,
                SurveyID   = sm.Generalmodel.Specialfacility.SurveyID,
                Section    = sm.Generalmodel.Specialfacility.Section,
                CreatedOn  = DateTime.UtcNow,
                ModifiedOn = DateTime.UtcNow,
                AnyFacilitiesForDisableStudents = sm.Generalmodel.Specialfacility.AnyFacilitiesForDisableStudents,
                Description = sm.Generalmodel.Specialfacility.Description
            };

            db.SpecialFacilities.Add(sf);
            db.SaveChanges();
            List <Picture> res = sm.Generalmodel.Img.Select(x => new Picture {
                Entity     = x.Entity,
                SurveyID   = x.SurveyID,
                Section    = x.Section,
                CreatedOn  = DateTime.UtcNow,
                ModifiedOn = DateTime.UtcNow,
                Picture1   = x.Picture1
            }).ToList();

            db.Pictures.AddRange(res);
            db.SaveChanges();

            Surveyor s = new Surveyor()
            {
                Entity        = sm.Surveyor.Entity,
                SurveyID      = sm.Surveyor.SurveyID,
                Section       = sm.Surveyor.Section,
                CreatedOn     = DateTime.UtcNow,
                ModifiedOn    = DateTime.UtcNow,
                NameOfMonitor = sm.Surveyor.NameOfMonitor,
                Department    = sm.Surveyor.Department
            };

            db.Surveyors.Add(s);
            db.SaveChanges();

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }