public static Dictionary <string, string> CreateDAL(string name_space, string model_staff, string dal_staff, int action)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();

            foreach (var item in tbDic)
            {
                string text = string.Empty;
                if (PageCache.DbTool == 0)
                {
                    if (PageCache.UIType == 0 && PageCache.DbType == 0)
                    {
                        // easyui mysql
                        text = DALHelper_EasyUI_MySql.CreateDAL(name_space, item.Key, item.Value, action, item.Key + dal_staff, item.Key + model_staff, db_name);
                    }
                    else if (PageCache.UIType == 0 && PageCache.DbType == 1)
                    {
                        // easyui mssql
                        text = DALHelper_EasyUI_MsSql.CreateDAL(name_space, item.Key, item.Value, action, item.Key + dal_staff, item.Key + model_staff, db_name);
                    }
                    else if (PageCache.UIType == 1 && PageCache.DbType == 0)
                    {
                        // bootstarp mysql
                        text = DALHelper_Bootstrap_MySql.CreateDAL(name_space, item.Key, item.Value, action, item.Key + dal_staff, item.Key + model_staff, db_name);
                    }
                    else if (PageCache.UIType == 1 && PageCache.DbType == 1)
                    {
                        // bootstarp mssql
                        text = DALHelper_Bootstrap_MsSql.CreateDAL(name_space, item.Key, item.Value, action, item.Key + dal_staff, item.Key + model_staff, db_name);
                    }
                }
                else if (PageCache.DbTool == 1)
                {
                    text = DALHelper_Dapper.CreateDAL(name_space, item.Key, item.Value, action, item.Key + dal_staff, item.Key + model_staff, db_name);
                }

                result.Add(item.Key + dal_staff + ".cs", text);
            }

            return(result);
        }
Esempio n. 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
            }
        }