Exemplo n.º 1
0
        private void CustGridControlForTrue()
        {
            UFWebClientGridAdapter adapter = new UFWebClientGridAdapter(this.DataGrid0);
            string             str         = adapter.getSelectedValuePK("ArrirmState");
            string             expression  = "debugger;if(" + adapter.getSelectedValuePK("ArrirmState") + "=='false')";
            CodeBlock          codeBlock   = new CodeBlock();
            AssociationControl control     = this.CreateAssociationControl(this.DataGrid0, codeBlock, "OnBeforeCellFocusEnter", expression);

            //使列不可用
            //
            //this.DataGrid5.r

            string[]        strArray = new string[] { "SubKey", "Dosage", "Tier" };
            List <string[]> list     = new List <string[]>();

            list.Add(new string[] { "SubKey", "true", "" });
            list.Add(new string[] { "Dosage", "true", "" });
            list.Add(new string[] { "Tier", "true", "" });
            foreach (string str2 in strArray)
            {
                adapter.FireEventCols.Add(str2);
            }
            foreach (string[] strArray2 in list)
            {
                adapter.EnabledCols.Add(new string[] { strArray2[0], strArray2[1], strArray2[2] });
            }

            codeBlock.TargetControls.addControl(adapter);
        }
Exemplo n.º 2
0
        private void Register_CallBack_FDDocType_DoCustomerAction()
        {
            //结合控件
            UFSoft.UBF.UI.WebControls.Association.AssociationControl ac = new AssociationControl();
            //设定触发源
            ac.SourceServerControl = (UFSoft.UBF.UI.ControlModel.IUFFldReference) this.txtOrderOrg;
            if (ac.SourceServerControl == null)
            {
                return;
            }
            //设定事件名称,经验证区分大小写,可查看portal\js\对应控件.js
            //对应js文件中有: add_onchange: function (handler)
            ac.SourceControl.EventName = "OnValueChanged";
            //查看事件的方法
            //UFSoft.UBF.UI.WebControls.Association.UFReferenceEventName.OnContentChanged

            //客户端刷新框架
            ClientCallBackFrm cF = new ClientCallBackFrm();

            //加入相关控件(才可取其值)
            cF.ParameterControls.Add((IUFControl)this.txtOrderOrg);

            cF.Add(ac);

            //加事件
            cF.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(CallBack_FDDocType_DoCustomerAction);
        }
Exemplo n.º 3
0
        private void Register_CallBack_Qty_Action()
        {
            //结合控件
            UFSoft.UBF.UI.WebControls.Association.AssociationControl ac = new AssociationControl();
            ac.SourceServerControl = (UFSoft.UBF.UI.ControlModel.IUFDataGrid) this.DataGrid5;
            //设定事件名称,经验证区分大小写,可查看portal\js\对应控件.js
            //事件名参考\Portal\js\DataGrid.js,<!--DataGrid控件事件名称常量定义--> 节点
            //DataGrid事件,OnBeforeCellFocusEnter等验证能触发
            ac.SourceControl.EventName = "OnCellDataChanged";
            //查看事件的方法
            //UFSoft.UBF.UI.WebControls.Association.UFDateGridEventName.OnCellFocusEnter

            //加入触发事件的列名,先转成Adapter
            UFSoft.UBF.UI.WebControls.Association.Adapter.UFWebClientGridAdapter adapter1 = ((UFWebClientGridAdapter)ac.SourceControl);
            adapter1.FireEventCols.Add("ThisCancelQty");

            //客户端刷新框架
            ClientCallBackFrm cF = new ClientCallBackFrm();

            //加入相关控件(才可取其值)
            cF.ParameterControls.Add((IUFControl)this.DataGrid5);
            cF.Add(ac);

            //加事件
            cF.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(cF_DoCustomerAction);
        }
        private void Register_DataGrid_BeforeDeleteLine_PoskBack()
        {
            AssociationControl assocControl = new AssociationControl();

            assocControl.SourceServerControl     = this.DataGrid8;
            assocControl.SourceControl.EventName = "OnBeforeRowDelete";//OnBeforeRowAdd

            CodeBlock cb = new CodeBlock();
            UFWebClientGridAdapter gridAdapter = new UFWebClientGridAdapter(this.DataGrid8);

            gridAdapter.IsPostBack  = true;
            gridAdapter.PostBackTag = "OnBeforeRowDelete";
            cb.TargetControls.addControl(gridAdapter);
            assocControl.addBlock(cb);
            UFGrid itemGrid = this.DataGrid8 as UFGrid;

            itemGrid.GridCustomerPostBackEvent += new GridCustomerPostBackDelegate(itemGriding_GridCustomerPostBackEvent);



            //ClientCallBackFrm cf = new ClientCallBackFrm();
            //cf.ParameterControls.Add(this.DataGrid8);
            //cf.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(cf_DoCustomerAction);
            //cf.Add(assocControl);
            //this.Controls.Add(cf);
        }
