using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CoreSavingLibrary; using System.Data; using DataLibrary; namespace Saving.Applications.trading.ws_td_slip_dec_ctrl { public partial class DsMain : DataSourceFormView { public DataSet2.DSMAINDataTable DATA { get; private set; } public void InitdsMain(PageWeb pw) { css1.Visible = false; DataSet2 ds = new DataSet2(); this.DATA = ds.DSMAIN; this.InitDataSource(pw, FormViewMain, this.DATA, "dsMain"); this.EventItemChanged = "OnDsMainItemChanged"; //this.EventClicked = "OnDsMainClicked"; //this.Button.Add("b_debtno"); this.Register(); } public void of_retrieve(string coop_id,string store_id) { string sql = @"select store_id, store_desc from ststore where coop_id={0} and store_id={1}"; sql = WebUtil.SQLFormat(sql, coop_id, store_id); DataTable dt = WebUtil.Query(sql); this.DropDownDataBind(dt, "store_id", "store_desc", "store_id"); DATA[0].store_id = store_id; if(Sta.IS_MYSQL_MODE) { string sql1 = @"select '000' as store_id,'กรุณาเลือก' as store_desc from dual union select store_id, store_desc from ststore where coop_id ={0} order by store_id asc"; sql1 = WebUtil.SQLFormat(sql1, coop_id); DataTable dt1 = WebUtil.Query(sql1); this.DropDownDataBind(dt1, "tostore_id", "store_desc", "store_id"); } else{ string sql1 = @"select store_id, store_desc, 1 as sorter from ststore where coop_id={0} union select '000','กรุณาเลือก',0 from dual order by sorter, store_id"; sql1 = WebUtil.SQLFormat(sql1, coop_id); DataTable dt1 = WebUtil.Query(sql1); this.DropDownDataBind(dt1, "tostore_id", "store_desc", "store_id"); } } public void of_sliptype(string coop_id) { if(Sta.IS_MYSQL_MODE){ string sql = @"select '000' as sliptype_code,'กรุณาเลือก' as sliptype_desc from dual union select '998' as sliptype_code,'จัดกระเช้า' as sliptype_desc from dual union select '999' as sliptype_code,'ยุบกระเช้า' as sliptype_desc from dual union select sliptype_code, sliptype_desc from ststocksliptype where coop_id ={0} and sliptype_code in ('005','007','009','010','015') order by sliptype_code asc"; sql = WebUtil.SQLFormat(sql, coop_id); DataTable dt = WebUtil.Query(sql); this.DropDownDataBind(dt, "sliptype_code", "sliptype_desc", "sliptype_code"); } else{ string sql = @"select sliptype_code, sliptype_desc, 1 as sorter from ststocksliptype where coop_id={0} and sliptype_code in ('005','007','009','010','015') union select sliptype_code,'จัดกระเช้า', 2 as sorter from ststocksliptype where coop_id= {0} and sliptype_code = '014' union select '000' as sliptype_code, 'กรุณาเลือก', 0 as sorter from dual order by sorter,sliptype_code"; sql = WebUtil.SQLFormat(sql, coop_id); DataTable dt = WebUtil.Query(sql); this.DropDownDataBind(dt, "sliptype_code", "sliptype_desc", "sliptype_code"); } } } }