Beispiel #1
0
        public virtual List<PrintingHint> SelectValidpHint(List<PrintingHint> pHint, double smallerCalculatedDCutLessZero, double smallerCalculatedDCut)
        {
            List<PrintingHint> pHint1;

            pHint1 = pHint.Where(x => x.IsDie || (x.DCut2 >= this.MinDCut
                    && x.DCut2 <= this.MaxDCut && (x.DCut1 >= x.DCut2 || (x.DCut1 == 0 && x.MaxGain1 == 1)))).ToList();

            var c = pHint1.Where(y => !y.IsDie);

            if (c.Count() == 0 || MinDCut == 0)
            {
                //fascette gommate
                if (MinDCut == 0 && MaxDCut == 0)
                {
                    var pHint2 = pHint.Where(x => x.IsDie || (x.DCut2 == smallerCalculatedDCutLessZero * -1));
                    pHint1 = pHint.Where(x => x.IsDie || (x.DCut2 >= 0 && x.DCut2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2 || x.DCut1 == 0))).ToList();
                    var pHint3 = pHint1.Union(pHint2);
                    pHint1 = pHint3.ToList();
                }
                else
                {
                    var smaller = pHint.Where(x => x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1).Select(x => x.DeltaDCut2).Min();
                    var pHintLast1 = pHint.Where(x => x.IsDie || (x.DeltaDCut2 == smaller && (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1)));

                    try
                    {
                        var smaller2 = pHint.Where(x => (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1) && x.DeltaDCut2 != smaller).Select(x => x.DeltaDCut2).Min();
                        var pHintLast2 = pHint.Where(x => x.IsDie || (x.DeltaDCut2 == smaller2 && x.DeltaDCut2 != smaller && (x.DCut1 >= x.DCut2 || x.DCut1 == 0 && x.MaxGain1 == 1)));


                        pHint1 = pHintLast1.Union(pHintLast2).ToList();

                    }
                    catch (Exception)
                    {
                        pHint1 = pHintLast1.ToList();

                    }
                    //                    pHint1 = pHint.Where(x => x.DCut2 >= 0 && x.DCut2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2 || x.DCut1 == 0)).ToList();
                }
            }

            var pRemove = pHint1.Select(x => x.BuyingFormat.GetSide1() == 0);
            Console.WriteLine(pRemove);

            pHint1 = pHint1.Where(x => x.GainOnSide2 > 0 && x.GainOnSide1 > 0).ToList();

            return pHint1.Where(x => x.BuyingFormat.GetSide1() != 0).ToList();
        }
        public override List<PrintingHint> SelectValidpHint(List<PrintingHint> pHint, double smallerCalculatedDCutLessZero, double smallerCalculatedDCut)
        {
            List<PrintingHint> pHint1;

            pHint1 = pHint.Where(x => x.DCut2 / 2 >= this.MinDCut
                    && x.DCut2 / 2 <= this.MaxDCut && (x.DCut1 >= x.DCut2 / 2 || (x.DCut1 == 0 && x.MaxGain1 == 1))).ToList();

            if (pHint1.Count <= 1)
            {
                //fascette gommate
                if (MinDCut == 0 && MaxDCut == 0)
                {
                    var pHint2 = pHint.Where(x => x.DCut2 / 2 == smallerCalculatedDCutLessZero * -1);
                    pHint1 = pHint.Where(x => x.DCut2 / 2 >= 0 && x.DCut2 / 2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2 / 2 || x.DCut1 == 0)).ToList();
                    var pHint3 = pHint1.Union(pHint2);
                    pHint1 = pHint3.ToList();
                }
                else
                {
                    var smaller = pHint.Where(x => (x.DCut1 >= x.DCut2 / 2) || x.DCut1 == 0).Select(x => x.DeltaDCut2).Min();
                    var pHintLast1 = pHint.Where(x => x.DeltaDCut2 == smaller && (x.DCut1 >= x.DCut2 / 2 || x.DCut1 == 0));

                    try
                    {
                        var smaller2 = pHint.Where(x => (x.DCut1 >= x.DCut2 / 2 || x.DCut1 == 0) && x.DeltaDCut2 != smaller).Select(x => x.DeltaDCut2).Min();
                        var pHintLast2 = pHint.Where(x => x.DeltaDCut2 == smaller2 && x.DeltaDCut2 != smaller && (x.DCut1 >= x.DCut2 / 2 || x.DCut1 == 0));

                        pHint1 = pHintLast1.Union(pHintLast2).ToList();

                    }
                    catch (Exception)
                    {
                        pHint1 = pHintLast1.ToList();

                    }
                    //                    pHint1 = pHint.Where(x => x.DCut2/2 >= 0 && x.DCut2/2 <= smallerCalculatedDCut && (x.DCut1 >= x.DCut2/2 || x.DCut1 == 0)).ToList();
                }
            }

            return pHint1;

        }