Exemplo n.º 5
0
        private void CustGridControl_Prices()
        {
            UFWebClientGridAdapter adapter = new UFWebClientGridAdapter(this.DataGrid5);
            string             str         = adapter.getSelectedValuePK("DiscountType");
            int                EnumValus   = (int)AllEnumBE.DiscountTypeEnumData.PercentValues;
            string             expression  = "debugger;if(" + str + "==" + EnumValus + ")";
            CodeBlock          codeBlock   = new CodeBlock();
            AssociationControl control     = this.CreateAssociationControl(this.DataGrid5, codeBlock, "OnBeforeCellFocusEnter", expression);

            string[]        strArray = new string[] { "Prices" };
            List <string[]> list     = new List <string[]>();

            list.Add(new string[] { "Prices", "false", "" });
            list.Add(new string[] { "CurrencyType", "false", "" });

            foreach (string str2 in strArray)
            {
                adapter.FireEventCols.Add(str2);
            }
            foreach (string[] strArray2 in list)
            {
                adapter.EnabledCols.Add(new string[] { strArray2[0], strArray2[1], strArray2[2] });
            }

            codeBlock.TargetControls.addControl(adapter);
        }
        private void RegisterGridCellEnableTrue(IUFDataGrid grid)
        {
            AssociationControl gridCellDataChangedASC = new AssociationControl();

            gridCellDataChangedASC.SourceServerControl     = grid;
            gridCellDataChangedASC.SourceControl.EventName = "OnBeforeCellFocusEnter";
            CodeBlock codeBlock  = new CodeBlock();
            string    expression = "";

            expression = "if(";
            UFWebClientGridAdapter webClientGridAdapter = null;

            webClientGridAdapter = new UFWebClientGridAdapter(grid);
            expression          += webClientGridAdapter.getSelectedValuePK("DiscountType");
            expression          += "==";
            expression          += "0";
            expression          += ")";
            codeBlock.Condition  = expression;
            webClientGridAdapter.FireEventCols.Add("DiscountPrice");
            webClientGridAdapter.FireEventCols.Add("DiscountRate");

            webClientGridAdapter.EnabledCols.Add(new object[] { "DiscountPrice", "true", "" });
            webClientGridAdapter.EnabledCols.Add(new object[] { "DiscountRate", "false", "" });
            codeBlock.TargetControls.addControl(webClientGridAdapter);
            gridCellDataChangedASC.addBlock(codeBlock);
        }
