public BussinessForm(PackageInfo packageinfo) { // // The InitializeComponent() call is required for Windows Forms designer support. // //传入更新包 this.frompath = packageinfo.Packagepath; this.packageinfo = packageinfo; this.Closing += new CancelEventHandler(Form_Closing); InitializeComponent(); this.textBox1.Text = frompath; String[] temp = frompath.Split('\\'); filename = temp[temp.Length - 1]; /*加载模块选择框*/ datasource_module = ModuleDao.getAllModuleInfo(); ModuleInfo all = new ModuleInfo(); all.Fullname = "选择模块"; all.Id = 0; datasource_module.Insert(0, all); this.comboBox1.DataSource = datasource_module; this.comboBox1.DisplayMember = "Fullname"; this.comboBox1.ValueMember = "Id"; this.comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems; this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.comboBox1.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged); /*加载责任人选择框*/ datasource_person = PersonDao.getAllPersonInfo(); PersonInfo person = new PersonInfo(); person.Fullname = "选择责任人"; person.Id = 0; datasource_person.Insert(0, person); this.comboBox2.DataSource = datasource_person; this.comboBox2.DisplayMember = "Fullname"; this.comboBox2.ValueMember = "Id"; this.comboBox2.AutoCompleteSource = AutoCompleteSource.ListItems; this.comboBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend; //测试复杂度 this.comboBox3.DataSource = FunctionUtils.Convert(CommonConst.TestRate); this.comboBox3.DisplayMember = "col0"; this.comboBox3.ValueMember = "col1"; /*绑定模块*/ int index_module = 0; if (packageinfo.Moduleid != 0) //更新包已有模块ID { for (index_module = 0; index_module < datasource_module.Count; index_module++) { if (packageinfo.Moduleid == datasource_module[index_module].Id) { this.comboBox1.SelectedItem = this.comboBox1.Items[index_module]; isChange = false; break; } } } else //没有模块ID自动绑定 { string[] fi = filename.Split('('); if (fi.Length >= 2) { string name = fi[0]; string[] fi1 = fi[1].Split(')'); string code = fi1[0]; string version = fi1[1]; List <ModuleInfo> list = ModuleDao.getAllModuleInfoLikename(name, code); if (list.Count != 0) { ModuleInfo right_module = null; if (list.Count >= 2) { //找到多个模块(可能是使用分组前缀及其他模块),查找出 使用分组前缀的模块 for (int i = 0; i < list.Count; i++) { if (list[i].Fullname.Contains("_" + name)) //是否使用分组前缀 { right_module = list[i]; break; } } } else { right_module = list[0]; } for (index_module = 0; index_module < datasource_module.Count; index_module++) { if (right_module.Id == datasource_module[index_module].Id) { this.comboBox1.SelectedItem = this.comboBox1.Items[index_module]; //this.packageinfo.Managerid = list[0].Managerid; break; } } //SavePackage();//自动绑定成功。。 if (string.IsNullOrEmpty(right_module.Lastversion)) { } isChange = true; } else { MessageBox.Show("没能找到与更新包相关的模块,请手动确认"); } } else { MessageBox.Show("没能找到与更新包相关的模块,请手动确认"); } } /*绑定责任人*/ int index_manager = 0; if (packageinfo.Managerid != 0) { for (index_manager = 0; index_manager < datasource_module.Count; index_manager++) { if (packageinfo.Managerid == datasource_person[index_manager].Id) { this.comboBox2.SelectedItem = this.comboBox2.Items[index_manager]; break; } } } if (packageinfo.TestRate != 0) { int rate_index; int rate_lenth = CommonConst.TestRate.GetLength(0); for (rate_index = 0; rate_index < rate_lenth; rate_index++) { string sel_rate = CommonConst.TestRate[rate_index, 1]; if (packageinfo.TestRate == Int32.Parse(sel_rate)) { this.comboBox3.SelectedIndex = rate_index; break; } } } getAllProjectPath(); // // TODO: Add constructor code after the InitializeComponent() call. // }