Пример #1
0
        private void FormOpen()
        {
            DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString);

            //Config確認
            try
            {
                DbConfig config = new DbConfig();
                foreach (var n in context.config)
                {
                    if (n.config_name == "bumonname")
                    {
                        config.bumonnname = n.config_value;
                    }
                    else if (n.config_name == "companyname")
                    {
                        config.companyname = n.config_value;
                    }
                    else if (n.config_name == "symbolcolor_argb")
                    {
                        config.symbolcolor = Color.FromArgb(int.Parse(n.config_value));
                    }
                    else if (n.config_name == "bumontextcolor_argb")
                    {
                        config.bumontextcolor = Color.FromArgb(int.Parse(n.config_value));
                    }
                    else if (n.config_name == "barcodeprefix")
                    {
                        config.barcodeplefix = int.Parse(n.config_value);
                    }
                    else if (n.config_name == "itemname_imeon")
                    {
                        config.itemname_iemon = bool.Parse(n.config_value);
                    }
                    else if (n.config_name == "entertotab")
                    {
                        config.entertotab = bool.Parse(n.config_value);
                    }
                    else if (n.config_name == "connection_string")
                    {
                        config.connectionstring = n.config_value;
                    }
                }
                if (config.bumonnname == null)
                {
                    ConfigForm configform = new ConfigForm();
                    if (configform.ShowDialog() == DialogResult.OK)
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        this.DialogResult = DialogResult.Cancel;
                    }
                }
                else
                {
                    Globals.Config    = config;
                    this.DialogResult = DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            this.Dispose();
        }