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.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; 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 System.ServiceModel.Channels; using System.Xml; using DataLibrary; using CoreSavingLibrary; namespace Saving.Applications.mbshr { public partial class w_sheet_dp_conteck_new : PageWebSheet, WebSheet { protected String jsPostPrintBookin; protected String jsPostPrintNewBookout; private String pbl = "dp_conteck.pbl"; protected String postAccountNo; protected String jsPostPrintNewBook; protected String jsPostPrintHeadCard; //private DepositClient DepService; private n_depositClient ndept; //new deposit private n_commonClient ncommon; //new common #region WebSheet Members string coop_crmja = "000501"; public void InitJsPostBack() { postAccountNo = WebUtil.JsPostBack(this, "postAccountNo"); jsPostPrintNewBook = WebUtil.JsPostBack(this, "jsPostPrintNewBook"); jsPostPrintNewBookout = WebUtil.JsPostBack(this, "jsPostPrintNewBookout"); jsPostPrintBookin = WebUtil.JsPostBack(this, "jsPostPrintBookin"); jsPostPrintHeadCard = WebUtil.JsPostBack(this, "jsPostPrintHeadCard"); if (state.SsCoopId == coop_crmja) { Bookout.Style.Add("display", "none"); bookin2.Style.Add("display", "none"); } } public void WebSheetLoadBegin() { ndept = wcf.NDeposit; this.ConnectSQLCA(); DwMain.SetTransaction(sqlca); DwDetail.SetTransaction(sqlca); if (!IsPostBack) { DwMain.InsertRow(0); DwMain.SetItemString(1, "coop_id", state.SsCoopControl); } else { this.RestoreContextDw(DwMain); this.RestoreContextDw(DwDetail); } } public void SaveWebSheet() { } public void CheckJsPostBack(string eventArg) { if (eventArg == "postAccountNo") { JsPostAccountNo(); } else if (eventArg == "jsPostPrintNewBook") { String endMessage = ""; PostPrintNewBook( endMessage ); } else if (eventArg == "jsPostPrintNewBookout") { PostPrintNewBookout(); } else if (eventArg == "jsPostPrintBookin") { PostPrintBookin(); } else if (eventArg == "jsPostPrintHeadCard") { Printing.PrintHead_CardShare(this, DwMain.GetItemString(1, "member_no"), state.SsCoopControl); } } private void PostPrintBookin() { String sql1 = @"select * from amsecusers where user_name={0} and coop_id={1}"; sql1 = WebUtil.SQLFormat(sql1, state.SsUsername, state.SsCoopId); Sdt dt1 = WebUtil.QuerySdt(sql1); string full_name = ""; string position = ""; if (dt1.Next()) { full_name = dt1.GetString("full_name"); position = dt1.GetString("description"); } try { if (state.SsCoopId == "000401") { string bookin = "bookin"; try { string sqlselect = @"select * from report_master where ireport_id ='bookin' and coop_id={0}"; sqlselect = WebUtil.SQLFormat(sqlselect, state.SsCoopId); Sdt Greport = WebUtil.QuerySdt(sqlselect); if (Greport.Next()) { bookin = Greport.GetString("ireport_name"); // พิมพ์สมุดจ่ายเงินกู้ พร้อม หัวสมุด } } catch { } iReportBuider report = new iReportBuider(this, ""); string report_label3 = "พิมพ์ปกสมุดใน"; iReportArgument args3 = new iReportArgument(); args3.Add("member_no", iReportArgumentType.String, DwMain.GetItemString(1, "member_no")); args3.Add("full_name", iReportArgumentType.String, full_name); args3.Add("position", iReportArgumentType.String, position); report.AddCriteria(bookin, report_label3, ReportType.pdf, args3); report.AutoOpenPDF = true; report.Retrieve(); } } catch { } } private void PostPrintNewBookout() { try { if (state.SsCoopId == "000401") { string bookout = "bookout"; try { string sqlselect = @"select * from report_master where ireport_id ='bookout' and coop_id={0}"; sqlselect = WebUtil.SQLFormat(sqlselect, state.SsCoopId); Sdt Greport = WebUtil.QuerySdt(sqlselect); if (Greport.Next()) { bookout = Greport.GetString("ireport_name"); // พิมพ์สมุดจ่ายเงินกู้ พร้อม หัวสมุด } } catch { } iReportBuider report = new iReportBuider(this, ""); string report_label3 = "พิมพ์ปกนอก"; iReportArgument args3 = new iReportArgument(); args3.Add("member_no", iReportArgumentType.String, DwMain.GetItemString(1, "member_no")); report.AddCriteria(bookout, report_label3, ReportType.pdf, args3); report.AutoOpenPDF = true; report.Retrieve(); } } catch { } } public void WebSheetLoadEnd() { //DwDetail.PageNavigationBarSettings.Visible = (DwDetail.RowCount > 10); DwMain.SaveDataCache(); DwDetail.SaveDataCache(); } #endregion private void JsPostAccountNo() { String member_no = ""; member_no = HdMemberNo.Value; // member_no = Dw_main.GetItemString(1, "member_no"); int dtMember = getMember(); if (dtMember <= 1) { member_no = WebUtil.MemberNoFormat(member_no); DwUtil.RetrieveDataWindow(DwMain, pbl, null, state.SsCoopControl, member_no); DwUtil.RetrieveDataWindow(DwDetail, pbl, null, state.SsCoopControl, member_no); } else { // HdMemno.Value = dsMain.DATA[0].MEMBER_NO; Page.ClientScript.RegisterStartupScript(this.GetType(), "CheckCountMemberNo", "CheckCountMemberNo(" + member_no + ")", true); } Hdmem_no.Value = member_no; DwMain.SetItemString(1, "check_no", Hdmem_no.Value); //String member_no = DwMain.GetItemString(1, "check_no"); //String sql; //member_no = WebUtil.MemberNoFormat(member_no); //Hdmem_no.Value = member_no; //if (member_no.Length < 10) //{ // for (int i = member_no.Length; i < 8; i++) // { // member_no = ("0" + member_no); // } // Hdmem_no.Value = member_no; // DwUtil.RetrieveDataWindow(DwMain, pbl, null, state.SsCoopControl, member_no); // DwUtil.RetrieveDataWindow(DwDetail, pbl, null, state.SsCoopControl, member_no); //} //else //{ // sql = @"select member_no from shsharemaster where sharepassbook_no = '" + member_no + "'"; // Sdt result = WebUtil.QuerySdt(sql); // if (result.Next()) // { // string mem_no = result.GetString("member_no"); // Hdmem_no.Value = mem_no; // DwUtil.RetrieveDataWindow(DwMain, pbl, null, state.SsCoopControl, mem_no); // DwUtil.RetrieveDataWindow(DwDetail, pbl, null, state.SsCoopControl, mem_no); // } //} //DwMain.SetItemString(1, "check_no", Hdmem_no.Value); } private void PostPrintNewBook( string message ) { try { string as_member_no = Hdmem_no.Value; DateTime adtm_date = state.SsWorkDate; string as_xml_return = ""; String as_entryid = ""; //short ai_reprint = 0 ; String as_newpassbook_no = ""; String as_reson = ""; int result = ndept.of_print_bookshare_firstpage(state.SsWsPass, as_member_no, state.SsWorkDate, as_entryid, ref as_xml_return, 0, as_newpassbook_no, as_reson); //Printing.Shareprintbookfristpage(this, as_xml_return); if (state.SsCoopControl == "000101") { Printing.PrintApplet(this, "share_printbookfirst", as_xml_return); } else { Printing.PrintApplet(this, "loan_printbookout", as_xml_return); } } catch (Exception ex) { LtServerMessage.Text = WebUtil.ErrorMessage(ex); } } public int getMember() { string memberno = HdMemberNo.Value; //dsMain.DATA[0].MEMBER_NO; int rows = 0; // string memberno = dw_main.GetItemString(1, "member_no"); if (memberno.Length <= 5) { memberno = Convert.ToDecimal(memberno).ToString("00000"); DwMain.SetItemString(1, "member_no", memberno); } string sql = "select count( member_no) as member_no from mbmembmaster where member_no Like '%" + memberno + "'"; Sdt d = WebUtil.QuerySdt(sql); if (d.Next()) { rows = d.GetInt32("member_no"); } return rows; } } }