Exemplo n.º 1
0
        public UserOnlineList(ABCChatScreen form)
        {
            ChatScreen = form;

            InitializeComponent();

            lstAllUsers = new BindingList <ABCUserInfo>(ABCUserProvider.GetAllUsers(true, true));

            this.gridControl1.DataSource = lstAllUsers;
            this.gridControl1.RefreshDataSource();
            this.gridView1.CustomDrawCell += new DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventHandler(gridView1_CustomDrawCell);
            this.gridView1.FocusRectStyle  = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.None;
            this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
            this.gridView1.OptionsSelection.EnableAppearanceFocusedRow  = false;
            this.gridView1.Click        += new EventHandler(gridView1_Click);
            this.gridView1.MouseMove    += new MouseEventHandler(gridView1_MouseMove);
            this.gridView1.RowCellStyle += new RowCellStyleEventHandler(gridView1_RowCellStyle);
            this.gridView1.ExpandAllGroups();

            btnShowOnlineOnly.Checked = false;
            ChangeView(false);

            btnSoundOn.Checked = true;
            ChangeSoundOnOff(true);

            Timer timer = new Timer();

            timer.Interval = 15000;
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Start();
        }
Exemplo n.º 2
0
        public void StartSection( )
        {
            SystemProvider.StartSection();
            if (SystemProvider.SystemConfig.IsRelease)
            {
                ABCUserProvider.SynchronizePermission();
                //     InventoryProvider.PeriodEndingProcessings();
            }

            ABCScreen.SplashUtils.ShowSplash(LoginType.Studio);

            CloseTrialTimer          = new System.Timers.Timer();
            CloseTrialTimer.Interval = 10;
            CloseTrialTimer.Elapsed += new System.Timers.ElapsedEventHandler(CloseDevexpressTrialForm);
            CloseTrialTimer.Start();

            MainStudio = new Studio(false);

            if (CustomizeView != null)
            {
                (MainStudio as Studio).Worker.OpenFromDatabase(CustomizeView);
                (MainStudio as Studio).RefreshFieldBindingTree(true);
            }

            ABCScreen.SplashUtils.CloseSplash();

            MainStudio.ShowDialog();
        }
Exemplo n.º 3
0
        public bool CheckVoucherPermission(String strTableName, Guid ID, VoucherPermission permission)
        {
            Guid?iUserID = GetCurrentUserID();

            if (iUserID.HasValue == false)
            {
                return(false);
            }

            return(ABCUserProvider.CheckVoucherPermission(iUserID.Value, strTableName, ID, permission));
        }
Exemplo n.º 4
0
        public bool CheckFieldPermission(String strTableName, String strFieldName, FieldPermission permission)
        {
            Guid?iUserID = GetCurrentUserID();

            if (iUserID.HasValue == false)
            {
                return(false);
            }

            return(ABCUserProvider.CheckFieldPermission(iUserID.Value, strTableName, strFieldName, permission));
        }
Exemplo n.º 5
0
        public bool CheckViewPermission(Guid viewID, ViewPermission permission)
        {
            Guid iUserID = GetCurrentUserID();

            if (iUserID == Guid.Empty)
            {
                return(false);
            }

            return(ABCUserProvider.CheckViewPermission(iUserID, viewID, permission));
        }
Exemplo n.º 6
0
        public void LoadAllUsers( )
        {
            lstAllUsers.Clear();
            List <ABCUserInfo> lstTemp = ABCUserProvider.GetAllUsers(false, false);

            foreach (ABCUserInfo user in lstTemp)
            {
                lstAllUsers.Add(user);
            }

            this.gridControl1.DataSource = lstAllUsers;
            this.gridControl1.RefreshDataSource();
        }
Exemplo n.º 7
0
        public void LoadHomePages( )
        {
            if (ABCScreenManager.Instance == null)
            {
                return;
            }
            List <Guid> lstViewIDs = ABCUserProvider.GetHomepages(ABCUserProvider.CurrentUser.ADUserID);

            if (lstViewIDs.Count > 0)
            {
                xtraTabControl1.TabPages.Clear();
            }

            foreach (Guid strViewID in lstViewIDs)
            {
                if (ABCScreenManager.Instance.CheckViewPermission(strViewID, ABCCommon.ViewPermission.AllowView))
                {
                    OpenHomePage(strViewID);
                }
            }
        }
