예제 #1
0
        private DataGridViewRow GetRow(Shedule shed)
        {
            var row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTextBoxCell {
                Value = shed.date.ToString("dd.MM.yy")
            });

            string strTO3 = "", strTR1 = "";

            foreach (MVPS mvps in shed.MVPS_Maintenance)
            {
                strTO3 += mvps.GetSeries() + ",";
            }
            foreach (MVPS mvps in shed.MVPS_Repair)
            {
                strTR1 += mvps.GetSeries() + ",";
            }
            strTO3 = strTO3.TrimEnd(',');
            strTR1 = strTR1.TrimEnd(',');

            row.Cells.Add(new DataGridViewTextBoxCell {
                Value = strTO3
            });
            row.Cells.Add(new DataGridViewTextBoxCell {
                Value = strTR1
            });

            return(row);
        }
예제 #2
0
        private void RemoveFromShed(int v)
        {
            using (kipEntities context = new kipEntities())
            {
                var shedule = context.SheduleSet.Where(b => b.date == dateTimePicker1.Value.Date).SingleOrDefault();

                if (shedule == null)
                {
                    shedule = new Shedule()
                    {
                        date = dateTimePicker1.Value.Date,
                    };
                    context.SheduleSet.Add(shedule);
                }

                var strings = DayMVPSList.Items[v].ToString().Split(' ');

                var repairOrMaintenance = strings[0];
                var type   = strings[1];
                var series = strings[2];

                var mvps = context.MVPSSet.Where(b => b.series == series && b.MVPSType.name == type).First();

                if (repairOrMaintenance == "ТО3")
                {
                    shedule.MVPS_Maintenance.Remove(mvps);
                }
                else if (repairOrMaintenance == "ТР1")
                {
                    shedule.MVPS_Repair.Remove(mvps);
                }

                context.SaveChanges();
                FillTable();
            }
        }
예제 #3
0
        private void AddToShed(bool isRepair)
        {
            CheckFields();
            {
                using (kipEntities context = new kipEntities())
                {
                    var shedule = context.SheduleSet.Where(b => b.date == dateTimePicker1.Value.Date).SingleOrDefault();

                    if (shedule == null)
                    {
                        shedule = new Shedule()
                        {
                            date = dateTimePicker1.Value.Date,
                        };
                        context.SheduleSet.Add(shedule);
                    }

                    var strings = MVPSSeriesBox.SelectedItem.ToString().Split(' ');
                    var type    = strings[0];
                    var series  = strings[1];
                    var mvps    = context.MVPSSet.Where(b => b.series == series && b.MVPSType.name == type).First();
                    if (isRepair)
                    {
                        shedule.MVPS_Repair.Add(mvps);
                    }
                    else
                    {
                        shedule.MVPS_Maintenance.Add(mvps);
                    }

                    context.SaveChanges();
                    FillTable();
                    FillList();
                }
            }
        }
예제 #4
0
        public static void FillGrid(ListBox list, DataGridView view)
        {
            var str = "";

            if (list.SelectedItem != null)
            {
                str = list.SelectedItem.ToString();
            }
            gridView = view;
            listBox  = list;

            switch (str)
            {
            case "Оборудование":
                Equipment.FillGrid(view);
                break;

            case "Типы оборудования":
                EquipmentType.FillGrid(view);
                break;

            case "Производители":
                Manufacturer.FillGrid(view);
                break;

            case "Типы систем":
                SystemType.FillGrid(view);
                break;

            case "Роли МВПС":
                MVPSRole.FillGrid(view);
                break;

            case "Типы МВПС":
                MVPSType.FillGrid(view);
                break;

            case "МВПС":
                MVPS.FillGrid(view);
                break;

            case "Правила компелктования":
                EquipmentRule.FillGrid(view);
                break;

            case "Замены оборудования":
                ReplacingLog.FillGrid(view);
                break;

            case "Работники":
                Worker.FillGrid(view);
                break;

            case "Должности":
                Position.FillGrid(view);
                break;

            case "График ТО и ТР":
                Shedule.FillGrid(view);
                break;

            case "Журнал проверки/ремонта":
                ServiceLog.FillGrid(view);
                break;

            default:
                break;
            }
        }