Example #1
0
        public void UpdateObject()
        {
            //获取焦点对象
            LineList1 obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //创建对象的一个副本


            LineList1 objCopy = new LineList1();

            DataConverter.CopyTo <LineList1>(obj, objCopy);

            //执行修改操作
            using (FrmLineList1Dialog dlg = new FrmLineList1Dialog())
            {
                dlg.Object = objCopy;   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //用副本更新焦点对象


            DataConverter.CopyTo <LineList1>(objCopy, obj);
            //刷新表格
            gridControl.RefreshDataSource();
        }
Example #2
0
        public void LoadData(string uid)
        {
            LineList1 line = new LineList1();

            line.col1 = uid;
            IList <LineList1> linelist = Services.BaseService.GetList <LineList1>("SelectLineList1ByRefLineEleID", line);
            ArrayList         val      = new ArrayList();



            for (int i = 0; i < linelist.Count; i++)
            {
                PSP_SubstationUserNum num1 = new PSP_SubstationUserNum();
                num1.userID       = Itop.Client.MIS.UserNumber;
                num1.SubStationID = linelist[i].UID;
                num1.num          = 3;
                IList <PSP_SubstationUserNum> sublist = Services.BaseService.GetList <PSP_SubstationUserNum>("SelectPSP_SubstationUserNumByUser", num1);
                if (sublist.Count == 0)
                {
                    MessageBox.Show("线路" + linelist[i].LineName + "还没有评分完成,不能自动计算权值。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            LineList1 n1 = new LineList1();

            n1.col1 = uid;
            list1   = Services.BaseService.GetList <LineList1>("SelectLineList1ByEleIDToTal", n1);


            //for (int i = 0; i < list1.Count; i++)
            //{
            //    LineInfo line = new LineInfo();
            //    line.EleID = list1[i].LineEleID;
            //    line.SvgUID = "c5ec3bc7-9706-4cbd-9b8b-632d3606f933";
            //    line = (LineInfo)Services.BaseService.GetObject("SelectLineInfoByEleID", line);
            //    if (line != null)
            //    {
            //        list1[i].col1 = line.ObligateField6;
            //        list1[i].col2 = line.ObligateField7;
            //    }
            //}
            gridControl.DataSource = list1;
            gridControl.RefreshDataSource();
        }
Example #3
0
        public bool RefreshData()
        {
            try
            {
                LineList1 line = new LineList1();
                line.col1 = eleid;
                IList <LineList1> list = Services.BaseService.GetList <LineList1>("SelectLineList1ByRefLineEleID", line);

                this.gridControl.DataSource = list;
            }
            catch (Exception exc)
            {
                //Debug.Fail(exc.Message);
                //HandleException.TryCatch(exc);
                return(false);
            }

            return(true);
        }
Example #4
0
        protected override void Add()
        {
            //if(treeView1.SelectedNode==null || treeView1.SelectedNode.Parent!=null){
            //    MessageBox.Show("请选择线路规划方案(第一级树目录)。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}



            string    uid  = PID; //treeView1.SelectedNode.Tag.ToString();
            LineList1 line = new LineList1();

            line.col1 = uid;
            IList <LineList1> linelist = Services.BaseService.GetList <LineList1>("SelectLineList1ByRefLineEleID", line);
            ArrayList         val      = new ArrayList();



            for (int i = 0; i < linelist.Count; i++)
            {
                PSP_SubstationUserNum num1 = new PSP_SubstationUserNum();
                num1.userID       = Itop.Client.MIS.UserNumber;
                num1.SubStationID = linelist[i].UID;
                num1.num          = 3;
                IList <PSP_SubstationUserNum> sublist = Services.BaseService.GetList <PSP_SubstationUserNum>("SelectPSP_SubstationUserNumByUser", num1);
                if (sublist.Count == 0)
                {
                    MessageBox.Show("线路" + linelist[i].LineName + "还没有评分完成,不能自动计算权值。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                f = new float[sublist.Count];
                float   sum    = 0f;
                float[] subnum = new float[sublist.Count];
                for (int j = 0; j < sublist.Count; j++)
                {
                    sum = sum + getNumber(sublist[j].col2);
                }
                for (int j = 0; j < sublist.Count; j++)
                {
                    if (getNumber(sublist[j].col2) == 0)
                    {
                        //subnum[j] = 1 / sum;
                        subnum[j] = 0;
                    }
                    else
                    {
                        subnum[j] = getNumber(sublist[j].col2) / sum;
                    }
                }
                val.Add(subnum);
            }
            for (int i = 0; i < val.Count; i++)
            {
                float[] t = val[i] as float[];
                for (int j = 0; j < f.Length; j++)
                {
                    f[j] = f[j] + t[j];
                }
            }
            for (int i = 0; i < f.Length; i++)
            {
                f[i] = Convert.ToSingle(Math.Round((f[i] / val.Count), 3));
            }
            for (int i = 0; i < linelist.Count; i++)
            {
                PSP_SubstationUserNum num1 = new PSP_SubstationUserNum();
                num1.userID       = Itop.Client.MIS.UserNumber;
                num1.SubStationID = linelist[i].UID;
                num1.num          = 3;
                IList <PSP_SubstationUserNum> sublist = Services.BaseService.GetList <PSP_SubstationUserNum>("SelectPSP_SubstationUserNumByUser", num1);
                for (int j = 0; j < sublist.Count; j++)
                {
                    PSP_SubstationUserNum t = sublist[j];
                    t      = Services.BaseService.GetOneByKey <PSP_SubstationUserNum>(t);
                    t.col1 = Convert.ToString(f[j]);
                    Services.BaseService.Update <PSP_SubstationUserNum>(t);
                }
            }
            f = null;
            MessageBox.Show("更新完成。");
            LoadData(sss);
        }
Example #5
0
 private void frmLineList2_Load(object sender, EventArgs e)
 {
     data     = Services.BaseService.GetOneByKey <PSP_LineData>("a");
     q1.Text  = data.q1;
     q2.Text  = data.q2;
     q3.Text  = data.q3;
     q4.Text  = data.q4;
     q5.Text  = data.q5;
     q6.Text  = data.q6;
     q7.Text  = data.q7;
     q8.Text  = data.q8;
     q9.Text  = data.q9;
     q10.Text = data.q10;
     q11.Text = data.q11;
     q12.Text = data.q12;
     q13.Text = data.q13;
     q14.Text = data.q14;
     q15.Text = data.q15;
     q16.Text = data.q16;
     q17.Text = data.q17;
     q18.Text = data.q18;
     q19.Text = data.q19;
     q20.Text = data.q20;
     q21.Text = data.q21;
     q22.Text = data.q22;
     q23.Text = data.q23;
     q24.Text = data.q24;
     q25.Text = data.q25;
     for (int i = 0; i < list.Count; i++)
     {
         LineList1 line = Services.BaseService.GetOneByKey <LineList1>(list[i].ToString());
         this.Controls["lb" + (i + 1)].Text          = line.LineName;
         this.Controls["groupBox" + (i + 2)].Tag     = line.UID;
         this.Controls["groupBox" + (i + 2)].Enabled = true;
     }
     if (groupBox2.Enabled == true)
     {
         PSP_LineData d1 = Services.BaseService.GetOneByKey <PSP_LineData>(groupBox2.Tag.ToString());
         //d1.UID = groupBox2.Tag.ToString();
         if (d1 != null)
         {
             comboBox1.Text  = d1.q1;
             comboBox2.Text  = d1.q2;
             comboBox3.Text  = d1.q3;
             comboBox4.Text  = d1.q4;
             comboBox5.Text  = d1.q5;
             comboBox6.Text  = d1.q6;
             comboBox7.Text  = d1.q7;
             comboBox8.Text  = d1.q8;
             comboBox9.Text  = d1.q9;
             comboBox10.Text = d1.q10;
             comboBox11.Text = d1.q11;
             comboBox12.Text = d1.q12;
             comboBox13.Text = d1.q13;
             comboBox14.Text = d1.q14;
             comboBox15.Text = d1.q15;
             t1.Text         = d1.q16;
             t2.Text         = d1.q17;
             t3.Text         = d1.q18;
             t4.Text         = d1.q19;
             comboBox16.Text = d1.q20;
             comboBox17.Text = d1.q21;
             comboBox18.Text = d1.q22;
             comboBox19.Text = d1.q23;
             comboBox20.Text = d1.q24;
             comboBox21.Text = d1.q25;
             textBox1.Text   = d1.col1;
         }
     }
     if (groupBox3.Enabled == true)
     {
         PSP_LineData d1 = Services.BaseService.GetOneByKey <PSP_LineData>(groupBox3.Tag.ToString());
         //d1.UID = groupBox3.Tag.ToString();
         if (d1 != null)
         {
             b1c1.Text     = d1.q1;
             b1c2.Text     = d1.q2;
             b1c3.Text     = d1.q3;
             b1c4.Text     = d1.q4;
             b1c5.Text     = d1.q5;
             b1c6.Text     = d1.q6;
             b1c7.Text     = d1.q7;
             b1c8.Text     = d1.q8;
             b1c9.Text     = d1.q9;
             b1c10.Text    = d1.q10;
             b1c11.Text    = d1.q11;
             b1c12.Text    = d1.q12;
             b1c13.Text    = d1.q13;
             b1c14.Text    = d1.q14;
             b1c15.Text    = d1.q15;
             t5.Text       = d1.q16;
             t6.Text       = d1.q17;
             t7.Text       = d1.q18;
             t8.Text       = d1.q19;
             b1c16.Text    = d1.q20;
             b1c17.Text    = d1.q21;
             b1c18.Text    = d1.q22;
             b1c19.Text    = d1.q23;
             b1c20.Text    = d1.q24;
             b1c21.Text    = d1.q25;
             textBox2.Text = d1.col1;
         }
     }
     if (groupBox4.Enabled == true)
     {
         PSP_LineData d1 = Services.BaseService.GetOneByKey <PSP_LineData>(groupBox4.Tag.ToString());
         //d1.UID = groupBox4.Tag.ToString();
         if (d1 != null)
         {
             b2c1.Text     = d1.q1;
             b2c2.Text     = d1.q2;
             b2c3.Text     = d1.q3;
             b2c4.Text     = d1.q4;
             b2c5.Text     = d1.q5;
             b2c6.Text     = d1.q6;
             b2c7.Text     = d1.q7;
             b2c8.Text     = d1.q8;
             b2c9.Text     = d1.q9;
             b2c10.Text    = d1.q10;
             b2c11.Text    = d1.q11;
             b2c12.Text    = d1.q12;
             b2c13.Text    = d1.q13;
             b2c14.Text    = d1.q14;
             b2c15.Text    = d1.q15;
             t9.Text       = d1.q16;
             t10.Text      = d1.q17;
             t11.Text      = d1.q18;
             t12.Text      = d1.q19;
             b2c16.Text    = d1.q20;
             b2c17.Text    = d1.q21;
             b2c18.Text    = d1.q22;
             b2c19.Text    = d1.q23;
             b2c20.Text    = d1.q24;
             b2c21.Text    = d1.q25;
             textBox3.Text = d1.col1;
         }
     }
     if (groupBox5.Enabled == true)
     {
         PSP_LineData d1 = Services.BaseService.GetOneByKey <PSP_LineData>(groupBox5.Tag.ToString());
         //d1.UID = groupBox5.Tag.ToString();
         if (d1 != null)
         {
             b3c1.Text     = d1.q1;
             b3c2.Text     = d1.q2;
             b3c3.Text     = d1.q3;
             b3c4.Text     = d1.q4;
             b3c5.Text     = d1.q5;
             b3c6.Text     = d1.q6;
             b3c7.Text     = d1.q7;
             b3c8.Text     = d1.q8;
             b3c9.Text     = d1.q9;
             b3c10.Text    = d1.q10;
             b3c11.Text    = d1.q11;
             b3c12.Text    = d1.q12;
             b3c13.Text    = d1.q13;
             b3c14.Text    = d1.q14;
             b3c15.Text    = d1.q15;
             t13.Text      = d1.q16;
             t14.Text      = d1.q17;
             t15.Text      = d1.q18;
             t16.Text      = d1.q19;
             b3c16.Text    = d1.q20;
             b3c17.Text    = d1.q21;
             b3c18.Text    = d1.q22;
             b3c19.Text    = d1.q23;
             b3c20.Text    = d1.q24;
             b3c21.Text    = d1.q25;
             textBox4.Text = d1.col1;
         }
     }
     if (groupBox6.Enabled == true)
     {
         PSP_LineData d1 = Services.BaseService.GetOneByKey <PSP_LineData>(groupBox6.Tag.ToString());
         // d1.UID = groupBox6.Tag.ToString();
         if (d1 != null)
         {
             b4c1.Text     = d1.q1;
             b4c2.Text     = d1.q2;
             b4c3.Text     = d1.q3;
             b4c4.Text     = d1.q4;
             b4c5.Text     = d1.q5;
             b4c6.Text     = d1.q6;
             b4c7.Text     = d1.q7;
             b4c8.Text     = d1.q8;
             b4c9.Text     = d1.q9;
             b4c10.Text    = d1.q10;
             b4c11.Text    = d1.q11;
             b4c12.Text    = d1.q12;
             b4c13.Text    = d1.q13;
             b4c14.Text    = d1.q14;
             b4c15.Text    = d1.q15;
             t17.Text      = d1.q16;
             t18.Text      = d1.q17;
             t19.Text      = d1.q18;
             t20.Text      = d1.q19;
             b4c16.Text    = d1.q20;
             b4c17.Text    = d1.q21;
             b4c18.Text    = d1.q22;
             b4c19.Text    = d1.q23;
             b4c20.Text    = d1.q24;
             b4c21.Text    = d1.q25;
             textBox5.Text = d1.col1;
         }
     }
 }