Beispiel #3
0
        public virtual void InsertAtBookmark(string toInsert, string bookmarkName)
        {
            if (bookmarkName.IsNullOrWhiteSpace())
                throw new ArgumentException("bookmark cannot be null or empty", "bookmarkName");

            var headerCollection = Document.Headers;
            var headers = new List<Header> { headerCollection.first, headerCollection.even, headerCollection.odd };
            foreach (var header in headers.Where(x => x != null))
                foreach (var paragraph in header.Paragraphs)
                    paragraph.InsertAtBookmark(toInsert, bookmarkName);

            foreach (var paragraph in Paragraphs)
                paragraph.InsertAtBookmark(toInsert, bookmarkName);

            var footerCollection = Document.Footers;
            var footers = new List<Footer> { footerCollection.first, footerCollection.even, footerCollection.odd };
            foreach (var footer in footers.Where(x => x != null))
                foreach (var paragraph in footer.Paragraphs)
                    paragraph.InsertAtBookmark(toInsert, bookmarkName);
        }
        public ActionResult dropdown_for_courses(int? symposium_id)
        {
            if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated == true)
            {
                if (symposium_id == null)
                {
                    var symposiums = db.Symposiums.ToList();
                    int i = 0;
                    int count = 0;
                    foreach (var item in symposiums)
                    {

                        count = count + item.Courses.Count();
                    }
                    Course[] found_courses = new Course[db.Courses.Count()];
                    found_courses[0] = db.Courses.First();
                    int ix = 0;
                    var all_courses = db.Courses.ToList();
                    List<Course> list = new List<Course>();
                    foreach (var item in all_courses)
                    {
                        if (list.Where(x => x.courseNumber == item.courseNumber).FirstOrDefault() == null)
                        {
                            list.Add(item);
                            ix++;
                        }
                    }

                       ViewBag.CourseNames = db.Courses.Select(x=> x.courseName).ToArray();

                        ViewBag.CourseNumbers = db.Courses.Select(x => x.courseName);

                    ViewBag.Courses = list;
                    ViewBag.Course_Count = db.Courses.ToList().Count();
                }
                else
                {
                    Symposium found_symposium = db.Symposiums.Find(symposium_id);
                    Project[] projects = found_symposium.Projects.Distinct().ToArray();
                    int array_length = projects.Count();
                    int[] course_ids = new int[array_length];
                    for (int i = 0; i < projects.Count(); i++)
                    {
                        course_ids[i] = projects[i].courseID;
                    }

                    Course[] found_courses = new Course[projects.Count()];

                    for (int i = 0; i < projects.Count(); i++)
                    {

                        found_courses[i] = db.Courses.Find(projects[i].courseID);
                    }
                    found_courses = found_courses.Distinct().ToArray();

                    ViewBag.Course_Count = found_courses.Count();
                    ViewBag.Courses = found_courses;
                }
                return View();
            }
            else
            {
                return RedirectToAction("desktop_vote", "Projects");
            }
        }
Beispiel #5
0
 private TemplBuilder(bool useDefaultModules)
 {
     //Add default handlers for Sections,tables,pictures,text,TOC,comments. Ordering is important.
     DefaultModules = new List<TemplModule>()
     {
         new TemplSectionModule("Section", this, new string[] { "sec" }),
         new TemplPictureReplaceModule("Picture Replace", this, new string[] { "pic" }),
         new TemplRepeatingTextModule("Repeating Text", this, new string[] { "li" }),
         new TemplRepeatingCellModule("Repeating Cell", this, new string[] { "cel" }),
         new TemplRepeatingRowModule("Repeating Row", this, new string[] { "row" }),
         new TemplPictureReplaceModule("Picture Replace", this, new string[] { "pic" }),
         new TemplTableModule("Table", this, new string[] { "tab" }),
         new TemplPicturePlaceholderModule("Picture Placeholder", this, new string[] { "pic" }),
         new TemplTextModule("Text", this, new string[] { "txt" }),
         new TemplTOCModule("Table of Contents", this, new string[] { "toc" }),
         new TemplCommentsModule("Comments", this, new string[] { "!" }),
     };
     Modules.AddRange(DefaultModules.Where(mod => useDefaultModules));
 }