Ejemplo n.º 1
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)
                {
                }
            }
        }
Ejemplo n.º 2
0
        public static void InitExchangeRates( )
        {
            ExchangeRateLists = new Dictionary <Guid, SortedList <DateTime, double> >();
            String  strQuery = String.Format(@"SELECT FK_GECurrencyID,RateDate, EndExchangeRate FROM GEExchangeRates ORDER BY RateDate ASC");
            DataSet ds       = BusinessObjectController.RunQuery(strQuery);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Guid     currencyID   = ABCHelper.DataConverter.ConvertToGuid(dr["FK_GECurrencyID"]);
                    DateTime rateDate     = TimeProvider.ConvertToDateTime(dr["RateDate"]);
                    double   exchangeRate = Convert.ToDouble(dr["EndExchangeRate"]);

                    if (currencyID == Guid.Empty || rateDate == null || rateDate == DateTime.MinValue)
                    {
                        continue;
                    }

                    if (!ExchangeRateLists.ContainsKey(currencyID))
                    {
                        ExchangeRateLists.Add(currencyID, new SortedList <DateTime, double>());
                    }

                    ExchangeRateLists[currencyID].Add(rateDate, exchangeRate);
                }
            }
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        public static bool IsMainObject(String strTableName)
        {
            if (String.IsNullOrWhiteSpace(strTableName))
            {
                return(false);
            }

            bool isOK = false;

            if (IsMainObjectCachingList.TryGetValue(strTableName, out isOK))
            {
                return(isOK);
            }

            if (String.IsNullOrWhiteSpace(strTableName) == false)
            {
                object objCount = BusinessObjectController.GetData(String.Format("SELECT COUNT(*) FROM STViews WHERE [MainTableName] = '{0}' ", strTableName));
                if (objCount != null && objCount != DBNull.Value)
                {
                    if (Convert.ToDouble(objCount) > 0)
                    {
                        isOK = true;
                    }
                }
            }

            IsMainObjectCachingList.Add(strTableName, isOK);
            return(isOK);
        }
