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(); }
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(); }
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)); }
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)); }
public bool CheckViewPermission(Guid viewID, ViewPermission permission) { Guid iUserID = GetCurrentUserID(); if (iUserID == Guid.Empty) { return(false); } return(ABCUserProvider.CheckViewPermission(iUserID, viewID, permission)); }
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(); }
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); } } }
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"); } }
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(); }