protected void cbSearch_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
    {
        //if (!String.IsNullOrEmpty(txtHiddenAccountId.Text))
        {
            String keyWord = textKeyWord.Text;

            IList <TimeSchedule> schedules = null;
            if (IsFundSchedule)
            {
                TreeListNode type = TreeListNode.FindByCode(iSabayaContext, "MutualFundSchedule");
                schedules = iSabaya.TimeSchedule.List(iSabayaContext, type);
            }
            else
            {
                if (txtHiddenAccountId.Text == "")
                {
                    return;
                }
                TreeListNode category = TreeListNode.FindByCode(iSabayaContext, "MFAccountSchedule");
                ICriteria    crit     = iSabayaContext.PersistenceSession.CreateCriteria(typeof(TimeSchedule));
                crit.Add(Expression.Eq("Category", category));
                crit.Add(Expression.Eq("MFAccountID", int.Parse(txtHiddenAccountId.Text)));
                schedules = crit.List <TimeSchedule>();
            }

            //List<VOSchedule> vos = new List<VOSchedule>();
            //foreach (TimeSchedule s in schedules)
            //{
            //    vos.Add(new VOSchedule(s));
            //}



            Session["ctrls_ScheduleControl_Schedules"] = schedules;
            gridSchedules.DataSource = schedules;
            gridSchedules.DataBind();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ComboTLNCardType.ParentNode = TreeListNode.FindByCode(iSabayaContext, "cardtype");
            ComboTLNCardType.DataBind();

            CallbackSearchByCard.ClientInstanceName     = this.ClientID + CallbackSearchByCard.ClientID;
            CallbacklikeCustomerName.ClientInstanceName = this.ClientID + CallbacklikeCustomerName.ClientID;
            cbSelect.ClientInstanceName        = this.ClientID + cbSelect.ClientID;
            cbLostFocus.ClientInstanceName     = this.ClientID + cbLostFocus.ClientID;
            GridCustomer.ClientInstanceName    = this.ClientID + GridCustomer.ClientID;
            txtFirstName.ClientInstanceName    = this.ClientID + txtFirstName.ClientID;
            btnFindName.ClientInstanceName     = this.ClientID + btnFindName.ClientID;
            btnFindCard.ClientInstanceName     = this.ClientID + btnFindCard.ClientID;
            btnFindName.ClientInstanceName     = this.ClientID + btnFindName.ClientID;
            GridCustomer.ClientSideEvents.Init = @"function(s, e) {
                  s.SetFocusedRowIndex(-1);
            }";

            CallbackSearchByCard.ClientSideEvents.CallbackComplete = @"function(s, e) {
                " + GridCustomer.ClientInstanceName + @".SetFocusedRowIndex(-1);
                " + GridCustomer.ClientInstanceName + @".PerformCallback();
            }";

            CallbacklikeCustomerName.ClientSideEvents.CallbackComplete = @"function(s, e) {
                " + GridCustomer.ClientInstanceName + @".SetFocusedRowIndex(-1);
                " + GridCustomer.ClientInstanceName + @".PerformCallback();
            }";

            btnFindCard.ClientSideEvents.Click = @"function(s, e) {
            " + CallbackSearchByCard.ClientInstanceName + @".SendCallback();
            }";

            btnFindName.ClientSideEvents.Click = @"function(s, e) {
            " + CallbacklikeCustomerName.ClientInstanceName + @".SendCallback();
            }";

            //--------------------------------------------------------
            lblMFCustomerName.ClientInstanceName = this.ClientID + lblMFCustomerName.ClientID;
            txtMFCustomerNo.ClientInstanceName   = this.ClientID + txtMFCustomerNo.ClientID;

            popupAccount.ClientInstanceName      = this.ClientID + popupAccount.ClientID;
            cbpTxtMFAccountNo.ClientInstanceName = this.ClientID + cbpTxtMFAccountNo.ClientID;

            String lostFocus = @"function(s,e){
       
            " + cbLostFocus.ClientInstanceName + ".SendCallback(" + txtMFCustomerNo.ClientInstanceName + @".GetValue()); 
            }";
            txtMFCustomerNo.ClientSideEvents.LostFocus = lostFocus;

            String buttonClick = @"function(s,e){ 
                    var win = " + popupAccount.ClientInstanceName + @".GetWindow(0); 
                    " + popupAccount.ClientInstanceName + @".ShowWindow(win);
                    }";

            txtMFCustomerNo.ClientSideEvents.ButtonClick = buttonClick;
            //+ cbpTxtMFAccountNo.ClientInstanceName + @".PerformCallback();
            cbSelect.ClientSideEvents.CallbackComplete = @"function(s,e){
                " + txtMFCustomerNo.ClientInstanceName + @".SetValue(e.result);
                if(typeof(oncompleteLoadCustomer)!='undefined'){                   
                       oncompleteLoadCustomer();
                }
                var value = e.result;
                " + ClientSideEvents.AfterSelectedChanged + @"
            }";

            cbLostFocus.ClientSideEvents.CallbackComplete = @"function(s,e){ 
                if(e.result=='hit'){
                    " + cbpTxtMFAccountNo.ClientInstanceName + @".PerformCallback(); 
                    if(typeof(oncompleteLoadCustomer)!='undefined'){                   
                           oncompleteLoadCustomer();                       
                    }
                    var value = " + txtMFCustomerNo.ClientInstanceName + @".GetText();
                    " + ClientSideEvents.AfterSelectedChanged + @"
                }else{
                    " + txtMFCustomerNo.ClientInstanceName + @".SetValue('');
                    " + lblMFCustomerName.ClientInstanceName + @".SetValue('');
                    var value = '';
                    " + ClientSideEvents.AfterSelectedChanged + @"
                }
            }";

            GridCustomer.ClientSideEvents.CustomButtonClick = @"function(s,e){
                var buttonID = e.buttonID;               
                var visibleIndex = e.visibleIndex;
                  if(buttonID = 'buttonSelect')
                  {                         
                     " + cbSelect.ClientInstanceName + @".SendCallback(visibleIndex);         
                     " + popupAccount.ClientInstanceName + @".Hide();
                  }
            }";
        }
        if (IsRequiredField)
        {
            txtMFCustomerNo.SetValidation(ValidationGroup);
        }

        if (Session[this.ID + this.GetType().ToString() + "GridCustomerVOS"] != null)
        {
            GridCustomer.DataSource = (IList <MFCustomer>)Session[this.ID + this.GetType().ToString() + "GridCustomerVOS"];
            GridCustomer.DataBind();
        }
    }
