Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Distress distress = db.Distress.Find(id);

            db.Distress.Remove(distress);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "id,safe,status,nature,gps,user,cellphone,timerec,timeres")] Distress distress)
 {
     if (ModelState.IsValid)
     {
         db.Entry(distress).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(distress));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "id,safe,status,nature,gps,user,cellphone,timerec,timeres")] Distress distress)
        {
            if (ModelState.IsValid)
            {
                db.Distress.Add(distress);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(distress));
        }
Ejemplo n.º 4
0
        private void WritePCISample(List <SRSObjectPCI> listPCI, int m_nNextID, List <PCIDistressObject> distressRows, bool bIsMetricData)
        {
            if (listPCI.Count == 0)
            {
                return;
            }
            m_nNextID++;

            double        dArea     = listPCI[0].Area;
            string        strMethod = listPCI[0].Method;
            string        strType   = listPCI[0].Type;
            StringBuilder sbDeduct  = new StringBuilder();
            double        dPCI      = 100.0;

            foreach (SRSObjectPCI pci in listPCI)
            {
                string strDistress = pci.Distress;
                string strSeverity = pci.Severity;
                double dAmount     = pci.Amount;
                double dExtent     = dAmount / dArea;

                if (strDistress != "No Distress")
                {
                    double dConvertArea = dArea;
                    if (bIsMetricData)
                    {
                        dConvertArea = dArea * ((distressRows.Find(delegate(PCIDistressObject distressObject)
                                                                   { return(distressObject.Distress == strDistress); })).MetricRatio);
                    }
                    double dDeduct = CalculateCurrentRowDeducts(strMethod, strDistress, strSeverity, dAmount, dConvertArea);

                    if (sbDeduct.Length != 0)
                    {
                        sbDeduct.Append(",");
                    }
                    sbDeduct.Append(dDeduct.ToString());
                    string strDetail = "\t" + m_nNextPCIID.ToString() + "\t" + strDistress + "\t" + strSeverity + "\t" + dAmount.ToString() + "\t" + dExtent.ToString("f8") + "\t" + dDeduct.ToString("f8");
                    m_twPCIDetail.WriteLine(strDetail);
                }
            }

            if (sbDeduct.Length > 0)
            {
                if (listPCI[0].Facility == "TL1")
                {
                }
                dPCI = Distress.ComputePCIValue(sbDeduct.ToString(), strMethod);
            }

            string strPCI = m_nNextPCIID.ToString() + "\t\t\t\t\t" + listPCI[0].Facility + "\t" + listPCI[0].Section + "\t" + listPCI[0].Sample + "\t" + listPCI[0].Date.ToString() + "\t\t" + listPCI[0].Method + "\t" + dArea.ToString() + "\t" + dPCI.ToString("f2") + "\t\t\t\t" + listPCI[0].Type + "\t";

            m_twPCI.WriteLine(strPCI);
        }
Ejemplo n.º 5
0
        // GET: Distresses/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Distress distress = db.Distress.Find(id);

            if (distress == null)
            {
                return(HttpNotFound());
            }
            return(View(distress));
        }
Ejemplo n.º 6
0
        private double CalculateCurrentRowDeducts(string strMethod, string strDistress, string strSeverity, double dAmount, double dArea)
        {
            PCIMethodObject method = Validation.PCIMethods.Find(delegate(PCIMethodObject pciMethod){ return(pciMethod.Method == strMethod); });

            if (method == null)
            {
                return(0.0);
            }

            double dPCIDeduct = 0.0;

            if (Distress.IsWASHCLKMethod(method.Method))
            {
                double dExtent   = dAmount / dArea;
                string extent    = string.Format("{0:F2}", dExtent);
                int    nDistress = method.GetDistress(strDistress);
                dPCIDeduct = Distress.pvt_ComputeNonPCIDeduct(method.Method, nDistress, strSeverity, dExtent);
            }
            else
            {
                dPCIDeduct = Distress.pvt_ComputePCIDeduct(method.GetDistress(strDistress), strSeverity, dAmount, dArea);
            }
            return(dPCIDeduct);
        }