示例#1
0
文件: UIfcm.cs 项目: DR2010/FCM2
        private void frmParserMainUI_Load(object sender, EventArgs e)
        {
            //Utils.ClientList = new ClientList(_userID);
            //Utils.ClientList.List();

            //foreach (Client c in Utils.ClientList.clientList)
            //{
            //    cbxClientName.Items.Add(c.UID + "; " + c.Name);
            //}
            //cbxClientName.SelectedIndex = 0;

            //Utils.ClientID = Utils.ClientList.clientList[cbxClientName.SelectedIndex].UID;
            //Utils.ClientIndex = cbxClientName.SelectedIndex;

            UILogon log = new UILogon();

            log.ShowDialog();
        }
示例#2
0
文件: UIfcm.cs 项目: DR2010/FCM2
        /// <summary>
        /// Load method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmParserMainUI_Load(object sender, EventArgs e)
        {
            // Set current environment
            Utils.FCMenvironment = MackkadoITFramework.Helper.Utils.EnvironmentList.LOCAL;

            UILogon log = new UILogon();

            log.ShowDialog();

            if (log.connectedTo == "not connected" || string.IsNullOrEmpty(log.connectedTo))
            {
                Application.Exit();
            }

            if (log.connectedTo == "Local")
            {
                toolStripStatusLabel1.BackColor = Color.Green;
            }

            if (log.connectedTo == "Server")
            {
                toolStripStatusLabel1.BackColor = Color.Red;
            }


            // Utils.ClientList = Client.List();

            int st = ConnString.ConnectionString.IndexOf("Data Source");

            int en = ConnString.ConnectionString.IndexOf(";");

            if (st > 0 && en > 0)
            {
                string s = ConnString.ConnectionString.Substring(st, en - st);
                toolStripStatusLabel1.Text = string.Format("({0}) {1}", log.connectedTo, s);
            }
            else
            {
                toolStripStatusLabel1.Text = string.Format("({0}) {1}", log.connectedTo, ConnString.ConnectionString.Substring(0, 10));
            }

            toolStripStatusLabel2.Text = @"Version: " + ControllerUtils.GetCurrentAssemblyVersion();

            tslLoadedFrom.Text = this.Tag.ToString();


            var responseCL = new BUSClient().ClientList(HeaderInfo.Instance);

            var responseClientList = responseCL.clientList;

            // Retrieve last client id
            //
            var lastClient = new CodeValue();

            lastClient.FKCodeType = "LASTINFO";
            lastClient.ID         = "CLIENTID";
            lastClient.Read(false);
            try
            {
                Utils.ClientID = Convert.ToInt32(lastClient.ValueExtended);
            }
            catch
            {
                Utils.ClientID = Utils.ClientList[0].UID;
            }

            // Load HeaderInfo
            HeaderInfo.Instance.UserID          = Utils.UserID;
            HeaderInfo.Instance.CurrentDateTime = DateTime.Now;

            // Remove menu items

            // Get full list of screens
            var fullListOfScreens = CachedInfo.GetListOfCodeValue(FCMConstant.CodeTypeString.SCREENCODE);

            // var listOfScreen = BUSReferenceData.GetListScreensForUser(Utils.UserID);

            foreach (var screen in fullListOfScreens)
            {
                bool found = CachedInfo.ListOfScreensAllowedToUser.Any(allowedScreen => allowedScreen.ID == screen.ID);

                //foreach (var allowedScreen in CachedInfo.ListOfScreensAllowedToUser)
                //{
                //    if (allowedScreen.ID == screen.ID)
                //    {
                //        found = true;
                //        break;
                //    }
                //}

                if (found)
                {
                    continue;
                }

                // find screen disallowed and hide
                switch (screen.ID)
                {
                case FCMConstant.ScreenCode.DocumentSetLink:
                    miDocumentSetLink.Enabled = false;
                    break;

                case FCMConstant.ScreenCode.DocumentSetList:
                    miDocumentSetList.Enabled = false;
                    break;

                case FCMConstant.ScreenCode.DocumentList:
                    miDocumentList.Enabled = false;
                    break;

                case FCMConstant.ScreenCode.DocumentLink:
                    miDocumentLink.Enabled = false;
                    break;

                case FCMConstant.ScreenCode.ClientList:
                    toolStripClient.Enabled = false;
                    miListNew.Enabled       = false;
                    break;

                case FCMConstant.ScreenCode.ReportMetadata:
                    miReportMetadata.Enabled = false;
                    break;

                case FCMConstant.ScreenCode.ReferenceData:
                    miReferenceData.Enabled = false;
                    break;

                //case FCMConstant.ScreenCode.UserAccess:
                //    miUsers.Enabled = false;
                //    break;
                case FCMConstant.ScreenCode.UserSettings:
                    miUserSettings.Enabled = false;
                    break;

                case FCMConstant.ScreenCode.ImpactedDocuments:
                    miImpacted.Enabled = false;
                    break;

                case FCMConstant.ScreenCode.ProcessRequest:
                    miProcessRequest.Enabled = false;
                    break;
                }
            }

            this.Activate();

            // Utils.ClientIndex = 0;
        }