コード例 #1
0
ファイル: FormDep.cs プロジェクト: scaperow/-V2.0
        private void FormDep_Load(object sender, EventArgs e)
        {
            DepTree.Nodes.Clear();
            List <Orginfo> UnitInfos = DepositoryOrganInfo.QueryOrgans("", "");

            foreach (Orginfo dep in UnitInfos)
            {
                TreeNode Node = new TreeNode();
                Node.Tag  = dep;
                Node.Text = dep.DepName;
                DepTree.Nodes.Add(Node);
            }

            TreeView_Company.Nodes.Clear();
            UnitInfos = DepositoryOrganInfo.QueryOrgans("", "@unit_施工单位");
            foreach (Orginfo dep in UnitInfos)
            {
                TreeNode Node = new TreeNode();
                Node.Name = dep.Index;
                Node.Tag  = dep;
                Node.Text = dep.DepName;
                TreeView_Company.Nodes.Add(Node);
            }

            IsNew  = true;
            IsDele = false;
            IsEdit = false;
        }
コード例 #2
0
ファイル: FormDep.cs プロジェクト: scaperow/-V2.0
 private void btnDele_Click(object sender, EventArgs e)
 {
     if (IsDele)
     {
         if (!DepositoryOrganInfo.ToUser(UnitInfo.Index))
         {
             Boolean Result = DepositoryOrganInfo.DeleteDepName(UnitInfo.Index);
             if (Result)
             {
                 TreeNode Node = DepTree.SelectedNode;
                 UnitInfo = Node.Tag as Orginfo;
                 for (int i = 0; i < DepComboBox.Items.Count; i++)
                 {
                     Orginfo dep = DepComboBox.Items[i] as Orginfo;
                     if (dep.Index == UnitInfo.Index)
                     {
                         DepComboBox.Items.Remove(dep);
                         DepComboBox.Refresh();
                     }
                 }
                 DepTree.Nodes.Remove(Node);
             }
         }
         else
         {
             MessageBox.Show("该单位正在使用,不能删除!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     else
     {
         MessageBox.Show("你还没有选中要删除的单位,\n\r请在右边的树列表中选择一个你要删除的单位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
コード例 #3
0
ファイル: ModifyDevice.cs プロジェクト: scaperow/-V2.0
        private void Section_SelectedIndexChanged(object sender, EventArgs e)
        {
            var section = Section.SelectedItem as Prjsct;
            var units   = new List <Orginfo>();

            if (section != null && !string.IsNullOrEmpty(section.PrjsctCode))
            {
                units.AddRange(DepositoryOrganInfo.QueryOrgans(section.PrjsctCode, ""));
            }

            Unit.DataSource = units;
        }
コード例 #4
0
ファイル: FormDep.cs プロジェクト: scaperow/-V2.0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (IsEdit)
            {
                UnitInfo.DepName   = DepNameTxt.Text;
                UnitInfo.DepAbbrev = DepAbbrevTxt.Text;
                UnitInfo.DepType   = "@unit_" + DepTypeCmb.Text;

                List <string> Companys = new List <string>();
                foreach (TreeNode Node in TreeView_Company.Nodes)
                {
                    if (Node.Checked)
                    {
                        Companys.Add(Node.Name);
                    }
                }
                UnitInfo.ConstructionCompany = string.Join(",", Companys.ToArray());

                if (DepTree.Nodes.Count > 0)
                {
                    foreach (TreeNode n in DepTree.Nodes)
                    {
                        Orginfo TempDep = n.Tag as Orginfo;
                        if ((TempDep.DepName == UnitInfo.DepName) && (TempDep.Index != UnitInfo.Index))
                        {
                            MessageBox.Show("已经存在该单位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                }

                Boolean Result = DepositoryOrganInfo.Update(UnitInfo);
                if (Result)
                {
                    for (int i = 0; i < DepComboBox.Items.Count; i++)
                    {
                        Orginfo dep = DepComboBox.Items[i] as Orginfo;
                        if (dep.Index == UnitInfo.Index)
                        {
                            dep.DepName   = UnitInfo.DepName;
                            dep.DepAbbrev = UnitInfo.DepAbbrev;
                            dep.DepCode   = UnitInfo.DepCode;
                            dep.DepType   = UnitInfo.DepType;
                        }
                    }

                    TreeNode Node = DepTree.SelectedNode;
                    Node.Tag  = UnitInfo;
                    Node.Text = UnitInfo.DepName;
                }
            }
        }
コード例 #5
0
        private void FormSelectDep_Load(object sender, EventArgs e)
        {
            cbCOMPACT.Items.Clear();
            List <Orginfo> UnitInfos = new List <Orginfo>();

            UnitInfos = DepositoryOrganInfo.QueryOrgans("", "");
            if (UnitInfos.Count > 0)
            {
                foreach (Orginfo dep in UnitInfos)
                {
                    cbCOMPACT.Items.Add(dep);
                }
                cbCOMPACT.SelectedIndex = 0;
            }
        }
コード例 #6
0
        private void ComboBox_Segments_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox_Company.Items.Clear();
            ComboBox_Company.Items.Add("全部单位");

            if (ComboBox_Segments.SelectedItem is Prjsct)
            {
                Prjsct         prjsct   = ComboBox_Segments.SelectedItem as Prjsct;
                List <Orginfo> OrgInfos = DepositoryOrganInfo.QueryOrgans(prjsct.PrjsctCode, "");
                ComboBox_Company.Items.AddRange(OrgInfos.ToArray());
            }

            if (ComboBox_Company.Items.Count > 0)
            {
                ComboBox_Company.SelectedIndex = 0;
            }
        }
コード例 #7
0
ファイル: FormCreatDep.cs プロジェクト: scaperow/-V2.0
        private void FormCreatUnit_Load(object sender, EventArgs e)
        {
            TreeView_Company.Nodes.Clear();
            List <Orginfo> UnitInfos = DepositoryOrganInfo.QueryOrgans("", "@unit_施工单位");

            foreach (Orginfo dep in UnitInfos)
            {
                TreeNode Node = new TreeNode();
                Node.Name = dep.Index;
                Node.Tag  = dep;
                Node.Text = dep.DepName;
                TreeView_Company.Nodes.Add(Node);
            }

            this.txtDEPNAME.Text = UnitInfo.DepName;
            this.txtEXPLAIN.Text = UnitInfo.DepAbbrev;

            int Index = this.combBDEPNAME.Items.IndexOf(UnitInfo.DepType.Replace("@unit_", ""));

            this.combBDEPNAME.SelectedIndex = (Index == -1 ? 0 : Index);

            if (UnitInfo.ConstructionCompany == null)
            {
                UnitInfo.ConstructionCompany = "";
            }
            string[] companys = UnitInfo.ConstructionCompany.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (TreeNode Node in TreeView_Company.Nodes)
            {
                int ArrayIndex = Array.IndexOf(companys, Node.Name);
                Node.Checked = (ArrayIndex != -1);
            }

            txtOrderID.Text = UnitInfo.OrderID;
            //if (string.IsNullOrEmpty(UnitInfo.OrderID))
            //{
            //    txtOrderID.Enabled = false;
            //}
            //else
            //{
            //    txtOrderID.Enabled = true;
            //}
        }
コード例 #8
0
ファイル: DeviceManagement.cs プロジェクト: scaperow/-V2.0
        private void Section_SelectedIndexChanged(object sender, EventArgs e)
        {
            Search.Enabled  = false;
            Unit.DataSource = null;

            var section = Section.SelectedItem as Prjsct;
            var units   = new List <Orginfo>();

            if (section != null && !string.IsNullOrEmpty(section.PrjsctCode))
            {
                units.AddRange(DepositoryOrganInfo.QueryOrgans(section.PrjsctCode, ""));
                units.Add(new Orginfo()
                {
                    DepName = "全部",
                    DepCode = "#"
                });

                Unit.DataSource = units;
            }
            Search.Enabled = true;
        }
コード例 #9
0
ファイル: ModifyDevice.cs プロジェクト: scaperow/-V2.0
        private void SetTreeValues(Prjsct section, Orginfo unit, PrjFolder room)
        {
            Section.SelectedIndexChanged  -= new EventHandler(Section_SelectedIndexChanged);
            Unit.SelectedIndexChanged     -= new EventHandler(Unit_SelectedIndexChanged);
            TestRoom.SelectedIndexChanged -= new EventHandler(TestRoom_SelectedIndexChanged);

            Section.DataSource = DepositoryPrjsctInfo.QueryPrjscts(Yqun.Common.ContextCache.ApplicationContext.Current.InProject.Code);
            Section.Text       = section.PrjsctName;

            Unit.DataSource = DepositoryOrganInfo.QueryOrgans(section.PrjsctCode, "");
            Unit.Text       = unit.DepName;

            TestRoom.DataSource    = DepositoryFolderInfo.QueryPrjFolders(unit.DepCode, "");
            TestRoom.SelectedItem  = room;
            TestRoom.SelectedValue = room.FolderCode;
            TestRoom.SelectedText  = room.FolderName;
            TestRoom.Text          = room.FolderName;


            Section.SelectedIndexChanged  += new EventHandler(Section_SelectedIndexChanged);
            Unit.SelectedIndexChanged     += new EventHandler(Unit_SelectedIndexChanged);
            TestRoom.SelectedIndexChanged += new EventHandler(TestRoom_SelectedIndexChanged);
        }
コード例 #10
0
ファイル: FormDep.cs プロジェクト: scaperow/-V2.0
        private void btnNew_Click(object sender, EventArgs e)
        {
            if (IsNew && (!IsDele || !IsEdit))
            {
                UnitInfo           = new Orginfo();
                UnitInfo.DepName   = DepNameTxt.Text;
                UnitInfo.DepAbbrev = DepAbbrevTxt.Text;
                UnitInfo.DepType   = "@unit_" + DepTypeCmb.Text;

                List <string> Companys = new List <string>();
                foreach (TreeNode Node in TreeView_Company.Nodes)
                {
                    if (Node.Checked)
                    {
                        Companys.Add(Node.Name);
                    }
                }
                UnitInfo.ConstructionCompany = string.Join(",", Companys.ToArray());

                if (UnitInfo.DepName == string.Empty || UnitInfo.DepAbbrev == string.Empty || UnitInfo.DepType == string.Empty)
                {
                    if (MessageBox.Show("单位信息不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning) == DialogResult.OK)
                    {
                        this.DialogResult = DialogResult.None;
                        return;
                    }
                    else
                    {
                        this.Close();
                    }
                }

                if (DepTree.Nodes.Count > 0)
                {
                    foreach (TreeNode n in DepTree.Nodes)
                    {
                        if (n.Text == UnitInfo.DepName)
                        {
                            MessageBox.Show("已经存在该单位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                }

                Boolean Result = DepositoryOrganInfo.New(UnitInfo);
                if (Result)
                {
                    DepComboBox.Items.Add(UnitInfo);

                    TreeNode Node = new TreeNode();
                    Node.Tag  = UnitInfo;
                    Node.Text = UnitInfo.DepName;
                    DepTree.Nodes.Add(Node);

                    DepNameTxt.Clear();
                    DepAbbrevTxt.Clear();

                    foreach (TreeNode CompanyNode in TreeView_Company.Nodes)
                    {
                        CompanyNode.Checked = false;
                    }
                }
            }
            else if (IsDele || IsEdit)
            {
                IsNew  = true;
                IsDele = false;
                IsEdit = false;

                DepNameTxt.Clear();
                DepAbbrevTxt.Clear();

                foreach (TreeNode Node in TreeView_Company.Nodes)
                {
                    Node.Checked = false;
                }
            }
        }