void treeViewOperator_CreatingObject(JH_yearkst newobj) { string pid = getparentValue(); TreeListNode pnode = null; newobj.结束日期 = DateTime.Today; newobj.开始日期 = DateTime.Today; newobj.年 = DateTime.Today.Year.ToString(); newobj.标题 = "计划"; if (treeList1.Selection[0] != null) { pnode = treeList1.Selection[0].ParentNode; } if (newobj.ParentID == pid) {//同级 if (pnode != null) Ebada.Core.ConvertHelper.CopyTo(pnode, newobj); //newobj.材料代码=getcode(pnode, pnode != null ? pnode.Nodes : treeList1.Nodes); } else { //newobj.材料代码 = getcode(treeList1.Selection[0], treeList1.Selection[0].Nodes); } //newobj.材料名称 = JH_yearkst.f_材料名称; }
void treeViewOperator_AfterEdit(JH_yearkst newobj) { if (AfterAdd != null) AfterEdit(treeList1, newobj); }
void treeViewOperator_AfterAdd(JH_yearkst newobj) { if (AfterAdd != null) AfterAdd(treeList1, newobj); treeList1.SetFocusedNode(treeList1.FindNodeByKeyID(newobj.ID)); }
void treeViewOperator_AfterDelete(JH_yearkst newobj) { if (AfterDelete != null) AfterDelete(treeList1, newobj); }
private void buildyear(int year) { //Client.ClientHelper.PlatformSqlMap.DeleteByWhere<JH_yearkst>(" where id like '" + year + "%'"); JH_yearkst jh= Client.ClientHelper.PlatformSqlMap.GetOneByKey<JH_yearkst>(year.ToString()); if (jh != null) return; string syear=year.ToString(); JH_yearkst jh_year = new JH_yearkst() { 年 = syear, ID = syear, ParentID = "0", 标题 = syear + "年计划", 开始日期 = new DateTime(year, 1, 1), 结束日期 = new DateTime(year, 12, 31) }; Client.ClientHelper.PlatformSqlMap.Create<JH_yearkst>(jh_year); JH_yearkst[] jh_months = new JH_yearkst[12]; string smonth=""; for (int i = 1; i <= 12; i++) { smonth=syear+i.ToString("00"); //DateTime.Today. DateTime dt2 = new DateTime(i < 12 ? year : year + 1, i < 12 ? i+1 : 1, 1).AddDays(-1); jh_months[i - 1] = new JH_yearkst() { 年 = smonth, ID = smonth, ParentID = syear, 标题 = syear+"年"+i.ToString("00") + "月计划", 开始日期 = new DateTime(year,i, 1), 结束日期 = dt2 }; } Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(jh_months, null, null); List<JH_yearkst> weeklist = new List<JH_yearkst>(); string lastmonth = syear+"01"; int index = 0; string[] weeks = new string[5] { "第一周", "第二周", "第三周", "第四周", "第五周" }; for (int i = 1; i < 55; i++) { try { DateTime date1=DateTime.Today; DateTime date2=DateTime.Today; string month= ConvertDate.GetWeekOfMonth(year, i, out date1, out date2); string months = syear + "年" + month.Substring(4, 2) + "月"; if (lastmonth == month) { index++; } else { index = 1; lastmonth = month; } weeklist.Add(new JH_yearkst() { 年 = month + index, ID = month + index, ParentID = month, 标题 = months + weeks[index - 1] + "计划", 开始日期 = date1, 结束日期 = date2 }); } catch { } } Client.ClientHelper.PlatformSqlMap.ExecuteTransationUpdate(weeklist.ToArray(), null, null); }
public static void ExportExcelWeek(JH_yearkst year, IList<JH_weekks> nrList) { ExcelAccess ex = new ExcelAccess(); SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string fname = Application.StartupPath + "\\00记录模板\\pdca周循环一览表.xls"; ex.Open(fname); int row = 1; int col = 1; //加页 int pageindex = 1; if (pageindex < Ecommonjh.GetPagecount(nrList.Count, 7)) { pageindex = Ecommonjh.GetPagecount(nrList.Count, 7); } for (int j = 1; j <= pageindex; j++) { ex.ActiveSheet(j);//xjq change 2013-03-01; if (j > 1) { ex.CopySheet(1, 1); } string strWeek = "";//xjq change 2013-03-01; string strYearMonth = ""; int pos = year.标题.IndexOf("第"); if (pos >= 0) { strWeek = year.标题.Substring(pos, 3); strYearMonth = year.标题.Substring(0, pos); } // ex.SetCellValue(year.标题.Replace("计划", "PDCA循环一览表"), row, col); ex.SetCellValue(strYearMonth, row, 1); ex.SetCellValue("(" + strWeek + ")", row, 6); ex.SetCellValue("PDCA循环一览表", row, 7); ex.SetCellValue(year.单位代码, row + 2, col); ; ex.SetCellValue(year.开始日期.ToString("yyyy-MM-dd"), 3, 10); ex.SetCellValue(year.结束日期.ToString("yyyy-MM-dd"), 3, 12); } //ex.ActiveSheet(1); //string strWeek = ""; //string strYearMonth = ""; //int pos = year.标题.IndexOf("第"); //if (pos >= 0) { // strWeek = year.标题.Substring(pos, 3); // strYearMonth = year.标题.Substring(0, pos); //} //// ex.SetCellValue(year.标题.Replace("计划", "PDCA循环一览表"), row, col); //ex.SetCellValue(strYearMonth, row, 1); //ex.SetCellValue("(" + strWeek + ")", row, 6); //ex.SetCellValue("PDCA循环一览表", row, 7); //ex.SetCellValue(year.单位代码, row + 2, col); ; //ex.SetCellValue(year.开始日期.ToString("yyyy-MM-dd"), 3, 10); //ex.SetCellValue(year.结束日期.ToString("yyyy-MM-dd"), 3, 12); for (int j = 1; j <= pageindex; j++) { ex.ActiveSheet(j); //ex.ReNameWorkSheet(j, "Sheet" + (j)); int prepageindex = j - 1; //主题 int starow = prepageindex * 7 + 1; int endrow = j * 7; if (nrList.Count > endrow) { for (int i = 0; i < 7; i++) { ex.SetCellValue(nrList[starow - 1 + i].计划项目, row + 5 + i, 2); ex.SetCellValue(nrList[starow - 1 + i].预计时间.ToString("yyyy-MM-dd"), row + 5 + i, 3); ex.SetCellValue(nrList[starow - 1 + i].主要负责人, row + 5 + i, 4); ex.SetCellValue(nrList[starow - 1 + i].参加人员, row + 5 + i, 5); ex.SetCellValue(nrList[starow - 1 + i].实施内容, row + 5 + i, 6); ex.SetCellValue(nrList[starow - 1 + i].完成标记, row + 5 + i, 8); ex.SetCellValue(nrList[starow - 1 + i].未完成原因, row + 5 + i, 9); if (nrList[starow - 1 + i].完成时间.Year != 1900) ex.SetCellValue(nrList[starow - 1 + i].完成时间.ToString("yyyy-MM-dd"), row + 5 + i, 10); ex.SetCellValue(nrList[starow - 1 + i].总结提升, row + 5 + i, 11); } } else if (nrList.Count <= endrow && nrList.Count >= starow) { for (int i = 0; i < nrList.Count - starow + 1; i++) { ex.SetCellValue(nrList[starow - 1 + i].计划项目, row + 5 + i, 2); ex.SetCellValue(nrList[starow - 1 + i].预计时间.ToString("yyyy-MM-dd"), row + 5 + i, 3); ex.SetCellValue(nrList[starow - 1 + i].主要负责人, row + 5 + i, 4); ex.SetCellValue(nrList[starow - 1 + i].参加人员, row + 5 + i, 5); ex.SetCellValue(nrList[starow - 1 + i].实施内容, row + 5 + i, 6); ex.SetCellValue(nrList[starow - 1 + i].完成标记, row + 5 + i, 8); ex.SetCellValue(nrList[starow - 1 + i].未完成原因, row + 5 + i, 9); if (nrList[starow - 1 + i].完成时间.Year != 1900) ex.SetCellValue(nrList[starow - 1 + i].完成时间.ToString("yyyy-MM-dd"), row + 5 + i, 10); ex.SetCellValue(nrList[starow - 1 + i].总结提升, row + 5 + i, 11); } } } ex.ActiveSheet(1); ex.ShowExcel(); }
public static void ExportExcelMoth(JH_yearkst year, IList<JH_monthks> nrList) { ExcelAccess ex = new ExcelAccess(); SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string fname = Application.StartupPath + "\\00记录模板\\pdca循环一览表.xls"; ex.Open(fname); int row = 1; int col = 1; //加页 int pageindex = 1; if (pageindex < Ecommonjh.GetPagecount(nrList.Count, 7)) { pageindex = Ecommonjh.GetPagecount(nrList.Count, 7); } for (int j = 1; j <= pageindex; j++) { ex.ActiveSheet(j);//xjq change if (j > 1) { ex.CopySheet(1, 1); } ex.SetCellValue(year.标题.Replace("计划", "PDCA循环一览表"), row, col);//xjq change ex.SetCellValue(year.单位代码, row + 2, col); ; ex.SetCellValue(year.开始日期.ToString("yyyy-MM-dd"), 3, 9); ex.SetCellValue(year.结束日期.ToString("yyyy-MM-dd"), 3, 11); } // PS_xl xlobject = Client.ClientHelper.PlatformSqlMap.GetOneByKey<PS_xl>(jl.LineID); //ex.ActiveSheet(1); //ex.SetCellValue(year.标题.Replace("计划", "PDCA循环一览表"), row, col); //ex.SetCellValue(year.单位代码,row+2,col);; //ex.SetCellValue(year.开始日期.ToString("yyyy-MM-dd"), 3, 9); //ex.SetCellValue(year.结束日期.ToString("yyyy-MM-dd"), 3, 11); for (int j = 1; j <= pageindex; j++) { ex.ActiveSheet(j); //ex.ReNameWorkSheet(j, "Sheet" + (j)); int prepageindex = j - 1; //主题 int starow = prepageindex * 7 + 1; int endrow = j * 7; if (nrList.Count > endrow) { for (int i = 0; i < 7; i++) { ex.SetCellValue(nrList[starow - 1 + i].计划项目, row + 5 + i, 2); ex.SetCellValue(nrList[starow - 1 + i].预计时间.ToString("yyyy-MM-dd"), row + 5 + i, 3); ex.SetCellValue(nrList[starow - 1 + i].主要负责人, row + 5 + i, 4); ex.SetCellValue(nrList[starow - 1 + i].参加人员, row + 5 + i, 5); ex.SetCellValue(nrList[starow - 1 + i].实施内容, row + 5 + i, 6); ex.SetCellValue(nrList[starow - 1 + i].完成标记, row + 5 + i, 7); ex.SetCellValue(nrList[starow - 1 + i].未完成原因, row + 5 + i, 8); if (nrList[starow - 1 + i].完成时间.Year != 1900) ex.SetCellValue(nrList[starow - 1 + i].完成时间.ToString("yyyy-MM-dd"), row + 5 + i, 9); ex.SetCellValue(nrList[starow - 1 + i].总结提升, row + 5 + i, 10); } } else if (nrList.Count <= endrow && nrList.Count >= starow) { for (int i = 0; i < nrList.Count - starow + 1; i++) { ex.SetCellValue(nrList[starow - 1 + i].计划项目, row + 5 + i, 2); ex.SetCellValue(nrList[starow - 1 + i].预计时间.ToString("yyyy-MM-dd"), row + 5 + i, 3); ex.SetCellValue(nrList[starow - 1 + i].主要负责人, row + 5 + i, 4); ex.SetCellValue(nrList[starow - 1 + i].参加人员, row + 5 + i, 5); ex.SetCellValue(nrList[starow - 1 + i].实施内容, row + 5 + i, 6); ex.SetCellValue(nrList[starow - 1 + i].完成标记, row + 5 + i, 7); ex.SetCellValue(nrList[starow - 1 + i].未完成原因, row + 5 + i, 8); if (nrList[starow - 1 + i].完成时间.Year != 1900) ex.SetCellValue(nrList[starow - 1 + i].完成时间.ToString("yyyy-MM-dd"), row + 5 + i, 9); ex.SetCellValue(nrList[starow - 1 + i].总结提升, row + 5 + i, 10); } } } ex.ActiveSheet(1); ex.ShowExcel(); }
void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { JH_yearkst org = treeList1.GetDataRecordByNode(e.Node) as JH_yearkst; if (org != null && org.年.Length>6) { ParentID = org.年; ParentOBJ = org; ucjh_year.showread(全局 ? "0" : "", ParentID.Substring(0,6)); } }