コード例 #1
0
ファイル: EL-3.cs プロジェクト: BorislavRadev/NPLab
        private void SaveGr_Click(object sender, EventArgs e)
        {
            if (!isNewGr) SaveLoad.UpdateEl_3(tempGr, GroundingDate.Value, objId, db);
             else
             {
                 if (currObj.El_3.Any<EL_3>(p => p.Date == GroundingDate.Value))
                 {
                     MessageBox.Show("Вече съществува актуализация със същата дата!");
                     return;
                 }
                 SaveLoad.SaveEl_3(tempGr, objId, db);
                 //currObj.El_1.Add(tempIsol);
             }
             foreach (Control con in Grounding.Controls)
             {
                 if (con == NewActGr || con == EditActGr || con == SaveGr || con == BackGr || con == EngineerNameGr || con == GroundingDate)
                     con.Enabled = true;
                 else con.Enabled = false;
             }

             //db.SaveChanges();
             SwitchVisGr();

             EL_3 t = tempGr;
             tempGr = new EL_3();
             foreach (Grounding cab in t.ListOfGroundings)
             {
                 Grounding tempC = new Grounding();
                 tempC.Adjusted = cab.Adjusted;
                 tempC.AuxiliaryGrounding = cab.AuxiliaryGrounding;
                 tempC.Measured = cab.Measured;
                 tempC.Name = cab.Name;
                 tempC.Probe = cab.Probe;
                 tempGr.ListOfGroundings.Add(tempC);
             }
             tempGr.Date = t.Date;
             tempGr.Max = t.Max;
             tempGr.NameOfEngineer = t.NameOfEngineer;
             tempGr.WetSeason = t.WetSeason;
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: BorislavRadev/NPLab
        //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);
        }