public List <WorkItem> computeWork(List <WorkItem> list) { //最终需要返回的集合 List <WorkItem> workItemList = new List <WorkItem>(); //模块数据层实例 ModuleDao moduleDao = new ModuleDao(); int num = 0; //循环所有订单 foreach (WorkItem workItem in list) { //订单开始日期 DateTime nowDate = workItem.work_start_date; //总生产数量 double lastNum = workItem.work_num; //订单所选模块 List <module_info> moduleList = moduleDao.listByWorkId(workItem.id); //循环添加模块对应的每天生产的数量 do { //查找包含当前循环模块的订单实例 for (int i = num, j = 0; i < (moduleList.Count + num); i++) { try { workItemList[i].moduleInfo = moduleList[j]; } catch (ArgumentOutOfRangeException e) { workItemList.Add(new WorkItem(workItem)); workItemList[i].moduleInfo = moduleList[j]; workItemList[i].workDayList = new List <WorkDay>(); } WorkDay workDay = new WorkDay(); //当天工作几小时 double hour = workHour(nowDate); //当天生产数量 double workNum = hour * (double)moduleList[j].num; //总生产数量减去当天生产数量 lastNum -= workNum; //累加天 workDay.dateTime = nowDate; //当天生产数量 workDay.work_num = lastNum < 0 ? workNum + lastNum < 0 ? 0 : workNum + lastNum : workNum; //添加到当前循环模块的工作天集合 workItemList[i].workDayList.Add(workDay); j++; } //天数加1 nowDate = nowDate.Date.AddDays(1); } while (lastNum > 0); num += moduleList.Count; } return(workItemList); }
//新增 void Button1Click(object sender, EventArgs e) { if (ValidateModuleEdit()) { ModuleInfo newmodule = new ModuleInfo(); newmodule.Code = textBox2.Text; newmodule.Createtime = DateTime.Now.ToLocalTime().ToString(); newmodule.Fullname = textBox1.Text; newmodule.Managerid = Int32.Parse(comboBox1.SelectedValue.ToString()); newmodule.Managername = comboBox1.Text; newmodule.Lastversion = textBox9.Text; newmodule.Id = 0; if (ModuleDao.getModuleByCode(newmodule.Code)) { MessageBox.Show("模块代码已存在,不能重复!", "提示:"); return; } else { bool isinsert = SqlDBUtil.insert(newmodule); if (isinsert) { getAllModuleInfo(); } } } }
public Cdc.MetaManager.DataAccess.Domain.Module GetModuleById(Guid moduleId) { Cdc.MetaManager.DataAccess.Domain.Module module = ModuleDao.FindById(moduleId); NHibernateUtil.Initialize(module.Application); return(module); }
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. // }
public IList <Domain.Module> GetAllModules(Guid applicationId) { IList <Domain.Module> modules = ModuleDao.FindAll(applicationId); foreach (Domain.Module module in modules) { NHibernateUtil.Initialize(module.Dialogs); } return(modules); }
public JsonResult GetMainMenus() { ModuleDao moduleDao = new ModuleDao(); List <Module> modules = moduleDao.FindByParent("root"); List <Module> results = new List <Module>(); foreach (var item in modules) { results.Add(item); } return(new ServiceStackJsonResult() { Data = results, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetSubMenus() { string parentId = Request["Id"]; List <MenuItem> result = new List <MenuItem>(); ModuleDao moduleDao = new ModuleDao(); List <Module> modules = moduleDao.FindByParent(parentId); foreach (var item in modules) { MenuItem menu = new MenuItem(); menu.text = "<div style=\"width:95px;\">" + item.Title + "</div>"; menu.handler = "function() { loadModule('" + item.Name + "', '" + item.Title + "', '" + item.Url + "');}"; result.Add(menu); } return(new ServiceStackJsonResult { Data = result.ToArray(), JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
/**************************版本信息开始*******************************************************************/ 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); } }
void getlistboxdata() { List <ModuleInfo> selmodule = ModuleDao.getAllModuleInfoByProjectID(comboBox2.SelectedValue.ToString()); List <ModuleInfo> listBox1data = new List <ModuleInfo>(); List <ModuleInfo> listBox2data = new List <ModuleInfo>(); foreach (ModuleInfo module in modulelist) { bool t = true; foreach (ModuleInfo sel in selmodule) { if (sel.Equals(module)) { t = false; break; } } if (t) { listBox1data.Add(module); } else { listBox2data.Add(module); } } this.listBox1.DataSource = listBox1data; this.listBox1.DisplayMember = "Fullname"; this.listBox1.ValueMember = "Id"; this.listBox1.SelectedItem = null; this.listBox2.DataSource = listBox2data; this.listBox2.DisplayMember = "Fullname"; this.listBox2.ValueMember = "Id"; this.listBox2.SelectedItem = null; }
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. // }
private bool CheckVersion() { //计算是不是大于最新版本,如果大于,更新模块最新版本。 try { string[] fi = packageinfo.Packagename.Split('('); string[] fi1 = fi[1].Split(')'); string code = fi1[0]; string version = fi1[1]; string[] version_groups = version.Split('.'); ModuleInfo mi = new ModuleInfo(); mi = ModuleDao.getModuleInfobyId(packageinfo.Moduleid); string[] lastversion_groups = mi.Lastversion.Split('.'); if (!string.IsNullOrEmpty(mi.Lastversion)) //三位检测 5.168.1 { if (version_groups.Length < 3) { MessageBox.Show("版本号序列小于3位!"); return(false); } if (version_groups.Length == lastversion_groups.Length) { for (int i = 0; i < version_groups.Length - 2; i++) { if (version_groups[i] != lastversion_groups[i]) { DialogResult dr = MessageBox.Show("版本号检测存在异常,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (DialogResult.No == dr) { return(false); } } } } //必须大于 发布版本 if (int.Parse(version_groups[version_groups.Length - 2]) < int.Parse(lastversion_groups[version_groups.Length - 2])) { DialogResult dr = MessageBox.Show("版本号小于发布版本,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (DialogResult.No == dr) { return(false); } } if (version_groups[version_groups.Length - 2] == lastversion_groups[version_groups.Length - 2]) { if (int.Parse(version_groups[version_groups.Length - 1]) > int.Parse(lastversion_groups[version_groups.Length - 1])) { DialogResult dr = MessageBox.Show("较低的测试位,请注意该版本已发布,如要发布此版本,请重新发布,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (DialogResult.No == dr) { return(false); } } } } return(true); } catch (Exception) { MessageBox.Show("版本号序列不正确。"); return(false); } }
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 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. // }