예제 #1
0
 private void cmdRunTask_Click(object sender, RoutedEventArgs e)
 {
     using (var context = GetDataBasePath.GetSql4Connection())
     {
         commands.LoadDrawingStack(DateSelected);
     }
 }
예제 #2
0
        public void PreparePolylineFiles(DateTime time)
        {
            Polylines.Clear();

            using (var context = GetDataBasePath.GetSql4Connection())
            {
                var points =
                    from p in context.PolylineDWGS
                    where (p.DateStamp == Convert.ToDateTime(DateSelected))
                    select p;


                string command;
                var    i = 1;
                foreach (var val in points)
                {
                    Files stack = new Files();

                    stack.Order      = Order(val.DrawingName);
                    stack.FileName   = val.DrawingName;
                    stack.SourceFile = val.SourcePath;
                    stack.DestFile   = val.DestinationPath;
                    stack.time       = Convert.ToDateTime(val.DateStamp);
                    Polylines.Add(stack);
                }

                context.SubmitChanges();
            }
        }
예제 #3
0
        public void PullPointCloudFiles(DateTime time)
        {
            using (var context = GetDataBasePath.GetSql4Connection())
            {
                var points =
                    from p in context.PointCloud
                    where (p.DateStamp == Convert.ToDateTime(DateSelected))
                    select p;


                string command;
                var    i = 1;
                foreach (var val in points)
                {
                    var stack = new DrawingStack();
                    command = string.Format(
                        "{0},{1},{2},{3},{4}", Order(val.DrawingName), val.DrawingName, val.SourcePath,
                        val.DestinationPath,
                        val.DateStamp);
                    stack.Function = command;
                    context.DrawingStack.InsertOnSubmit(stack);
                    // PointClouds.Add(stack);
                }

                context.SubmitChanges();
            }
        }
예제 #4
0
        private void MergeStacks(IList <Files> pointClouds, IList <Files> polylines)
        {
            string order, pointFile, destination, timestamp, command;

            using (var context = GetDataBasePath.GetSql4Connection())
            {
                string t = "";

                for (int i = 1; i < 19; i++)
                {
                    if (i < 10)
                    {
                        t = "0" + i.ToString();
                    }
                    else
                    {
                        t = i.ToString();
                    }
                    var point = from po in pointClouds
                                where ((po.Order).Equals(t))
                                select po;


                    var pline = from pl in polylines
                                where ((pl.Order).Equals(t))
                                select pl;


                    foreach (var po in point)
                    {
                        DrawingStack stack = new DrawingStack();

                        order     = po.Order;
                        pointFile = System.IO.Path.Combine(po.SourceFile, po.FileName);
                        if (String.IsNullOrEmpty(po.DestFile))
                        {
                            destination = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(po.SourceFile),
                                                                 "HOLE" + po.Order);
                        }
                        else
                        {
                            destination = System.IO.Path.Combine(po.DestFile, "HOLE" + po.Order);
                        }
                        timestamp = po.time.ToString();

                        var polyfile = from p in pline
                                       where order.Equals(p.Order)
                                       select System.IO.Path.Combine(p.SourceFile, p.FileName);

                        command = String.Format(
                            "{0},{1},{2},{3},{4}", order, pointFile, polyfile.FirstOrDefault(), destination, timestamp);


                        //stack.Commands = command;
                        //context.CommandStack.InsertOnSubmit(stack);
                    }
                    context.SubmitChanges();
                }
            }
        }
예제 #5
0
        private void cmdRunTask_Click(object sender, RoutedEventArgs e)
        {
            // 1. Load CommandStack
            // 2. Run  Stack
            //(PointFile,PolyFile,DestFile,Command,Args)

            using (var context = GetDataBasePath.GetSql4Connection())
            {
                commands.LoadDrawingStack(DateSelected);
                //PreparePointCloudFiles(DateSelected);
                //PreparePolylineFiles(DateSelected);
                //MergeStacks(PointClouds, Polylines);
                //CopyFilesToLocal();
                // InvokeMapClean();
            }
        }