Exemplo n.º 7
0
        private void Register_DataGrid4_Price_CallBack()
        {
            if (DataGrid4 == null)
            {
                return;
            }
            //2)创建表格适配器对象
            UFWebClientGridAdapter _clientGrid = new UFWebClientGridAdapter(DataGrid4);
            //3)注册:事件源、事件名称、事件关联的列
            AssociationControl AssCtrl = new AssociationControl();

            AssCtrl.SourceServerControl     = DataGrid4;
            AssCtrl.SourceControl.EventName = "OnCellDataChanged";
            ((UFWebClientGridAdapter)AssCtrl.SourceControl).FireEventCols.Add("OrderPriceTC");
            ((UFWebClientGridAdapter)AssCtrl.SourceControl).FireEventCols.Add("OrderByQtyTU");
            ((UFWebClientGridAdapter)AssCtrl.SourceControl).FireEventCols.Add("DescFlexField_PrivateDescSeg5");
            ((UFWebClientGridAdapter)AssCtrl.SourceControl).FireEventCols.Add("DescFlexField_PrivateDescSeg1");

            //4)创建:CallBack窗体、事件方法、CallBack对象、事件相关
            ClientCallBackFrm frm = new ClientCallBackFrm();

            frm.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(DataGrid4_Price_OnCellDataChanged);
            //添加参数控件
            frm.ParameterControls.Add(DataGrid4);
            frm.Add(AssCtrl);
        }
Exemplo n.º 8
0
        private AssociationControl CreateAssociationControl(IUFControl ctrl, CodeBlock codeBlock, string eventName, string expression)
        {
            AssociationControl control = new AssociationControl();

            control.SourceServerControl     = ctrl;
            control.SourceControl.EventName = eventName;
            codeBlock.Condition             = expression;
            control.addBlock(codeBlock);
            return(control);
        }
Exemplo n.º 9
0
        private void CustGridCallToPostBackByRowAdded()
        {
            AssociationControl asso = new AssociationControl();

            asso.SourceServerControl     = this.DataGrid1;
            asso.SourceControl.EventName = "OnAfterRowAdded";
            ClientCallBackFrm cf = new ClientCallBackFrm();

            cf.ParameterControls.Add(this.DataGrid1);
            cf.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(RowInsert_CustomCallback);
            cf.Add(asso);
            this.Controls.Add(cf);
        }
Exemplo n.º 10
0
        private void UnitQtyCustGridCallToPostBack()
        {
            AssociationControl asso = new AssociationControl();

            asso.SourceServerControl     = this.DataGrid0;
            asso.SourceControl.EventName = "OnCellDataChanged";
            ((IUFClientAssoGrid)asso.SourceControl).FireEventCols.Add("Dosage");//列对应的字段名称
            ClientCallBackFrm cf = new ClientCallBackFrm();

            cf.ParameterControls.Add(this.DataGrid0);
            cf.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(UnitQtyChange_CustomCallback);
            cf.Add(asso);
            this.Controls.Add(cf);
        }
Exemplo n.º 11
0
        // <summary>
        /// 注册表格单元格内容改变的回调事件
        /// </summary>
        private void RegisterGridCellDataChangedPostBack()
        {
            AssociationControl assocControl = new AssociationControl();

            assocControl.SourceServerControl     = this.DataGrid1;
            assocControl.SourceControl.EventName = "GridRowClicked";
            //((IUFClientAssoGrid)assocControl.SourceControl).FireEventCols.Add("Gift");
            CodeBlock cb = new CodeBlock();
            UFWebClientGridAdapter gridAdapter = new UFWebClientGridAdapter(this.DataGrid1);

            gridAdapter.IsPostBack  = true;
            gridAdapter.PostBackTag = "GridRowClicked";
            cb.TargetControls.addControl(gridAdapter);
            assocControl.addBlock(cb);
            UFGrid itemGrid = this.DataGrid1 as UFGrid;

            itemGrid.GridCustomerPostBackEvent += new GridCustomerPostBackDelegate(GridCellOnChanged_DoCustomerAction_Grid);
        }
        private void CellDataChangedPostBack()
        {
            AssociationControl assocControl = new AssociationControl();

            assocControl.SourceServerControl     = this.DataGrid5;
            assocControl.SourceControl.EventName = "OnCellDataChanged";
            ((IUFClientAssoGrid)assocControl.SourceControl).FireEventCols.Add("BillNoid");
            CodeBlock cb = new CodeBlock();
            UFWebClientGridAdapter gridAdapter = new UFWebClientGridAdapter(this.DataGrid5);

            gridAdapter.IsPostBack  = true;
            gridAdapter.PostBackTag = "OnCellDataChanged";//OnCellDataValueChanged
            cb.TargetControls.addControl(gridAdapter);
            assocControl.addBlock(cb);
            UFGrid itemGrid = this.DataGrid5 as UFGrid;

            itemGrid.GridCustomerPostBackEvent += new GridCustomerPostBackDelegate(itemGrid_GridCustomerPostBackEvent);
        }
