Esempio n. 1
0
        public static void outputTXT(DataSet ds, string pclassno, string term, string mg, string sess, string session, string pdate, string filter, TextWriter sw, bool namemask = false)
        {
            string          pattern = @"\d+";
            Regex           rx      = new Regex(pattern);
            MatchCollection matches = rx.Matches(filter);
            EsStudReport    esrp    = null;

            if (pclassno.StartsWith("P"))
            {
                esrp = new PEsStudReportFillCDS();
            }
            else if (pclassno.EndsWith("E"))
            {
                esrp = new VEsStudReportFillCDS();
            }
            else
            {
                esrp = new SEsStudReportFillCDS();
            }

            DataTable tb = ds.Tables["Table"];

            for (int i = 0; i < tb.Rows.Count; i++)
            {
                string seat = tb.Rows[i]["curr_seat"].ToString();
                if (matches.Count > 0)
                {
                    int crt = 0;
                    for (crt = 0; crt < matches.Count; crt++)
                    {
                        if (matches[crt].Value.Equals(seat))
                        {
                            break;
                        }
                    }
                    if (crt >= matches.Count)
                    {
                        continue;
                    }
                }
                String marktxt = esrp.MrkTxt(term, mg, tb.Rows[i].GetChildRows("sr_mk"),
                                             tb.Rows[i].GetChildRows("sr_cd"),
                                             tb.Rows[i].GetChildRows("sr_ac"),
                                             tb.Rows[i].GetChildRows("sr_gc")
                                             );
                Console.WriteLine(marktxt);
            }
        }
Esempio n. 2
0
 public override string a2g(Decimal m)
 {
     return(EsStudReport._a2g(m, "P"));
 }
Esempio n. 3
0
      public override string a2g(Object m)
      {
          Decimal m0 = Decimal.Parse(m.ToString());

          return(EsStudReport._a2g(m0, "P"));
      }
Esempio n. 4
0
        public static void outputDOCX(DataSet ds, string pclassno, string term, string mg, string sess, string session, string pdate, string filter, TextWriter sw, bool namemask = false)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("session", typeof(String));
            dt.Columns.Add("p_date", typeof(String));
            dt.Columns.Add("dsej_ref", typeof(String));
            dt.Columns.Add("C_NAME", typeof(String));
            dt.Columns.Add("E_NAME", typeof(String));
            dt.Columns.Add("classname", typeof(String));
            dt.Columns.Add("curr_class", typeof(String));
            dt.Columns.Add("seat", typeof(String));
            dt.Columns.Add("stud_ref", typeof(String));
            dt.Columns.Add("Markdetail", typeof(String));
            dt.Columns.Add("conduct", typeof(String));
            dt.Columns.Add("schooleval1", typeof(String));
            dt.Columns.Add("pingyu1", typeof(String));
            dt.Columns.Add("conduct2", typeof(String));
            dt.Columns.Add("schooleval2", typeof(String));
            dt.Columns.Add("pingyu2", typeof(String));
            dt.Columns.Add("conduct3", typeof(String));
            dt.Columns.Add("schooleval3", typeof(String));
            dt.Columns.Add("pingyu3", typeof(String));
            dt.Columns.Add("act_py", typeof(String));
            dt.Columns.Add("qrbc", typeof(String));
            dt.Columns.Add("photo", typeof(String));
            EsStudReport esrp = null;

            if (pclassno.StartsWith("P"))
            {
                esrp = new PEsStudReportFillCDS();
            }
            else if (pclassno.EndsWith("E"))
            {
                esrp = new VEsStudReportFillCDS();
            }
            else
            {
                esrp = new SEsStudReportFillCDS();
            }
            String    classno = "";
            DataTable tb      = ds.Tables["Table"];

            for (int i = 0; i < tb.Rows.Count; i++)
            {
                DataRow drr  = dt.NewRow(); //選擇輸出:1,2,3,4
                string  seat = tb.Rows[i]["curr_seat"].ToString();
                classno           = tb.Rows[i]["curr_class"].ToString();
                drr["dsej_ref"]   = tb.Rows[i]["dsej_ref"];
                drr["C_NAME"]     = tb.Rows[i]["c_name"];
                drr["E_NAME"]     = tb.Rows[i]["e_name"];
                drr["curr_class"] = tb.Rows[i]["curr_class"];
                drr["classname"]  = EsStudReport.class2n(classno);
                drr["seat"]       = tb.Rows[i]["curr_seat"];
                drr["stud_ref"]   = tb.Rows[i]["stud_ref"];
                drr["session"]    = session;
                drr["p_date"]     = pdate;
                String marktxt = esrp.MrkTxt(term, mg, tb.Rows[i].GetChildRows("sr_mk"),
                                             tb.Rows[i].GetChildRows("sr_cd"),
                                             tb.Rows[i].GetChildRows("sr_ac"),
                                             tb.Rows[i].GetChildRows("sr_gc")
                                             );
                foreach (DataRow cRow in tb.Rows[i].GetChildRows("sr_cd"))
                {
                    drr["conduct"]     = EsStudReport.GetCDFMT(cRow, pclassno, "1");
                    drr["conduct2"]    = EsStudReport.GetCDFMT(cRow, pclassno, "2");
                    drr["conduct3"]    = EsStudReport.GetCDFMT(cRow, pclassno, "3");
                    drr["schooleval1"] = cRow["SchoolEval1"];
                    drr["schooleval2"] = cRow["SchoolEval2"];
                    drr["schooleval3"] = cRow["SchoolEval3"];
                }
                foreach (DataRow cRow in tb.Rows[i].GetChildRows("sr_ac"))
                {
                    drr["act_py"] = cRow["act_py"];
                }
                drr["Markdetail"] = marktxt;
                foreach (DataRow cRow in tb.Rows[i].GetChildRows("sr_py"))
                {
                    drr["pingyu1"] = cRow["py1"];
                    drr["pingyu2"] = cRow["py2"];
                    drr["pingyu3"] = cRow["py3"];
                }
                drr["photo"] = @"c:\photo" + sess + @"\" + drr["dsej_ref"] + ".jpg";
                drr["qrbc"]  = @"c:\photo" + sess + @"\qrcode\" + sess + drr["curr_class"] + (seat.Length == 1 ? "0" : "") + seat + drr["dsej_ref"] + ".jpg";
                dt.Rows.Add(drr);
            }
            //////////////
            string templ_page1 = AppPath + @"\xmldata" + @"\T1516.xml";

            if (classno.StartsWith("P"))
            {
                templ_page1 = AppPath + @"\xmldata" + @"\PT1920.xml";                         // + @"\PT1415.xml";
            }
            if (classno.EndsWith("E"))
            {
                templ_page1 = mg.Equals("m") ? AppPath + @"\xmldata" + @"\VOCAMT1516.xml" : AppPath + @"\xmldata" + @"\VOCAGT1516.xml";
            }
            string   out_filename = AppPath + @"\xmlout" + @"\MarkTable_" + classno + "_" + mg + ".doc";
            FileInfo finfo        = new FileInfo(out_filename);

            if (finfo.Exists && (DateTime.Now - finfo.CreationTime).TotalMinutes < 2)
            {
                Console.WriteLine("Exists Docx{0} {1}", out_filename, finfo.CreationTime);
            }
            else
            {
                Console.WriteLine("Make Docx{0}", out_filename);
                mklib.TDB2WML dw = new mklib.TDB2WML(new mklib.TParseWMLitem(null), dt, templ_page1);
                dw.makeDoc(out_filename);
            }
            sw.Write(out_filename);
        }