/// <summary> /// 生成表头 /// </summary> /// <param name="fieldNameBefore"></param> /// <param name="nodeFieldCount"></param> /// <param name="colNames"></param> public void makeColumns(string fieldNameBefore, int nodeFieldCount, string[] colNames) { gcGrid.DataSource = null; gvDetail.Columns.Clear(); DataTable dtTemp = BaseModuleController.getTempDataTable(fieldNameBefore, nodeFieldCount); int colIndexx = 0; DevExpress.XtraGrid.Columns.GridColumn colTemp = null; foreach (string cName in colNames) { colIndexx++; colTemp = new DevExpress.XtraGrid.Columns.GridColumn(); colTemp.Caption = cName; colTemp.FieldName = fieldNameBefore + colIndexx; colTemp.Name = fieldNameBefore + colIndexx; colTemp.Visible = true; colTemp.VisibleIndex = colIndexx; if (cName == "归一化单位") { colTemp.OptionsColumn.AllowEdit = true; } else { colTemp.OptionsColumn.AllowEdit = false; } gvDetail.Columns.Add(colTemp); } }
public void updateCatalogs() { DataTable dt = BaseModuleController.getTempDataTable("row", 8); List <Catalog> list = ConnectionManager.Context.table("Catalog").where ("CatalogType='建议书'").select("*").getList <Catalog>(new Catalog()); int indexx = 0; foreach (Catalog catalog in list) { indexx++; List <object> cells = new List <object>(); cells.Add(indexx); cells.Add(catalog.CatalogVersion); cells.Add(catalog.CatalogNumber); cells.Add(catalog.CatalogName); Person p = ConnectionManager.Context.table("Person").where ("IsProjectMaster='true' and CatalogID = '" + catalog.CatalogID + "'").select("*").getItem <Person>(new Person()); if (p != null) { cells.Add(p.PersonName); cells.Add(p.WorkUnit); } cells.Add(catalog.CatalogID); cells.Add("删除"); dt.Rows.Add(cells.ToArray()); } gcGrid.DataSource = dt; }
private void loadData() { Dictionary <string, string> subjectDict = new Dictionary <string, string>(); dtSubject = BaseModuleController.getTempDataTable("row", 5); dtPerson = BaseModuleController.getTempDataTable("row", 6); //构造课题数据 List <Subject> subjectList = ConnectionManager.Context.table("Subject").where ("ProjectID='" + proj.ProjectID + "'").select("*").getList <Subject>(new Subject()); foreach (Subject subObj in subjectList) { if (subObj.DutyNormalUnit == "未匹配") { List <object> cells = new List <object>(); cells.Add(subObj.SubjectName); cells.Add(subObj.DutyUnit); cells.Add(subObj.DutyNormalUnit); cells.Add(subObj.ProjectID); cells.Add(subObj.SubjectID); dtSubject.Rows.Add(cells.ToArray()); } subjectDict[subObj.SubjectID] = subObj.SubjectName; } //构造人员数据 List <Person> personList = ConnectionManager.Context.table("Person").where ("ProjectID='" + proj.ProjectID + "'").select("*").getList <Person>(new Person()); foreach (Person perObj in personList) { if (perObj.WorkNormalUnit == "未匹配") { List <object> cells = new List <object>(); if (subjectDict.ContainsKey(perObj.SubjectID)) { cells.Add(subjectDict[perObj.SubjectID]); } else { cells.Add(string.Empty); } cells.Add(perObj.PersonName); cells.Add(perObj.WorkUnit); cells.Add(perObj.WorkNormalUnit); cells.Add(perObj.ProjectID); cells.Add(perObj.PersonID); dtPerson.Rows.Add(cells.ToArray()); } } rbSubjectItems.Checked = true; makeColumns("row", 3, new string[] { "课题名称", "负责单位", "归一化单位" }); gcGrid.DataSource = dtSubject; }
private void updateTeacherComments() { if (TeacherObj != null) { DataTable dtTemp = BaseModuleController.getTempDataTable("row", 5); List <DB.Entitys.TeacherComment> list = ConnectionManager.Context.table("TeacherComment").where ("TeacherID='" + teacherID + "'").select("*").getList <DB.Entitys.TeacherComment>(new DB.Entitys.TeacherComment()); foreach (DB.Entitys.TeacherComment tc in list) { List <object> cells = new List <object>(); cells.Add(ExcelHelper.getDateTimeForString(tc.CommentDate, "yyyy年MM月dd日", string.Empty)); cells.Add(tc.CommentText); cells.Add(tc.TeacherCommentID); cells.Add("编辑"); cells.Add("删除"); dtTemp.Rows.Add(cells.ToArray()); } gcGrid.DataSource = dtTemp; } }
private void srpSearch_OnExportToClick(object sender, EventArgs args) { BaseModuleController.exportToExcelWithDevExpress(dgvDetail); }
private void tvProjectList_AfterSelect(object sender, TreeViewEventArgs e) { DataTable dtSubject = null; DataTable dtUnit = null; //清理经费显示区域 tpTag1.Controls.Clear(); if (e.Node.Tag is Catalog) { //项目金额 Catalog catalogObj = (Catalog)e.Node.Tag; tpTag1.PageVisible = true; xtcData.SelectedTabPage = tpTag1; #region 显示经费表 List <Dicts> projectDicts = ConnectionManager.Context.table("Dicts").where ("CatalogID='" + catalogObj.CatalogID + "' and ProjectID='" + catalogObj.CatalogID + "' and (SubjectID is null or SubjectID= '')").select("*").getList <Dicts>(new Dicts()); addMoneyTablePage(catalogObj.CatalogID, catalogObj.CatalogName, projectDicts); #endregion List <Subject> subjectList = ConnectionManager.Context.table("Subject").where ("CatalogID='" + catalogObj.CatalogID + "'").select("*").getList <Subject>(new Subject()); //生成列 makeTableColumnsForCatalogID(catalogObj.CatalogID); dtSubject = BaseModuleController.getTempDataTable("row", gvDetailForSubject.Columns.Count); dtUnit = BaseModuleController.getTempDataTable("row", gvDetailForSubject.Columns.Count); #region 组织课题经费数据 foreach (Subject sObj in subjectList) { List <SubjectMoneys> lxSubjects = ConnectionManager.Context.table("SubjectMoneys").where ("CatalogID='" + catalogObj.CatalogID + "' and SubjectID='" + sObj.SubjectID + "'").orderBy("CatalogID,SubjectID,SMName").select("*").getList <SubjectMoneys>(new SubjectMoneys()); int totalValue = 0; DataRow drr = dtSubject.NewRow(); drr[nodeColDict["****名称"]] = sObj.SubjectName; foreach (SubjectMoneys sms in lxSubjects) { MoneySends mss = ConnectionManager.Context.table("MoneySends").where ("MSID='" + sms.NodeID + "'").select("*").getItem <MoneySends>(new MoneySends()); if (string.IsNullOrEmpty(mss.MSID)) { continue; } try { totalValue += int.Parse(sms.SMValue); } catch (Exception ex) { } if (nodeColDict.ContainsKey(mss.SendRule)) { drr[nodeColDict[mss.SendRule]] = sms.SMValue; } } drr[nodeColDict["****合计"]] = totalValue.ToString(); dtSubject.Rows.Add(drr); } #endregion #region 组织单位经费数据 List <string> unitList = new List <string>(); List <UnitMoneys> unitMoneysList = ConnectionManager.Context.table("UnitMoneys").where ("CatalogID='" + catalogObj.CatalogID + "'").select("*").getList <UnitMoneys>(new UnitMoneys()); foreach (UnitMoneys ums in unitMoneysList) { if (unitList.Contains(ums.UnitName)) { continue; } else { unitList.Add(ums.UnitName); } } foreach (string unitName in unitList) { List <UnitMoneys> lxUnits = ConnectionManager.Context.table("UnitMoneys").where ("CatalogID='" + catalogObj.CatalogID + "' and UnitName='" + unitName + "'").orderBy("CatalogID,UnitName,UMName").select("*").getList <UnitMoneys>(new UnitMoneys()); int totalValue = 0; DataRow drr = dtUnit.NewRow(); drr[nodeColDict["****名称"]] = unitName; foreach (UnitMoneys ums in lxUnits) { MoneySends mss = ConnectionManager.Context.table("MoneySends").where ("MSID='" + ums.NodeID + "'").select("*").getItem <MoneySends>(new MoneySends()); if (string.IsNullOrEmpty(mss.MSID)) { continue; } try { totalValue += int.Parse(ums.UMValue); } catch (Exception ex) { } if (nodeColDict.ContainsKey(mss.SendRule)) { drr[nodeColDict[mss.SendRule]] = ums.UMValue; } } drr[nodeColDict["****合计"]] = totalValue.ToString(); dtUnit.Rows.Add(drr); } #endregion } else if (e.Node.Tag is Subject) { //课题金额 Subject subectObj = (Subject)e.Node.Tag; tpTag1.PageVisible = false; //生成列 makeTableColumnsForCatalogID(subectObj.CatalogID); dtSubject = BaseModuleController.getTempDataTable("row", gvDetailForSubject.Columns.Count); dtUnit = BaseModuleController.getTempDataTable("row", gvDetailForSubject.Columns.Count); #region 组织课题经费数据 List <SubjectMoneys> lxSubjects = ConnectionManager.Context.table("SubjectMoneys").where ("CatalogID='" + subectObj.CatalogID + "' and SubjectID='" + subectObj.SubjectID + "'").orderBy("CatalogID,SubjectID,SMName").select("*").getList <SubjectMoneys>(new SubjectMoneys()); int totalValue = 0; DataRow drr = dtSubject.NewRow(); drr[nodeColDict["****名称"]] = subectObj.SubjectName; foreach (SubjectMoneys sms in lxSubjects) { MoneySends mss = ConnectionManager.Context.table("MoneySends").where ("MSID='" + sms.NodeID + "'").select("*").getItem <MoneySends>(new MoneySends()); if (string.IsNullOrEmpty(mss.MSID)) { continue; } try { totalValue += int.Parse(sms.SMValue); } catch (Exception ex) { } if (nodeColDict.ContainsKey(mss.SendRule)) { drr[nodeColDict[mss.SendRule]] = sms.SMValue; } } drr[nodeColDict["****合计"]] = totalValue.ToString(); dtSubject.Rows.Add(drr); #endregion #region 组织单位经费数据 #endregion } gcGridForSubject.DataSource = dtSubject; gcGridForUnit.DataSource = dtUnit; }
/// <summary> /// 显示模块 /// </summary> /// <param name="name">模块名称</param> /// <param name="isDisableAllModules">是否屏蔽其它模块</param> public void showModule(string oldName, bool isDisableAllModules) { string name = oldName.Trim(); //检查是否需要屏蔽其它的模块 if (isDisableAllModules) { foreach (BaseModuleController bmc in ModuleDict.Values) { //停止 bmc.stop(); } //清除顶部工具条 int clearCount = rcTopBar.Pages.Count; if (clearCount >= 1) { for (int kk = 0; kk < clearCount; kk++) { rcTopBar.Pages.RemoveAt(0); } } } //按名称搜索并显示模块 BaseModuleController currentModule = null; if (ModuleDict.ContainsKey(name)) { //设置当前模块引用 currentModule = ModuleDict[name]; //设置内容显示控件 currentModule.DisplayControl = plRightContent; //设置底部提示文本控件 currentModule.StatusLabelControl = bsiBottomText; //插入顶部工具条 RibbonPage[] pages = currentModule.getTopBarPages(); if (pages != null && pages.Length >= 1) { //显示顶部工具条 foreach (RibbonPage rp in pages) { if (rcTopBar.Pages.Contains(rp)) { continue; } else { rcTopBar.Pages.Insert(rcTopBar.Pages.Count - 1, rp); } } //显示新添加的页面 rcTopBar.SelectedPage = pages[0]; } //启动 currentModule.start(); } }
public DataTable getTempMoneyTable(string fieldNameBefore, int nodeFieldCount) { #region 生成DataTable和Column dgvDetail.Columns.Clear(); DataTable dtTemp = BaseModuleController.getTempDataTable(fieldNameBefore, 4 + nodeFieldCount); int colIndexx = 0; colIndexx++; DevExpress.XtraGrid.Columns.GridColumn colTemp = new DevExpress.XtraGrid.Columns.GridColumn(); colTemp.Caption = "科目名称"; colTemp.FieldName = fieldNameBefore + colIndexx; colTemp.Name = fieldNameBefore + colIndexx; colTemp.Visible = true; colTemp.VisibleIndex = colIndexx; dgvDetail.Columns.Add(colTemp); colIndexx++; colTemp = new DevExpress.XtraGrid.Columns.GridColumn(); colTemp.Caption = "项目合同总价款"; colTemp.FieldName = fieldNameBefore + colIndexx; colTemp.Name = fieldNameBefore + colIndexx; colTemp.Visible = true; colTemp.VisibleIndex = colIndexx; dgvDetail.Columns.Add(colTemp); for (int kkk = 1; kkk <= nodeFieldCount; kkk++) { colIndexx++; colTemp = new DevExpress.XtraGrid.Columns.GridColumn(); colTemp.Caption = "项目节点" + kkk + "支出经费"; colTemp.FieldName = fieldNameBefore + colIndexx; colTemp.Name = fieldNameBefore + colIndexx; colTemp.Visible = true; colTemp.VisibleIndex = colIndexx; dgvDetail.Columns.Add(colTemp); } colIndexx++; colTemp = new DevExpress.XtraGrid.Columns.GridColumn(); colTemp.Caption = "项目累计支出经费"; colTemp.FieldName = fieldNameBefore + colIndexx; colTemp.Name = fieldNameBefore + colIndexx; colTemp.Visible = true; colTemp.VisibleIndex = colIndexx; dgvDetail.Columns.Add(colTemp); colIndexx++; colTemp = new DevExpress.XtraGrid.Columns.GridColumn(); colTemp.Caption = "备注"; colTemp.FieldName = fieldNameBefore + colIndexx; colTemp.Name = fieldNameBefore + colIndexx; colTemp.Visible = true; colTemp.VisibleIndex = colIndexx; dgvDetail.Columns.Add(colTemp); #endregion #region 写入第一列的值 string[] tNames = new string[] { "(一) 直接费用", " 1.设备费", " (1)设备购置费", " (2)设备试制费", " (3)其他", " 2.材料费", " 3.外部协作费", " 4.燃料动力费", " 5.会议/差旅/国际合作与交流费", " 6.出版/文献/信息传播知识产权事务费", " 7.劳务费", " 8.专家咨询费", " 9.其他支出", "(二) 间接费用", " 10.管理费/科研绩效支出" }; foreach (string s in tNames) { List <string> cells = new List <string>(); cells.Add(s); for (int ffff = 0; ffff < dtTemp.Columns.Count - 1; ffff++) { cells.Add(string.Empty); } dtTemp.Rows.Add(cells.ToArray()); } #endregion return(dtTemp); }