Exemplo n.º 13
0
        private void Register_DataGrid_BeforeDeleteLine_PoskBack()
        {
            AssociationControl assocControl = new AssociationControl();

            assocControl.SourceServerControl     = this.DataGrid1;
            assocControl.SourceControl.EventName = "OnBeforeRowDelete";//OnBeforeRowAdd

            CodeBlock cb = new CodeBlock();
            UFWebClientGridAdapter gridAdapter = new UFWebClientGridAdapter(this.DataGrid1);

            gridAdapter.IsPostBack  = true;
            gridAdapter.PostBackTag = "OnBeforeRowDelete";
            cb.TargetControls.addControl(gridAdapter);
            assocControl.addBlock(cb);
            UFGrid itemGrid = this.DataGrid1 as UFGrid;

            itemGrid.GridCustomerPostBackEvent += new GridCustomerPostBackDelegate(itemGrid_GridCustomerPostBackEvent);
        }
Exemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        private void QryCellDataChangedPostBack()
        {
            AssociationControl assocControl = new AssociationControl();

            assocControl.SourceServerControl     = this.DataGrid1;
            assocControl.SourceControl.EventName = "OnCellClick";

            //((IUFClientAssoGrid)assocControl.SourceControl).FireEventCols.Add("SONo");
            CodeBlock cb = new CodeBlock();
            UFWebClientGridAdapter gridAdapter = new UFWebClientGridAdapter(this.DataGrid1);

            gridAdapter.IsPostBack  = true;
            gridAdapter.PostBackTag = "OnCellClick";
            cb.TargetControls.addControl(gridAdapter);
            assocControl.addBlock(cb);
            UFGrid qryGrid = this.DataGrid1 as UFGrid;

            qryGrid.GridCustomerPostBackEvent += new GridCustomerPostBackDelegate(qryGrid_GridCustomerPostBackEvent);
        }
        /// <summary>
        /// 注册表格单元格内容改变的回调事件
        /// </summary>
        private void SumDeliveryCellDataChangedPostBack()
        {
            AssociationControl assocControl = new AssociationControl();

            assocControl.SourceServerControl     = this.DataGrid13;
            assocControl.SourceControl.EventName = "OnCellDataValueChanged";

            ((IUFClientAssoGrid)assocControl.SourceControl).FireEventCols.Add("InstalledArkNumber");
            CodeBlock cb = new CodeBlock();
            UFWebClientGridAdapter gridAdapter = new UFWebClientGridAdapter(this.DataGrid13);

            gridAdapter.IsPostBack  = true;
            gridAdapter.PostBackTag = "OnCellDataValueChanged";
            cb.TargetControls.addControl(gridAdapter);
            assocControl.addBlock(cb);
            UFGrid itemGrid = this.DataGrid13 as UFGrid;

            itemGrid.GridCustomerPostBackEvent += new GridCustomerPostBackDelegate(GridCellOnChanged_DoCustomerAction_Grid);
        }
        private void Register_DataGrid4_Price_CallBack()
        {
            //2)创建表格适配器对象
            UFWebClientGridAdapter _clientGrid = new UFWebClientGridAdapter(this.DataGrid0);
            //3)注册:事件源、事件名称、事件关联的列
            AssociationControl AssCtrl = new AssociationControl();

            AssCtrl.SourceServerControl     = this.DataGrid0;
            AssCtrl.SourceControl.EventName = "OnCellDataChanged";
            ((UFWebClientGridAdapter)AssCtrl.SourceControl).FireEventCols.Add("Prices");
            ((UFWebClientGridAdapter)AssCtrl.SourceControl).FireEventCols.Add("BrokerageRatio");

            //4)创建:CallBack窗体、事件方法、CallBack对象、事件相关
            ClientCallBackFrm frm = new ClientCallBackFrm();

            frm.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(DataGrid4_Price_OnCellDataChanged);
            //添加参数控件
            frm.ParameterControls.Add(this.DataGrid0);
            frm.Add(AssCtrl);
        }
