void Button1Click(object sender, EventArgs e) { string username = this.textBox6.Text; string password = this.textBox7.Text; Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine; Microsoft.Win32.RegistryKey reg = key.CreateSubKey("software\\WisoftWatchClient"); reg.SetValue("Version", this.textBox1.Text); reg.SetValue("SqlDB", this.textBox1.Text); reg.SetValue("UnitDocPath", this.textBox2.Text); reg.SetValue("UnitHtmlPath", this.textBox3.Text); reg.SetValue("HtmlUrl", this.textBox4.Text); reg.SetValue("WisofServiceHost", this.textBox5.Text); if (PersonDao.getAllPersonInfo(username).Count == 1) { PersonInfo ps = PersonDao.getAllPersonInfo(username)[0]; ps.Fullname = username; password = MD5Common.GetMd5Hash(password); ps.Password = password; GlobalParams.User = ps; reg.SetValue("Username", username); reg.SetValue("Password", password); reg.SetValue("UserId", ps.Id); FunctionUtils.UpdateAppConfig("Username", username); FunctionUtils.UpdateAppConfig("Password", password); FunctionUtils.UpdateAppConfig("UserId", ps.Id.ToString()); SqlDBUtil.update(ps); } else { MessageBox.Show("数据库没有该用户!,请联系管理员"); } }
public UICheckList() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); System.DateTime dt = System.DateTime.Now; dateTimePicker1.Value = dt.AddDays(-7); List <PersonInfo> 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"; List <ModuleInfo> 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.comboBox3.Items.Add("全部状态"); this.comboBox3.Items.AddRange(Enum.GetNames(typeof(CommonConst.CheckState))); this.comboBox3.SelectedIndex = 0; this.comboBox3.SelectedIndexChanged += new EventHandler(conditionChanged); this.comboBox1.SelectedIndexChanged += new EventHandler(conditionChanged); this.comboBox2.SelectedIndexChanged += new EventHandler(conditionChanged); this.listView1.DoubleClick += new EventHandler(ListVew_DoubleClick); this.dateTimePicker1.ValueChanged += new EventHandler(conditionChanged); this.dateTimePicker2.ValueChanged += new EventHandler(conditionChanged); this.currentpage = 1; this.label3.Text = string.Format(currentstr, this.currentpage); this.label5.Text = string.Format(pagestr, this.pagesize); this.label4.Text = string.Format(countstr, (count % pagesize == 0)?count / pagesize:count / pagesize + 1, this.count); getUIcheckList(); // // TODO: Add constructor code after the InitializeComponent() call. // }
/**************************项目信息结束*******************************************************************/ /**************************责任人信息开始*******************************************************************/ private void getAllPersonInfo() { this.textBox6.Text = null; this.textBox5.Text = null; this.textBox10.Text = null; this.textBox11.Text = null; List <PersonInfo> personlist = PersonDao.getAllPersonInfo(); this.listView3.Items.Clear(); foreach (PersonInfo person in personlist) { ListViewBingForPerson(person); } }
/**************************版本信息开始*******************************************************************/ private void getAllModuleInfo() { datasource_person = PersonDao.getAllPersonInfo(); PersonInfo person = new PersonInfo(); person.Fullname = "选择责任人"; person.Id = 0; datasource_person.Insert(0, person); comboBox1.DataSource = datasource_person; comboBox1.DisplayMember = "Fullname"; comboBox1.ValueMember = "Id"; this.textBox1.Text = null; this.textBox2.Text = null; modulelist = ModuleDao.getAllModuleInfo(); modulelist2 = ModuleDao.getAllModuleInfo(); this.listView1.Items.Clear(); foreach (ModuleInfo module in modulelist) { ListViewBingForModule(module); } }
public PackageUI() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); this.listView1.DoubleClick += new EventHandler(Button4Click); TreeNode tmp = new TreeNode("全部"); tmp.Nodes.Add(CommonConst.PACKSTATE_YiJieShou); //已接收 tmp.Nodes.Add(CommonConst.PACKSTATE_YiChuLi); //已处理 tmp.Nodes.Add(CommonConst.PACKSTATE_YiCeShi); //已测试 tmp.Nodes.Add(CommonConst.PACKSTATE_YiFaBu); //已发布 tmp.Nodes.Add(CommonConst.PACKSTATE_YiFeiZhi); //已废止 treeView1.Nodes.Add(tmp); treeView1.SelectedNode = treeView1.Nodes[0].Nodes[0]; //让选中项背景色呈现蓝色 treeView1.SelectedNode.BackColor = Color.SteelBlue; //前景色为白色 treeView1.SelectedNode.ForeColor = Color.White; treeView1.ExpandAll(); treeView1.NodeMouseClick += new TreeNodeMouseClickEventHandler(treeView1_NodeMouseClick); treeView1.Leave += new EventHandler(treeView1_Leave); treeView1.BeforeSelect += new TreeViewCancelEventHandler(treeView1_BeforeSelect); List <PersonInfo> 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.SelectedIndexChanged += new EventHandler(conditionChanged); List <ModuleInfo> 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(conditionChanged); System.DateTime dt = System.DateTime.Now; dateTimePicker1.Value = dt.AddDays(-7); this.dateTimePicker1.ValueChanged += new EventHandler(conditionChanged); this.dateTimePicker2.ValueChanged += new EventHandler(conditionChanged); this.currentpage = 1; this.label3.Text = string.Format(currentstr, this.currentpage); this.label5.Text = string.Format(pagestr, this.pagesize); this.label4.Text = string.Format(countstr, (count % pagesize == 0)?count / pagesize:count / pagesize + 1, this.count); getAllPackInList(); // // TODO: Add constructor code after the InitializeComponent() call. // }
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. // }
public PublishUI() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); List <PersonInfo> 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"; List <ModuleInfo> 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; //---------------------------------- TreeNode root1 = new TreeNode(); root1.Text = "未发布"; TreeNode root = new TreeNode(); root.Text = ftphost; string[] list = this.ListDirectory("/"); if (list != null) { foreach (var element in list) { TreeNode temp = new TreeNode(element); temp.Nodes.Add(new TreeNode()); root.Nodes.Add(temp); } } this.treeView1.Nodes.Add(root1); this.treeView1.Nodes.Add("今日发布"); this.treeView1.Nodes.Add(root); this.treeView1.Nodes[1].Expand(); this.treeView1.AfterExpand += new TreeViewEventHandler(treeView1_AfterExpand); this.treeView1.NodeMouseClick += new TreeNodeMouseClickEventHandler(treeView1_NodeMouseClick); this.treeView1.Leave += new EventHandler(treeView1_Leave); this.treeView1.BeforeSelect += new TreeViewCancelEventHandler(treeView1_BeforeSelect); treeView1.SelectedNode = treeView1.Nodes[0]; //让选中项背景色呈现蓝色 treeView1.SelectedNode.BackColor = Color.SteelBlue; //前景色为白色 treeView1.SelectedNode.ForeColor = Color.White; this.exListView1.MySortBrush = SystemBrushes.ControlLight; this.exListView1.MyHighlightBrush = Brushes.Goldenrod; this.exListView1.GridLines = true; this.exListView1.ControlPadding = 4; ImageList colimglst = new ImageList(); colimglst.ImageSize = new Size(1, 25); // this will affect the row height this.exListView1.SmallImageList = colimglst; this.exListView1.Columns.Add(new EXColumnHeader("更新包名称", 200)); this.exListView1.Columns.Add(new EXEditableColumnHeader("上传路径", 180)); this.exListView1.Columns.Add(new EXColumnHeader("进度", 120)); this.exListView1.Columns.Add(new EXColumnHeader("状态", 150)); this.exListView1.Columns.Add(new EXColumnHeader("操作", 45)); this.currentpage = 1; this.label3.Text = string.Format(currentstr, this.currentpage); this.label5.Text = string.Format(pagestr, this.pagesize); this.label4.Text = string.Format(countstr, (count % pagesize == 0)?count / pagesize:count / pagesize + 1, this.count); System.DateTime dt = System.DateTime.Now; dateTimePicker1.Value = dt.AddDays(-7); getPublishPackageList(); // // TODO: Add constructor code after the InitializeComponent() call. // }
public Main() { // // The InitializeComponent() call is required for Windows Forms designer support. // Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine; Microsoft.Win32.RegistryKey dbc = key.OpenSubKey("software\\WisoftWatchClient", true); //注册热键(窗体句柄,热键ID,辅助键,实键) RegisterHotKey(this.Handle, 888, (int)KeyModifiers.Ctrl , Keys.N); RegisterHotKey(this.Handle, 999, ((int)KeyModifiers.Ctrl + (int)KeyModifiers.Shift), Keys.A); string username = ConfigurationManager.AppSettings["Username"]; string password = ConfigurationManager.AppSettings["Password"]; bool checkpass = true; string errorstr = ""; if (dbc == null || dbc.GetValue("Username") == null) { { checkpass = false; errorstr = "对不起,您的设置可能有问题,请重新设置!"; } } else if (string.IsNullOrEmpty(username)) { { checkpass = false; errorstr = "您好像是第一次登录系统,请设置用户名密码"; } } else if (PersonDao.getAllPersonInfo(username, password).Count != 1) { { checkpass = false; errorstr = "您的用户名密码好像不正确,请设置用户名密码"; } } else if (dbc.GetValue("Version").ToString() != "0.4.3") { { System.Diagnostics.Process.Start("notepad.exe", System.Environment.CurrentDirectory + "\\releasenote.txt"); dbc.SetValue("Version", "0.4.3"); } } if (!checkpass) { MessageBox.Show(errorstr); Dbconfig db = new Dbconfig(); if (db.ShowDialog() != DialogResult.OK) { //this.Load += new EventHandler(main_Load); this.Close(); System.Windows.Forms.Application.Exit(); //return; } else { if (dbc.GetValue("Version").ToString() != "0.4.3") { { System.Diagnostics.Process.Start("notepad.exe", System.Environment.CurrentDirectory + "\\releasenote.txt"); dbc.SetValue("Version", "0.4.3"); } } InitializeComponent(); username = ConfigurationManager.AppSettings["Username"]; if (string.IsNullOrEmpty(username)) { this.Text = this.Text + "--未登录"; } else { this.Text = this.Text + "--" + username; } } } else { try { SqlDBUtil.CheckDBState(); } catch (Exception) { MessageBox.Show("数据库异常", "DBERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); System.Windows.Forms.Application.Exit(); } GlobalParams.User = PersonDao.getAllPersonInfo(username, password)[0]; InitializeComponent(); this.Text = this.Text + "--" + username; } this.notifyIcon1.Visible = true; this.notifyIcon1.MouseClick += new MouseEventHandler(notifyIcon1_Click); this.SizeChanged += new EventHandler(Main_MinimumSizeChanged); this.Closing += new CancelEventHandler(Main_Closing); LoadModules(); // // TODO: Add constructor code after the InitializeComponent() call. // }
public TestListUI() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); TreeNode tmp = new TreeNode("全部"); foreach (var element in Enum.GetNames(typeof(CommonConst.TestState))) { tmp.Nodes.Add(element); } treeView1.Nodes.Add(tmp); treeView1.ExpandAll(); treeView1.SelectedNode = treeView1.Nodes[0].Nodes[0]; //让选中项背景色呈现蓝色 treeView1.SelectedNode.BackColor = Color.SteelBlue; //前景色为白色 treeView1.SelectedNode.ForeColor = Color.White; System.DateTime dt = System.DateTime.Now; dateTimePicker1.Value = dt.AddDays(-7); List <PersonInfo> 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"; List <ModuleInfo> 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.comboBox3.Items.Add("全部等级"); this.comboBox3.Items.AddRange(CommonConst.BUGLEVEL); this.comboBox3.SelectedIndex = 0; this.comboBox3.SelectedIndexChanged += new EventHandler(conditionChanged); this.comboBox1.SelectedIndexChanged += new EventHandler(conditionChanged); this.comboBox2.SelectedIndexChanged += new EventHandler(conditionChanged); treeView1.NodeMouseClick += new TreeNodeMouseClickEventHandler(treeView1_NodeMouseClick); treeView1.Leave += new EventHandler(treeView1_Leave); treeView1.BeforeSelect += new TreeViewCancelEventHandler(treeView1_BeforeSelect); this.listView1.DoubleClick += new EventHandler(ListVew_DoubleClick); this.dateTimePicker1.ValueChanged += new EventHandler(conditionChanged); this.dateTimePicker2.ValueChanged += new EventHandler(conditionChanged); this.currentpage = 1; this.label3.Text = string.Format(currentstr, this.currentpage); this.label5.Text = string.Format(pagestr, this.pagesize); this.label4.Text = string.Format(countstr, (count % pagesize == 0)?count / pagesize:count / pagesize + 1, this.count); getTestUnitList(); // // TODO: Add constructor code after the InitializeComponent() call. // }