示例#1
0
        public void ReloadDatas( )
        {
            if (!String.IsNullOrWhiteSpace(TableName) && GridCtrl != null && DataStructureProvider.IsExistedTable(TableName))
            {
                BusinessObjectController ctrl = BusinessControllerFactory.GetBusinessController(TableName);

                String strQuery = QueryGenerator.GenSelect(TableName, "*", true);
                strQuery = QueryGenerator.AddCondition(strQuery, ConditionString);

                if (DataStructureProvider.IsTableColumn(TableName, ABCCommon.ABCConstString.colDocumentDate))
                {
                    strQuery = strQuery + String.Format(@" ORDER BY {0} DESC", ABCCommon.ABCConstString.colDocumentDate);
                }

                GridCtrl.GridDataSource = ctrl.GetListByQuery(strQuery);
                GridCtrl.RefreshDataSource();
                this.GridCtrl.GridDefaultView.BestFitColumns();
            }
        }
示例#2
0
        public static List <BusinessObject> GetAlertData(Guid alertID)
        {
            if (AlertList.ContainsKey(alertID) == false)
            {
                return(null);
            }

            String       strQuery  = GetAlertQueryString(alertID);
            GEAlertsInfo alertInfo = AlertList[alertID];

            BusinessObjectController ctrl = BusinessControllerFactory.GetBusinessController(alertInfo.TableName);

            if (ctrl == null)
            {
                return(null);
            }

            return(ctrl.GetListByQuery(strQuery));
        }
示例#3
0
        public void Search( )
        {
            if (BindingObject != null && GridCtrl != null)
            {
                if (BindingObject.DataManager.MainObject == null)
                {
                    return;
                }

                BusinessObject           mainObj = BindingObject.DataManager.MainObject.DataObject as BusinessObject;
                BusinessObjectController ctrl    = BusinessControllerFactory.GetBusinessController(mainObj.AATableName);

                ConditionBuilder strBuilder = BindingObject.GenerateQuery(true);

                if (strBuilder == null || String.IsNullOrWhiteSpace(strBuilder.ToString()))
                {
                    return;
                }

                if (SearchPanel != null)
                {
                    SearchPanel.GetSearchQuery(strBuilder, SearchPanel);
                }

                if (BindingObject.DataManager.Screen.UIManager.View.DataField != null)
                {
                    GEVouchersInfo config = VoucherProvider.GetConfig(BindingObject.TableName, BindingObject.DataManager.Screen.UIManager.View.DataField.STViewNo);
                    if (config != null && !String.IsNullOrWhiteSpace(config.ConditionString))
                    {
                        strBuilder.AddCondition(config.ConditionString);
                    }
                }

                if (DataStructureProvider.IsTableColumn(BindingObject.TableName, ABCCommon.ABCConstString.colApprovalStatus))
                {
                    if (chkNotYetApproved.Checked)
                    {
                        strBuilder.AddCondition(String.Format("{0}<>'{1}'", ABCCommon.ABCConstString.colApprovalStatus, ABCCommon.ABCConstString.ApprovalTypeApproved));
                    }
                }

                if (DataStructureProvider.IsTableColumn(BindingObject.TableName, ABCCommon.ABCConstString.colLockStatus))
                {
                    if (chkLocked.Checked)
                    {
                        strBuilder.AddCondition(String.Format("{0}='{1}'", ABCCommon.ABCConstString.colLockStatus, ABCCommon.ABCConstString.LockStatusLocked));
                    }
                }

                if (DataStructureProvider.IsTableColumn(BindingObject.TableName, ABCCommon.ABCConstString.colJournalStatus))
                {
                    if (chkNotYetPosted.Checked)
                    {
                        strBuilder.AddCondition(String.Format("{0}<>'{1}'", ABCCommon.ABCConstString.colJournalStatus, ABCCommon.ABCConstString.PostStatusPosted));
                    }
                }

                object datasource = null;
                Type   objType    = BusinessObjectFactory.GetBusinessObjectType(GridCtrl.TableName);
                if (objType != null)
                {
                    Type       typeABCList = typeof(ABCList <>).MakeGenericType(objType);
                    MethodInfo method;
                    if (typeABCList != null)
                    {
                        datasource = ABCBusinessEntities.ABCDynamicInvoker.CreateInstanceObject(typeABCList);
                        method     = typeABCList.GetMethod("LoadData", new Type[] { typeof(List <BusinessObject>) });
                        method.Invoke(datasource, new object[] { ctrl.GetListByQuery(strBuilder.ToString()) });
                    }
                }
                binding.DataSource = datasource;
                binding.ResetBindings(false);

                this.GridCtrl.GridDefaultView.BestFitColumns();

                for (int i = 0; i < this.GridCtrl.GridDefaultView.DataRowCount; i++)
                {
                    BusinessObject obj = this.GridCtrl.GridDefaultView.GetRow(i) as BusinessObject;
                    if (obj != null && obj.GetID() == mainObj.GetID())
                    {
                        this.GridCtrl.GridDefaultView.FocusedRowHandle = i;
                        return;
                    }
                }
            }
        }