Exemplo n.º 17
0
        private void Register_CallBack_Fee_DoCustomerAction()
        {
            //结合控件
            UFSoft.UBF.UI.WebControls.Association.AssociationControl ac = new AssociationControl();
            //设定触发源(可以设定多个,如多事件触发)
            ac.SourceServerControl     = (UFSoft.UBF.UI.ControlModel.IUFDataGrid) this.DataGrid5;
            ac.SourceControl.EventName = "OnCellDataChanged";
            //加入触发事件的列名,先转成Adapter
            UFSoft.UBF.UI.WebControls.Association.Adapter.UFWebClientGridAdapter adapter1 = ((UFWebClientGridAdapter)ac.SourceControl);
            adapter1.FireEventCols.Add("DiscountType"); //折扣方式
            adapter1.FireEventCols.Add("Discount");     //折扣
            adapter1.FireEventCols.Add("Prices");       //价格
            //客户端刷新框架
            ClientCallBackFrm cF = new ClientCallBackFrm();

            //加入相关控件(才可取其值)
            cF.ParameterControls.Add((IUFControl)this.DataGrid5);
            cF.Add(ac);
            //加事件
            cF.DoCustomerAction += new ClientCallBackFrm.ActionCustomer(cF_DoCustomerAction);
        }
Exemplo n.º 18
0
        private void Register_DataGrid4_ExportPrice_PostBack()
        {
            if (DataGrid4 == null)
            {
                DataGrid4 = (IUFDataGrid)part.GetUFControlByName(part.TopLevelContainer, "DataGrid4");
            }
            AssociationControl assocControl = new AssociationControl();

            assocControl.SourceServerControl     = DataGrid4;
            assocControl.SourceControl.EventName = "OnCellDataChanged";
            ((IUFClientAssoGrid)assocControl.SourceControl).FireEventCols.Add("DescFlexField_PrivateDescSeg5");
            CodeBlock cb = new CodeBlock();
            UFWebClientGridAdapter gridAdapter = new UFWebClientGridAdapter(DataGrid4);

            gridAdapter.IsPostBack  = true;
            gridAdapter.PostBackTag = "OnCellDataChanged";
            cb.TargetControls.addControl(gridAdapter);
            assocControl.addBlock(cb);

            UFGrid itemGrid = DataGrid4 as UFGrid;

            itemGrid.GridCustomerPostBackEvent += new GridCustomerPostBackDelegate(GridCellOnChanged_DoCustomerAction_Grid);
        }
        private void CellEditEnabledAssoControl()
        {
            AssociationControl associationControl = new AssociationControl();
            associationControl.SourceServerControl = this.DataGrid5;
            associationControl.SourceControl.EventName = "OnBeforeCellFocusEnter";
            // 触发列名
            //((UFWebClientGridAdapter)associationControl.SourceControl).FireEventCols.Add(this.Model.Vouchers_VouchersLine.FieldMoney.Name);
            //((UFWebClientGridAdapter)associationControl.SourceControl).FireEventCols.Add(this.Model.Vouchers_VouchersLine.FieldEffectiveDate.Name);
            CodeBlock codeBlock = new CodeBlock();
            StringBuilder stringBuilder = new StringBuilder(256);
            stringBuilder.AppendFormat("var currentrow = $find('{0}').get_CurrentRowIndex(); \n", this.DataGrid5.ClientID);
            //stringBuilder.AppendFormat("var custid     = $find('{0}').GetCellValueByFieldAndRow('Customer',currentrow).Value; \n", this.DataGrid5.ClientID);
            //stringBuilder.AppendFormat("var custsiteid = $find('{0}').GetCellValueByFieldAndRow('CustomerSite',currentrow).Value; \n", this.DataGrid5.ClientID);
            //stringBuilder.AppendFormat("var custcateid = $find('{0}').GetCellValueByFieldAndRow('CustomerCategory',currentrow).Value; \n", this.DataGrid5.ClientID);
            //stringBuilder.AppendFormat("var itemid     = $find('{0}').GetCellValueByFieldAndRow('ItemInfo_ItemID',currentrow).Value; \n", this.DataGrid5.ClientID);
            //stringBuilder.AppendFormat("var itemcateid = $find('{0}').GetCellValueByFieldAndRow('MaterialCategory',currentrow).Value; \n", this.DataGrid5.ClientID);
            //stringBuilder.AppendFormat("var itemdepid  = $find('{0}').GetCellValueByFieldAndRow('ItemDepended',currentrow).Value; \n", this.DataGrid5.ClientID);
            //stringBuilder.Append("if(custid == -1) \n custid = ''; \n");
            //stringBuilder.Append("if(custsiteid == -1) \n custsiteid = ''; \n");
            //stringBuilder.Append("if(custcateid == -1) \n custcateid = ''; \n");
            //stringBuilder.Append("if(itemid == -1) \n itemid = ''; \n");
            //stringBuilder.Append("if(itemcateid == -1) \n itemcateid = ''; \n");
            //stringBuilder.Append("if(itemdepid == -1) \n itemdepid = ''; \n");
            //stringBuilder.Append("switch(args.arg.ColField)\n");
            //stringBuilder.Append("{ \n");
            //stringBuilder.Append("   case 'Customer':\n");
            //stringBuilder.Append("      if(custcateid != '') \n {args.arg.CellEditEnabled = false;} \n");
            //stringBuilder.Append("      break; \n");
            //stringBuilder.Append("   case 'CustomerSite':");
            //stringBuilder.Append("      if(custid == '')    \n {args.arg.CellEditEnabled = false;} \n");
            //stringBuilder.Append("      break; \n");
            //stringBuilder.Append("   case 'CustomerCategory':");
            //stringBuilder.Append("      if(custid != '')    \n {args.arg.CellEditEnabled = false;} \n");
            //stringBuilder.Append("      break; \n");
            //stringBuilder.Append("   case 'ItemInfo_ItemID':");
            //stringBuilder.Append("      if(itemcateid != '') \n {args.arg.CellEditEnabled = false;} \n");
            //stringBuilder.Append("      break; \n");
            //stringBuilder.Append("   case 'MaterialCategory':");
            //stringBuilder.Append("      if(itemid != '')    \n {args.arg.CellEditEnabled = false;} \n");
            //stringBuilder.Append("      break; \n");
            //stringBuilder.Append("   case 'Price':");
            //stringBuilder.Append("      if(itemdepid != '')  \n {args.arg.CellEditEnabled = false;} \n");
            //stringBuilder.Append("      break; \n");
            //stringBuilder.Append("} \n");

            stringBuilder.AppendFormat("var isUsed     = $find('{0}').GetCellValueByFieldAndRow('" + this.Model.Vouchers_VouchersLine.FieldIsUsed.Name + "',currentrow).Value; \n", this.DataGrid5.ClientID);

            stringBuilder.Append("      if(isUsed == 'true') \n {args.arg.CellEditEnabled = false;} \n");

            codeBlock.Condition = stringBuilder.ToString();
            associationControl.addBlock(codeBlock);
        }