コード例 #1
0
        public List <AV_Test> GetAllTest(string siteId, string networModeId, string BandId, string CarrierId)
        {
            AV_SitesBL     siteBL   = new AV_SitesBL();
            List <AV_Test> listTest = new List <AV_Test>();
            var            data     = siteBL.ToDataTable("GET_TEST_BY_LAYER", null, networModeId, BandId, CarrierId, null, null, null);

            foreach (DataRow item in data.Rows)
            {
                AV_Test test = new AV_Test();
                //test.Id = Convert.ToInt64(item["DefinationId"].ToString());
                test.Name = item["DefinationName"].ToString();
                test.UEId = item["UEId"].ToString();
                listTest.Add(test);
            }

            return(listTest);
        }
コード例 #2
0
        //public List<AV_Site> ListIsActive(string value1 = null, string value2 = null, string value3 = null)
        //{
        //    DataTable dtbl = new DataTable();
        //    dtbl = wod.Get("Search", value1, value2, value3);
        //    List<AV_Site> WorkOrders = dtbl.ToList<AV_Site>();

        //    return WorkOrders;
        //}

        public bool ChangeFolderName(Workorder wo, List <Workorder> wolst)
        {
            try {
                List <string>           Newpath      = new List <string>();
                List <string>           OldPath      = new List <string>();
                AD_DefinationBL         db           = new AD_DefinationBL();
                int                     x            = 0;
                string                  ClientPrefix = "";
                string                  networkmode  = "";
                string                  carriors     = "";
                string                  bands        = "";
                var                     Newtworkmode = db.SelectedList("NetworkModes", null, "-NetworkMode-");
                var                     Bands        = db.ToList("Bands");
                var                     Carriers     = db.ToList("Carriers");
                List <AV_Sector>        Sectors      = new List <AV_Sector>();
                List <Changefoldername> t            = new List <Changefoldername>();
                List <Changefoldername> oldt         = new List <Changefoldername>();

                AV_SitesBL sb   = new AV_SitesBL();
                AV_Site    Site = new AV_Site();
                sb.SiteWithSectors(Convert.ToInt32(wo.SiteId), ref Site, ref Sectors);

                for (int i = 0; i < 1; i++)
                {
                    ClientPrefix = wolst[0].ClientPrefix;
                }



                var dt = wod.GetSiteBands("Get_All", wo.SiteId);
                if (wolst != null)
                {
                    if (wo.siteCode.ToString() == Site.SiteCode)
                    {
                        foreach (var row in Sectors)
                        {
                            foreach (var netmod in Newtworkmode)
                            {
                                if (netmod.Value == row.NetworkModeId.ToString())
                                {
                                    networkmode = netmod.Text;
                                }
                            }
                            foreach (var b in Bands)
                            {
                                if (b.DefinationId == row.BandId)
                                {
                                    bands = b.DefinationName;
                                }
                            }
                            foreach (var c in Carriers)
                            {
                                if (c.DefinationId == row.CarrierId)
                                {
                                    carriors = c.DefinationName;
                                }
                            }
                            var oldp            = "/Content/AirViewLogs/" + ClientPrefix + "/" + Site.SiteCode + '/' + networkmode + "_" + bands + "_" + carriors + "";
                            Changefoldername cf = new Changefoldername();
                            cf.Id   = Convert.ToInt64(row.SectorId);
                            cf.Path = oldp;
                            oldt.Add(cf);
                        }
                        foreach (var item in wolst)
                        {
                            foreach (var netmod in Newtworkmode)
                            {
                                if (netmod.Value == item.networkMode)
                                {
                                    networkmode = netmod.Text;
                                }
                            }
                            foreach (var b in Bands)
                            {
                                if (b.DefinationId.ToString() == item.Band)
                                {
                                    bands = b.DefinationName;
                                }
                            }
                            foreach (var c in Carriers)
                            {
                                if (c.DefinationId.ToString() == item.Carrier)
                                {
                                    carriors = c.DefinationName;
                                }
                            }


                            var p = "/Content/AirViewLogs/" + ClientPrefix + "/" + wo.siteCode.ToString() + '/' + networkmode + "_" + bands + "_" + carriors + "";
                            foreach (var itm in Sectors)
                            {
                                if (itm.SectorId == item.SectorId)
                                {
                                    Changefoldername cfn = new Changefoldername();
                                    cfn.Id   = Convert.ToInt64(item.SectorId);
                                    cfn.Path = p;
                                    t.Add(cfn);
                                    break;
                                }
                            }
                        }

                        List <long> RemoveLayesId = new List <long>();
                        foreach (var itme in t)
                        {
                            foreach (var tm in oldt)
                            {
                                if (itme.Id == tm.Id && itme.Path == tm.Path)
                                {
                                    RemoveLayesId.Add(itme.Id);
                                }
                            }
                        }
                        foreach (var r in RemoveLayesId)
                        {
                            var obj  = t.Where(xx => xx.Id == r).FirstOrDefault();
                            var obj1 = oldt.Where(xx => xx.Id == r).FirstOrDefault();
                            t.Remove(obj);
                            oldt.Remove(obj1);
                        }
                        for (int i = 0; i < t.Count; i++)
                        {
                            bool exists = System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(oldt[i].Path));
                            if (exists)
                            {
                                bool exists1 = System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(t[i].Path));
                                if (!exists1)
                                {
                                    t[i].Path    = HttpContext.Current.Server.MapPath(t[i].Path);
                                    oldt[i].Path = HttpContext.Current.Server.MapPath(oldt[i].Path);
                                    Directory.CreateDirectory(t[i].Path);
                                    DirectoryInfo dirInfo = new DirectoryInfo(t[i].Path);
                                    int           xx      = 0;
                                    int           y       = 0;
                                    List <String> MyFiles = Directory
                                                            .GetFiles(oldt[i].Path, "*.*", SearchOption.AllDirectories).ToList();

                                    foreach (string file in MyFiles)
                                    {
                                        FileInfo mFile = new FileInfo(file);
                                        // to remove name collisions
                                        if (new FileInfo(dirInfo + "\\" + mFile.Name).Exists == false)
                                        {
                                            mFile.MoveTo(dirInfo + "\\" + mFile.Name);
                                            xx++;
                                        }
                                    }
                                    //Directory.CreateDirectory(HttpContext.Current.Server.MapPath(t[i].Path));
                                    //      }
                                    //  System.IO.Directory.Move(HttpContext.Current.Server.MapPath(oldt[i].Path), HttpContext.Current.Server.MapPath(t[i].Path));
                                }
                                else
                                {
                                    t[i].Path    = HttpContext.Current.Server.MapPath(t[i].Path);
                                    oldt[i].Path = HttpContext.Current.Server.MapPath(oldt[i].Path);
                                    List <String> Files = Directory
                                                          .GetFiles(oldt[i].Path, "*.*", SearchOption.AllDirectories).ToList();



                                    if (Files.Count > 0)
                                    {
                                        var MyFiles = Directory
                                                      .GetFiles(oldt[i].Path, "*.*", SearchOption.AllDirectories).ToList();

                                        foreach (string file in MyFiles)
                                        {
                                            FileInfo mFile = new FileInfo(file);
                                            // to remove name collisions
                                            if (new FileInfo(t[i].Path + "\\" + mFile.Name).Exists == false)
                                            {
                                                mFile.MoveTo(t[i].Path + "\\" + mFile.Name);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        var oldp    = "/Content/AirViewLogs/" + ClientPrefix + "/" + Site.SiteCode + '/';
                        var p       = "/Content/AirViewLogs/" + ClientPrefix + "/" + wo.siteCode.ToString() + '/';
                        var newPath = HttpContext.Current.Server.MapPath(p);
                        var oldPath = HttpContext.Current.Server.MapPath(oldp);
                        DirectoryCopy(oldPath, newPath, true);
                        clearFolder(oldPath);
                        DeleteFolder(oldPath);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public bool ChangeFolderName(long networklayerid, string SiteCode)
        {
            try
            {
                AD_DefinationBL     db           = new AD_DefinationBL();
                int                 x            = 0;
                string              ClientPrefix = "";
                string              networkmode  = "";
                string              carriors     = "";
                string              bands        = "";
                var                 Newtworkmode = db.SelectedList("NetworkModes", null, "-NetworkMode-");
                var                 Bands        = db.ToList("Bands");
                var                 Carriers     = db.ToList("Carriers");
                string              oldpath      = "";
                string              newpath      = "";
                AV_NetLayerStatusBL nlsb         = new AV_NetLayerStatusBL();

                var rec = nlsb.ToSingle("Get_byLayerStatusId", 0, 0, 0, 0, networklayerid.ToString());

                AV_SitesBL sb      = new AV_SitesBL();
                AV_Site    oldSite = new AV_Site();
                oldSite = sb.Single("SingleSitebyId", rec.SiteId.ToString(), null, null, null, null);
                AV_Site newSite = new AV_Site();
                newSite = sb.Single("SingleSitebySiteCode", SiteCode.ToString(), null, null, null, null);
                var Newrec        = nlsb.ToSingle("Get_byLayerStatusId", 0, 0, 0, 0, networklayerid.ToString());
                var oldSiteRecord = sb.ToList("BySiteCodeWithLayer", oldSite.SiteCode, null, null, null, null, null);
                var newSiteRecord = sb.ToList("BySiteCodeWithLayer", newSite.SiteCode, null, null, null, null, null);

                foreach (var netmod in Newtworkmode)
                {
                    if (netmod.Value == rec.NetworkModeId.ToString())
                    {
                        networkmode = netmod.Text;
                    }
                }
                foreach (var b in Bands)
                {
                    if (b.DefinationId == rec.BandId)
                    {
                        bands = b.DefinationName;
                    }
                }
                foreach (var c in Carriers)
                {
                    if (c.DefinationId == rec.CarrierId)
                    {
                        carriors = c.DefinationName;
                    }
                }
                oldpath = "/Content/AirViewLogs/" + oldSiteRecord[0].ClientPrefix + "/" + oldSite.SiteCode + "/" + networkmode + "_" + bands + "_" + carriors + "";

                foreach (var netmod in Newtworkmode)
                {
                    if (netmod.Value == Newrec.NetworkModeId.ToString())
                    {
                        networkmode = netmod.Text;
                    }
                }
                foreach (var b in Bands)
                {
                    if (b.DefinationId == Newrec.BandId)
                    {
                        bands = b.DefinationName;
                    }
                }
                foreach (var c in Carriers)
                {
                    if (c.DefinationId == Newrec.CarrierId)
                    {
                        carriors = c.DefinationName;
                    }
                }


                newpath = "/Content/AirViewLogs/" + newSiteRecord[0].ClientPrefix + "/" + newSite.SiteCode + '/' + networkmode + "_" + bands + "_" + carriors + "";

                var         newPath = HttpContext.Current.Server.MapPath(newpath);
                var         oldPath = HttpContext.Current.Server.MapPath(oldpath);
                WorkOrderBL wo      = new WorkOrderBL();
                wo.DirectoryCopy(oldPath, newPath, true);

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }