コード例 #1
0
        /// <summary>
        /// 无参数的构造函数
        /// </summary>
        public ProjectCompany()
        {
            InitializeComponent();

            // 填充公司名称和资质代码
            this.CompanyNameTextBox.Text = SettingDataBase.ReadCompanyName();
            this.CompanyCodeTextBox.Text = SettingDataBase.ReadCompanyCode();

            // 设置ComboBox数据
            InitialComboBox();
        }
コード例 #2
0
        /// <summary>
        /// 点击"项目公司信息设置"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ProjectCompanySettingButton_Click(object sender, RoutedEventArgs e)
        {
            // 赋值传递数据,并初始化projectCompany窗体
            string name;

            if (!string.IsNullOrEmpty(projectSetting.CompanyName))
            {
                name = projectSetting.CompanyName;
            }
            else
            {
                name = SettingDataBase.ReadCompanyName();
            }
            string code;

            if (!string.IsNullOrEmpty(projectSetting.CompanyCode))
            {
                code = projectSetting.CompanyCode;
            }
            else
            {
                code = SettingDataBase.ReadCompanyCode();
            }
            string         drawer         = projectSetting.Drawer;
            string         writer         = projectSetting.Writer;
            string         checker        = projectSetting.Checker;
            string         inspector      = projectSetting.Inspector;
            string         approver       = projectSetting.Approver;
            string         finalApprover  = projectSetting.FinalApprover;
            ProjectCompany projectCompany = new ProjectCompany(name, code, drawer, writer, checker, inspector, approver, finalApprover);

            projectCompany.ShowDialog();

            // 点击确定按钮后,刷新projectSetting类中关于公司信息的属性
            if (projectCompany.DialogResult == true)
            {
                projectSetting.CompanyName   = projectCompany.CompanyNameTextBox.Text;
                projectSetting.CompanyCode   = projectCompany.CompanyCodeTextBox.Text;
                projectSetting.Drawer        = projectCompany.DrawerComboBox.Text;
                projectSetting.Writer        = projectCompany.WriterComboBox.Text;
                projectSetting.Checker       = projectCompany.CheckerComboBox.Text;
                projectSetting.Inspector     = projectCompany.InspectorComboBox.Text;
                projectSetting.Approver      = projectCompany.ApproverComboBox.Text;
                projectSetting.FinalApprover = projectCompany.FinalApproverComboBox.Text;
            }
        }