Ejemplo 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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public static void GeneratePeriods( )
        {
            GEPeriodsController periodCtrl = new GEPeriodsController();

            for (int year = ABCApp.ABCDataGlobal.WorkingDate.Year; year <= ABCApp.ABCDataGlobal.WorkingDate.Year + 1; year++)
            {
                String strQuery = String.Format(@"SELECT COUNT(*) FROM GEPeriods WHERE Year = {0}", year);
                object objAmt   = BusinessObjectController.GetData(strQuery);
                if (objAmt == null || objAmt == DBNull.Value || Convert.ToInt32(objAmt) != 12)
                {
                    strQuery = String.Format(@"DELETE  FROM GEPeriods WHERE Year = {0}", year);
                    BusinessObjectController.RunQuery(strQuery);

                    for (int i = 1; i <= 12; i++)
                    {
                        GEPeriodsInfo period = new GEPeriodsInfo();
                        period.Month  = i;
                        period.Year   = year;
                        period.Period = new DateTime(period.Year.Value, period.Month.Value, 1);
                        if (i >= 10)
                        {
                            period.No = String.Format("Tháng {0}/{1}", period.Month.Value, period.Year.Value);
                        }
                        else
                        {
                            period.No = String.Format("Tháng  0{0}/{1}", period.Month.Value, period.Year.Value);
                        }

                        period.Closed = false;
                        periodCtrl.CreateObject(period);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public static void CreateNewNotify(String strToUser, String strToEmployee, String strNotifyTitle, String strNotifyContent, String strTableName, Guid iID, String strPriorityLevel)
        {
            if (strToUser == ABCUserProvider.CurrentUserName)
            {
                return;
            }

            strToUser        = strToUser.Replace("'", "''");
            strToEmployee    = strToEmployee.Replace("'", "''");
            strNotifyTitle   = strNotifyTitle.Replace("'", "''");
            strNotifyContent = strNotifyContent.Replace("'", "''");
            strTableName     = strTableName.Replace("'", "''");
            strPriorityLevel = strPriorityLevel.Replace("'", "''");

            object obj       = BusinessObjectController.GetData(String.Format(@"SELECT GENotifyID FROM GENotifys WHERE ToUser=N'{0}' AND TableName ='{1}' AND ID ='{2}'", strToUser, strTableName, iID));
            Guid   iNofityID = ABCHelper.DataConverter.ConvertToGuid(obj);

            String strQuery = String.Empty;

            if (iNofityID == Guid.Empty)
            {
                strQuery = String.Format(@"INSERT INTO GENotifys ( GENotifyID,LastTime , ToUser , ToEmployee , NotifyTitle , NotifyContent ,Viewed,TableName,ID,PriorityLevel ) 
                                                              VALUES ('{0}',GetDate() ,N'{1}' ,N'{2}' ,N'{3}',N'{4}',0,'{5}','{6}',N'{7}')", Guid.NewGuid(), strToUser, strToEmployee, strNotifyTitle, strNotifyContent, strTableName, iID, strPriorityLevel);
            }
            else
            {
                strQuery = String.Format(@"UPDATE GENotifys SET LastTime = GetDate() , NotifyTitle =N'{0}' , NotifyContent =N'{1}', Viewed =0, PriorityLevel =N'{2}' WHERE GENotifyID ='{3}' ", strNotifyTitle, strNotifyContent, strPriorityLevel, iNofityID);
            }
            BusinessObjectController.RunQuery(strQuery);
        }
Ejemplo n.º 9
0
        public static Boolean IsNeedAlert(Guid alertID)
        {
            if (AlertList == null)
            {
                GetAlertConfigs(ABCUserProvider.CurrentUser.ADUserID);
            }

            if (AlertList.ContainsKey(alertID) == false)
            {
                return(false);
            }

            GEAlertsInfo alertInfo = AlertList[alertID];

            if (alertInfo == null || alertInfo.GetID() == null)
            {
                return(false);
            }

            String strQuery = QueryGenerator.GenSelect(alertInfo.TableName, "COUNT(*)", false);

            strQuery = QueryGenerator.AddCondition(strQuery, alertInfo.ConditionString);

            object obj = BusinessObjectController.GetData(strQuery);

            if (obj != null && obj != DBNull.Value)
            {
                return(Convert.ToInt32(obj) > 0);
            }

            return(false);
        }
Ejemplo n.º 10
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();
        }
Ejemplo n.º 11
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));
        }
Ejemplo n.º 12
0
        public void SetBinding(ABCDataObject bindInfo)
        {
            Binding    = bindInfo;
            TableName  = bindInfo.Config.TableName;
            Controller = BusinessControllerFactory.GetBusinessController(TableName);

            this.ListChanged += new ListChangedEventHandler(ABCList_ListChanged);
        }
Ejemplo n.º 13
0
        public static double GetJournalAmount(List <String> lstDebitAccounts, List <String> lstCreditAccounts, DateTime?startDate, DateTime?endDate, String strConditionQuery, bool isIncludeChildren)
        {
            List <GLAccountsInfo> lstDebits  = GetAccounts(lstDebitAccounts, isIncludeChildren);
            List <GLAccountsInfo> lstCredits = GetAccounts(lstCreditAccounts, isIncludeChildren);

            String strDebit = String.Empty;

            foreach (GLAccountsInfo acc in lstDebits)
            {
                if (String.IsNullOrEmpty(strDebit) == false)
                {
                    strDebit += " OR ";
                }
                strDebit += String.Format(@" FK_GLAccountID_Debit='{0}' ", acc.GLAccountID);
            }
            strDebit = "(" + strDebit + ")";

            String stCredit = String.Empty;

            foreach (GLAccountsInfo acc in lstCredits)
            {
                if (String.IsNullOrEmpty(stCredit) == false)
                {
                    stCredit += " OR ";
                }
                stCredit += String.Format(@" FK_GLAccountID_Credit='{0}' ", acc.GLAccountID);
            }
            stCredit = "(" + stCredit + ")";


            double dbResult = 0;


            String strQuery = String.Format(@"SELECT SUM(AmtTot) FROM GLJournalEntrys WHERE ApprovalStatus='{0}' AND {1} AND {2}  ", ABCCommon.ABCConstString.ApprovalTypeApproved, strDebit, stCredit);

            if (startDate.HasValue)
            {
                strQuery += String.Format(@" AND {0}", TimeProvider.GenCompareDateTime("JournalDate", ">=", startDate.Value));
            }
            if (endDate.HasValue)
            {
                strQuery += String.Format(@" AND {0} ", TimeProvider.GenCompareDateTime("JournalDate", "<=", endDate.Value));
            }

            if (String.IsNullOrWhiteSpace(strConditionQuery) == false)
            {
                strQuery += String.Format(@" AND {0} ", strConditionQuery);
            }

            object objAmt = BusinessObjectController.GetData(strQuery);

            if (objAmt != null && objAmt != DBNull.Value)
            {
                dbResult += Convert.ToDouble(objAmt);
            }

            return(dbResult);
        }
Ejemplo n.º 14
0
        public static bool GenerateCurrencyValue(BusinessObject obj)
        {
            bool isModified = false;

            String strFK_GECurrencyID = DataStructureProvider.GetForeignKeyOfTableName(obj.AATableName, "GECurrencys");

            if (!String.IsNullOrWhiteSpace(strFK_GECurrencyID))
            {
                if (AppCurrencyID == Guid.Empty)
                {
                    String strQuery = @"SELECT FK_GECurrencyID FROM GEAppConfigs";
                    AppCurrencyID = ABCHelper.DataConverter.ConvertToGuid(BusinessObjectController.GetData(strQuery));
                }
                ABCDynamicInvoker.SetValue(obj, strFK_GECurrencyID, AppCurrencyID);
                if (AppCurrencyID != Guid.Empty && DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colExchangeRate))
                {
                    object objDate    = DateTime.MinValue;
                    String strDateCol = String.Empty;
                    if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colCreateTime))
                    {
                        strDateCol = ABCCommon.ABCConstString.colCreateTime;
                    }
                    if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colDocumentDate))
                    {
                        strDateCol = ABCCommon.ABCConstString.colDocumentDate;
                    }

                    if (DataStructureProvider.IsTableColumn(obj.AATableName, ABCCommon.ABCConstString.colVoucherDate))
                    {
                        strDateCol = ABCCommon.ABCConstString.colVoucherDate;
                    }

                    if (!String.IsNullOrWhiteSpace(strDateCol))
                    {
                        objDate = ABCDynamicInvoker.GetValue(obj, strDateCol);

                        object objOldValue = ABCDynamicInvoker.GetValue(obj, ABCCommon.ABCConstString.colExchangeRate);

                        if (objDate != null && objDate is DateTime)
                        {
                            object objNewValue = CurrencyProvider.GetExchangeRate(AppCurrencyID, Convert.ToDateTime(objDate));
                            ABCDynamicInvoker.SetValue(obj, ABCCommon.ABCConstString.colExchangeRate, objNewValue);
                            isModified = isModified || (objOldValue != objNewValue);
                        }
                        else if (objDate != null && objDate is Nullable <DateTime> )
                        {
                            object objNewValue = CurrencyProvider.GetExchangeRate(AppCurrencyID, (objDate as Nullable <DateTime>).Value);
                            ABCDynamicInvoker.SetValue(obj, ABCCommon.ABCConstString.colExchangeRate, objNewValue);
                            isModified = isModified || (objOldValue != objNewValue);
                        }
                    }
                }
            }

            return(isModified);
        }
