Esempio n. 1
0
        public void Invalidate(IList dataList)
        {
            InvalidateCachingAllNodes();

            RootData         = new ABCTreeListNode(null, null, null);
            RootData.Manager = this;

            if (RootConfig.ChildrenNodes.Count > 0)
            {
                foreach (String strObjectName in RootConfig.ChildrenNodes.Keys)
                {
                    String strTableName = RootConfig.ChildrenNodes[strObjectName].InnerData.TableName;
                    BusinessObjectController Controller = BusinessControllerFactory.GetBusinessController(strTableName);
                    foreach (object objChild in dataList)
                    {
                        if (objChild is BusinessObject == false)
                        {
                            continue;
                        }

                        ABCTreeListNode node = new ABCTreeListNode(RootData, strObjectName, objChild as BusinessObject);
                        node.CachingNode();
                    }

                    break;
                }
            }
            ExpandDataAll();

            TreeList.InnerTreeList.DataSource = RootData;
            TreeList.InnerTreeList.RefreshDataSource();
        }
Esempio n. 2
0
 public bool IsValidForeignKeyProperty(String strForeignKeyColumn)
 {
     try
     {
         VinaDbUtil dbUtil = new VinaDbUtil();
         //String strMainObjectTableName = MainObject.GetType().Name.Substring(0, MainObject.GetType().Name.Length - 4);
         String strMainObjectTableName = VinaUtil.GetTableNameFromBusinessObject(MainObject);
         String strPrimaryTable        = ((IBaseModuleERP)Module).GetTreePrimaryTableWhichForeignColumnReferenceTo(strMainObjectTableName, strForeignKeyColumn);
         String strPrimaryColumn       = ((IBaseModuleERP)Module).GetTreePrimaryTableWhichForeignColumnReferenceTo(strMainObjectTableName, strForeignKeyColumn);
         BaseBusinessController objPrimaryTableObjectController = BusinessControllerFactory.GetBusinessController(strPrimaryTable + "Controller");
         int iForeignKeyColumnValue = Convert.ToInt32(dbUtil.GetPropertyValue(MainObject, strForeignKeyColumn));
         if (iForeignKeyColumnValue > 0)
         {
             return(objPrimaryTableObjectController.IsExist(iForeignKeyColumnValue));
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 3
0
        public void InvalidateCachingAllNodes( )
        {
            DataList.Clear();
            foreach (TreeConfigNode configNode in ConfigList.Values)
            {
                try
                {
                    if (configNode.InnerData != null && configNode.ParentNode != null)
                    {
                        DataView view = DataCachingProvider.TryToGetDataView(configNode.InnerData.TableName, false);
                        BusinessObjectController Controller = BusinessControllerFactory.GetBusinessController(configNode.InnerData.TableName);

                        //DataSet ds=Controller.GetAllObjects();
                        //if ( ds!=null&&ds.Tables.Count>0 )
                        //{
                        foreach (DataRow dr in view.Table.Rows)
                        {
                            BusinessObject obj = Controller.GetObjectFromDataRow(dr);
                            if (obj != null)
                            {
                                ABCTreeListNode node = new ABCTreeListNode(null, configNode.InnerData.Name, obj);
                                node.Manager = this;
                                node.CachingNode();
                            }
                        }
                        //     }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Esempio n. 4
0
        public void Invalidate(DataTable table, String strObjectName)
        {
            InvalidateCachingAllNodes();

            RootData         = new ABCTreeListNode(null, null, null);
            RootData.Manager = this;

            if (RootConfig.ChildrenNodes.ContainsKey(strObjectName))
            {
                String strTableName = RootConfig.ChildrenNodes[strObjectName].InnerData.TableName;
                BusinessObjectController Controller = BusinessControllerFactory.GetBusinessController(strTableName);
                foreach (DataRow dr in table.Rows)
                {
                    BusinessObject objChild = Controller.GetObjectFromDataRow(dr);
                    if (objChild != null)
                    {
                        ABCTreeListNode node = new ABCTreeListNode(RootData, strObjectName, objChild);
                        node.CachingNode();
                    }
                }
            }

            ExpandDataAll();

            TreeList.InnerTreeList.DataSource = RootData;
            TreeList.InnerTreeList.RefreshDataSource();
        }
Esempio n. 5
0
        public static BusinessObject GetRealCompanyUnit(Guid companyUnitID)
        {
            GECompanyUnitsInfo comUnit = new GECompanyUnitsController().GetObjectByID(companyUnitID) as GECompanyUnitsInfo;

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

            if (!comUnit.FK_GECompanyUnitTypeID.HasValue)
            {
                return(null);
            }

            GECompanyUnitTypesInfo comUnitType = new GECompanyUnitTypesController().GetObjectByID(comUnit.FK_GECompanyUnitTypeID.Value) as GECompanyUnitTypesInfo;

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

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

            if (ctrl != null)
            {
                return(ctrl.GetObjectByNo(comUnit.No));
            }

            return(null);
        }
Esempio n. 6
0
        public virtual void Invalidate(DataTable table)
        {
            this.Clear();
            OriginalList.Clear();
            BaseBusinessController objItemController = BusinessControllerFactory.GetBusinessController(ItemTableName + "Controller");

            //Invalidate lookup edit columns to reflect all changes of lookup table
            //if (GridControl != null)
            //    GridControl.InvalidateLookupEditColumns();

            foreach (DataRow row in table.Rows)
            {
                T objT = (T)objItemController.GetObjectFromDataRow(row);
                this.Add(objT);
                OriginalList.Add((T)objT.Clone());
            }
            if (GridControl != null)
            {
                GridControl.RefreshDataSource();
                if (this.Count > 0)
                {
                    if (CurrentIndex >= 0 && CurrentIndex < Count)
                    {
                        GridViewFocusRow(CurrentIndex);
                    }
                    else
                    {
                        GridViewFocusRow(0);
                    }
                }
            }
        }
Esempio n. 7
0
        public void DeleteItem(BusinessObject objT)
        {
            if (objT is T == false)
            {
                return;
            }

            foreach (String strChildName in Binding.Config.Children.Keys)
            {
                if (Binding.DataManager.DataObjectsList[strChildName].Config.DisplayOnly)
                {
                    continue;
                }

                String strFK          = Binding.DataManager.DataObjectsList[strChildName].Config.ChildField;
                String strFKTableName = Binding.DataManager.DataObjectsList[strChildName].TableName;
                Guid   iID            = ABCHelper.DataConverter.ConvertToGuid(ABCBusinessEntities.ABCDynamicInvoker.GetValue(objT, DataStructureProvider.GetPrimaryKeyColumn(this.TableName)));
                if (iID != Guid.Empty)
                {
                    BusinessObjectController ctrller = BusinessControllerFactory.GetBusinessController(strFKTableName);
                    if (ctrller != null)
                    {
                        ctrller.DeleteObjectsByFK(strFK, iID);
                    }
                }
            }
            Controller.DeleteObject(objT);
        }
Esempio n. 8
0
        protected virtual bool IsValidObjectNo(string objectNo)
        {
            VinaDbUtil             dbUtil = new VinaDbUtil();
            BaseBusinessController objCurrentObjectController = BusinessControllerFactory.GetBusinessController(CurrentModuleEntity.MainObject.GetType().Name.Substring(0, CurrentModuleEntity.MainObject.GetType().Name.Length - 4) + "Controller");
            String mainTable = VinaUtil.GetTableNameFromBusinessObject(CurrentModuleEntity.MainObject);
            String mainTablePrimaryColumn = dbUtil.GetTablePrimaryColumn(mainTable);
            bool   isValid = true;

            if (!String.IsNullOrEmpty(objectNo))
            {
                if (this.Toolbar.ModuleAction == BaseToolbar.ModuleNew)
                {
                    if (objCurrentObjectController.IsExist(objectNo))
                    {
                        MessageBox.Show("Mã đã tồn tại trong hệ thống vui lòng nhập mã khác!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        isValid = false;
                    }
                }
                else if (this.Toolbar.ModuleAction == BaseToolbar.ModuleEdit)
                {
                    BusinessObject objMainObject = (BusinessObject)objCurrentObjectController.GetObjectByNo(objectNo);
                    if (objMainObject != null)
                    {
                        int iMainObjectID = Convert.ToInt32(dbUtil.GetPropertyValue(objMainObject, mainTablePrimaryColumn));
                        if (iMainObjectID != Toolbar.CurrentObjectID)
                        {
                            MessageBox.Show("Mã đã tồn tại trong hệ thống vui lòng nhập mã khác!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            isValid = false;
                        }
                    }
                }
            }
            return(isValid);
        }
Esempio n. 9
0
        public virtual void Invalidate(int iObjectID)
        {
            //Invalidate lookup edit columns to reflect all changes of lookup table
            //if (GridControl != null)
            //    GridControl.InvalidateLookupEditColumns();

            VinaDbUtil             dbUtil            = new VinaDbUtil();
            BaseBusinessController objItemController = BusinessControllerFactory.GetBusinessController(ItemTableName + "Controller");
            DataSet ds = new DataSet();

            if (Relation.Equals(cstRelationForeign))
            {
                ds = objItemController.GetAllDataByForeignColumn(ItemTableForeignKey, iObjectID);
            }
            else if (Relation.Equals(cstRelationParent))
            {
                ds = objItemController.GetAllObjectsByObjectParentID(iObjectID);
            }
            else if (Relation.Equals(cstRelationNone))
            {
                ds = objItemController.GetAllObjects();
            }
            DataView view = ds.Tables[0].DefaultView;
            string   ID   = ItemTableName.Substring(0, ItemTableName.Length - 1) + "ID";

            view.Sort = ID + " ASC";
            DataTable sortIDData = view.ToTable();

            ds.Clear();
            ds.Merge(sortIDData);
            Invalidate(ds);
        }
Esempio n. 10
0
        protected virtual DataSet GetSearchData()
        {
            String mainObjectTableName = VinaUtil.GetTableNameFromBusinessObject(CurrentModuleEntity.MainObject);
            BaseBusinessController objCurrentObjectController = BusinessControllerFactory.GetBusinessController(mainObjectTableName + "Controller");

            return(objCurrentObjectController.GetAllObjects());
        }
Esempio n. 11
0
        public virtual void ActionInvalidate(int objectID)
        {
            VinaDbUtil dbUtil     = new VinaDbUtil();
            string     tableName  = VinaUtil.GetTableNameFromBusinessObject(CurrentModuleEntity.MainObject);
            string     primaryKey = dbUtil.GetTablePrimaryColumn(tableName);

            if (Toolbar.ObjectCollection != null)
            {
                for (int i = 0; i < Toolbar.ObjectCollection.Tables[0].Rows.Count; i++)
                {
                    if (objectID == Convert.ToInt32(Toolbar.ObjectCollection.Tables[0].Rows[i][primaryKey]))
                    {
                        Toolbar.CurrentIndex = i;
                        //FocusRowOfGridSearchResultByToolbarCurrentIndex();
                        return;
                    }
                }
            }

            //If can't find the object in toolbar's collection
            BaseBusinessController controller = BusinessControllerFactory.GetBusinessController(tableName + "Controller");

            if (controller != null)
            {
                DataSet ds = controller.GetDataSetByID(objectID);
                Toolbar.SetToolbar(ds);
                //InvalidateAfterSearch(null, String.Empty);
            }
        }
Esempio n. 12
0
        public virtual bool ReCalculate(BusinessObject obj, bool isSave)
        {
            if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colLockStatus))
            {
                if (ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colLockStatus).ToString() == ABCCommon.ABCConstString.LockStatusLocked)
                {
                    return(false);
                }
            }

            if (obj.GetID() != Guid.Empty)
            {
                Dictionary <String, IEnumerable <BusinessObject> > lstObjecItems = new Dictionary <string, IEnumerable <BusinessObject> >();
                foreach (GEVoucherItemsInfo configItem in ConfigItems)
                {
                    if (!DataStructureProvider.IsForeignKey(configItem.ItemTableName, configItem.ItemFKField))
                    {
                        continue;
                    }

                    BusinessObjectController itemCtrl = BusinessControllerFactory.GetBusinessController(configItem.ItemTableName);

                    if (!lstObjecItems.ContainsKey(configItem.ItemTableName))
                    {
                        lstObjecItems.Add(configItem.ItemTableName, (IEnumerable <BusinessObject>)itemCtrl.GetListByForeignKey(configItem.ItemFKField, obj.GetID()));
                    }
                }

                return(ReCalculate(obj, lstObjecItems, false, String.Empty, isSave));
            }

            return(ReCalculate(obj, null, false, String.Empty, isSave));
        }
Esempio n. 13
0
        public void AddComment(String strTableName, Guid iID, String strComment)
        {
            if (String.IsNullOrWhiteSpace(strComment))
            {
                return;
            }
            if (DataStructureProvider.IsExistedTable(strTableName) == false)
            {
                return;
            }
            if (BusinessControllerFactory.GetBusinessController(strTableName).GetObjectByID(iID) == null)
            {
                return;
            }

            RefreshTagsString();

            String strCreateUser     = ABCUserProvider.CurrentUserName.Replace("'", "''");
            String strCreateEmployee = ABCUserProvider.CurrentEmployeeName.Replace("'", "''");

            String strQuery = String.Format(@"INSERT INTO GEComments ( GECommentID,CreateTime , CreateUser , Employee , TableName , ID ,Comment,TagString,TagStringDisplay ) 
                                                              VALUES ('{0}',GetDate() ,N'{1}' ,N'{2}' ,'{3}','{4}',N'{5}',N'{6}',N'{7}')", Guid.NewGuid(), strCreateUser.Replace("'", "''"), strCreateEmployee.Replace("'", "''"), strTableName, iID, strComment.Replace("'", "''"), Tags.Replace("'", "''"), TagsDisplay.Replace("'", "''"));

            BusinessObjectController.RunQuery(strQuery);
            NotifyProvider.CreateNewNotifyFromComment(strTableName, iID);
            LoadComments();
            this.gridView.MoveLast();

            this.richEditControl1.Text = "";

            this.tabPanel.ClearTags();
        }
Esempio n. 14
0
        public void SetBinding(ABCDataObject bindInfo)
        {
            Binding    = bindInfo;
            TableName  = bindInfo.Config.TableName;
            Controller = BusinessControllerFactory.GetBusinessController(TableName);

            this.ListChanged += new ListChangedEventHandler(ABCList_ListChanged);
        }
Esempio n. 15
0
 public static GECompanyUnitsInfo GetCompanyUnit(String strRealTableName, Guid realCompanyUnitID)
 {
     if (DataStructureProvider.IsExistedTable(strRealTableName))
     {
         BusinessObject obj = BusinessControllerFactory.GetBusinessController(strRealTableName).GetObjectByID(realCompanyUnitID);
         return(GetCompanyUnit(obj));
     }
     return(null);
 }
Esempio n. 16
0
        public static void AutomaticUpdateNo(String strTableName)
        {
            BusinessObjectController ctrl = BusinessControllerFactory.GetBusinessController(strTableName);

            foreach (BusinessObject obj in ctrl.GetListAllObjects())
            {
                GenerateNo(obj);
                ctrl.UpdateObject(obj);
            }
        }
Esempio n. 17
0
        public static String GenerateNo(String strTableName, Guid ID)
        {
            BusinessObjectController ctrl = BusinessControllerFactory.GetBusinessController(strTableName);

            if (ctrl != null)
            {
                return(GenerateNo(ctrl.GetObjectByID(ID)));
            }
            return(String.Empty);
        }
Esempio n. 18
0
        private void InvalidateMainObject( )
        {
            BusinessObjectController controller = BusinessControllerFactory.GetBusinessController(BindingObject.TableName);
            BusinessObject           obj        = GridCtrl.GridDefaultView.GetRow(GridCtrl.GridDefaultView.FocusedRowHandle) as BusinessObject;

            if (obj != null)
            {
                BindingObject.DataManager.Invalidate(BindingObject.Config.Name, obj.GetID());
            }
        }
Esempio n. 19
0
        public virtual bool ReCalculate(String strTableName, Guid ID, bool isSave)
        {
            BusinessObjectController ctrl = BusinessControllerFactory.GetBusinessController(strTableName);

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

            return(ReCalculate(ctrl.GetObjectByID(ID), isSave));
        }
Esempio n. 20
0
        public static DataSet GetLookupTableData(string lookupTableName)
        {
            BaseBusinessController objBusinessController = BusinessControllerFactory.GetBusinessController(lookupTableName + "Controller");
            DataSet ds = new DataSet();

            if (objBusinessController != null)
            {
                ds = objBusinessController.GetAllObjects();
            }
            return(ds);
        }
Esempio n. 21
0
        public virtual int CreateMainObject()
        {
            VinaDbUtil dbUtil       = new VinaDbUtil();
            int        iObjectID    = 0;
            bool       editObjectNo = true;

            //Get Table which Business object Represent
            String strMainObjectTableName = VinaUtil.GetTableNameFromBusinessObject(MainObject);
            BaseBusinessController objMainObjectController = BusinessControllerFactory.GetBusinessController(strMainObjectTableName + "Controller");

            //Set Object No value
            String strPrimaryColumn = strMainObjectTableName.Substring(0, strMainObjectTableName.Length - 1) + "ID";
            String strColumnNo      = strMainObjectTableName.Substring(0, strMainObjectTableName.Length - 1) + "No";
            String strMainObjectNo  = dbUtil.GetPropertyStringValue(MainObject, strColumnNo);
            int    numberingStart   = 0;

            try
            {
                if (strMainObjectNo.Equals(NewObjectNoText))
                {
                    editObjectNo    = false;
                    strMainObjectNo = GetMainObjectNo(ref numberingStart);
                    dbUtil.SetPropertyValue(MainObject, strColumnNo, strMainObjectNo);
                }

                //Set Created User, Created Date
                dbUtil.SetPropertyValue(MainObject, AACreatedUser, VinaApp.CurrentUserName);
                dbUtil.SetPropertyValue(MainObject, AACreatedDate, DateTime.Now);


                iObjectID = dbUtil.GetPropertyIntValue(MainObject, strPrimaryColumn);
                if (iObjectID == 0)
                {
                    iObjectID = objMainObjectController.CreateObject(MainObject);
                }
                else
                {
                    objMainObjectController.CreateObject(MainObject, iObjectID);
                }
            }
            catch (Exception ex)
            {
                if (!editObjectNo)
                {
                    dbUtil.SetPropertyValue(MainObject, strColumnNo, NewObjectNoText);
                    dbUtil.SetPropertyValue(MainObject, strPrimaryColumn, 0);
                }

                iObjectID = 0;
                MessageBox.Show(ex.Message.ToString());
            }

            return(iObjectID);
        }
Esempio n. 22
0
        public void RunLink(String strTableName, ViewMode mode, bool isShowDialog, Guid iMainID, ABCScreenAction action)
        {
            STViewsInfo       viewResult = null;
            STViewsController viewCtrl   = new STViewsController();

            String strViewNo = VoucherProvider.GetViewNo(strTableName, iMainID);

            if (!String.IsNullOrWhiteSpace(strViewNo))
            {
                viewResult = viewCtrl.GetObjectByNo(strViewNo) as STViewsInfo;
            }
            if (viewResult == null)
            {
                #region Without Voucher
                BusinessObjectController controller = BusinessControllerFactory.GetBusinessController(strTableName);
                if (controller == null)
                {
                    return;
                }

                BusinessObject obj = controller.GetObjectByID(iMainID);
                if (obj == null)
                {
                    return;
                }


                List <BusinessObject> lstViews = viewCtrl.GetListFromDataset(viewCtrl.GetDataSet(String.Format("SELECT * FROM STViews WHERE [MainTableName] = '{0}' ", strTableName)));
                foreach (STViewsInfo viewIfo in lstViews)
                {
                    if (String.IsNullOrWhiteSpace(viewIfo.MainFieldName) == false && DataStructureProvider.IsTableColumn(strTableName, viewIfo.MainFieldName))
                    {
                        object objValue = ABCBusinessEntities.ABCDynamicInvoker.GetValue(obj, viewIfo.MainFieldName);
                        if (objValue != null && objValue.ToString().ToUpper().Trim() == viewIfo.MainValue.ToUpper())
                        {
                            viewResult = viewIfo;
                            break;
                        }
                    }
                }

                if (viewResult == null && lstViews.Count > 0)
                {
                    viewResult = lstViews[0] as STViewsInfo;
                }

                #endregion
            }

            if (viewResult != null)
            {
                ABCScreenManager.Instance.RunLink(viewResult, mode, isShowDialog, iMainID, action);
            }
        }
Esempio n. 23
0
        public virtual int UpdateMainObject()
        {
            int    iObjectID = 0;
            String strMainObjectTableName = VinaUtil.GetTableNameFromBusinessObject(MainObject);
            BaseBusinessController objMainObjectController = BusinessControllerFactory.GetBusinessController(strMainObjectTableName + "Controller");

            VinaDbUtil dbUtil = new VinaDbUtil();

            dbUtil.SetPropertyValue(MainObject, AAUpdatedUser, VinaApp.CurrentUserName);
            dbUtil.SetPropertyValue(MainObject, AAUpdatedDate, DateTime.Now);

            iObjectID = objMainObjectController.UpdateObject(MainObject);
            return(iObjectID);
        }
Esempio n. 24
0
        public void RefreshData(Boolean includeParent, Boolean includeChildren, Boolean defaultOnly)
        {
            #region Current Node
            if (InnerData != null)
            {
                BusinessObjectController ctrller = BusinessControllerFactory.GetBusinessController(InnerData.AATableName);
                String strPK = DataStructureProvider.GetPrimaryKeyColumn(InnerData.AATableName);
                Guid   iID   = ABCHelper.DataConverter.ConvertToGuid(ABCBusinessEntities.ABCDynamicInvoker.GetValue(InnerData, strPK));
                InnerData = ctrller.GetObjectByID(iID);
                if (InnerData == null)
                {
                    if (this.ParentNode != null)
                    {
                        this.ParentNode.ChildrenNodes.Remove(iID);
                        this.ParentNode = null;
                    }
                    Dictionary <Guid, ABCTreeListNode> innerList = null;
                    if (this.Manager.DataList.TryGetValue(this.ObjectName, out innerList))
                    {
                        if (innerList.ContainsKey(iID))
                        {
                            innerList.Remove(iID);
                        }
                    }
                }
            }
            #endregion

            List <ABCTreeListNode> lstTemps = new List <ABCTreeListNode>();
            foreach (ABCTreeListNode childNode in this.ChildrenNodes.Values)
            {
                lstTemps.Add(childNode);
            }

            if (includeChildren)
            {
                foreach (ABCTreeListNode childNode in lstTemps)
                {
                    childNode.RefreshData(false, includeChildren, defaultOnly);
                }
            }
            if (includeParent && this.ParentNode != null)
            {
                this.ParentNode.RefreshData(true, false, defaultOnly);
            }

            ExpandData(includeChildren, defaultOnly);
        }
Esempio n. 25
0
        public virtual void Invalidate(int iObjectID)
        {
            string strTableName = VinaUtil.GetTableNameFromBusinessObject(CurrentModuleEntity.MainObject);
            BaseBusinessController objBaseBusinessController = BusinessControllerFactory.GetBusinessController(strTableName + "Controller");
            BusinessObject         mainObject = (BusinessObject)objBaseBusinessController.GetObjectByID(iObjectID);

            if (mainObject != null)
            {
                CurrentModuleEntity.Invalidate(iObjectID);

                CurrentModuleEntity.MainObject.OldObject = (BusinessObject)CurrentModuleEntity.MainObject.Clone();

                InvalidateToolbar();
            }
            InvalidateEmployee();
        }
Esempio n. 26
0
        public Dictionary <List <STGridColumnsInfo>, DataSet> GetScreenEmployeeOffWork(string sModuleName, int iObjectID)
        {
            DataSet dsScreen = GetScreenByModuleNameAndUserGroupName(sModuleName, "ADMIN");

            if (dsScreen == null || dsScreen.Tables.Count == 0 && dsScreen.Tables[0].Rows.Count == 0)
            {
                return(null);
            }
            STScreensInfo  objScreen = new STScreensController().GetObjectFromDataRow(dsScreen.Tables[0].Rows[0]) as STScreensInfo;
            List <DataRow> dr        = GetLocalDataSet("*", "STFields", string.Format(@"STScreenID = {0} AND STFieldType = 'GMCGridControl' 
                                    AND STFieldGroup <> 'HiddenWeb'", objScreen.STScreenID));

            if (dr.Count == 0)
            {
                return(null);
            }
            STFieldsInfo objField = (STFieldsInfo) new STFieldsController().GetObjectFromDataRow(dr[0]);

            if (objField == null)
            {
                return(null);
            }
            BaseBusinessController itemCtrl = BusinessControllerFactory.GetBusinessController(objField.STFieldDataSource + "Controller");
            DataSet ds = new DataSet();

            if (itemCtrl != null)
            {
                ds = itemCtrl.GetDataSetByID(iObjectID);
            }

            List <STGridColumnsInfo> lstGridColumns = new List <STGridColumnsInfo>();

            dr = GetLocalDataSet("*", "STGridColumns", string.Format("FK_STFieldID = {0}", objField.STFieldID));
            STGridColumnsController GridColCtrl = new STGridColumnsController();

            dr.Distinct().ToList().ForEach(x =>
            {
                STGridColumnsInfo colInfo = (STGridColumnsInfo)GridColCtrl.GetObjectFromDataRow(x);
                lstGridColumns.Add(colInfo);
            });
            return(new Dictionary <List <STGridColumnsInfo>, DataSet>()
            {
                { lstGridColumns, ds }
            });
        }
Esempio n. 27
0
        public static void ReloadLookupTable(String strTableName)
        {
            lock ( LookupTables )
            {
                LoadLookupTable(strTableName);
                DataTable lookupTable = LookupTables[strTableName];

                DataSet ds = BusinessControllerFactory.GetBusinessController(strTableName).GetDataSetAllObjects();
                if (ds != null && ds.Tables.Count > 0)
                {
                    lookupTable.Rows.Clear();
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        lookupTable.ImportRow(dr);
                    }
                }
            }
        }
Esempio n. 28
0
        public virtual String GetMainObjectNo(ref int numberingStart)
        {
            String strMainObjectNo = String.Empty;
            GENumberingsController objGENumberingController = new GENumberingsController();
            GENumberingsInfo       objGENumberingInfo       = (GENumberingsInfo)objGENumberingController.GetObjectByName(Module.CurrentModuleName);

            if (objGENumberingInfo != null)
            {
                String mainTableName = VinaUtil.GetTableNameFromBusinessObject(MainObject);
                BaseBusinessController objMainObjectController = BusinessControllerFactory.GetBusinessController(mainTableName + "Controller");
                if (objMainObjectController != null)
                {
                    VinaDbUtil    dbUtil              = new VinaDbUtil();
                    string        strPrefixHaveYear   = DateTime.Now.Year.ToString().Substring(2, 2);
                    List <string> subMainObjectNoList = new List <string>();
                    subMainObjectNoList.Add(objGENumberingInfo.GENumberingPrefix);
                    if (objGENumberingInfo.GENumberingPrefixHaveYear)
                    {
                        subMainObjectNoList.Add(strPrefixHaveYear);
                    }
                    subMainObjectNoList.Add(objGENumberingInfo.GENumberingNumber.ToString().PadLeft(objGENumberingInfo.GENumberingLength, '0'));

                    strMainObjectNo = string.Join(".", subMainObjectNoList.ToArray());

                    numberingStart = objGENumberingInfo.GENumberingNumber;
                    while (objMainObjectController.IsExist(strMainObjectNo))
                    {
                        objGENumberingInfo.GENumberingNumber++;

                        subMainObjectNoList.Clear();
                        subMainObjectNoList.Add(objGENumberingInfo.GENumberingPrefix);
                        if (objGENumberingInfo.GENumberingPrefixHaveYear)
                        {
                            subMainObjectNoList.Add(strPrefixHaveYear);
                        }
                        subMainObjectNoList.Add(objGENumberingInfo.GENumberingNumber.ToString().PadLeft(objGENumberingInfo.GENumberingLength, '0'));

                        strMainObjectNo = string.Join(".", subMainObjectNoList.ToArray());
                        numberingStart  = objGENumberingInfo.GENumberingNumber;
                    }
                }
            }
            return(strMainObjectNo);
        }
Esempio n. 29
0
        public static DataSet GetAlertDataSet(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.GetDataSet(strQuery));
        }
Esempio n. 30
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();
            }
        }