Exemplo n.º 8
0
        public void LoadChatContents(bool isFirstLoad)
        {
            if (isFirstLoad || ContentTable == null)
            {
                if (IsLoadAllMessages)
                {
                    DataSet ds = BusinessObjectController.RunQuery(String.Format(@"SELECT * FROM GEChatContents WHERE (FromUser =N'{0}' AND ToUser =N'{1}') OR  (ToUser =N'{0}' AND FromUser =N'{1}') ORDER BY CreateTime", User1, User2));
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ContentTable != null)
                        {
                            ContentTable.Dispose();
                        }
                        ContentTable = ds.Tables[0];
                    }
                }
                else
                {
                    String strQuery = String.Format(@"SELECT * FROM (SELECT TOP 50 * FROM GEChatContents WHERE (FromUser =N'{0}' AND ToUser =N'{1}') OR  (ToUser =N'{0}' AND FromUser =N'{1}') ORDER BY CreateTime DESC ) as A ORDER BY A.CreateTime", User1, User2);
                    if (DataQueryProvider.IsCompanySQLConnection == false)
                    {
                        strQuery = String.Format(@"SELECT * FROM (SELECT * FROM GEChatContents WHERE (FromUser =N'{0}' AND ToUser =N'{1}') OR  (ToUser =N'{0}' AND FromUser =N'{1}') ORDER BY CreateTime DESC LIMIT 50 ) as A ORDER BY A.CreateTime", User1, User2);
                    }

                    DataSet ds = BusinessObjectController.RunQuery(strQuery);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ContentTable != null)
                        {
                            ContentTable.Dispose();
                        }
                        ContentTable = ds.Tables[0];
                    }
                }
            }
            else
            {
                String strQuery = String.Format(@"SELECT * FROM (SELECT TOP 50 * FROM GEChatContents WHERE ((FromUser =N'{0}' AND ToUser =N'{1}') OR  (ToUser =N'{0}' AND FromUser =N'{1}'))  AND {2} ORDER BY CreateTime DESC ) as A ORDER BY A.CreateTime", User1, User2, TimeProvider.GenCompareDateTime("CreateTime", ">", lastUpdate));
                if (DataQueryProvider.IsCompanySQLConnection == false)
                {
                    strQuery = String.Format(@"SELECT * FROM (SELECT * FROM GEChatContents WHERE ((FromUser =N'{0}' AND ToUser =N'{1}') OR  (ToUser =N'{0}' AND FromUser =N'{1}'))  AND {2} ORDER BY CreateTime DESC LIMIT 50 ) as A ORDER BY A.CreateTime", User1, User2, TimeProvider.GenCompareDateTime("CreateTime", ">", lastUpdate));
                }
                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)
                    {
                        ContentTable.ImportRow(dr);
                    }
                }
            }

            if (ContentTable != null && ContentTable.Rows.Count > 0)
            {
                object obj = ContentTable.Rows[ContentTable.Rows.Count - 1]["CreateTime"];
                if (obj != null && obj != DBNull.Value)
                {
                    lastUpdate = Convert.ToDateTime(obj);
                }
            }

            RefreshDataSource();

            this.colEmployee.MinWidth = 0;
            this.colEmployee.BestFit();
            this.colEmployee.MinWidth = this.colEmployee.Width;
            this.colEmployee.MaxWidth = this.colEmployee.Width;
            StartTimer();

            if (ABCUserProvider.IsOnline(User2))
            {
                picOnOff.Image = ABCControls.ABCImageList.GetImage16x16("Online");
            }
            else
            {
                picOnOff.Image = ABCControls.ABCImageList.GetImage16x16("Offline");
            }
        }
Exemplo n.º 9
0
        public void RefreshViewList( )
        {
            List <Guid> lstViewIDs = ABCUserProvider.GetViews(ABCUserProvider.CurrentUser.ADUserID);

            STViewGroupsController viewGroupCtrl = new STViewGroupsController();
            STViewsController      viewCtrl      = new STViewsController();

            ViewNode rootNode = new ViewNode(null, null, null);

            Dictionary <Guid, ViewNode> lstGroupNodes = new Dictionary <Guid, ViewNode>();

            List <BusinessObject> lstViews = viewCtrl.GetList("SELECT * FROM STViews WHERE (DisplayInTree IS NULL OR DisplayInTree ='TRUE') ORDER BY SortOrder");

            List <BusinessObject> lstGroups = viewGroupCtrl.GetList("SELECT * FROM STViewGroups ORDER BY SortOrder");

            foreach (STViewGroupsInfo group in lstGroups)
            {
                ViewNode groupNode = null;

                foreach (STViewsInfo view in lstViews)
                {
                    if (view.FK_STViewGroupID.HasValue && view.FK_STViewGroupID.Value == group.STViewGroupID && lstViewIDs.Contains(view.STViewID))
                    {
                        if (groupNode == null)
                        {
                            groupNode = new ViewNode(rootNode, new object[] { group.Name, group.STViewGroupID }, group);
                            lstGroupNodes.Add(group.STViewGroupID, groupNode);
                        }
                        String strCaption = view.STViewName;
                        if (String.IsNullOrWhiteSpace(strCaption))
                        {
                            strCaption = view.STViewNo;
                        }

                        ViewNode viewNode = new ViewNode(groupNode, new object[] { strCaption, view.STViewID }, view);
                        viewNode.ViewCount = 1;
                        groupNode.ViewCount++;
                    }
                }
            }

            foreach (Guid iID in lstGroupNodes.Keys)
            {
                if ((lstGroupNodes[iID].InnerData as STViewGroupsInfo).FK_STViewGroupID.HasValue && (lstGroupNodes[iID].InnerData as STViewGroupsInfo).FK_STViewGroupID.Value != Guid.Empty)
                {
                    foreach (Guid iID2 in lstGroupNodes.Keys)
                    {
                        if (iID2 != iID)
                        {
                            if ((lstGroupNodes[iID].InnerData as STViewGroupsInfo).FK_STViewGroupID.Value == (lstGroupNodes[iID2].InnerData as STViewGroupsInfo).STViewGroupID)
                            {
                                lstGroupNodes[iID].parentCore.childrenCore.Remove(lstGroupNodes[iID]);
                                lstGroupNodes[iID].parentCore = lstGroupNodes[iID2];
                                lstGroupNodes[iID2].childrenCore.Add(lstGroupNodes[iID]);
                                lstGroupNodes[iID2].ViewCount += lstGroupNodes[iID].ViewCount;
                            }
                        }
                    }
                }
            }
            if (ABCUserProvider.CurrentUser != null && !ABCUserProvider.CurrentUser.No.Contains("admin"))
            {
                foreach (Guid iID in lstGroupNodes.Keys)
                {
                    if (lstGroupNodes[iID].ViewCount <= 0)
                    {
                        lstGroupNodes[iID].parentCore.childrenCore.Remove(lstGroupNodes[iID]);
                    }
                }
            }

            this.DataSource = rootNode;
            this.CollapseAll();
        }