Ejemplo n.º 15
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());
            }
        }
Ejemplo 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);
            }
        }
Ejemplo 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);
        }
Ejemplo n.º 18
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);
            }
        }
Ejemplo 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));
        }
Ejemplo n.º 20
0
        public static bool IsNeedCalculateCredit(String strTableName)
        {
            object iCount = BusinessObjectController.GetData(String.Format("SELECT COUNT(*) FROM CRCreditConfigs WHERE TableName = '{0}'", strTableName));

            if (iCount == null || iCount.GetType() != typeof(int))
            {
                return(false);
            }

            return(Convert.ToInt32(iCount) > 0);
        }
Ejemplo n.º 21
0
        public static bool IsNeedValuationCalculate(String strTableName)
        {
            object iCount = BusinessObjectController.GetData(String.Format("SELECT COUNT(*) FROM ICInventoryConfigs WHERE VoucherTableName = '{0}' AND COGSEffective='TRUE' ", strTableName));

            if (iCount == null || iCount.GetType() != typeof(int))
            {
                return(false);
            }

            return(Convert.ToInt32(iCount) > 0);
        }
Ejemplo n.º 22
0
        public static double GetDebitAmount(GLAccountsInfo accInfo, DateTime?startDate, DateTime?endDate, String strConditionQuery, bool isIncludeChildren)
        {
            double dbResult = 0;

            String strQuery = String.Format(@"SELECT SUM(AmtTot) FROM GLJournalEntrys WHERE  ApprovalStatus='{0}' AND FK_GLAccountID_Debit={1} ", ABCCommon.ABCConstString.ApprovalTypeApproved, accInfo.GLAccountID);

            if (startDate.HasValue)
            {
                strQuery += String.Format(@" AND {0}", TimeProvider.GenCompareDateTime("JournalDate", ">=", startDate.Value));
            }
            if (endDate.HasValue)
            {
                strQuery += String.Format(@" AND {0} ", TimeProvider.GenCompareDateTime("JournalDate", "<=", endDate.Value));
            }


            if (String.IsNullOrWhiteSpace(strConditionQuery) == false)
            {
                strQuery += String.Format(@" AND {0} ", strConditionQuery);
            }

            object objAmt = BusinessObjectController.GetData(strQuery);

            if (objAmt != null && objAmt != DBNull.Value)
            {
                dbResult += Convert.ToDouble(objAmt);
            }

            if (isIncludeChildren)
            {
                List <BusinessObject> lstChildren = new GLAccountsController().GetListByForeignKey("FK_GLAccountID", accInfo.GLAccountID);
                foreach (GLAccountsInfo accChildInfo in lstChildren)
                {
                    dbResult += GetDebitAmount(accChildInfo, startDate, endDate, strConditionQuery, true);
                }
                if (lstChildren.Count <= 0)
                {
                    if (startDate.HasValue == false || (startDate.HasValue && startDate.Value <= SystemProvider.AppConfig.StartDate.Value))
                    {
                        dbResult += accInfo.DebitBeginBalance;
                    }
                }
            }
            else
            {
                if (startDate.HasValue == false || (startDate.HasValue && startDate.Value <= SystemProvider.AppConfig.StartDate.Value))
                {
                    dbResult += accInfo.DebitBeginBalance;
                }
            }

            return(dbResult);
        }
