Ejemplo n.º 1
0
        private void btnSub_Click(object sender, EventArgs e)
        {
            PramasBLL     pbll = new PramasBLL();
            IntroducerBLL ibll = new IntroducerBLL();
            List <HOZAPModel.Introducer> IntroducerList = null;
            string PramasName = txtPramasName.Text.Trim();

            if (!string.IsNullOrEmpty(PramasName))
            {
                pbll.Add_Pramas(PramasName);
                int pramasid = pbll.Get_PramasId(PramasName);
                if (dgvIntroducer.Rows.Count > 0)
                {
                    IntroducerList = new List <HOZAPModel.Introducer>();
                    foreach (DataGridViewRow row in dgvIntroducer.Rows)
                    {
                        HOZAPModel.Introducer IntroducerInfo = new HOZAPModel.Introducer();
                        IntroducerInfo.IntroducerText = row.Cells[1].Value.ToString();
                        IntroducerInfo.PramasId       = pramasid;
                        IntroducerList.Add(IntroducerInfo);
                    }
                }
                if (ibll.Add_Introducerinfo(IntroducerList))
                {
                    if (MyPreParamSelectionDataBindEvents != null)
                    {
                        MyPreParamSelectionDataBindEvents();
                    }
                    MessageBox.Show("添加成功!");
                    this.Close();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 已选参数展示表的数据绑定
        /// </summary>
        private void PreParamSledDataBind()
        {
            IntroducerBLL                     ibll        = new IntroducerBLL();
            string                            ProName     = HAZOP分析系统.ProName;
            List <SelectedPramas>             splist      = spbll.Get_SelectedPramasList(ProName);
            List <DisplayPramasAndIntroducer> displaylist = null;

            if (splist != null)
            {
                List <HOZAPModel.Introducer> introducerlist = new List <HOZAPModel.Introducer>();
                displaylist = new List <DisplayPramasAndIntroducer>();
                for (int i = 0; i < splist.Count; i++)
                {
                    DisplayPramasAndIntroducer displayinfo = new DisplayPramasAndIntroducer();
                    displayinfo.PramasID = splist[i].PramasId;
                    displayinfo.Name     = splist[i].PramasText;
                    introducerlist       = ibll.Get_IntroducerList(splist[i].PramasId);
                    for (int j = 0; j < introducerlist.Count; j++)
                    {
                        if (j == introducerlist.Count - 1)
                        {
                            displayinfo.AllIntroducer += introducerlist[j].IntroducerText;
                        }
                        else
                        {
                            displayinfo.AllIntroducer += introducerlist[j].IntroducerText + "、";
                        }
                    }
                    displaylist.Add(displayinfo);
                }
            }

            dgvPreParamSled.AutoGenerateColumns = false;
            dgvPreParamSled.DataSource          = displaylist;
        }
Ejemplo n.º 3
0
        public void SetInfo(List <int> PramasIDlist)
        {
            PramasBLL     pbll = new PramasBLL();
            IntroducerBLL ibll = new IntroducerBLL();

            PramasIDList = PramasIDlist;
            Pramas PramasInfo = pbll.Get_PramasInfo(PramasIDlist[0]);

            txtPramasName.Text = PramasInfo.Name;
            List <Introducer> Introducerlist = ibll.Get_IntroducerList(PramasIDlist[0]);

            if (Introducerlist != null)
            {
                dgvIntroducer.Columns.Clear();
                DataGridViewTextBoxColumn a = new DataGridViewTextBoxColumn();
                a.HeaderText = "序号";
                dgvIntroducer.Columns.Add(a);
                DataGridViewTextBoxColumn b = new DataGridViewTextBoxColumn();
                b.HeaderText = "引导词";
                dgvIntroducer.Columns.Add(b);
                DataGridViewTextBoxColumn c = new DataGridViewTextBoxColumn();
                c.HeaderText = "偏离描述";
                dgvIntroducer.Columns.Add(c);
                for (int i = 0; i < Introducerlist.Count; i++)
                {
                    int index = this.dgvIntroducer.Rows.Add();
                    this.dgvIntroducer.Rows[index].Cells[0].Value = index + 1;
                    this.dgvIntroducer.Rows[index].Cells[1].Value = Introducerlist[i].IntroducerText;
                    this.dgvIntroducer.Rows[index].Cells[2].Value = "";
                }
            }
        }
Ejemplo n.º 4
0
        private void UcAnalyCombox_DataBind()
        {
            IntroducerBLL introducerBLL = new IntroducerBLL();

            if (ReceiveSelectedTreeNode != null)
            {
                int id = Convert.ToInt32(ReceiveSelectedTreeNode);
                List <Introducer> introducerList = introducerBLL.Get_IntroducerList(id);
                this.dataGridView1.Columns["Column1"].DataPropertyName = "IntroducerText";
                this.dataGridView1.AutoGenerateColumns = false;
                this.dataGridView1.DataSource          = introducerList;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 创建TreeView
        /// </summary>
        private void CreateTree()
        {
            TreeNode root = new TreeNode();

            root.Text = InitialInterface.ProName;
            trvUcAnaly.Nodes.Add(root);
            SelectedPramasBLL     spbll    = new SelectedPramasBLL();
            IntroducerBLL         ibll     = new IntroducerBLL();
            NodeBLL               nbll     = new NodeBLL();
            List <Node>           nodelist = nbll.Get_NodeList(InitialInterface.ProName);
            List <SelectedPramas> sp       = spbll.Get_SelectedPramasList(InitialInterface.ProName);

            if (nodelist != null)
            {
                for (int i = 0; i < nodelist.Count; i++)
                {
                    TreeNode node1 = new TreeNode();
                    node1.Text = nodelist[i].NodeName;
                    node1.Tag  = nodelist[i].NodeId;
                    root.Nodes.Add(node1);
                    if (sp != null)
                    {
                        for (int j = 0; j < sp.Count; j++)
                        {
                            TreeNode node2 = new TreeNode();
                            node2.Text = sp[j].PramasText;
                            node2.Tag  = sp[j].PramasId;
                            node1.Nodes.Add(node2);
                            List <HOZAPModel.Introducer> Introducerlist = ibll.Get_IntroducerList(sp[j].PramasId);
                            for (int k = 0; k < Introducerlist.Count; k++)
                            {
                                TreeNode node3 = new TreeNode();
                                node3.Text = Introducerlist[k].IntroducerText;
                                node3.Tag  = Introducerlist[k].IntroducerId;
                                node2.Nodes.Add(node3);
                            }
                        }
                    }
                }
                this.trvUcAnaly.Nodes[0].Expand();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 删除参数及相关信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tspPreParamSelDel_Click(object sender, EventArgs e)
        {
            List <int> PramasIdList = new List <int>();

            foreach (DataGridViewRow row in dgvPreParamSelection.Rows)
            {
                DataGridViewCheckBoxCell checkbox = (DataGridViewCheckBoxCell)row.Cells[0];
                if (checkbox.Value == null)
                {
                    checkbox.Value = 0;
                }
                if ((int)checkbox.Value == 1)
                {
                    if ((int)row.Cells["Type"].Value == 0)
                    {
                        MessageBox.Show("选项中有系统参数,无法删除!");
                        return;
                    }
                    else
                    {
                        PramasIdList.Add(Convert.ToInt32(row.Cells["PramasID"].Value));
                    }
                }
            }
            if (PramasIdList.Count > 0)
            {
                PramasBLL     pbll = new PramasBLL();
                IntroducerBLL ibll = new IntroducerBLL();
                if (pbll.Del_PramasById(PramasIdList))
                {
                    ibll.Del_IntroducerByPramasID(PramasIdList);
                    MessageBox.Show("删除成功!");
                    PreParamSelectionDataBind();
                }
            }
            else
            {
                MessageBox.Show("请选择要删除的参数信息!");
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 为选择的参数展示表的数据绑定
        /// </summary>
        private void PreParamSelectionDataBind()
        {
            PramasBLL     pbll    = new PramasBLL();
            IntroducerBLL ibll    = new IntroducerBLL();
            string        ProName = HAZOP分析系统.ProName;
            List <Pramas> plist   = pbll.Get_PramasList(ProName);
            List <DisplayPramasAndIntroducer> displaylist = null;

            if (plist != null)
            {
                List <Introducer> introducerlist = new List <Introducer>();
                displaylist = new List <DisplayPramasAndIntroducer>();
                for (int i = 0; i < plist.Count; i++)
                {
                    DisplayPramasAndIntroducer displayinfo = new DisplayPramasAndIntroducer();
                    displayinfo.PramasID = plist[i].PramasID;
                    displayinfo.Name     = plist[i].Name;
                    displayinfo.Type     = plist[i].Type;
                    introducerlist       = ibll.Get_IntroducerList(plist[i].PramasID);
                    if (introducerlist != null)
                    {
                        for (int j = 0; j < introducerlist.Count; j++)
                        {
                            if (j == introducerlist.Count - 1)
                            {
                                displayinfo.AllIntroducer += introducerlist[j].IntroducerText;
                            }
                            else
                            {
                                displayinfo.AllIntroducer += introducerlist[j].IntroducerText + "、";
                            }
                        }
                    }
                    displaylist.Add(displayinfo);
                }
            }
            dgvPreParamSelection.AutoGenerateColumns = false;
            dgvPreParamSelection.DataSource          = displaylist;
        }
Ejemplo n.º 8
0
        private void btnSub_Click(object sender, EventArgs e)
        {
            PramasBLL     pbll = new PramasBLL();
            IntroducerBLL ibll = new IntroducerBLL();
            List <HOZAPModel.Introducer> IntroducerList = null;
            string PramasName = txtPramasName.Text.Trim();

            if (!string.IsNullOrEmpty(PramasName))
            {
                Pramas PramasInfo = new Pramas();
                PramasInfo.PramasID = PramasIDList[0];
                PramasInfo.Name     = PramasName;
                PramasInfo.Type     = 1;
                if (pbll.Update_Pramas(PramasInfo))
                {
                    if (dgvIntroducer.Rows.Count > 0)
                    {
                        IntroducerList = new List <HOZAPModel.Introducer>();
                        foreach (DataGridViewRow row in dgvIntroducer.Rows)
                        {
                            HOZAPModel.Introducer IntroducerInfo = new HOZAPModel.Introducer();
                            IntroducerInfo.IntroducerText = row.Cells[1].Value.ToString();
                            IntroducerInfo.PramasId       = PramasIDList[0];
                            IntroducerList.Add(IntroducerInfo);
                        }
                    }
                    if (IntroducerList != null)
                    {
                        if (ibll.Check_IntroducerByPramasID(PramasIDList[0]))
                        {
                            if (ibll.Del_IntroducerByPramasID(PramasIDList))
                            {
                                if (ibll.Add_Introducerinfo(IntroducerList))
                                {
                                    if (MyPreParamSelectionDataBindEvents != null)
                                    {
                                        MyPreParamSelectionDataBindEvents();
                                    }
                                    MessageBox.Show("更新成功!");
                                    this.Close();
                                }
                            }
                        }
                        else
                        {
                            if (ibll.Add_Introducerinfo(IntroducerList))
                            {
                                if (MyPreParamSelectionDataBindEvents != null)
                                {
                                    MyPreParamSelectionDataBindEvents();
                                }
                                MessageBox.Show("更新成功!");
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        if (ibll.Del_IntroducerByPramasID(PramasIDList))
                        {
                            if (MyPreParamSelectionDataBindEvents != null)
                            {
                                MyPreParamSelectionDataBindEvents();
                            }
                            MessageBox.Show("更新成功!");
                            this.Close();
                        }
                    }
                }
            }
        }