Exemple #1
0
        private void SaveLiPro_Click(object sender, EventArgs e)
        {
            if (!isNewLiPro) SaveLoad.UpdateEl_3m(tempLiPro, LiProDate.Value, objId, db);
            else
            {
                if (currObj.El_3m.Any<EL_3m>(p => p.Date == LiProDate.Value))
                {
                    MessageBox.Show("Вече съществува актуализация със същата дата!");
                    return;
                }
                SaveLoad.SaveEl_3m(tempLiPro, objId, db);
                //currObj.El_1.Add(tempIsol);
            }
            foreach (Control con in LightningProtection.Controls)
            {
                if (con == NewActLiPro || con == EditActLiPro || con == SaveLiPro || con == BackLiPro || con == EngineerNameLiPro || con == LiProDate)
                    con.Enabled = true;
                else con.Enabled = false;
            }
            //db.SaveChanges();
            SwitchVisLiPro();

            EL_3m t = tempLiPro;
            tempLiPro = new EL_3m();
            foreach (LightningGrounding cab in t.ListOfGroundings_El_3m)
            {
                LightningGrounding tempC = new LightningGrounding();
                tempC.Adjusted = cab.Adjusted;
                tempC.AuxiliaryGrounding = cab.AuxiliaryGrounding;
                tempC.Measured = cab.Measured;
                tempC.Name = cab.Name;
                tempC.Probe = cab.Probe;
                tempLiPro.ListOfGroundings_El_3m.Add(tempC);
            }
            tempLiPro.Date = t.Date;
            tempLiPro.Max = t.Max;
            tempLiPro.NameOfEngineer = t.NameOfEngineer;
            tempLiPro.WetSeason = t.WetSeason;
        }
Exemple #2
0
        //private void IsolationTable_Scroll(object sender, EventArgs e) { IsolationTable.VerticalScroll.Value = (sender as ScrollBar).Value; }
        private void Main_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'nPLabDataSet.Engineers' table. You can move, or remove it, as needed.
            //this.engineersTableAdapter.Fill(this.nPLabDataSet.Engineers);
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<NPLabDbContext, Configuration>());

            currObj = (from p in db.Object
                       where p.Id == this.objId
                       select p).FirstOrDefault();
            //
            //var db = new NPLabDbContext();

            //Създаване на скролбар
            IsolationTable.AutoScroll = true;

            //Инициализация на статичните данни
            Stats = new StaticClass();

            //
            tempIsol = new EL_1
            {
                Date = DateTime.Now,
                SourceVoltage = System.Convert.ToInt32(Naprejenie.Value),
                Min = System.Convert.ToDouble(Norm.Value),
                MinMeasured = System.Convert.ToInt32(MinMeas.Value),
                MaxMeasured = System.Convert.ToInt32(MaxMeas.Value),
            };

            EngineerNameIsol.Items.AddRange(Stats.Engineers);
            EngineerNameIsol.SelectedIndex = 0;
            EngineerNameImp.Items.AddRange(Stats.Engineers);
            EngineerNameImp.SelectedIndex = 0;
            EngineerNameGr.Items.AddRange(Stats.Engineers);
            EngineerNameGr.SelectedIndex = 0;
            EngineerNameLiPro.Items.AddRange(Stats.Engineers);
            EngineerNameLiPro.SelectedIndex = 0;
            EngineerNameDef.Items.AddRange(Stats.Engineers);
            EngineerNameDef.SelectedIndex = 0;

            //Добавяне на вече съществуващите контроли към списъците с тях
            Names.Add(textBoxName);
            TypeCabs.Add(TypeCabel);
            Count.Add(Number);
            Surface.Add(CabelArea);
            MeasuredForm.Add(Measured);
            Conductors.Add(Cond);
            Rem.Add(Delete);

            //По подразбиране се избира тип кабел "СВТ"
            tempIsol.ListOfCabels.Add(new Cabel());
            TypeCabel.SelectedIndex = 0;
            textBoxName_TextChanged(textBoxName, new EventArgs());
            Number_ValueChanged(Number, new EventArgs());
            CabelArea_ValueChanged(CabelArea, new EventArgs());
            Measured_ValueChanged(Measured, new EventArgs());

            tempImp.Coefficent = System.Convert.ToInt32(Coefficient.Value);
            tempImp.MaxMeasured = System.Convert.ToDouble(Maximum.Value);
            tempImp.MinMeasured = System.Convert.ToDouble(Minimum.Value);

            Grounding gr = new Models.Grounding
            {
                AuxiliaryGrounding = System.Convert.ToDouble(AuxGr1.Value),
                Probe = System.Convert.ToDouble(Probe1.Value),
                Measured = System.Convert.ToDouble(Meas1.Value),
                Adjusted = System.Convert.ToDouble(Adj1.Value),
                Name = GroundingName.Text
            };
            tempGr.ListOfGroundings.Add(gr);

            LightningGrounding LiGr = new Models.LightningGrounding
            {
                AuxiliaryGrounding = System.Convert.ToDouble(AuxLi1.Value),
                Probe = System.Convert.ToDouble(ProbeLi1.Value),
                Measured = System.Convert.ToDouble(MeasLi1.Value),
                Adjusted = System.Convert.ToDouble(AdjLi1.Value),
                Name = LightningName.Text
            };
            tempLiPro.ListOfGroundings_El_3m.Add(LiGr);
            LoadObj(currObj);
            tempDef.DNHighest = System.Convert.ToDouble(MaxIN.Value);
            tempDef.DNLowest = System.Convert.ToDouble(MinIN.Value);
            tempDef.DTHighest = System.Convert.ToDouble(Maxt.Value);
            tempDef.DTLowest = System.Convert.ToDouble(Mint.Value);
            tempDef.maxDN = System.Convert.ToDouble(NormIN.Value);
            tempDef.maxDT = System.Convert.ToDouble(Normt.Value);
        }