public static Dictionary <string, string> CreateFactory(string name_space)
        {
            string text = string.Empty;

            if (PageCache.DbTool == 0)
            {
                if (PageCache.DbType == 0)
                {
                    text = FactoryHelper_MySql.CreateFactory(name_space, db_name);
                }
                else if (PageCache.DbType == 1)
                {
                    text = FactoryHelper_MsSql.CreateFactory(name_space, db_name);
                }
            }
            else if (PageCache.DbTool == 1 && PageCache.DbType == 0)
            {
                text = FactoryHelper_Dapper_MySql.CreateFactory(name_space, db_name);
            }
            else if (PageCache.DbTool == 1 && PageCache.DbType == 1)
            {
                text = FactoryHelper_Dapper_MsSql.CreateFactory(name_space, db_name);
            }

            Dictionary <string, string> result = new Dictionary <string, string>();

            result.Add("ConnectionFactory.cs", text);

            return(result);
        }
Exemple #2
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;

            if (btn.Text == "Model")
            {
                #region Model
                int modelType = PageCache.ModelStyle;
                if (modelType == 0)
                {
                    string modelStr = ModelHelper_Default.CreateModel();
                    this.txtResult.Text = modelStr;
                }
                else if (modelType == 1)
                {
                    string modelStr = ModelHelper_DefaultAttribute.CreateModel();
                    this.txtResult.Text = modelStr;
                }
                else
                {
                    string modelStr = ModelHelper_DefaultLowerField.CreateModel();
                    this.txtResult.Text = modelStr;
                }
                #endregion
            }
            else if (btn.Text == "Aspx")
            {
                #region Aspx
                int uitype = PageCache.UIType;
                if (uitype == 0)
                {
                    // easyui
                    string modelStr = AspxHelper_EasyUI.CreateASPX();
                    this.txtResult.Text = modelStr;
                }
                else if (uitype == 1)
                {
                    // bootstarp
                    string modelStr = AspxHelper_Bootstrap.CreateASPX();
                    this.txtResult.Text = modelStr;
                }
                #endregion
            }
            else if (btn.Text == "Aspx.cs")
            {
                #region Aspx.cs
                int uitype = PageCache.UIType;
                if (uitype == 0)
                {
                    // easyui
                    string modelStr = AspxCsHelper_EasyUI.CreateASPXCS();

                    this.txtResult.Text = modelStr;
                }
                else if (uitype == 1)
                {
                    // bootstarp
                    string modelStr = AspxCsHelper_Bootstrap.CreateASPXCS();
                    this.txtResult.Text = modelStr;
                }
                #endregion
            }
            else if (btn.Text == "DAL")
            {
                #region DAL
                int uitype = PageCache.UIType;
                int dbtype = PageCache.DbType;
                int dbtool = PageCache.DbTool;
                if (dbtool == 0)
                {
                    if (uitype == 0)
                    {
                        // easyui
                        if (dbtype == 0)
                        {
                            // mysql
                            string modelStr = DALHelper_EasyUI_MySql.CreateDAL();

                            this.txtResult.Text = modelStr;
                        }
                        else if (dbtype == 1)
                        {
                            // mssql
                            string modelStr = DALHelper_EasyUI_MsSql.CreateDAL();

                            this.txtResult.Text = modelStr;
                        }
                    }
                    else if (uitype == 1)
                    {
                        // bootstarp
                        if (dbtype == 0)
                        {
                            // mysql
                            string modelStr = DALHelper_Bootstrap_MySql.CreateDAL();
                            this.txtResult.Text = modelStr;
                        }
                        else if (dbtype == 1)
                        {
                            // mssql
                            string modelStr = DALHelper_Bootstrap_MsSql.CreateDAL();
                            this.txtResult.Text = modelStr;
                        }
                    }
                }
                else if (dbtool == 1)
                {
                    string modelStr = DALHelper_Dapper.CreateDAL();

                    this.txtResult.Text = modelStr;
                }
                #endregion
            }
            else if (btn.Text == "Factory")
            {
                #region Factory
                int dbtype = PageCache.DbType;
                int dbtool = PageCache.DbTool;
                if (dbtool == 0)
                {
                    if (dbtype == 0)
                    {
                        // mysql
                        string modelStr = FactoryHelper_MySql.CreateFactory();

                        this.txtResult.Text = modelStr;
                    }
                    else if (dbtype == 1)
                    {
                        // mysql
                        string modelStr = FactoryHelper_MsSql.CreateFactory();
                        this.txtResult.Text = modelStr;
                    }
                }
                else if (dbtool == 1)
                {
                    if (dbtype == 0)
                    {
                        // mysql
                        string modelStr = FactoryHelper_Dapper_MySql.CreateFactory();

                        this.txtResult.Text = modelStr;
                    }
                    else if (dbtype == 1)
                    {
                        // mysql
                        string modelStr = FactoryHelper_Dapper_MsSql.CreateFactory();
                        this.txtResult.Text = modelStr;
                    }
                }
                #endregion
            }
            else if (btn.Text == "Config")
            {
                #region Config
                int uitype = PageCache.UIType;
                int dbtype = PageCache.DbType;
                if (uitype == 0)
                {
                    // easyui
                    if (dbtype == 0)
                    {
                        // mysql
                        string modelStr = ConfigHelper.GetConnectStringConfig();

                        this.txtResult.Text = modelStr;
                    }
                }
                else if (uitype == 1)
                {
                    // bootstarp
                    if (dbtype == 0)
                    {
                        // mysql
                        string modelStr = ConfigHelper.GetConnectStringConfig();

                        this.txtResult.Text = modelStr;
                    }
                }
                #endregion
            }
            else if (btn.Text == "View")
            {
                #region View
                int webType = PageCache.WebType;
                int uiType  = PageCache.UIType;
                if (webType == 1)
                {
                    if (uiType == 0)
                    {
                        string viewStr = MvcViewHelper_EasyUI.CreateView();
                        this.txtResult.Text = viewStr;
                    }
                    else if (uiType == 1)
                    {
                        string viewStr = MvcViewHelper_Bootstrap.CreateView();
                        this.txtResult.Text = viewStr;
                    }
                }
                #endregion
            }
            else if (btn.Text == "Controller")
            {
                #region Controller
                string controllerStr = MvcControllerHelper.CreateController();

                this.txtResult.Text = controllerStr;
                #endregion
            }
            else if (btn.Text == "Test")
            {
                #region Test

                #endregion
            }
        }