Ejemplo n.º 23
0
        public void AutoOpenChatBox( )
        {
            DataSet ds = BusinessObjectController.RunQuery(String.Format(@"SELECT FromUser FROM GEChatContents WHERE ToUser ='******' AND Viewed=0 GROUP BY FromUser", ABCUserProvider.CurrentUserName));

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    OpenChatBox(dr[0].ToString());
                }
            }
        }
Ejemplo n.º 24
0
        public static void CreateNewNotify(String strToUser, String strNotifyTitle, String strNotifyContent, String strTableName, Guid iID, String strPriorityLevel)
        {
            if (strToUser == ABCUserProvider.CurrentUserName)
            {
                return;
            }

            object obj = BusinessObjectController.GetData(String.Format(@"SELECT HREmployees.Name FROM ADUsers,HREmployees
                                        WHERE ADUsers.ABCStatus ='Alive' AND ADUsers.Active =1 AND FK_HREmployeeID =HREmployeeID AND ADUsers.No =N'{0}'", strToUser));

            if (obj != null && obj != DBNull.Value)
            {
                CreateNewNotify(strToUser, obj.ToString(), strNotifyTitle, strNotifyContent, strTableName, iID, strPriorityLevel);
            }
        }
Ejemplo n.º 25
0
        private void CheckPlaySound( )
        {
            String strQuery = String.Format(@"SELECT COUNT(*) FROM GEChatContents WHERE  (ToUser =N'{0}' AND FromUser =N'{1}') AND Viewed =0 AND {2}"
                                            , User1, User2, TimeProvider.GenCompareDateTime("CreateTime", ">", lastUpdate));
            object objQty = BusinessObjectController.GetData(strQuery);

            if (objQty != null && objQty != DBNull.Value && Convert.ToInt32(objQty) > 0)
            {
                IsViewed = false;
                if ((this.ChatBox.ChatScreen.Visible == false || this.ChatBox.ChatScreen.WindowState == FormWindowState.Minimized) && this.ChatBox.ChatScreen.SoundOn)
                {
                    new System.Media.SoundPlayer(@"SoundChat.wav").Play();
                }
            }
        }
Ejemplo n.º 26
0
        public static void SynchronizeTablePermission( )
        {
            GEPermissionTablesController permissionCtrl = new GEPermissionTablesController();
            String strQuery = String.Format(@"DELETE FROM GEPermissionTables WHERE FK_GEPermissionID NOT IN (SELECT GEPermissionID FROM GEPermissions)");

            BusinessObjectController.RunQuery(strQuery);

            foreach (GEPermissionsInfo permission in new GEPermissionsController().GetListAllObjects())
            {
                #region Table
                Dictionary <String, GEPermissionTablesInfo> lstTables = new Dictionary <string, GEPermissionTablesInfo>();

                foreach (GEPermissionTablesInfo tableInfo in permissionCtrl.GetListByForeignKey("FK_GEPermissionID", permission.GEPermissionID).Cast <GEPermissionTablesInfo>().ToList())
                {
                    if (lstTables.ContainsKey(tableInfo.TableName) == false)
                    {
                        if (DataStructureProvider.IsExistedTable(tableInfo.TableName))
                        {
                            lstTables.Add(tableInfo.TableName, tableInfo);
                        }
                        else
                        {
                            permissionCtrl.DeleteObject(tableInfo);
                        }
                    }
                }


                foreach (String strTableName in DataStructureProvider.DataTablesList.Keys)
                {
                    if (lstTables.ContainsKey(strTableName) == false)
                    {
                        GEPermissionTablesInfo tableInfo = new GEPermissionTablesInfo();
                        tableInfo.FK_STTableConfigID = DataConfigProvider.TableConfigList[strTableName].ConfigID;
                        tableInfo.TableName          = strTableName;
                        tableInfo.FK_GEPermissionID  = permission.GEPermissionID;
                        tableInfo.AllowView          = true;
                        tableInfo.AllowNew           = true;
                        tableInfo.AllowEdit          = true;
                        tableInfo.AllowDelete        = true;

                        permissionCtrl.CreateObject(tableInfo);
                        lstTables.Add(tableInfo.TableName, tableInfo);
                    }
                }
                #endregion
            }
        }
Ejemplo n.º 27
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);
        }