Exemplo n.º 1
0
        public ModuleManageBLL()
        {
            IDataBaseInfoBll bll = DataBaseInfoFactory.GetDataBaseInfoBll(DataBaseStaticConfig.Config.provider);
            DbHelper         db  = bll.SetDbHelperHasDbName(DataBaseStaticConfig.Config);

            _dbSession = DbSessionFactory.GetDbSession <RLFrameWorkEntities>(db.dbConnectionString);
        }
Exemplo n.º 2
0
        private void buildcode_process(uc_template_source source)
        {
            var databaselist = (List <TableInfo>)gv_table.DataSource;

            foreach (TableInfo table in databaselist.Where(o => o.ck))
            {
                ViewRazor razor    = new ViewRazor();
                string    filename = source.Format.Replace("$Table$", table.name);
                string    file     = source.BuildPath + "//" + filename + ".cs";
                if (File.Exists(file) && ck_ignore.Checked)
                {
                    continue;
                }
                IDataBaseInfoBll bll = DataBaseInfoFactory.GetDataBaseInfoBll(DataBaseStaticConfig.Config.provider);
                var list             = bll.GetColumnList(table.name);

                ViewModel_back model = new ViewModel_back();
                model.FormatTablename = filename;
                model.TableInfo       = table;
                model.Colums          = list;
                model.DataBaseName    = Static.DataBaseStaticConfig.Config.dbname;
                model.NameSpace       = source.NameSpaceName;
                model.Tables          = databaselist.Where(o => o.ck).ToList();

                razor.OutputEncoding = Encoding.UTF8;
                razor.TemplateUrl    = source.TemplatePath;
                razor.SaveUrl        = file;
                razor.ToPageNoMaster(model);
            }
        }
Exemplo n.º 3
0
        private void AutoGeneration_Load(object sender, EventArgs e)
        {
            if (DesignMode)
            {
                return;
            }
            if (!string.IsNullOrWhiteSpace(DataBaseStaticConfig.Config.provider) &&
                !string.IsNullOrWhiteSpace(DataBaseStaticConfig.Config.username) &&
                !string.IsNullOrWhiteSpace(DataBaseStaticConfig.Config.dbaddr) &&
                !string.IsNullOrWhiteSpace(DataBaseStaticConfig.Config.dbname) &&
                !string.IsNullOrWhiteSpace(DataBaseStaticConfig.Config.userpwd))
            {
                IDataBaseInfoBll bll = DataBaseInfoFactory.GetDataBaseInfoBll(DataBaseStaticConfig.Config.provider);
                var list             = bll.GetTableList();
                gv_table.DataSource = list;

                //读取配置文件
                try
                {
                    string a = FileHelper.ReadFile("//temp//templateconfig.json");
                    if (!string.IsNullOrWhiteSpace(a))
                    {
                        var listTemplate = JsonConvert.DeserializeObject <List <uc_template_source> >(a);
                        foreach (var li in listTemplate.Where(o => o.Enable))
                        {
                            uc_templatereadonly tmp = new uc_templatereadonly();
                            tmp.Dock       = DockStyle.Top;
                            tmp.DataSource = new uc_template_source()
                            {
                                Enable        = li.Enable,
                                TemplateName  = li.TemplateName,
                                TemplatePath  = li.TemplatePath,
                                BuildPath     = li.BuildPath,
                                NameSpaceName = li.NameSpaceName,
                                Format        = li.Format
                            };
                            tmp.DataBind();
                            tmp.buildcodeHandler += tmp_buildcodeHandler;
                            pnl_main.Controls.Add(tmp);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(" 读取配置失败!详细信息:" + ex.ToString());
                }
            }
        }
Exemplo n.º 4
0
        private void dbname_Click(object sender, EventArgs e)
        {
            //根据配置 获取数据库列表
            if (!string.IsNullOrWhiteSpace(txtprovider.Text) &&
                !string.IsNullOrWhiteSpace(dbaddr.Text) &&
                !string.IsNullOrWhiteSpace(username.Text) &&
                !string.IsNullOrWhiteSpace(userpwd.Text))
            {
                IDataBaseInfoBll bll = DataBaseInfoFactory.GetDataBaseInfoBll(txtprovider.Text);

                List <string> list = bll.GetAllDatabaseName(new uc_statusbar_datasource()
                {
                    provider = txtprovider.Text,
                    dbaddr   = dbaddr.Text,
                    username = username.Text,
                    userpwd  = userpwd.Text
                });

                dbname.DataSource = list;
            }
        }