Esempio n. 1
0
        public static void UpdateProjectHeader()
        {
            Console.WriteLine("Projects.LoadDataBase");
            try
            {
                using (var Neo = new NeoTrackerDbEntities())
                    using (var Genius = new IVCLIVEDBEntities())
                    {
                        var list = Neo.Projects.ToList();

                        foreach (var i in list)
                        {
                            var order = Genius.Comms.FirstOrDefault(x => x.No_Com == i.Code);
                            i.Client           = order.Fact_A1;
                            i.PurchaseOrder    = order.No_Po;
                            Neo.Entry(i).State = EntityState.Modified;
                        }
                        Neo.SaveChanges();
                    }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message.ToString());
            }
        }
Esempio n. 2
0
        public static void GetProjectItems(Project Project)
        {
            try
            {
                using (var Neo = new NeoTrackerDbEntities())
                    using (var Genius = new IVCLIVEDBEntities())
                    {
                        var StatusCreatedID   = Neo.Status.First(x => x.Name == "Created").StatusID;
                        var StatusCompletedID = Neo.Status.First(x => x.Name == "Completed").StatusID;

                        var list = Genius.Comm2.Where(x => x.No_Com == Project.Code).Select(x => new Item()
                        {
                            Code      = x.Item,
                            DueDate   = x.Dateliv,
                            IsActive  = true,
                            Name      = x.Des,
                            SortKey   = x.Clef,
                            SortOrder = x.Ligneitm,
                            StatusID  = x.DateClient < DateTime.Now ? StatusCompletedID : StatusCreatedID,
                            CreatedAt = DateTime.Now,
                            UpdatedAt = DateTime.Now,
                            CreatedBy = "SYS",
                            UpdatedBy = "SYS"
                        }).ToList();

                        list.ForEach(x => GetItemOperations(x, Project.Code));
                        Project.Items = list;
                    }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message.ToString());
            }
        }