using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; //using Saving.WcfCommon; //using Saving.WcfDeposit; using CoreSavingLibrary.WcfNDeposit; // new deposit using CoreSavingLibrary.WcfNCommon; //new common using System.Web.Services.Protocols; using DataLibrary; using CoreSavingLibrary; namespace Saving.Applications.shrlon.dlg { public partial class w_dlg_sl_print_booknew : PageWebDialog, WebDialog { //private DepositClient dep; private n_depositClient ndept; //new deposit private n_commonClient ncommon; //new common private String deptAccountNo; protected String postPrintBook; protected String PrintBookCard; #region WebDialog Members public void InitJsPostBack() { postPrintBook = WebUtil.JsPostBack(this, "postPrintBook"); PrintBookCard = WebUtil.JsPostBack(this, "PrintBookCard"); } public void WebDialogLoadBegin() { ndept = wcf.NDeposit; this.ConnectSQLCA(); // DwNewBook.SetTransaction(sqlca); //DwStm.SetTransaction(sqlca); if (!IsPostBack) { HdIsPostBack.Value = "false"; try { HdAccountNo.Value = Request["mem_no"]; deptAccountNo = HdAccountNo.Value; //DwStm.Retrieve(deptAccountNo, state.SsCoopControl); //String xmlInitDwNewBook = dep.InitPrintBook(state.SsWsPass, deptAccountNo, state.SsCoopId); //DwPrintPrompt.InsertRow(0); //string smltest = DwPrintPrompt.Describe("Datawindow.Data.Xml"); //DwPrintPrompt.ImportString(xmlInitDwNewBook, Sybase.DataWindow.FileSaveAsType.Xml); DwUtil.RetrieveDataWindow(DwPrintPrompt, "sl_print_book.pbl", null, state.SsCoopControl, deptAccountNo); DwUtil.RetrieveDataWindow(DwPrintPrompt2, "sl_print_book.pbl", null, state.SsCoopControl, deptAccountNo); if (DwPrintPrompt.GetItemDecimal(1, "lastrec_no") + 1 > DwPrintPrompt.GetItemDecimal(1, "last_stm_no")) { DwPrintPrompt.SetItemDecimal(1, "lastrec_no", (DwPrintPrompt.GetItemDecimal(1, "last_stm_no"))); } else { DwPrintPrompt.SetItemDecimal(1, "lastrec_no", (DwPrintPrompt.GetItemDecimal(1, "lastrec_no") + 1)); } } catch (SoapException ex) { LtServerMessage.Text = WebUtil.ErrorMessage(WebUtil.SoapMessage(ex)); DwPrintPrompt.InsertRow(0); //DwStm.InsertRow(0); } catch (Exception ex) { LtServerMessage.Text = WebUtil.ErrorMessage(ex.Message); DwPrintPrompt.InsertRow(0); //DwStm.InsertRow(0); } } else { HdIsPostBack.Value = "true"; this.RestoreContextDw(DwPrintPrompt); //this.RestoreContextDw(DwStm); } this.deptAccountNo = HdAccountNo.Value; } public void CheckJsPostBack(string eventArg) { if (eventArg == "postPrintBook") { try { Int16 seq = Convert.ToInt16(DwPrintPrompt.GetItemDecimal(1, "lastrec_no")); Int16 page = Convert.ToInt16(DwPrintPrompt.GetItemDecimal(1, "lastpage_no")); Int16 line = Convert.ToInt16(DwPrintPrompt.GetItemDecimal(1, "lastline_no")); String as_loan_no = Request["mem_no"]; //XmlConfigService xml = new XmlConfigService(); int ai_status = 1;// xml.DepositPrintMode; String as_xml_return = ""; String as_return = ""; string printset = state.SsPrinterSet; ndept.of_print_bookloan(state.SsWsPass, as_loan_no, seq, page, line, true, ref as_xml_return, ref as_return); String[] re = as_return.Split('@'); int rePage = int.Parse(re[0]); int reReq = int.Parse(re[1]); HdIsZeroPage.Value = rePage == 0 ? "true" : "false"; HdIsNewBook.Value = rePage == 1 ? "true" : "false"; //เพิ่มเพื่อรับค่าจาก pb srv ว่าขึ้นเล่มใหม่ //HdIsNewBook.Value = "true"; //if (ai_status == 1) //{ // Printing.Print(this, "Slip/ap_deposit/PrintBook.aspx", as_xml_return, 25); //} //else if (ai_status == 2) //{ //Printing.LoanPrintBook(this, as_xml_return); WebUtil.QuerySdt("update lncontmaster set lastrec_no = " + DwPrintPrompt.GetItemDecimal(1, "last_stm_no") + " where loancontract_no='" + as_loan_no + "' and coop_id = '" + state.SsCoopControl + "' "); Printing.PrintApplet(this, "loan_printbook", as_xml_return); //} DwPrintPrompt.SetItemDecimal(1, "lastpage_no", rePage); DwPrintPrompt.SetItemDecimal(1, "lastrec_no", reReq); DwPrintPrompt.SetItemDecimal(1, "lastline_no", 1); } catch (Exception ex) { LtServerMessage.Text = WebUtil.ErrorMessage(ex); } } else if (eventArg == "jsPrintBookCard2") { // clear_periodpayment();.......3 try { Int16 seq = Convert.ToInt16(DwPrintPrompt2.GetItemDecimal(1, "lastrec_no_card")); Int16 page = Convert.ToInt16(DwPrintPrompt2.GetItemDecimal(1, "lastpage_no_card")); Int16 line = Convert.ToInt16(DwPrintPrompt2.GetItemDecimal(1, "lastline_no_card")); String as_loan_no = Request["mem_no"]; //XmlConfigService xml = new XmlConfigService(); int ai_status = 1;// xml.DepositPrintMode; String as_xml_return = ""; String as_return = ""; string printset = state.SsPrinterSet; //ndept.of_printloanbook_card(state.SsWsPass, as_loan_no, seq, page, line, true, ref as_xml_return, ref as_return); String[] re = as_return.Split('@'); int rePage = int.Parse(re[0]); int reReq = int.Parse(re[1]); WebUtil.QuerySdt("update lncontmaster set lastrec_no_card = " + DwPrintPrompt.GetItemDecimal(1, "last_stm_no") + " where loancontract_no='" + as_loan_no + "' and coop_id = '" + state.SsCoopControl + "' "); Printing.PrintApplet(this, "loan_bookcard", as_xml_return); // Printing.PrintApplet(this, "loan_printbook", as_xml_return); Sdt d = WebUtil.QuerySdt("select lastpage_no_card,lastrec_no_card,lastline_no_card from lncontmaster where loancontract_no = '" + as_loan_no + "'"); if (d.Next()) { DwPrintPrompt2.SetItemDecimal(1, "lastpage_no_card", d.GetDecimal("lastpage_no_card")); DwPrintPrompt2.SetItemDecimal(1, "lastrec_no_card", d.GetDecimal("lastrec_no_card")); DwPrintPrompt2.SetItemDecimal(1, "lastline_no_card", d.GetDecimal("lastline_no_card")); } } catch (Exception ex) { LtServerMessage.Text = WebUtil.ErrorMessage(ex); } } } public void WebDialogLoadEnd() { DwPrintPrompt.SaveDataCache(); DwPrintPrompt2.SaveDataCache(); } #endregion } }