Esempio n. 3
0
    public void InitialControl()
    {
        ISession session = iSabayaContext.PersistencySession;
        IList <ProvidentFund> listFunds = null;

        //        if (isMasterFund)
        //        {
        //            // do notthing
        //        }
        //        else if (isNotMasterFund)
        //        {
        //            String sqlquery = @"select * from fund
        //                                where IsMasterFund = 0 and FundDiscriminator = 2";
        //            ISQLQuery query = session.CreateSQLQuery(sqlquery).AddEntity(typeof(ProvidentFund)); ;
        //            listFunds = query.List<ProvidentFund>();
        //        }
        //        else
        //        {
        //            //listFunds = ProvidentFund.List(iSabayaContext);
        //        }
        listFunds = ProvidentFund.ListSingleFunds(iSabayaContext);
        List <ProvidentFund> listFundFilters = new List <ProvidentFund>();

        if (!transactionTypeCode.Equals(""))
        {
            TreeListNode channel = TreeListNode.FindByCode(iSabayaContext, "WEB");
            InvestmentTransactionType tranType = InvestmentTransactionType.FindByCode(iSabayaContext, TransactionTypeCode);
            if (listFunds != null)
            {
                foreach (ProvidentFund fund in listFunds)
                {
                    //bool isHave = InstrumentTransactionType.IsHave(session, fund, channel, tranType);
                    ICriteria crit = iSabayaContext.PersistencySession.CreateCriteria(typeof(InstrumentTransactionType));
                    crit.Add(Expression.Eq("Fund", fund));
                    bool isHave = crit.List <InstrumentTransactionType>().Count > 0;
                    if (isHave)
                    {
                        listFundFilters.Add(fund);
                    }
                }
            }
        }
        else
        {
            if (listFunds != null)
            {
                foreach (ProvidentFund fund in listFunds)
                {
                    listFundFilters.Add(fund);
                }
            }
        }

        dic.Clear();

        if (includeAllFundItem)
        {
            dic.Add(0, "-All Funds-");
        }
        if (listFunds != null)
        {
            foreach (ProvidentFund fund in listFundFilters)
            {
                //dic.Add(fund.FundID, "[" + fund.Code + "]" + fund.ShortTitle.ToString());
                dic.Add(fund.FundID, fund.Code);
            }
            ViewState["listFunds"] = dic;
        }
        refreshControl();
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            initControl("th", PersistenceLayer.WebSessionManager.PersistenceSession);
            ComboTLNCardType.ParentNode = TreeListNode.FindByCode(iSabayaContext, "cardtype");
            ComboTLNCardType.DataBind();

            ASPxPopupControl1.ClientInstanceName = ASPxPopupControl1.ClientID;

            LabelCustomerName.ClientInstanceName    = LabelCustomerName.ClientID;
            cbpGridAccountOutput.ClientInstanceName = cbpGridAccountOutput.ClientID;

            CallbackSearchByCard.ClientInstanceName = CallbackSearchByCard.ClientID;

            CallbacklikeCustomerName.ClientInstanceName = CallbacklikeCustomerName.ClientID;
            Callback1FromPopup.ClientInstanceName       = Callback1FromPopup.ClientID;
            GridCustomer.ClientInstanceName             = GridCustomer.ClientID;
            TextSearchString.ClientInstanceName         = TextSearchString.ClientID;
            ButtonSearch.ClientInstanceName             = ButtonSearch.ClientID;
            buttonApplyAndClose.ClientInstanceName      = buttonApplyAndClose.ClientID;
            buttonClose.ClientInstanceName = buttonClose.ClientID;
            /*LostFocus*/
            TextCardCode.ClientSideEvents.LostFocus = @"function(s, e) {";

            TextCardCode.ClientSideEvents.LostFocus += CallbackSearchByCard.ClientInstanceName + ".SendCallback(s.GetValue());      }";

            /*Search by card complete*/
            CallbackSearchByCard.ClientSideEvents.CallbackComplete =
                @"function(s, e) {
                    document.getElementById('" + LabelCustomerName.ClientInstanceName + @"').innerHTML=e.result;
            " + cbpGridAccountOutput.ClientInstanceName + @".PerformCallback();
            setTimeout('" + GridName + ".PerformCallback()', 5000); ";
            CallbackSearchByCard.ClientSideEvents.CallbackComplete +=
                @"
                    var params = new Array(1);
                    params['source']='completeSearch';
                    //alert(eventCallback);
                    //if(eventCallback!= undefined){
                    //   eventCallback(params);
                    //}
            }";

            /*Click search from name*/
            String script = "function(s, e) { var likeCustomerName = " + TextSearchString.ClientInstanceName + ".GetValue();";
            script += " " + CallbacklikeCustomerName.ClientInstanceName + ".SendCallback(likeCustomerName);";
            script += "var win = " + ASPxPopupControl1.ClientInstanceName + ".GetWindow(0);";
            script += ASPxPopupControl1.ClientInstanceName + ".ShowWindow(win);";
            script += "}";
            ButtonSearch.ClientSideEvents.Click = script;

            /*show grid name like criteria*/
            CallbacklikeCustomerName.ClientSideEvents.CallbackComplete =
                @"function(s, e) {
            " + cbpGridAccountOutput.ClientInstanceName + @".PerformCallback();
             " + GridCustomer.ClientInstanceName + ".PerformCallback();  " +
                GridCustomer.ClientInstanceName + ".SetFocusedRowIndex(0); }";

            /*grid FocusedRowChanged*/
            GridCustomer.ClientSideEvents.FocusedRowChanged  = @"function(s, e) {
                     if(" + GridCustomer.ClientInstanceName + ".GetFocusedRowIndex()!=-1){";
            GridCustomer.ClientSideEvents.FocusedRowChanged += CallbackTest.ClientInstanceName + ".SendCallback(" + GridCustomer.ClientInstanceName + ".GetFocusedRowIndex());} }";

            /*click select from popup*/
            String scriptString1 = "function(s, e) { ";
            scriptString1 += Callback1FromPopup.ClientInstanceName + ".SendCallback();";
            scriptString1 += cbpGridAccountOutput.ClientInstanceName + ".PerformCallback();";
            scriptString1 += ASPxPopupControl1.ClientInstanceName + ".Hide();";
            scriptString1 += " }";
            buttonApplyAndClose.ClientSideEvents.Click = scriptString1;

            String scriptStringClose = "function(s, e) { ";
            scriptString1 += ASPxPopupControl1.ClientInstanceName + ".Hide();";
            scriptString1 += " }";
            buttonClose.ClientSideEvents.Click = scriptStringClose;

            /*Search by name complete after selected from grid*/
            Callback1FromPopup.ClientSideEvents.CallbackComplete =
                @"function(s, e) {
                    document.getElementById('" + LabelCustomerName.ClientInstanceName + "').innerHTML=e.result; setTimeout('" + GridName + ".PerformCallback()', 5000);  ";
            Callback1FromPopup.ClientSideEvents.CallbackComplete +=
                @"
                    var params = new Array(1);
                    params['source']='completeSearch';
                    if(typeof(eventCallback)!='undefined'){
                       eventCallback(params);
                    }
            }";

            gridAccountOutput.ClientInstanceName                 = gridAccountOutput.ClientID;
            cbSelectedIndexChnage.ClientInstanceName             = cbSelectedIndexChnage.ClientID;
            gridAccountOutput.ClientSideEvents.FocusedRowChanged = @"function(s, e) {
                    /*alert('hi');*/
                    var rowIndex = " + gridAccountOutput.ClientInstanceName + @".GetFocusedRowIndex();
                " + cbSelectedIndexChnage.ClientInstanceName + @".SendCallback(rowIndex);
            }";
        }

        if (Session[this.ID + "cbpGridAccountOutput"] != null)
        {
            IList <MFAccount> accounts = (IList <MFAccount>)Session[this.ID + "cbpGridAccountOutput"];

            gridAccountOutput.DataSource = accounts;

            gridAccountOutput.DataBind();
        }
        if (Session["GridCustomerVOS"] != null)
        {
            GridCustomer.DataSource = (IList <MFCustomer>)Session["GridCustomerVOS"];
            GridCustomer.DataBind();
        }
        if (Session[this.ID + "ctrls_CustomerControl_CurrentParty"] != null)
        {
            partyId = (int)Session[this.ID + "ctrls_CustomerControl_CurrentParty"];
        }
    }