private static void SetPageNumber(int?tprID, Report.frmReport frm, List <ReportDocument> listRpt, List <trn_book_print> listObjLog, int?objMax, int UserID, ref int StartPage, ref int endPage, int StatusPage, string code, ReportDocument rpt) { try { if (StatusPage == 1) { StartPage = (StartPage == 0) ? 1 : StartPage + endPage; endPage = (endPage == 0) ? 1 : frm.printChkPage(rpt, tprID, StartPage); trn_book_print ObjLog = new trn_book_print(); ObjLog.tpr_id = tprID; ObjLog.mrt_code = code; ObjLog.tbp_startPage = StartPage; ObjLog.tbp_endPage = (endPage > 1) ? (StartPage + endPage) - 1 : StartPage; ObjLog.tbp_remark = "V.101"; ObjLog.tbp_create_by = UserID; ObjLog.tbp_update_date = Program.GetServerDateTime(); ObjLog.tbp_print_runNum = objMax; listObjLog.Add(ObjLog); rpt.SetParameterValue("@tpr_id", tprID); rpt.SetParameterValue("@StartPage", StartPage); listRpt.Add(rpt); } } catch (Exception) { //throw new Exception(ex.Message); } }
public static void previewRpt(List <string> rptCode, int?tprID) { try { Report.frmReport frm = new Report.frmReport(); List <ReportDocument> listRpt = new List <ReportDocument>(); List <trn_book_print> listObjLog = new List <trn_book_print>(); InhCheckupDataContext dbcBookLog = new InhCheckupDataContext(); int?objMax = (dbcBookLog.trn_book_prints.Max(m => m.tbp_print_runNum)) + 1; int UserID = Program.CurrentUser.mut_id; int StartPage = 0; int endPage = 0; int StatusPage = 0; foreach (string code in rptCode) { ReportDocument rpt = rptDoc(code); if (rpt != null) { switch (code) { #region Page TH //--- TH --------------------------------------- //case "BK101": StatusPage = 1; break; //case "BK102": StatusPage = 1; break; //case "BK103": StatusPage = 1; break; //case "BK104": StatusPage = 1; break; //case "BK1051": StatusPage = 1; break; //case "BK1052": StatusPage = 1; break; //case "BK1053": StatusPage = 1; break; //case "BK106": StatusPage = 1; break; //case "BK107": StatusPage = 1; break; //case "BK108": StatusPage = 1; break; //case "BK109": StatusPage = 0; break; //case "BK110": StatusPage = 1; break; //case "BK111": StatusPage = 1; break; //case "BK112": StatusPage = 0; break; //case "BK113": StatusPage = 0; break; case "BK101": StatusPage = BK101(tprID, dbcBookLog, StatusPage); break; case "BK102": StatusPage = BK102(tprID, dbcBookLog, StatusPage); break; case "BK103": StatusPage = BK103(tprID, dbcBookLog, StatusPage); break; case "BK104": StatusPage = BK104(tprID, dbcBookLog, StatusPage); break; case "BK1051": StatusPage = BK1051(tprID, dbcBookLog, StatusPage); break; case "BK1052": StatusPage = BK1052(tprID, dbcBookLog, StatusPage); break; case "BK1053": StatusPage = BK1053(tprID, dbcBookLog, StatusPage); break; case "BK106": StatusPage = BK106(tprID, dbcBookLog, StatusPage); break; case "BK107": StatusPage = BK107(tprID, dbcBookLog, StatusPage); break; case "BK108": StatusPage = BK108(tprID, dbcBookLog, StatusPage); break; case "BK109": StatusPage = BK109(tprID, dbcBookLog, StatusPage); break; case "BK110": StatusPage = BK110(tprID, dbcBookLog, StatusPage); break; case "BK111": StatusPage = BK111(tprID, dbcBookLog, StatusPage); break; case "BK112": StatusPage = BK112(StatusPage); break; case "BK113": StatusPage = BK113(tprID, dbcBookLog, StatusPage); break; #endregion #region Page EN //--- EN --------------------------------------- //case "BK201": StatusPage = 1; break; //case "BK202": StatusPage = 1; break; //case "BK203": StatusPage = 1; break; //case "BK204": StatusPage = 1; break; //case "BK2051": StatusPage = 1; break; //case "BK2052": StatusPage = 1; break; //case "BK2053": StatusPage = 1; break; //case "BK206": StatusPage = 1; break; //case "BK207": StatusPage = 1; break; //case "BK208": StatusPage = 1; break; //case "BK209": StatusPage = 0; break; //case "BK210": StatusPage = 1; break; //case "BK211": StatusPage = 1; break; //case "BK212": StatusPage = 0; break; //case "BK213": StatusPage = 0; break; case "BK201": StatusPage = BK101(tprID, dbcBookLog, StatusPage); break; case "BK202": StatusPage = BK102(tprID, dbcBookLog, StatusPage); break; case "BK203": StatusPage = BK103(tprID, dbcBookLog, StatusPage); break; case "BK204": StatusPage = BK104(tprID, dbcBookLog, StatusPage); break; case "BK2051": StatusPage = BK1051(tprID, dbcBookLog, StatusPage); break; case "BK2052": StatusPage = BK1052(tprID, dbcBookLog, StatusPage); break; case "BK2053": StatusPage = BK1053(tprID, dbcBookLog, StatusPage); break; case "BK206": StatusPage = BK106(tprID, dbcBookLog, StatusPage); break; case "BK207": StatusPage = BK107(tprID, dbcBookLog, StatusPage); break; case "BK208": StatusPage = BK108(tprID, dbcBookLog, StatusPage); break; case "BK209": StatusPage = BK109(tprID, dbcBookLog, StatusPage); break; case "BK210": StatusPage = BK110(tprID, dbcBookLog, StatusPage); break; case "BK211": StatusPage = BK111(tprID, dbcBookLog, StatusPage); break; case "BK212": StatusPage = BK112(StatusPage); break; case "BK213": StatusPage = BK113(tprID, dbcBookLog, StatusPage); break; #endregion } SetPageNumber(tprID, frm, listRpt, listObjLog, objMax, UserID, ref StartPage, ref endPage, StatusPage, code, rpt); } } if (listRpt.Count > 0) { if (listObjLog.Count > 0) { frm.listObjLog = listObjLog; } else { frm.listObjLog = null; } frm.previewRpt(listRpt); } } catch (Exception) { //throw new Exception(ex.Message); } }