public bool updateSecDistance(string from_id, string to_id, double distance, out ASECTION section)
 {
     try
     {
         using (DBConnection_EF con = DBConnection_EF.GetUContext())
         {
             section                = sectionDAO.getByFromToAdr(con, from_id, to_id);
             section.SEC_DIS        = distance;
             section.LAST_TECH_TIME = DateTime.Now;
             sectionDAO.update(con, section);
         }
         return(true);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exception");
         section = null;
         return(false);
     }
 }
Example #2
0
            private void updateSection(ASECTION sec)
            {
                ASECTION secTemp = new ASECTION();

                using (sc.Data.DBConnection_EF con = sc.Data.DBConnection_EF.GetUContext())
                {
                    secTemp.SEC_ID  = sec.SEC_ID;
                    secTemp.SUB_VER = "";
                    con.ASECTION.Attach(secTemp);
                    secTemp.DIRC_DRIV     = sec.DIRC_DRIV;
                    secTemp.DIRC_GUID     = sec.DIRC_GUID;
                    secTemp.CDOG_1        = sec.CDOG_1;
                    secTemp.CDOG_2        = sec.CDOG_2;
                    secTemp.CHG_SEG_NUM_1 = sec.CHG_SEG_NUM_1;
                    secTemp.CHG_SEG_NUM_2 = sec.CHG_SEG_NUM_2;
                    secTemp.SEC_DIS       = sec.SEC_DIS;
                    secTemp.SEC_SPD       = sec.SEC_SPD;
                    secTemp.PRE_BLO_REQ   = sec.PRE_BLO_REQ;
                    secTemp.AREA_SECSOR   = sec.AREA_SECSOR;
                    //secTemp.PRE_DIV = sec.PRE_DIV;

                    con.Entry(secTemp).Property(p => p.DIRC_DRIV).IsModified     = true;
                    con.Entry(secTemp).Property(p => p.DIRC_GUID).IsModified     = true;
                    con.Entry(secTemp).Property(p => p.CDOG_1).IsModified        = true;
                    con.Entry(secTemp).Property(p => p.CDOG_2).IsModified        = true;
                    con.Entry(secTemp).Property(p => p.CHG_SEG_NUM_1).IsModified = true;
                    con.Entry(secTemp).Property(p => p.CHG_SEG_NUM_2).IsModified = true;
                    con.Entry(secTemp).Property(p => p.SEC_DIS).IsModified       = true;
                    con.Entry(secTemp).Property(p => p.SEC_SPD).IsModified       = true;
                    con.Entry(secTemp).Property(p => p.PRE_BLO_REQ).IsModified   = true;
                    con.Entry(secTemp).Property(p => p.AREA_SECSOR).IsModified   = true;
                    //con.Entry(secTemp).Property(p => p.PRE_DIV).IsModified = true;

                    SectionDao.update(con, secTemp);
                    con.Entry(secTemp).State = System.Data.Entity.EntityState.Detached;
                }
            }
Example #3
0
            public void SetConnectedSections()
            {
                using (DBConnection_EF con = DBConnection_EF.GetUContext())
                {
                    List <ASECTION> sections = SectionDao.loadAll(con);
                    foreach (ASECTION sec in sections)
                    {
                        int count1 = 0;
                        int count2 = 0;
                        foreach (ASECTION s in sections)
                        {
                            if (SCUtility.isMatche(sec.SEC_ID, s.SEC_ID))
                            {
                                continue;
                            }
                            else
                            {
                                if (SCUtility.isMatche(sec.FROM_ADR_ID, s.FROM_ADR_ID) || SCUtility.isMatche(sec.FROM_ADR_ID, s.TO_ADR_ID))
                                {
                                    count1++;
                                    if (count1 == 1)
                                    {
                                        sec.ADR1_CHG_SEC_ID_1 = s.SEC_ID;
                                    }
                                    else if (count1 == 2)
                                    {
                                        sec.ADR1_CHG_SEC_ID_2 = s.SEC_ID;
                                    }
                                    else if (count1 == 3)
                                    {
                                        sec.ADR1_CHG_SEC_ID_3 = s.SEC_ID;
                                    }
                                    else
                                    {
                                        //do nothing
                                    }
                                }
                                if (SCUtility.isMatche(sec.TO_ADR_ID, s.FROM_ADR_ID) || SCUtility.isMatche(sec.TO_ADR_ID, s.TO_ADR_ID))
                                {
                                    count2++;
                                    if (count2 == 1)
                                    {
                                        sec.ADR2_CHG_SEC_ID_1 = s.SEC_ID;
                                    }
                                    else if (count2 == 2)
                                    {
                                        sec.ADR2_CHG_SEC_ID_2 = s.SEC_ID;
                                    }
                                    else if (count2 == 3)
                                    {
                                        sec.ADR2_CHG_SEC_ID_3 = s.SEC_ID;
                                    }
                                    else
                                    {
                                        //do nothing
                                    }
                                }
                            }
                        }
                    }


                    foreach (ASECTION sec in sections)
                    {
                        SectionDao.update(con, sec);
                    }
                }
            }