Esempio n. 1
0
 public static void SetLegalNotice(LegalNotice legalNotice)
 {
     try
     {
         var pRegHive = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
         var pRootKey = pRegHive.OpenSubKey(_regPath, true);
         pRootKey.SetValue("legalnoticecaption", legalNotice.LegalNoticeCaption, RegistryValueKind.String);
         pRootKey.SetValue("legalnoticetext", legalNotice.LegalNoticeText, RegistryValueKind.String);
     }
     catch (Exception ex)
     {
         _log.Error(ex.Message);
     }
 }
Esempio n. 2
0
    private void initLegalNotice()
    {
        int?id = LegalNoticeIdParameter;

        if (id != null)
        {
            Database           db      = Global.GetDbConnection();
            LegalNotice        notice  = db.GetLegalNotice((int)id);
            LegalNoticeVersion version = db.GetLatestLegalNoticeVersion((int)notice.Id);

            LegalNoticeId.Text = notice.Id.ToString();
            Description.Text   = notice.Description;
            Notice.Text        = version == null ? string.Empty : version.Notice;
        }
        else
        {
            Response.Redirect(Administrators_LegalNotices_Default.GetLoadUrl());
        }
    }
Esempio n. 3
0
        public LegalNotice GetLegalNotice(int noticeId)
        {
            SqlCommand  cmd;
            DataSet     ds;
            LegalNotice notice;

            cmd = _dbConn.GetStoredProcedureCommand("Legal_GetNotice");
            cmd.Parameters.AddWithValue("@Id", noticeId);

            ds = _dbConn.GetDataSet(cmd);

            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                throw new ApplicationException("There are no versions for the specified legal notice.");
            }

            notice = new LegalNotice();
            DataMapper.PopulateObject(notice, ds, null, null);

            return(notice);
        }
Esempio n. 4
0
        static void Main()
        {
            const string applicationName = "TotalSmartCodingSolution"; bool createdNew;

            mutex = new Mutex(true, applicationName, out createdNew);
            if (!createdNew)
            {
                return;
            }                              //app is already running! Exiting the application

            Registries.ProductName = Application.ProductName.ToUpper();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            AutoMapperConfig.SetupMappings();

            //string ApplicationRoleRequired = "false"; //COMMENT ON 11-JUL-2018: NOT USE ApplicationRoleRequired. JUST REMOVE THIS COMMENT ONLY -> TO USE ApplicationRoleRequired (GET ApplicationRoleRequired OPTION FROM CONFIG SETTING BY THE FOLLOWING CommonConfigs.ReadSetting("ApplicationRoleRequired")).
            string ApplicationRoleRequired = CommonConfigs.ReadSetting("ApplicationRoleRequired");

            ApplicationRoles.Required = true; ApplicationRoles.Name = ""; ApplicationRoles.Password = ""; bool applicationRoleRequired = false;
            if (bool.TryParse(ApplicationRoleRequired, out applicationRoleRequired))
            {
                ApplicationRoles.Required = applicationRoleRequired;
            }


            TrialConnects trialConnects      = new TrialConnects();
            DialogResult  trialConnectResult = trialConnects.Connected();

            if (trialConnectResult == DialogResult.Yes)
            {
                Logon logon = new Logon();

                if (logon.ShowDialog() == DialogResult.OK)
                {
                    if (!GlobalEnums.CBPP)
                    {
                        LegalNotice legalNotice = new LegalNotice();
                        legalNotice.ShowDialog(); legalNotice.Dispose();
                    }

                    if (GlobalVariables.FillingLineID == GlobalVariables.FillingLine.Smallpack || GlobalVariables.FillingLineID == GlobalVariables.FillingLine.Pail || GlobalVariables.FillingLineID == GlobalVariables.FillingLine.Medium4L || GlobalVariables.FillingLineID == GlobalVariables.FillingLine.Import || GlobalVariables.FillingLineID == GlobalVariables.FillingLine.Drum)
                    {
                        Application.Run(new MasterMDI(GlobalEnums.NmvnTaskID.SmartCoding, new SmartCoding()));
                    }
                    else
                    {
                        if (GlobalVariables.ConfigID == (int)GlobalVariables.FillingLine.Pickup)
                        {
                            Application.Run(new MasterMDI(GlobalEnums.NmvnTaskID.Pickups, new Pickups()));
                        }
                        else if (GlobalVariables.ConfigID == (int)GlobalVariables.FillingLine.GoodsIssue)
                        {
                            Application.Run(new MasterMDI(GlobalEnums.NmvnTaskID.GoodsIssues, new GoodsIssues()));
                        }
                        else
                        {
                            Application.Run(new MasterMDI());
                        }
                    }
                }
                logon.Dispose();
            }
            else
            if (trialConnectResult == DialogResult.No)
            {
                if (ApplicationRoles.Required)
                {
                    ConnectServer connectServer = new ConnectServer(false);
                    connectServer.ShowDialog(); connectServer.Dispose();
                }
                else
                if (CustomMsgBox.Show(new Form(), "Do you want to specify new application role and password?", "Warning", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                {
                    ConnectServer connectServer = new ConnectServer(true);
                    connectServer.ShowDialog(); connectServer.Dispose();
                }
            }
        }