예제 #6
0
        private void CopyFilesToLocal()
        {
            using (var context = GetDataBasePath.GetSql4Connection())
            {
                var stack =
                    from p in context.DrawingStack
                    select p;

                foreach (var files in stack)
                {
                    CommandsForCopy fi = ParseCommand(files.Function);

                    FileFunctions.CopyFiles(fi.PointFile, fi.DestFile, Path.GetFileName(fi.PointFile));
                    FileFunctions.CopyFiles(fi.PolyFile, fi.DestFile, Path.GetFileName(fi.PolyFile));
                }
            }
        }
예제 #7
0
        public void PreparePolylineFiles(DateTime time)
        {
            if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            Polylines.Clear();

            try
            {
                using (PGAContext context = GetDataBasePath.GetSql4Connection())
                {
                    var points =
                        from p in context.PolylineDWGS
                        where (p.DateStamp == Convert.ToDateTime(DateSelected))
                        select p;


                    //string command;
                    //var i = 1;
                    foreach (var val in points)
                    {
                        Files stack = new Files();

                        stack.Order      = Order(val.DrawingName);
                        stack.FileName   = val.DrawingName;
                        stack.SourceFile = val.SourcePath;
                        stack.DestFile   = val.DestinationPath;
                        stack.time       = Convert.ToDateTime(val.DateStamp);
                        Polylines.Add(stack);
                    }

                    //context.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                PGA.MessengerManager.MessengerManager.LogException(ex);
            }
        }
예제 #8
0
        private void CopyFilesToLocal()
        {
            using (var context = GetDataBasePath.GetSql4Connection())
            {
                /*     command = String.Format(
                 *
                 * "{0},{1},{2},{3},{4}", order, pointFile, polyfile.FirstOrDefault(), destination, timestamp);*/

                //Get

                var stack =
                    from p in context.DrawingStack
                    select p;

                foreach (var files in stack)
                {
                    CommandsForCopy fi = ParseCommand(files.Function);

                    FileFunctions.CopyFiles(fi.PointFile, fi.DestFile, System.IO.Path.GetFileName(fi.PointFile));
                    FileFunctions.CopyFiles(fi.PolyFile, fi.DestFile, System.IO.Path.GetFileName(fi.PolyFile));
                }


                //var lsetting =
                //    from p in context.CommandStack
                //    //where p.DateStamp == Convert.ToDateTime(txtDateCreated.Text)
                //    select new { p.CourseName, p.DateStamp, p.ProjectCreator, p.ProjectName };

                //dgTasks.ItemsSource = lsetting.ToList();

                //foreach (var val in settings)
                //{
                //    DateCreated = DateTime.Now;
                //    txtDateCreated.Text = DateCreated.ToString();
                //    return true;
                //}
                // settings =   lsetting;

                //return settings;
            }
        }
예제 #9
0
        public void PullPointCloudFiles(DateTime time)
        {
            try
            {
                if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
                {
                    return;
                }

                using (PGAContext context = GetDataBasePath.GetSql4Connection())
                {
                    var points =
                        from p in context.PointCloud
                        where (p.DateStamp == Convert.ToDateTime(DateSelected))
                        select p;


                    string command;
                    // var i = 1;
                    foreach (var val in points)
                    {
                        var stack = new DrawingStack();
                        command = string.Format(
                            "{0},{1},{2},{3},{4}", Order(val.DrawingName), val.DrawingName, val.SourcePath,
                            val.DestinationPath,
                            val.DateStamp);
                        stack.Function = command;
                        context.DrawingStack.InsertOnSubmit(stack);
                        // PointClouds.Add(stack);
                    }

                    context.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                PGA.MessengerManager.MessengerManager.LogException(ex);
            }
        }
예제 #10
0
 public void CreateIfNotExistsTes3()
 {
     string value = GetDataBasePath.DbFileName;
     string res   =
         GetDataBasePath.GetAppPath(value);
 }
예제 #11
0
 public void CreateIfNotExistsTest2()
 {
     string value = GetDataBasePath.PathDb;
     string res   =
         GetDataBasePath.CreateIfNotExists(value);
 }