Esempio n. 1
0
        public static void CreatRiZhi(PJ_02aqhd 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.kssj.ToString("yyyy-MM-dd 00:00:00") + "' and '" + obj.kssj.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 = obj.OrgCode;
                pj.GdsName = obj.OrgName;
                pj.CreateDate = obj.kssj;
                pj.CreateMan = MainHelper.User.UserName;
                gzr.gzrjID = pj.gzrjID;
                pj.rq = obj.kssj;
                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.zcr;
            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.kssj;
            gzr.CreateMan = MainHelper.User.UserName;
            gzr.fssj = obj.kssj;
            MainHelper.PlatformSqlMap.Create<PJ_gzrjnr>(gzr);

        }
Esempio n. 2
0
        void gridViewOperation_AfterAdd(PJ_02aqhd obj) {

            CreatRiZhi(obj);
        }
Esempio n. 3
0
 /// <summary>
 /// 新建对象设置Key值
 /// </summary>
 /// <param name="newobj"></param>
 void gridViewOperation_CreatingObjectEvent(PJ_02aqhd newobj) {
     if (parentID == null) return;
     newobj.OrgCode = parentID;
     newobj.OrgName = parentObj.OrgName;
     newobj.CreateDate = DateTime.Now;
     Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin();
     newobj.CreateMan = m_UserBase.RealName;
     newobj.kssj = DateTime.Now;
     newobj.jssj = DateTime.Now;
 }
Esempio n. 4
0
 /// <summary>
 /// 新建对象设置Key值
 /// </summary>
 /// <param name="newobj"></param>
 void gridViewOperation_CreatingObjectEvent(PJ_02aqhd newobj) {
     if (parentID == null) return;
     newobj.OrgCode = parentID;
     newobj.OrgName = parentObj.OrgName;
     newobj.CreateDate = DateTime.Now;
     Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin();
     newobj.CreateMan = m_UserBase.RealName;
     newobj.kssj = DateTime.Now;
     newobj.jssj = DateTime.Now;
     try { frmLP.ReadTaskData(newobj, RecordWorkFlowData, ParentTemple, CurrRecord); } catch { }
 }
Esempio n. 5
0
 void gridViewOperation_AfterAdd(PJ_02aqhd obj) {
     if (isWorkflowCall) {
         WF_ModleRecordWorkTaskIns mrwt = new WF_ModleRecordWorkTaskIns();
         mrwt.ModleRecordID = obj.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.WorkTaskInsId = WorkFlowData.Rows[0]["WorkTaskInsId"].ToString();
         mrwt.CreatTime = DateTime.Now;
         mrwt.ModleTableName = obj.GetType().ToString();
         MainHelper.PlatformSqlMap.Create<WF_ModleRecordWorkTaskIns>(mrwt);
     }
     CreatRiZhi(obj);
 }
