Beispiel #1
0
            public static ECOClassification GetById(IDBContext db, int id)
            {
                ECOClassification rc = null;

                using (SqlCommand cmd = new SqlCommand("EGH.GetECOClassificationById", db.connection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    {
                        SqlParameter parm = new SqlParameter("@IdОтчета", SqlDbType.Int);
                        parm.Value = id;
                        cmd.Parameters.Add(parm);
                    }
                    try
                    {
                        SqlDataReader reader = cmd.ExecuteReader();
                        if (reader.Read())
                        {
                            string xmlContent = (string)reader["ТекстОтчета"];
                            if (!xmlContent.Trim().Equals(""))
                            {
                                XmlDocument doc = new XmlDocument();
                                doc.LoadXml(xmlContent);
                                rc = new GEAContext.ECOClassification(doc.DocumentElement);
                            }
                        }
                        reader.Close();
                    } catch (Exception e)
                    {
                        rc = null;
                    };
                }
                return(rc);
            }
Beispiel #2
0
            public ECORehabilitation(GEAContext.ECOClassification ecoclassification) : base(ecoclassification)
            {
                db        = new ORTContext();
                this.date = DateTime.Now;

                int mk = 0;

                {
                    PenetrationDepth x = null;
                    if (PenetrationDepth.GetByDepth(db, this.groundblur.depth, out x))
                    {
                        this.penetrationdepth = x;
                    }
                    else
                    {
                        this.penetrationdepth = PenetrationDepth.defaulttype;
                    }
                }
                {
                    EmergencyClass x = null;
                    if (EmergencyClass.GetByMass(db, this.groundblur.totalmass, out x))
                    {
                        this.emergencyclass = x;
                    }
                    else
                    {
                        this.emergencyclass = EmergencyClass.defaulttype;
                    }
                }


                this.waterprotectionarea = getWaterProtectionArea(db);


                List <RehabilitationMethod> source = new List <RehabilitationMethod>();

                if (Helper.GetListRehabilitationMethod(db, ref source))
                {
                    foreach (RehabilitationMethod rm in source)
                    {
                        bool r1 = (this.isriskobjecttype && this.riskobjecttype.type_code > 0 && this.riskobjecttype.type_code == rm.riskobjecttype.type_code);

                        bool r2 = (rm.cadastretype.type_code == 0 || this.cadastretype.type_code == rm.cadastretype.type_code);

                        bool r3 = (rm.emergencyclass.type_code == 0 || this.emergencyclass.type_code == rm.emergencyclass.type_code);

                        bool r4 = (rm.penetrationdepth.type_code == 0 || this.penetrationdepth.type_code == rm.penetrationdepth.type_code);

                        bool r5 = (rm.soilpollutioncategories.code == 0 || this.soilpollutioncategories.code == rm.soilpollutioncategories.code);

                        bool r6 = (rm.waterpollutioncategories.code == 0 || this.waterpollutioncategories.code == rm.waterpollutioncategories.code);

                        bool r7 = (this.waterachieved == rm.waterachieved);

                        bool r8 = (this.waterprotectionarea.type_code == rm.waterprotectionarea.type_code);

                        int k = (r1?1:0) + (r2?1:0) + (r3?1:0) + (r3?1:0) + (r4?1:0) + (r5?1:0) + (r6?1:0) + (r7?1:0);

                        mk = k > mk?k:mk;

                        // if (r1 && r2 && r3 && r4 && r5 && r6 && r7 ) rehabilitationlist.Add(rm);
                        if (k >= 5)
                        {
                            rehabilitationlist.Add(rm);
                        }
                    }
                }
            }