public static void ExportExcel(PJ_23 obj, ExcelAccess ex) { ex.SetCellValue(obj.jf + ":", 5, 4); ex.SetCellValue(obj.xybh, 4, 8); ex.SetCellValue(obj.cqdw + ":", 6, 4); string linename = ""; if (obj.linename.Contains("线")) { linename = obj.linename.Substring(0, obj.linename.LastIndexOf("线")); } else linename = obj.linename; string[] filtchar = { "V", "v" }; for (int i = 0; i < filtchar.Length; i++) { if (linename.Contains(filtchar[i])) { linename = linename.Substring(linename.LastIndexOf(filtchar[i]) + 1); } } ex.SetCellValue(linename, 10, 7); string fzlinename = ""; if (obj.fzlinename.Contains("支")) { fzlinename = obj.fzlinename.Substring(0, obj.fzlinename.LastIndexOf("支")); } else fzlinename = obj.fzlinename; ex.SetCellValue(fzlinename, 10, 10); ex.SetCellValue("'" + obj.gh, 10, 16); ex.SetCellValue(obj.cqfw, 11, 4); ex.SetCellValue(obj.cqdw + "。", 13, 4); ex.SetCellValue(obj.jf, 17, 4); //ex.SetCellValue(obj.cqdw, 15, 8); ex.SetCellValue(obj.qdrq.Year.ToString(), 21, 7); ex.SetCellValue(obj.qdrq.Month.ToString(), 21, 9); ex.SetCellValue(obj.qdrq.Day.ToString(), 21, 11); }
/// <summary> /// 文档格式预定义好的,只填写内容 /// </summary> /// <param name="obj"></param> public static void ExportExcel(PJ_23 obj) { ExcelAccess ex = new ExcelAccess(); SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string fname = Application.StartupPath + "\\00记录模板\\23配电线路产权维护范围协议书.xls"; if (obj.BigData != null && obj.BigData.Length > 10) { fname = Path.GetTempPath() + "23配电线路产权维护范围协议书.xls"; //MemoryStream ms = new MemoryStream(obj.BigData); FileStream fs = new FileStream(fname, FileMode.OpenOrCreate); fs.Write(obj.BigData, 0, obj.BigData.Length); fs.Flush(); fs.Close(); } ex.Open(fname); ex.SetCellValue(obj.jf, 5, 4); ex.SetCellValue(obj.xybh, 4, 8); ex.SetCellValue(obj.cqdw + ":", 6, 4); string linename = ""; if (obj.linename.Contains("线")) { linename = obj.linename.Substring(0, obj.linename.LastIndexOf("线")); } else linename = obj.linename; string[] filtchar = { "V", "v" }; for (int i = 0; i < filtchar.Length; i++) { if (linename.Contains(filtchar[i])) { linename = linename.Substring(linename.LastIndexOf(filtchar[i]) + 1); } } ex.SetCellValue(linename, 10, 7); string fzlinename = ""; if (obj.fzlinename.Contains("支")) { fzlinename = obj.fzlinename.Substring(0, obj.fzlinename.LastIndexOf("支")); } else fzlinename = obj.fzlinename; ex.SetCellValue(fzlinename, 10, 10); ex.SetCellValue("'" + obj.gh, 10, 16); ex.SetCellValue(obj.cqfw, 11, 4); ex.SetCellValue(obj.cqdw, 13, 4); ex.SetCellValue(obj.jf, 17, 4); //ex.SetCellValue(obj.cqdw, 15, 8); ex.SetCellValue(obj.qdrq.Year.ToString(), 21, 7); ex.SetCellValue(obj.qdrq.Month.ToString(), 21, 9); ex.SetCellValue(obj.qdrq.Day.ToString(), 21, 11); ex.ShowExcel(); }
/// <summary> /// 文档格式预定义好的,只填写内容 /// </summary> /// <param name="obj"></param> public static void ExportExcel(PJ_23 obj) { ExcelAccess ex = new ExcelAccess(); string fname = Application.StartupPath + "\\00记录模板\\23配电线路产权维护范围协议书.xls"; if (obj.BigData != null && obj.BigData.Length > 10) { fname = Path.GetTempPath() + "23配电线路产权维护范围协议书.xls"; //MemoryStream ms = new MemoryStream(obj.BigData); FileStream fs = new FileStream(fname, FileMode.OpenOrCreate); fs.Write(obj.BigData, 0, obj.BigData.Length); fs.Flush(); fs.Close(); } ex.Open(fname); ExportExcel(obj, ex); ex.ShowExcel(); }
void gridViewOperation_AfterEdit(PJ_23 obj) { //修改模板 //mOrg org = MainHelper.PlatformSqlMap.GetOneByKey<mOrg>(obj.ParentID); //string fname = Application.StartupPath + "\\00记录模板\\23配电线路产权维护范围协议书.xls"; //string bhname = org.OrgName.Replace("供电所", ""); //DSOFramerControl dsoFramerControl1 = new DSOFramerControl(); //dsoFramerControl1.FileOpen(fname); //Microsoft.Office.Interop.Excel.Workbook wb = dsoFramerControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook; //PJ_23 obj1 = (PJ_23)MainHelper.PlatformSqlMap.GetObject("SelectPJ_23List", "where ParentID='" + obj.ParentID + "' and xybh like '" + SelectorHelper.GetPysm(org.OrgName.Replace("供电所", ""), true) + "-" + DateTime.Now.Year.ToString() + "-%' order by xybh ASC"); //int icount = 1; //if (obj1 != null && obj1.xybh != "") //{ // icount = Convert.ToInt32(obj.xybh.Split('-')[2]) + 1; //} //string strname = SelectorHelper.GetPysm(bhname, true); //ExcelAccess ea = new ExcelAccess(); //ea.MyWorkBook = wb; //ea.MyExcel = wb.Application; //ea.SetCellValue(strname.ToUpper(), 4, 8); //strname = DateTime.Now.Year.ToString(); //ea.SetCellValue(strname, 4, 9); //strname = string.Format("{0:D3}", icount); //ea.SetCellValue(strname, 4, 10); //ea.SetCellValue(obj.cqdw + ":", 6, 4); //ea.SetCellValue(obj.linename, 10, 7); //ea.SetCellValue(obj.fzlinename, 10, 10); //ea.SetCellValue("'" + obj.gh, 10,16); //ea.SetCellValue(obj.cqfw, 11, 4); //ea.SetCellValue(obj.cqdw, 13, 4); //ea.SetCellValue(obj.qdrq.Year.ToString(), 21, 7); //ea.SetCellValue(obj.qdrq.Month.ToString(), 21, 9); //ea.SetCellValue(obj.qdrq.Day.ToString(), 21, 11); //dsoFramerControl1.FileSave(); //obj.BigData = dsoFramerControl1.FileData; //dsoFramerControl1.FileClose(); //dsoFramerControl1.Dispose(); //dsoFramerControl1 = null; MainHelper.PlatformSqlMap.Update<PJ_23>(obj); }
void gridViewOperation_AfterAdd(PJ_23 newobj) { if (isWorkflowCall) { WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns(); mrwt.ModleRecordID = newobj.ID; mrwt.RecordID = currRecord.ID; mrwt.WorkFlowId = WorkFlowData.Rows[0]["WorkFlowId"].ToString(); mrwt.WorkFlowInsId = WorkFlowData.Rows[0]["WorkFlowInsId"].ToString(); mrwt.WorkTaskId = WorkFlowData.Rows[0]["WorkTaskId"].ToString(); mrwt.ModleTableName = newobj.GetType().ToString(); mrwt.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString(); mrwt.CreatTime = DateTime.Now; MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt); currRecord.DocContent = newobj.BigData; MainHelper.PlatformSqlMap.Update<LP_Record>(currRecord); } }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(PJ_23 newobj) { if (parentID == null) return; newobj.ParentID = parentID; //newobj.OrgName = parentObj.OrgName; newobj.CreateDate = DateTime.Now; Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin(); newobj.CreateMan = m_UserBase.RealName; }
private void initbh(PJ_23 obj) { if (!string.IsNullOrEmpty(obj.xybh)) return; string ret = string.Empty; string year = DateTime.Now.Year.ToString(); string gds = parentObj.OrgName.Replace("供电所", ""); string strname = SelectorHelper.GetPysm(gds, true) + year + ""; strname = strname.ToUpper(); string strmax = MainHelper.PlatformSqlMap.GetObject("SelectOneStr", "select max(xybh) from pj_23 where xybh like '" + strname + "%'") as string; if (string.IsNullOrEmpty(strmax)) { ret = strname + "001"; } else { int count = int.Parse(strmax.Substring(strmax.Length - 3, 3)) + 1; ret = strname + count.ToString("000"); } obj.xybh = ret; }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(PJ_23 newobj) { if (parentID == null) return; newobj.ParentID = parentID; //newobj.OrgName = parentObj.OrgName; newobj.CreateDate = DateTime.Now; Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin(); newobj.CreateMan = m_UserBase.RealName; string bhname = ParentObj.OrgName.Replace("供电所", ""); PJ_23 obj = (PJ_23)MainHelper.PlatformSqlMap.GetObject("SelectPJ_23List", "where ParentID='" + ParentID + "' and xybh like '" + SelectorHelper.GetPysm(ParentObj.OrgName.Replace("供电所", ""), true) + "-" + DateTime.Now.Year.ToString() + "-%' order by xybh ASC"); int icount = 1; if (obj != null && obj.xybh != "") { icount = Convert.ToInt32(obj.xybh.Split('-')[2]) + 1; } newobj.xybh = SelectorHelper.GetPysm(bhname, true).ToUpper() + "-" + DateTime.Now.Year.ToString() + "-" + string.Format("{0:D3}", icount); }
public void CreatRiZhi(PJ_23 obj) { PJ_gzrjnr gzr = new PJ_gzrjnr(); gzr.gzrjID = gzr.CreateID(); gzr.ParentID = obj.ID; Thread.Sleep(new TimeSpan(100000));//0.1毫秒 IList<PJ_01gzrj> gzrj01 = MainHelper.PlatformSqlMap.GetList<PJ_01gzrj>("SelectPJ_01gzrjList", "where GdsCode='" + MainHelper.User.OrgCode + "' and rq between '" + obj.qdrq.ToString("yyyy-MM-dd 00:00:00") + "' and '" + obj.qdrq.ToString("yyyy-MM-dd 23:59:59") + "'"); if (gzrj01.Count > 0) { gzr.gzrjID = gzrj01[0].gzrjID; } else { PJ_01gzrj pj = new PJ_01gzrj(); pj.gzrjID = pj.CreateID(); pj.GdsCode = ParentObj.OrgCode; pj.GdsName = ParentObj.OrgName; pj.CreateDate = obj.qdrq; pj.CreateMan = MainHelper.User.UserName; gzr.gzrjID = pj.gzrjID; pj.rq = obj.qdrq; pj.xq = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek); pj.rsaqts = (DateTime.Today - MainHelper.UserOrg.PSafeTime.Date).Days; pj.sbaqts = (DateTime.Today - MainHelper.UserOrg.DSafeTime.Date).Days; Thread.Sleep(new TimeSpan(100000));//0.1毫秒 MainHelper.PlatformSqlMap.Create<PJ_01gzrj>(pj); } IList<PJ_gzrjnr> gzrlist = MainHelper.PlatformSqlMap.GetList<PJ_gzrjnr>("SelectPJ_gzrjnrList", "where gzrjID = '" + gzr.gzrjID + "' order by seq "); if (gzrlist.Count > 0) { gzr.seq = gzrlist[gzrlist.Count - 1].seq + 1; } else gzr.seq = 1; gzr.gznr = "配电设备产权、维护范围协议书"; gzr.fzr = obj.cqdw; //string[] strli = obj.cjry.Split(';'); //if (strli.Length < 3) // gzr.cjry = obj.cjry; //else //{ // gzr.cjry = strli[0] + strli[1] + "等" + strli.Length + "人"; //} gzr.CreateDate = obj.qdrq; gzr.CreateMan = MainHelper.User.UserName; gzr.fssj = obj.qdrq; MainHelper.PlatformSqlMap.Create<PJ_gzrjnr>(gzr); }
void gridViewOperation_AfterAdd(PJ_23 obj) { CreatRiZhi(obj); }
public static void filldata(DSOFramerControl c ,PJ_23 data) { Microsoft.Office.Interop.Excel.Workbook wb = c.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook; //PJ_23 obj = (PJ_23)MainHelper.PlatformSqlMap.GetObject("SelectPJ_23List", "where ParentID='" + rowData.ParentID + "' and xybh like '" + SelectorHelper.GetPysm(org.OrgName.Replace("供电所", ""), true) + "" + DateTime.Now.Year.ToString() + "%' order by xybh ASC"); //int icount = 1; //if (obj != null && obj.xybh !="") //{ // icount = Convert.ToInt32(obj.xybh.Split('-')[2])+1; //} //string strname = SelectorHelper.GetPysm(bhname, true); ExcelAccess ea = new ExcelAccess(); ea.MyWorkBook = wb; ea.MyExcel = wb.Application; ea.SetCellValue(data.xybh.ToUpper(), 4, 8); //strname = DateTime.Now.Year.ToString(); //ea.SetCellValue(strname, 4, 9); //strname = string.Format("{0:D3}", icount); //ea.SetCellValue(strname, 4, 10); ea.SetCellValue(data.linename, 10, 7); ea.SetCellValue(data.fzlinename, 10, 10); ea.SetCellValue("'" + data.gh, 10, 16); ea.SetCellValue(data.cqfw, 11, 4); ea.SetCellValue(data.cqdw, 13, 4); ea.SetCellValue(data.qdrq.Year.ToString(), 21, 7); ea.SetCellValue(data.qdrq.Month.ToString(), 21, 9); ea.SetCellValue(data.qdrq.Day.ToString(), 21, 11); }