Beispiel #1
0
        public static void edit(Int32 id, string name, DateTime date, Int32 count, Decimal cost)
        {
            DL temp = new DL();

            temp[id].cost  = cost;
            temp[id].count = count;
            temp[id].date  = date;
            temp[id].name  = name;
        }
Beispiel #2
0
 public static void Main(string[] args)
 {
     if (!DL.serialization())
     {
         Console.WriteLine("Входной файл не найден!");
         return;
     }
     DL.read_changing();
     GUI.show_menu();
     DL.deserialization();
 }
Beispiel #3
0
        public static string show_all(bool id = false)
        {
            //return DL.export_to_string_all ("\t", "\n", id);
            //????
            string s    = "";
            DL     temp = new DL();

            for (int i = 1; temp[i] != null; i++)
            {
                if (id)
                {
                    s += temp[i].id + "\t";
                }
                s += temp [i].name + "\t" +
                     temp [i].date.ToString("d") + "\t" +
                     temp [i].count + "\t" +
                     temp [i].cost + "\n";
            }
            return(s);
        }
Beispiel #4
0
        public static change view_changing(Int32 id)
        {
            Decimal profit       = 0;
            DL      temp         = new DL();
            string  name_company = temp [id].name;            //here we have a name of needed company

            //searching
            Decimal old_cost = 0;
            Entity  i        = Base.first_e;

            while (i != null)
            {
                //for each record in entity's list we should calculate profit
                if (i.name == name_company)
                {
                    //ok, this's needed company
                    //let's calculate profit
                    changing j = Base.first_c;
                    Decimal  q = i.count * i.cost;
                    while (j != null)
                    {
                        if (j.name == name_company && j.date.CompareTo(i.date) > 0)
                        {
                            q = q * (1 + (Decimal)j.change / 100);
                        }
                        j = j.next;
                    }
                    old_cost += i.cost * i.count;
                    profit   += q;
                }
                i = i.next;
            }
            change ret = new change();

            ret.new_cost = profit;
            ret.profit   = profit - old_cost;
            ret.percent  = ((float)(profit / old_cost) - 1) * 100;
            return(ret);
        }
Beispiel #5
0
        public static void delete(Int32 id)
        {
            DL temp = new DL();

            DL.delete(temp[id]);
        }
Beispiel #6
0
        public static Entity show_current(Int32 id)
        {
            DL temp = new DL();

            return(temp [id]);
        }
Beispiel #7
0
        public static void add(string name, DateTime date, Int32 count, Decimal cost)
        {
            Entity entity = new Entity(name, date, count, cost);

            DL.add_to_list(entity);
        }