コード例 #1
0
ファイル: InOutUtils.cs プロジェクト: ssnioka/LinkedList
        /// <summary>
        /// printing initial data to txt
        /// </summary>
        /// <param name="services">services</param>
        public static void PrintServices(ServiceList services)
        {
            string file = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "App_Data");

            services.Beginning();
            List <string> lines = new List <string>();

            lines.Add("Initial data \nServices:");
            lines.Add(new string('-', services.Get().StringFormat().Length));
            lines.Add(services.Get().StringFormat());
            lines.Add(new string('-', services.Get().StringFormat().Length));
            for (services.Beginning(); services.Exist(); services.Next())
            {
                lines.Add(services.Get().ToString());
            }
            services.Beginning();
            lines.Add(new string('-', services.Get().StringFormat().Length));
            File.AppendAllLines((file + "/Rezultatai.txt"), lines);
        }
コード例 #2
0
ファイル: Calcs.cs プロジェクト: ssnioka/LinkedList
        /// <summary>
        /// method to find out how much did the resident pay
        /// </summary>
        /// <param name="resident"></param>
        /// <param name="servicelist"></param>
        /// <returns></returns>
        public static double HowMuchPaid(Resident resident, ServiceList servicelist)
        {
            for (servicelist.Beginning(); servicelist.Exist(); servicelist.Next())
            {
                if (resident.ServiceId == servicelist.Get().ID)
                {
                    return(resident.Amount * servicelist.Get().Price);
                }
            }

            return(0);
        }
コード例 #3
0
ファイル: InOutUtils.cs プロジェクト: ssnioka/LinkedList
        /// <summary>
        /// inserting services to table
        /// </summary>
        /// <param name="table"></param>
        /// <param name="services"></param>
        public static void InsertServices(Table table, ServiceList services)
        {
            for (services.Beginning(); services.Exist(); services.Next())
            {
                Service temp = services.Get();

                TableCell servid    = new TableCell();
                TableCell servname  = new TableCell();
                TableCell servprice = new TableCell();

                servid.Text    = temp.ID;
                servname.Text  = temp.Title;
                servprice.Text = temp.Price.ToString();

                TableRow row = new TableRow();

                row.Cells.Add(servid);
                row.Cells.Add(servname);
                row.Cells.Add(servprice);

                table.Rows.Add(row);
            }
        }