示例#1
0
        private void WrForm(wrForm wrf)
        {
            switch (wrf)
            {
            case wrForm.modelINFO:
                groupBox_modINFO.Text = "Общая информация о модели";
                modINFO.Text          =
                    "Модель \"" + model.name + "\""
                    + "\nДата сохранения " + model.date.ToLongDateString()
                    + " " + model.date.ToShortTimeString()
                    + "\nВсего " + model.elementsCount + " элементов"
                    + " в " + model.elmGroups.Count + " группах";
                modINFO.BackColor = Color.LightBlue;
                break;

            case wrForm.modelReport:
                //                 ListBox rep = new ListBox();
                //8/4                    rep.Size = new Size(300, 300);
                List <string> modRep = new List <string>();
                foreach (var gr in model.elmGroups)
                {
                    string str = gr.mat + "\t" + gr.prf + "\t" + gr.totalPrice;
                    modRep.Add(str);
                }
                listBox1.DataSource = modRep;
                break;
            }
//            throw new NotImplementedException();
        }
示例#2
0
        private void WrForm(wrForm wrf, int indx = -1)
        {
            switch (wrf)
            {
            case wrForm.modelINFO:
                modINFOhdr.Text    = "Информация о модели";
                label_modINFO.Text =
                    "Название \"" + model.name + "\""
                    + "\nДата сохранения " + model.date.ToLongDateString()
                    + " " + model.date.ToShortTimeString()
                    + "\nВсего " + model.elementsCount + " элементов"
                    + " в " + model.elmGroups.Count + " группах";
                label_modINFO.BackColor = Color.LightBlue;
                break;

            case wrForm.modelReport:
                List <string> modRep = new List <string>();
                foreach (var gr in model.elmGroups)
                {
                    string str = string.Format("{0,12} {1,15} {2,20:N2}", gr.mat, gr.prf, gr.totalPrice);
                    modRep.Add(str);
                }
                listBox1.DataSource = modRep;
                double totalPrice = 0.0;
                foreach (var gr in model.elmGroups)
                {
                    totalPrice += gr.totalPrice;
                }
                string st = string.Format("Общая цена проекта {0:N0} руб", totalPrice);
                label_totalPrice.Text = st;
                break;
            }
        }