private void srpSearch_OnSearchClick(object sender, EventArgs args) { DataTable dt = getTempDataTable("row", 24); List <Project> projList = MakeSQLWithSearchRule.getProjectList(srpSearch); foreach (Project proj in projList) { List <object> cells = new List <object>(); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogVersion").getValue <string>("未知")); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogType").getValue <string>("未知")); cells.Add(proj.Domains); cells.Add(proj.TaskNumber); cells.Add(proj.ProjectNumber); cells.Add(proj.ProjectName); cells.Add(proj.TotalMoney); cells.Add(proj.TotalTime); cells.Add(proj.SecretLevel); //显示仅为项目负责人 Person masterPerson = ConnectionManager.Context.table("Person").where ("CatalogID = '" + proj.CatalogID + "' and SubjectID = '' and IsProjectMaster = 'true'").select("*").getItem <Person>(new Person()); if (masterPerson != null && masterPerson.PersonID != null && masterPerson.PersonID.Length >= 1) { cells.Add(masterPerson.PersonName); } else { cells.Add(string.Empty); } cells.Add(proj.DutyUnit); cells.Add(proj.DutyUnitOrg); cells.Add(proj.DutyUnitAddress); cells.Add(proj.OKQuestionMemo); cells.Add(proj.OKCheckA); cells.Add(proj.OKCheckB); cells.Add(proj.ContactCheckLevelA); cells.Add(proj.ContactCheckLevelB); cells.Add(proj.Memo); cells.Add(proj.ProjectID); if (masterPerson != null && masterPerson.PersonID != null && masterPerson.PersonID.Length >= 1) { cells.Add(masterPerson.Telephone); cells.Add(masterPerson.Mobilephone); } else { cells.Add(string.Empty); cells.Add(string.Empty); } cells.Add(proj.ProjectRange); cells.Add(proj.DutyNormalUnit); dt.Rows.Add(cells.ToArray()); } gcGrid.DataSource = dt; }
private void srpSearch_OnSearchClick(object sender, EventArgs args) { DataTable dt = getTempDataTable("row", 13); List <Project> projList = MakeSQLWithSearchRule.getProjectList(srpSearch); foreach (Project proj in projList) { List <MoneySends> subList = ConnectionManager.Context.table("MoneySends").where ("(CatalogID = '" + proj.CatalogID + "' and ProjectID = '" + proj.ProjectID + "')").orderBy("NodeIndex").select("*").getList <MoneySends>(new MoneySends()); int indexx = 0; foreach (MoneySends mss in subList) { if (srpSearch.Key3Label.Checked && isCurrentDay(mss.NodeWillTime, srpSearch.Key3EditControl) == false) { continue; } if (srpSearch.Key4Label.Checked && isCurrentDay(mss.WillTime, srpSearch.Key4EditControl) == false) { continue; } List <object> cells = new List <object>(); cells.Add(mss.NodeIndex); cells.Add(mss.SendRule); cells.Add(ExcelHelper.getDateTimeForString(mss.WillTime, "yyyy年MM月dd日", string.Empty)); cells.Add(mss.TotalMoney); cells.Add(mss.MemoText); cells.Add(mss.MSID); cells.Add(proj.ProjectName); cells.Add(ExcelHelper.getDateTimeForString(mss.NodeWillTime, "yyyy年MM月dd日", string.Empty)); cells.Add(mss.WillContent); cells.Add(mss.WillLevel); cells.Add(mss.WillWorker); cells.Add("从Excel导入数据"); cells.Add(mss.CatalogID); dt.Rows.Add(cells.ToArray()); } } gcGrid.DataSource = dt; }
private void srpSearch_OnSearchClick(object sender, EventArgs args) { DataTable dt = getTempDataTable("row", 13); List <Project> projList = MakeSQLWithSearchRule.getProjectList(srpSearch); foreach (Project proj in projList) { //显示仅为项目负责人 Person masterPersonObj = ConnectionManager.Context.table("Person").where ("CatalogID = '" + proj.CatalogID + "' and SubjectID = '' and IsProjectMaster = 'true'").select("*").getItem <Person>(new Person()); if (masterPersonObj != null && masterPersonObj.PersonID != null && masterPersonObj.PersonID.Length >= 1) { if (string.IsNullOrEmpty(srpSearch.Key1EditControl.Text) || ((srpSearch.getUsingRuleCount() == 0 || srpSearch.isUsingRule("人员")) && MakeSQLWithSearchRule.isDisplayData(typeof(Person).Name, masterPersonObj.PersonID)) || proj.ProjectName.Contains(srpSearch.Key1EditControl.Text)) { //存在仅为负责人的记录 List <object> cells = new List <object>(); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogVersion").getValue <string>("未知")); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogType").getValue <string>("未知")); cells.Add(proj.ProjectName); cells.Add("-"); cells.Add(masterPersonObj.PersonName); cells.Add(masterPersonObj.PersonIDCard); cells.Add(masterPersonObj.PersonSex); cells.Add(masterPersonObj.WorkUnit); cells.Add(masterPersonObj.PersonJob); cells.Add(masterPersonObj.PersonSpecialty); cells.Add(masterPersonObj.TotalTime); cells.Add(masterPersonObj.TaskContent); cells.Add("项目负责人"); dt.Rows.Add(cells.ToArray()); } } //显示课题成员 List <Subject> subList = ConnectionManager.Context.table("Subject").where ("CatalogID = '" + proj.CatalogID + "' and ProjectID = '" + proj.ProjectID + "'").select("*").getList <Subject>(new Subject()); foreach (Subject sub in subList) { if (string.IsNullOrEmpty(srpSearch.Key1EditControl.Text) || MakeSQLWithSearchRule.isDisplayData(typeof(Subject).Name, sub.SubjectID) || proj.ProjectName.Contains(srpSearch.Key1EditControl.Text)) { List <Person> perList = ConnectionManager.Context.table("Person").where ("CatalogID = '" + proj.CatalogID + "' and SubjectID = '" + sub.SubjectID + "'").select("*").getList <Person>(new Person()); foreach (Person p in perList) { if (string.IsNullOrEmpty(srpSearch.Key1EditControl.Text) || ((srpSearch.getUsingRuleCount() == 0 || srpSearch.isUsingRule("人员")) && MakeSQLWithSearchRule.isDisplayData(typeof(Person).Name, p.PersonID)) || sub.SubjectName.Contains(srpSearch.Key1EditControl.Text) || proj.ProjectName.Contains(srpSearch.Key1EditControl.Text)) { List <object> cells = new List <object>(); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogVersion").getValue <string>("未知")); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogType").getValue <string>("未知")); cells.Add(proj.ProjectName); cells.Add(sub.SubjectName); cells.Add(p.PersonName); cells.Add(p.PersonIDCard); cells.Add(p.PersonSex); cells.Add(p.WorkUnit); cells.Add(p.PersonJob); cells.Add(p.PersonSpecialty); cells.Add(p.TotalTime); cells.Add(p.TaskContent); string roleStr = "未知"; //if (p.IsProjectMaster == "true") //{ // roleStr = "项目负责人兼" + sub.SubjectName + "的" + p.JobInProject; //} //else //{ // roleStr = sub.SubjectName + "的" + p.JobInProject; //} if (p.IsProjectMaster == "true") { roleStr = "项目负责人兼课题" + p.JobInProject; } else { if (p.JobInProject == "负责人") { roleStr = "课题负责人"; } else { roleStr = p.JobInProject; } } cells.Add(roleStr); dt.Rows.Add(cells.ToArray()); } } } } } gcData.DataSource = dt; }
private void srpSearch_OnSearchClick(object sender, EventArgs args) { DataSet dsAll = new DataSet(); DataTable masterDt = getTempDataTable("row", 20); DataTable detailDt = getTempDataTable("row", 9); List <object> cells = new List <object>(); List <Project> projList = MakeSQLWithSearchRule.getProjectList(srpSearch); foreach (Project proj in projList) { int subCounttt = 0; #region 生成从表数据 if (proj != null && !string.IsNullOrEmpty(proj.ProjectID)) { List <Subject> subList = ConnectionManager.Context.table("Subject").where ("CatalogID = '" + proj.CatalogID + "' and ProjectID = '" + proj.ProjectID + "'").select("*").getList <Subject>(new Subject()); foreach (Subject sub in subList) { if (string.IsNullOrEmpty(srpSearch.Key1EditControl.Text) || ((srpSearch.getUsingRuleCount() == 0 || srpSearch.isUsingRule("课题")) && MakeSQLWithSearchRule.isDisplayData(typeof(Subject).Name, sub.SubjectID)) || proj.DutyUnit.Contains(srpSearch.Key1EditControl.Text) || proj.DutyNormalUnit.Contains(srpSearch.Key1EditControl.Text) || proj.DutyUnitAddress.Contains(srpSearch.Key1EditControl.Text)) { if (srpSearch.Key2EditControl.Text == "全部" || sub.DutyUnitOrg == srpSearch.Key2EditControl.Text) { subCounttt++; cells = new List <object>(); cells.Add(sub.SubjectName); Person personObj = ConnectionManager.Context.table("Person").where ("CatalogID = '" + proj.CatalogID + "' and SubjectID = '" + sub.SubjectID + "' and JobInProject = '负责人'").select("*").getItem <Person>(new Person()); if (string.IsNullOrEmpty(personObj.PersonID)) { cells.Add(string.Empty); } else { cells.Add(personObj.PersonName); } cells.Add(sub.DutyUnit); cells.Add(sub.DutyUnitOrg); cells.Add(sub.DutyUnitAddress); cells.Add(proj.ProjectID); if (string.IsNullOrEmpty(personObj.PersonID)) { cells.Add(string.Empty); cells.Add(string.Empty); } else { cells.Add(personObj.Telephone); cells.Add(personObj.Mobilephone); } cells.Add(sub.SecretLevel); detailDt.Rows.Add(cells.ToArray()); } } } } #endregion #region 主表数据 if (srpSearch.Key2EditControl.Text == "全部" || proj.DutyUnitOrg == srpSearch.Key2EditControl.Text || subCounttt >= 1) { cells = new List <object>(); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogVersion").getValue <string>("未知")); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogType").getValue <string>("未知")); cells.Add(proj.Domains); cells.Add(proj.TaskNumber); cells.Add(proj.ProjectNumber); cells.Add(proj.ProjectName); cells.Add(proj.TotalMoney); cells.Add(proj.TotalTime); cells.Add(proj.SecretLevel); //显示仅为项目负责人 Person masterPerson = ConnectionManager.Context.table("Person").where ("CatalogID = '" + proj.CatalogID + "' and SubjectID = '' and IsProjectMaster = 'true'").select("*").getItem <Person>(new Person()); if (masterPerson != null && masterPerson.PersonID != null && masterPerson.PersonID.Length >= 1) { cells.Add(masterPerson.PersonName); } else { cells.Add(string.Empty); } cells.Add(proj.DutyUnit); cells.Add(proj.DutyUnitOrg); cells.Add(proj.DutyUnitAddress); cells.Add(string.Empty); cells.Add(proj.ProjectID); cells.Add(proj.Keywords); if (masterPerson != null && masterPerson.PersonID != null && masterPerson.PersonID.Length >= 1) { cells.Add(masterPerson.Telephone); cells.Add(masterPerson.Mobilephone); } else { cells.Add(string.Empty); cells.Add(string.Empty); } cells.Add(proj.DutyNormalUnit); cells.Add(proj.ProjectRange); masterDt.Rows.Add(cells.ToArray()); } #endregion } #region 生成从属关系数据 masterDt.TableName = "MainView"; detailDt.TableName = "SubjectView"; dsAll.Tables.Add(masterDt); dsAll.Tables.Add(detailDt); DataColumn keyColumn = dsAll.Tables[masterDt.TableName].Columns["row15"]; //主键 DataColumn foreignColumn = dsAll.Tables[detailDt.TableName].Columns["row6"]; //外键 // //对于主从表,层次名至关重要,关系名必须和从表的层次名一致, //否则从表显示的是从表的所有字段,而不是所设计的显示字段 // dsAll.Relations.Add(detailDt.TableName, keyColumn, foreignColumn, false); //从表的层次名 gcGrid.DataSource = dsAll.Tables[masterDt.TableName]; #endregion }
private void srpSearch_OnSearchClick(object sender, EventArgs args) { dsAll = new DataSet(); DataTable masterDt = getTempDataTable("row", 33); DataTable detailDt = getTempDataTable("row", 9); List <Project> projList = MakeSQLWithSearchRule.getProjectList(srpSearch); foreach (Project proj in projList) { #region 主表数据 List <object> cells = new List <object>(); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogVersion").getValue <string>("未知")); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogType").getValue <string>("未知")); cells.Add(proj.Domains); cells.Add(proj.TaskNumber); cells.Add(proj.ProjectNumber); cells.Add(proj.ProjectName); cells.Add(proj.TotalMoney); cells.Add(proj.TotalTime); cells.Add(proj.SecretLevel); //显示仅为项目负责人 Person masterPerson = ConnectionManager.Context.table("Person").where ("CatalogID = '" + proj.CatalogID + "' and SubjectID = '' and IsProjectMaster = 'true'").select("*").getItem <Person>(new Person()); if (masterPerson != null && masterPerson.PersonID != null && masterPerson.PersonID.Length >= 1) { cells.Add(masterPerson.PersonName); } else { cells.Add(string.Empty); } cells.Add(proj.DutyUnit); cells.Add(proj.DutyUnitOrg); cells.Add(proj.DutyUnitAddress); cells.Add(string.Empty); cells.Add(proj.ProjectID); cells.Add(proj.Keywords); if (masterPerson != null && masterPerson.PersonID != null && masterPerson.PersonID.Length >= 1) { cells.Add(masterPerson.Telephone); cells.Add(masterPerson.Mobilephone); cells.Add(masterPerson.PersonJob); } else { cells.Add(string.Empty); cells.Add(string.Empty); cells.Add(string.Empty); } cells.Add(proj.OKQuestionMemo); cells.Add(proj.OKCheckA); cells.Add(proj.OKCheckB); cells.Add(proj.ContactCheckLevelA); cells.Add(proj.ContactCheckLevelB); cells.Add(proj.Memo); //第一年度经费,第二年度经费,第三年度经费,第四年度经费,第五年度经费 for (int kkk = 1; kkk <= 5; kkk++) { cells.Add(ConnectionManager.Context.table("Dicts").where ("CatalogID='" + proj.CatalogID + "' and DictName='Year" + kkk + "'").select("DictValue").getValue <string>(string.Empty)); } //起止时间(拨付时间) List <DateTime> dtList = new List <DateTime>(); DataList dlMoneySendList = ConnectionManager.Context.table("MoneySends").where ("CatalogID='" + proj.CatalogID + "'").orderBy("WillTime").select("WillTime").getDataList(); if (dlMoneySendList.getRowCount() >= 1) { foreach (DataItem diiii in dlMoneySendList.getRows()) { DateTime willTime = diiii.get("WillTime") != null?DateTime.Parse(diiii.get("WillTime").ToString()) : DateTime.Now; dtList.Add(willTime); } } if (dtList.Count >= 2) { cells.Add(dtList[0].ToString("yyyy年MM月dd日") + "~" + dtList[dtList.Count - 1].ToString("yyyy年MM月dd日")); } else if (dtList.Count == 1) { cells.Add(dtList[0].ToString("yyyy年MM月dd日") + "~"); } else { cells.Add(""); } cells.Add(proj.DutyNormalUnit); cells.Add(proj.ProjectRange); masterDt.Rows.Add(cells.ToArray()); #endregion #region 生成从表数据 if (proj != null && !string.IsNullOrEmpty(proj.ProjectID)) { List <Subject> subList = ConnectionManager.Context.table("Subject").where ("CatalogID = '" + proj.CatalogID + "' and ProjectID = '" + proj.ProjectID + "'").select("*").getList <Subject>(new Subject()); foreach (Subject sub in subList) { cells = new List <object>(); cells.Add(sub.SubjectName); Person personObj = ConnectionManager.Context.table("Person").where ("CatalogID = '" + proj.CatalogID + "' and SubjectID = '" + sub.SubjectID + "' and JobInProject = '负责人'").select("*").getItem <Person>(new Person()); if (string.IsNullOrEmpty(personObj.PersonID)) { cells.Add(string.Empty); } else { cells.Add(personObj.PersonName); } cells.Add(sub.DutyUnit); cells.Add(sub.DutyUnitOrg); cells.Add(sub.DutyUnitAddress); cells.Add(proj.ProjectID); if (string.IsNullOrEmpty(personObj.PersonID)) { cells.Add(string.Empty); cells.Add(string.Empty); } else { cells.Add(personObj.Telephone); cells.Add(personObj.Mobilephone); } cells.Add(sub.SecretLevel); detailDt.Rows.Add(cells.ToArray()); } } #endregion } #region 生成从属关系数据 masterDt.TableName = "MainView"; detailDt.TableName = "SubjectView"; dsAll.Tables.Add(masterDt); dsAll.Tables.Add(detailDt); DataColumn keyColumn = dsAll.Tables[masterDt.TableName].Columns["row15"]; //主键 DataColumn foreignColumn = dsAll.Tables[detailDt.TableName].Columns["row6"]; //外键 // //对于主从表,层次名至关重要,关系名必须和从表的层次名一致, //否则从表显示的是从表的所有字段,而不是所设计的显示字段 // dsAll.Relations.Add(detailDt.TableName, keyColumn, foreignColumn, false); //从表的层次名 gcGrid.DataSource = dsAll.Tables[masterDt.TableName]; #endregion }
private void srpSearch_OnSearchClick(object sender, EventArgs args) { DataTable dt = getTempDataTable("row", 12); List <Project> projList = MakeSQLWithSearchRule.getProjectList(srpSearch); foreach (Project proj in projList) { List <Subject> subList = ConnectionManager.Context.table("Subject").where ("CatalogID = '" + proj.CatalogID + "' and ProjectID = '" + proj.ProjectID + "'").select("*").getList <Subject>(new Subject()); foreach (Subject sub in subList) { if (string.IsNullOrEmpty(srpSearch.Key1EditControl.Text) || ((srpSearch.getUsingRuleCount() == 0 || srpSearch.isUsingRule("课题")) && MakeSQLWithSearchRule.isDisplayData(typeof(Subject).Name, sub.SubjectID)) || proj.ProjectName.Contains(srpSearch.Key1EditControl.Text)) { List <object> cells = new List <object>(); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogVersion").getValue <string>("未知")); cells.Add(ConnectionManager.Context.table("Catalog").where ("CatalogID='" + proj.CatalogID + "'").select("CatalogType").getValue <string>("未知")); cells.Add(proj.ProjectName); cells.Add(sub.SubjectName); Person personObj = ConnectionManager.Context.table("Person").where ("CatalogID = '" + proj.CatalogID + "' and SubjectID = '" + sub.SubjectID + "' and JobInProject = '负责人'").select("*").getItem <Person>(new Person()); if (string.IsNullOrEmpty(personObj.PersonID)) { cells.Add(string.Empty); } else { cells.Add(personObj.PersonName); } cells.Add(sub.DutyUnit); cells.Add(sub.DutyUnitOrg); cells.Add(sub.DutyUnitAddress); if (cells[1] != null && cells[1].ToString() == "合同书") { //合同书总经费 //cells.Add(ConnectionManager.Context.table("Dicts").where("CatalogID = '" + proj.CatalogID + "' and SubjectID ='" + sub.SubjectID + "' and DictType='SubjectMoney,SubjectMoneyInfo' and DictName = 'Money1'").select("DictValue").getValue<string>("")); cells.Add(sub.TotalMoney); } else { //建议书总经费 cells.Add(sub.TotalMoney); } if (string.IsNullOrEmpty(personObj.PersonID)) { cells.Add(string.Empty); cells.Add(string.Empty); } else { cells.Add(personObj.Telephone); cells.Add(personObj.Mobilephone); } cells.Add(sub.SecretLevel); dt.Rows.Add(cells.ToArray()); } } } gcGrid.DataSource = dt; }