Ejemplo n.º 1
0
        private void HandleSummary(summary summary)
        {
            OutLine("Summary line by line");
            summary.Text.Each(text =>
            {
                Message.PrintLine("{0}", text);
            });
            if (summary.Items != null)
            {
                OutLine("Iterating over summary.Items");
                summary.Items.Each(o =>
                {
                    Type itemType = o.GetType();
                    Message.PrintLine("\tItem type = {0}", ConsoleColor.Yellow, itemType.FullName);
                });
            }
            else
            {
                OutLine("summary.Items was null");
            }

            if (summary.Items1 != null)
            {
                OutLine("Iterating over summary.Items1");
                summary.Items1.Each(o =>
                {
                    Type itemType = o.GetType();
                    Message.PrintLine("\tItem type = {0}", ConsoleColor.Blue, itemType.FullName);
                });
            }
            else
            {
                OutLine("summary.Items1 was null");
            }
        }
Ejemplo n.º 2
0
        internal bool TrySetSummary(object item)
        {
            bool    result  = false;
            summary summary = item as summary;

            if (summary != null)
            {
                result = true;
                StringBuilder txt = new StringBuilder();
                summary.Text.Each(s =>
                {
                    txt.Append(s);
                });
                this.Summary = txt.ToString();

                if (summary.Items != null)
                {
                    AddItems(summary.Items);
                }

                if (summary.Items1 != null)
                {
                    AddItems(summary.Items1);
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public ActionResult Summary()
        {
            Models.Operations.covid19Api covid = new Models.Operations.covid19Api();
            summary summaryData = covid.getSummary();

            return(View(summaryData));
        }
        public async Task AddReview(reviewentity entity)
        {
            var dbentity = _mapper.Map <comments>(entity);

            await _dataContext.comments
            .AddAsync(dbentity);

            await _dataContext.SaveChangesAsync();

            var ratings = _dataContext.ratings
                          .FirstOrDefault(x => x.webid == dbentity.webid);

            var broadcastobj = setcomment(dbentity);

            dynamic objs = calculateratings(entity.webid);

            if (objs != null)
            {
                if (ratings != null)
                {
                    dynamic ratingobj = updateratings(objs, entity);

                    List <ratings> newratings = ratingobj.ratinglist;

                    summary avgrating = ratingobj.avgrating;

                    await _hubcontext.Clients.All
                    .SendAsync("sendratings", new Object[] { newratings, avgrating });
                }
                else
                {
                    dynamic newratingobj = getnewratings(objs);

                    List <ratings> newratings = newratingobj.newratings
                                                .ratinglist;

                    summary avgrating = newratingobj.newratings
                                        .avgrating;

                    await _hubcontext.Clients.All
                    .SendAsync("newratings", new Object[] { newratings, avgrating });
                }
                await _hubcontext.Clients
                .All.SendAsync("sendcomment", broadcastobj);
            }
            else
            {
                await _hubcontext.Clients
                .All.SendAsync("sendcomment", broadcastobj);
            }
        }
Ejemplo n.º 5
0
        public static List <summary> StockSummaryList()
        {
            List <summary> lstSales = new List <summary>();
            DataTable      dt       = new DataTable();

            dt = dba.GetDataTable("EXEC Get_GroupWise_Stock_Summary ''");

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    summary objsummary = new summary();
                    objsummary.ProductGroupName = dr["GroupName"].ToString();
                    objsummary.TotalQuantity    = Convert.ToInt32(dr["TotalQuantity"].ToString());
                    lstSales.Add(objsummary);
                }
            }
            return(lstSales);
        }
Ejemplo n.º 6
0
        public void ReadXmlDocs()
        {
            doc doc = new FileInfo("./TestDoc.xml").FromXmlFile <doc>();

            Message.PrintLine("Assembly Name: {0}", doc.assembly.name);
            if (doc.members == null)
            {
                OutLine("doc.members == null", ConsoleColor.Cyan);
            }
            else if (doc.members.Items == null)
            {
                OutLine("doc.members.Items == null", ConsoleColor.Yellow);
            }
            else
            {
                Message.PrintLine("Iterating on {0}", ConsoleColor.Cyan, "doc.members.Items");
                doc.members.Items.Each(member =>
                {
                    Message.PrintLine("member.name={0}", ConsoleColor.Yellow, member.name);
                    if (member.Items == null)
                    {
                        Message.PrintLine("member.Items == null");
                    }
                    else
                    {
                        Message.PrintLine("Iterating on {0}", ConsoleColor.Cyan, "member.Items");
                        member.Items.Each(item =>
                        {
                            Type itemType = item.GetType();
                            Message.PrintLine("\tItem type = {0}", ConsoleColor.Yellow, itemType.FullName);
                            summary summary = item as summary;
                            if (summary != null)
                            {
                                HandleSummary(summary);
                            }
                        });
                    }
                });
            }
        }
Ejemplo n.º 7
0
Archivo: audit.cs Proyecto: kwanboy/mcs
        //-------------------------------------------------
        //  summary - generate a summary, with an optional
        //  string format
        //-------------------------------------------------
        public summary summarize(string name, ref string output)
        {
            if (m_record_list.empty())
            {
                return(summary.NONE_NEEDED);
            }

            // loop over records
            summary overall_status = summary.CORRECT;

            foreach (audit_record record in m_record_list)
            {
                summary best_new_status = summary.INCORRECT;

                // skip anything that's fine
                if (record.substatus() == audit_record.audit_substatus.SUBSTATUS_GOOD)
                {
                    continue;
                }

                // output the game name, file name, and length (if applicable)
                if (output != null)
                {
                    if (name != null)
                    {
                        output += string.Format("{0}: {1}", name, record.name());  // %-12s: %s
                    }
                    else
                    {
                        output += string.Format("{0}", record.name());
                    }
                    if (record.expected_length() > 0)
                    {
                        output += string.Format(" ({0} bytes)", record.expected_length());  //  (%" I64FMT "d bytes)
                    }
                    output += " - ";
                }

                // use the substatus for finer details
                switch (record.substatus())
                {
                case audit_record.audit_substatus.SUBSTATUS_GOOD_NEEDS_REDUMP:
                    if (output != null)
                    {
                        output += "NEEDS REDUMP\n";
                    }
                    best_new_status = summary.BEST_AVAILABLE;
                    break;

                case audit_record.audit_substatus.SUBSTATUS_FOUND_NODUMP:
                    if (output != null)
                    {
                        output += "NO GOOD DUMP KNOWN\n";
                    }
                    best_new_status = summary.BEST_AVAILABLE;
                    break;

                case audit_record.audit_substatus.SUBSTATUS_FOUND_BAD_CHECKSUM:
                    if (output != null)
                    {
                        output += "INCORRECT CHECKSUM:\n";
                        output += string.Format("EXPECTED: {0}\n", record.expected_hashes().macro_string());
                        output += string.Format("   FOUND: {0}\n", record.actual_hashes().macro_string());
                    }
                    break;

                case audit_record.audit_substatus.SUBSTATUS_FOUND_WRONG_LENGTH:
                    if (output != null)
                    {
                        output += string.Format("INCORRECT LENGTH: {0} bytes\n", record.actual_length());                      // %" I64FMT "d bytes\n
                    }
                    break;

                case audit_record.audit_substatus.SUBSTATUS_NOT_FOUND:
                    if (output != null)
                    {
                        device_t shared_device = record.shared_device();
                        if (shared_device == null)
                        {
                            output += "NOT FOUND\n";
                        }
                        else
                        {
                            output += string.Format("NOT FOUND ({0})\n", shared_device.shortname());
                        }
                    }
                    break;

                case audit_record.audit_substatus.SUBSTATUS_NOT_FOUND_NODUMP:
                    if (output != null)
                    {
                        output += "NOT FOUND - NO GOOD DUMP KNOWN\n";
                    }
                    best_new_status = summary.BEST_AVAILABLE;
                    break;

                case audit_record.audit_substatus.SUBSTATUS_NOT_FOUND_OPTIONAL:
                    if (output != null)
                    {
                        output += "NOT FOUND BUT OPTIONAL\n";
                    }
                    best_new_status = summary.BEST_AVAILABLE;
                    break;

                default:
                    assert(false);
                    break;
                }

                // downgrade the overall status if necessary
                overall_status = (summary)Math.Max((int)overall_status, (int)best_new_status);
            }

            return(overall_status);
        }