Esempio n. 6
0
        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(PJ_02aqhd obj) {
            //lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\02安全活动记录.xls";

            ex.Open(fname);
            //每行显示文字长度
            int zc = 58;
            //与会人员之间的间隔符号
            char[] jksign = new char[1] { ';' };
            int row = 1;
            int col = 1;

            //计算页码
            int pagecount = 1;
            //活动内容


            string hdstr = Ecommon.Comparestring(obj.hdnr, "活动内容") ? "" : "活动内容:";
            List<string> hdlist = Ecommon.ResultStrListByPage(hdstr, obj.hdnr, zc, 8);
            //if (Ecommon.GetPagecount(hdlist.Count, 8) > pagecount)
            //{
            //    pagecount = Ecommon.GetPagecount(hdlist.Count, 8);
            //}
            //活动小结
            string hdxjstr = Ecommon.Comparestring(obj.hdxj, "活动小结") ? "" : "活动小结:";
            List<string> hdxlist = Ecommon.ResultStrListByPage(hdxjstr, obj.hdxj, zc, 5);
            //if (Ecommon.GetPagecount(hdxlist.Count, 5) > pagecount)
            //{
            //    pagecount = Ecommon.GetPagecount(hdxlist.Count, 5);
            //}
            //发言简要记录
            //领导评语
            string ldpystr = Ecommon.Comparestring(obj.py, "领导检查评语") ? "" : "领导检查评语:";
            List<string> ldpylist = Ecommon.ResultStrListByPage(ldpystr, obj.py, zc, 2);
            if (Ecommon.GetPagecount(ldpylist.Count + hdxlist.Count + hdlist.Count, 15) > pagecount) {
                pagecount = Ecommon.GetPagecount(ldpylist.Count + hdxlist.Count + hdlist.Count, 15);
            }
            List<string> fyjyjllist = Ecommon.ResultStrListByPage("", obj.fyjyjl, zc, 21);
            if (Ecommon.GetPagecount(fyjyjllist.Count, 21) > pagecount) {
                pagecount = Ecommon.GetPagecount(fyjyjllist.Count, 21);
            }

            //复制空模版
            if (pagecount > 1) {
                for (int i = 1; i < pagecount; i++) {
                    ex.CopySheet(1, i);
                    ex.ReNameWorkSheet(i + 1, "Sheet" + (i + 1));
                }
            }

            for (int p = 0; p < pagecount; p++) {
                ex.ActiveSheet(p + 1);
                //改造后的
                for (int i = 0; i < 15; i++) {

                    if (p * 15 + i < hdlist.Count) {

                        string tempstr = hdlist[p * 15 + i];
                        ex.SetCellValue(tempstr, 10 + i, 1);
                        if (p == 0 && i == 0) {
                            //设定活动内容为粗体
                            ex.SetFontBold(10 + i, 1, 10 + i, 1, true, 0, 5);
                        }
                    }
                    if (p * 15 + i >= hdlist.Count && p * 15 + i < hdlist.Count + hdxlist.Count) {

                        string tempstr = hdxlist[p * 15 + i - hdlist.Count];
                        ex.SetCellValue(tempstr, 10 + i, 1);
                        if (p * 15 + i == hdlist.Count) {
                            ex.SetFontBold(10 + i, 1, 10 + i, 1, true, 0, 5);
                        }
                        //break;
                    }

                    if (p * 15 + i >= hdlist.Count + hdxlist.Count && p * 15 + i < hdlist.Count + hdxlist.Count + ldpylist.Count) {

                        string tempstr = ldpylist[p * 15 + i - hdlist.Count - hdxlist.Count];

                        ex.SetCellValue(tempstr, 10 + i, 1);
                        if (p * 15 + i == hdlist.Count + hdxlist.Count)
                            ex.SetFontBold(10 + i, 1, 10 + i, 1, true, 0, 7);
                        //break;
                    }
                    if (p * 15 + i >= hdlist.Count + hdxlist.Count + ldpylist.Count) {
                        break;
                    }
                }
                ////活动内容
                //for (int i = 0; i < 8; i++)
                //{
                //    if (p * 8 + i>=hdlist.Count)
                //    {
                //        break;
                //    }
                //    string tempstr = hdlist[p * 8 + i];
                //    ex.SetCellValue(tempstr, 10 + i, 1);

                //}
                ////活动小结
                //for (int s = 0; s < 5; s++)
                //{
                //    if (p * 5 + s >= hdxlist.Count)
                //    {
                //        break;
                //    }
                //    string tempstr = hdxlist[p * 5 + s];
                //    ex.SetCellValue(tempstr, 18 + s, 1);
                //}
                ////领导评语
                //for (int t = 0; t < 2; t++)
                //{
                //    if (p * 2 + t >= ldpylist.Count)
                //    {
                //        break;
                //    }
                //    string tempstr = ldpylist[p * 2 + t];

                //    ex.SetCellValue(tempstr, 23 + t, 1);
                //}
                //简要记录
                int jymaxpage = Ecommon.GetPagecount(fyjyjllist.Count, 21);
                if (pagecount - jymaxpage <= p) {
                    for (int jy = 0; jy < 21; jy++) {

                        if ((jymaxpage + p - pagecount) * 21 + jy >= fyjyjllist.Count) {
                            break;
                        }
                        string tempstr = fyjyjllist[(jymaxpage + p - pagecount) * 21 + jy];
                        ex.SetCellValue(tempstr, 30 + jy, 1);

                        if (p == pagecount - jymaxpage && jy == 0) {
                            //设定活动内容为粗体
                            ex.SetFontBold(30, 1, 30, 1, true, 0, 6);
                        }
                    }
                }

            }

            ex.ActiveSheet(1);

            //主持人
            ex.SetCellValue(obj.zcr, 4, 2);

            //开始时间
            row = 2;
            ex.SetCellValue(obj.kssj.Year.ToString(), row + 2, col + 4);

            ex.SetCellValue(obj.kssj.Month.ToString(), row + 2, col + 6);

            ex.SetCellValue(obj.kssj.Day.ToString(), row + 2, col + 8);

            ex.SetCellValue(obj.kssj.Hour.ToString(), row + 2, col + 10);

            ex.SetCellValue(obj.kssj.Minute.ToString(), row + 2, col + 12);

            //结束时间
            ex.SetCellValue(obj.jssj.Year.ToString(), row + 3, col + 4);

            ex.SetCellValue(obj.jssj.Month.ToString(), row + 3, col + 6);

            ex.SetCellValue(obj.jssj.Day.ToString(), row + 3, col + 8);

            ex.SetCellValue(obj.jssj.Hour.ToString(), row + 3, col + 10);

            ex.SetCellValue(obj.jssj.Minute.ToString(), row + 3, col + 12);

            //出席人员
            string[] ary = obj.cjry.Split(jksign);
            int m = ary.Length / 8;
            int n = ary.Length % 8;
            if (n > 0) {
                m++;
            }
            if (m == 0) {
                m++;
            }

            for (int i = 0; i < ary.Length; i++) {
                int tempcol = col + 1 + i % 8;
                if (i % 8 > 3) {
                    tempcol = col + 4 + (i % 8 - 3) * 2;
                }
                ex.SetCellValue(ary[i], row + 4 + i / 8, tempcol);
            }
            //缺席人员
            string[] ary2 = obj.qxry.Split(jksign);

            for (int j = 0; j < ary2.Length; j++) {
                int tempcol = col + 2 + j % 7;
                if (j > 2 && j < 7) {
                    tempcol = col + 4 + (j % 7 - 2) * 2;
                }
                if (j < 7) {
                    ex.SetCellValue(ary2[j], row + 7, tempcol);
                } else//缺席人员大于七个时
                {
                    string tempstr = ex.ReadCellValue(row + 7, col + 12);
                    tempstr = tempstr + "/" + ary2[j];
                    ex.SetCellValue(tempstr, row + 7, col + 12);
                }

            }


            //签字
            // ex.SetCellValue("签字: ", 25, 1);
            // ex.SetCellValue(obj.qz, 25, col + 1);


            //签字时间小于系统默认时间则不输出
            //  if (ComboBoxHelper.CompreDate(obj.qzrq))
            //  {
            //     ex.SetCellValue(obj.qzrq.Year.ToString(), 25, 5);
            //     ex.SetCellValue(obj.qzrq.Month.ToString(), 25, 7);
            //     ex.SetCellValue(obj.qzrq.Day.ToString(), 25, 11);

            //    }

            ex.ShowExcel();

        }