Ejemplo n.º 1
0
 public string GetBLLCode(string AssemblyGuid, bool Maxid, bool Exists, bool Add, bool Update, bool Delete, bool GetModel, bool GetModelByCache, bool List, bool ListProc)
 {
     this.ibll = BuilderFactory.CreateBLLObj(AssemblyGuid);
     if (this.ibll == null)
     {
         return("//请选择有效的业务层代码组件类型!");
     }
     this.ibll.Fieldlist        = base.Fieldlist;
     this.ibll.Keys             = base.Keys;
     this.ibll.NameSpace        = base.NameSpace;
     this.ibll.Folder           = base.Folder;
     this.ibll.Modelpath        = base.Modelpath;
     this.ibll.ModelName        = base.ModelName;
     this.ibll.TableDescription = CodeCommon.CutDescText(base.TableDescription, 10, base.BLLName);
     this.ibll.BLLpath          = base.BLLpath;
     this.ibll.BLLName          = base.BLLName;
     this.ibll.Factorypath      = base.Factorypath;
     this.ibll.IDALpath         = base.IDALpath;
     this.ibll.IClass           = base.IClass;
     this.ibll.DALpath          = base.DALpath;
     this.ibll.DALName          = base.DALName;
     this.ibll.IsHasIdentity    = base.IsHasIdentity;
     this.ibll.DbType           = this.dbobj.DbType;
     return(this.ibll.GetBLLCode(Maxid, Exists, Add, Update, Delete, GetModel, GetModelByCache, List));
 }
Ejemplo n.º 2
0
        public string GetShowDesigner()
        {
            StringPlus stringPlus = new StringPlus();

            foreach (ColumnInfo current in this.Fieldlist)
            {
                string columnName = current.ColumnName;
                string typeName   = current.TypeName;
                string descText   = current.Description;
                descText = CodeCommon.CutDescText(descText, 15, columnName);
                CodeCommon.DbTypeToCS(typeName.Trim().ToLower()).ToLower();
                stringPlus.AppendSpaceLine(1, "protected global::System.Web.UI.WebControls.Label lbl" + columnName + ";");
            }
            return(stringPlus.ToString());
        }
Ejemplo n.º 3
0
        public string GetListAspx()
        {
            StringPlus stringPlus = new StringPlus();

            stringPlus.AppendLine();
            foreach (ColumnInfo current in this.Fieldlist)
            {
                string columnName = current.ColumnName;
                string typeName   = current.TypeName;
                string text       = current.Description;
                bool   arg_43_0   = current.IsPrimaryKey;
                bool   isIdentity = current.IsIdentity;
                text = CodeCommon.CutDescText(text, 15, columnName);
                if (!isIdentity && !this.isFilterColume(columnName))
                {
                    string a;
                    if ((a = typeName.Trim().ToLower()) != null && (a == "bit" || a == "dateTime"))
                    {
                        stringPlus.AppendSpaceLine(2, string.Concat(new string[]
                        {
                            "<asp:BoundField DataField=\"",
                            columnName,
                            "\" HeaderText=\"",
                            text,
                            "\" SortExpression=\"",
                            columnName,
                            "\" ItemStyle-HorizontalAlign=\"Center\"  /> "
                        }));
                    }
                    else
                    {
                        stringPlus.AppendSpaceLine(2, string.Concat(new string[]
                        {
                            "<asp:BoundField DataField=\"",
                            columnName,
                            "\" HeaderText=\"",
                            text,
                            "\" SortExpression=\"",
                            columnName,
                            "\" ItemStyle-HorizontalAlign=\"Center\"  /> "
                        }));
                    }
                }
            }
            return(stringPlus.ToString());
        }
Ejemplo n.º 4
0
        public string GetDALFactoryMethodCode()
        {
            StringPlus stringPlus = new StringPlus();

            stringPlus.AppendSpaceLine(2, "/// <summary>");
            stringPlus.AppendSpaceLine(2, "/// 创建" + base.DALName + "数据层接口。" + CodeCommon.CutDescText(base.TableDescription, 10, ""));
            stringPlus.AppendSpaceLine(2, "/// </summary>");
            stringPlus.AppendSpaceLine(2, string.Concat(new string[]
            {
                "public static ",
                base.IDALpath,
                ".",
                base.IClass,
                " Create",
                base.DALName,
                "()"
            }));
            stringPlus.AppendSpaceLine(2, "{\r\n");
            if (base.Folder != "")
            {
                stringPlus.AppendSpaceLine(3, string.Concat(new string[]
                {
                    "string ClassNamespace = AssemblyPath +\".",
                    base.Folder,
                    ".",
                    base.DALName,
                    "\";"
                }));
            }
            else
            {
                stringPlus.AppendSpaceLine(3, "string ClassNamespace = AssemblyPath +\"." + base.DALName + "\";");
            }
            stringPlus.AppendSpaceLine(3, "object objType=CreateObject(AssemblyPath,ClassNamespace);");
            stringPlus.AppendSpaceLine(3, string.Concat(new string[]
            {
                "return (",
                base.IDALpath,
                ".",
                base.IClass,
                ")objType;"
            }));
            stringPlus.AppendSpaceLine(2, "}");
            return(stringPlus.Value);
        }
Ejemplo n.º 5
0
        public string GetUpdateDesigner()
        {
            StringPlus stringPlus = new StringPlus();

            foreach (ColumnInfo current in this.Fieldlist)
            {
                string columnName   = current.ColumnName;
                string typeName     = current.TypeName;
                string descText     = current.Description;
                bool   isPrimaryKey = current.IsPrimaryKey;
                bool   isIdentity   = current.IsIdentity;
                descText = CodeCommon.CutDescText(descText, 15, columnName);
                if (!this.isFilterColume(columnName))
                {
                    if (isPrimaryKey || isIdentity || typeName.Trim().ToLower() == "uniqueidentifier")
                    {
                        stringPlus.AppendSpaceLine(1, "protected global::System.Web.UI.WebControls.Label lbl" + columnName + ";");
                    }
                    else
                    {
                        string a;
                        if ((a = CodeCommon.DbTypeToCS(typeName.Trim().ToLower()).ToLower()) != null)
                        {
                            if (a == "datetime" || a == "smalldatetime")
                            {
                                stringPlus.AppendSpaceLine(2, "protected global::System.Web.UI.WebControls.TextBox txt" + columnName + ";");
                                continue;
                            }
                            if (a == "bool")
                            {
                                stringPlus.AppendSpaceLine(2, "protected global::System.Web.UI.WebControls.CheckBox chk" + columnName + ";");
                                continue;
                            }
                        }
                        stringPlus.AppendSpaceLine(2, "protected global::System.Web.UI.WebControls.TextBox txt" + columnName + ";");
                    }
                }
            }
            stringPlus.AppendSpaceLine(1, "protected global::System.Web.UI.WebControls.Button btnSave;");
            stringPlus.AppendSpaceLine(1, "protected global::System.Web.UI.WebControls.Button btnCancel;");
            return(stringPlus.Value);
        }
Ejemplo n.º 6
0
        public string GetShowAspx()
        {
            StringPlus stringPlus = new StringPlus();

            stringPlus.AppendLine();
            stringPlus.AppendLine("<table cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\">");
            foreach (ColumnInfo current in this.Fieldlist)
            {
                string columnName = current.ColumnName;
                string typeName   = current.TypeName;
                string text       = current.Description;
                text = CodeCommon.CutDescText(text, 15, columnName);
                stringPlus.AppendSpaceLine(1, "<tr>");
                stringPlus.AppendSpaceLine(1, "<td height=\"25\" width=\"30%\" align=\"right\">");
                stringPlus.AppendSpaceLine(2, text);
                stringPlus.AppendSpaceLine(1, ":</td>");
                stringPlus.AppendSpaceLine(1, "<td height=\"25\" width=\"*\" align=\"left\">");
                typeName.Trim().ToLower();
                stringPlus.AppendSpaceLine(2, "<asp:Label id=\"lbl" + columnName + "\" runat=\"server\"></asp:Label>");
                stringPlus.AppendSpaceLine(1, "</td></tr>");
            }
            stringPlus.AppendLine("</table>");
            return(stringPlus.ToString());
        }
Ejemplo n.º 7
0
        public string GetUpdateAspxCs()
        {
            StringPlus stringPlus  = new StringPlus();
            StringPlus stringPlus2 = new StringPlus();
            StringPlus stringPlus3 = new StringPlus();
            StringPlus stringPlus4 = new StringPlus();

            stringPlus.AppendLine();
            stringPlus.AppendSpaceLine(3, "string strErr=\"\";");
            foreach (ColumnInfo current in this.Fieldlist)
            {
                string columnName   = current.ColumnName;
                string typeName     = current.TypeName;
                string text         = current.Description;
                bool   isPrimaryKey = current.IsPrimaryKey;
                bool   isIdentity   = current.IsIdentity;
                text = CodeCommon.CutDescText(text, 15, columnName);
                string key;
                if ((key = CodeCommon.DbTypeToCS(typeName.Trim().ToLower()).ToLower()) == null)
                {
                    goto IL_583;
                }
                if (dtCollection == null)
                {
                    dtCollection = new Dictionary <string, int>(12)
                    {
                        {
                            "int",
                            0
                        },

                        {
                            "smallint",
                            1
                        },

                        {
                            "long",
                            2
                        },

                        {
                            "float",
                            3
                        },

                        {
                            "numeric",
                            4
                        },

                        {
                            "decimal",
                            5
                        },

                        {
                            "datetime",
                            6
                        },

                        {
                            "smalldatetime",
                            7
                        },

                        {
                            "bool",
                            8
                        },

                        {
                            "byte[]",
                            9
                        },

                        {
                            "guid",
                            10
                        },

                        {
                            "uniqueidentifier",
                            11
                        }
                    };
                }
                int num;
                if (!dtCollection.TryGetValue(key, out num))
                {
                    goto IL_583;
                }
                switch (num)
                {
                case 0:
                case 1:
                    if (isPrimaryKey || isIdentity)
                    {
                        stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                        {
                            "int ",
                            columnName,
                            "=int.Parse(this.lbl",
                            columnName,
                            ".Text);"
                        }));
                    }
                    else
                    {
                        stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                        {
                            "int ",
                            columnName,
                            "=int.Parse(this.txt",
                            columnName,
                            ".Text);"
                        }));
                        stringPlus3.AppendSpaceLine(3, "if(!PageValidate.IsNumber(txt" + columnName + ".Text))");
                        stringPlus3.AppendSpaceLine(3, "{");
                        stringPlus3.AppendSpaceLine(4, "strErr+=\"" + text + "格式错误!\\\\n\";\t");
                        stringPlus3.AppendSpaceLine(3, "}");
                    }
                    break;

                case 2:
                    if (isPrimaryKey || isIdentity)
                    {
                        stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                        {
                            "long ",
                            columnName,
                            "=long.Parse(this.lbl",
                            columnName,
                            ".Text);"
                        }));
                    }
                    else
                    {
                        stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                        {
                            "long ",
                            columnName,
                            "=long.Parse(this.txt",
                            columnName,
                            ".Text);"
                        }));
                        stringPlus3.AppendSpaceLine(3, "if(!PageValidate.IsNumber(txt" + columnName + ".Text))");
                        stringPlus3.AppendSpaceLine(3, "{");
                        stringPlus3.AppendSpaceLine(4, "strErr+=\"" + text + "格式错误!\\\\n\";\t");
                        stringPlus3.AppendSpaceLine(3, "}");
                    }
                    break;

                case 3:
                case 4:
                case 5:
                    if (isPrimaryKey || isIdentity)
                    {
                        stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                        {
                            "decimal ",
                            columnName,
                            "=decimal.Parse(this.lbl",
                            columnName,
                            ".Text);"
                        }));
                    }
                    else
                    {
                        stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                        {
                            "decimal ",
                            columnName,
                            "=decimal.Parse(this.txt",
                            columnName,
                            ".Text);"
                        }));
                        stringPlus3.AppendSpaceLine(3, "if(!PageValidate.IsDecimal(txt" + columnName + ".Text))");
                        stringPlus3.AppendSpaceLine(3, "{");
                        stringPlus3.AppendSpaceLine(4, "strErr+=\"" + text + "格式错误!\\\\n\";\t");
                        stringPlus3.AppendSpaceLine(3, "}");
                    }
                    break;

                case 6:
                case 7:
                    stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                    {
                        "DateTime ",
                        columnName,
                        "=DateTime.Parse(this.txt",
                        columnName,
                        ".Text);"
                    }));
                    stringPlus3.AppendSpaceLine(3, "if(!PageValidate.IsDateTime(txt" + columnName + ".Text))");
                    stringPlus3.AppendSpaceLine(3, "{");
                    stringPlus3.AppendSpaceLine(4, "strErr+=\"" + text + "格式错误!\\\\n\";\t");
                    stringPlus3.AppendSpaceLine(3, "}");
                    break;

                case 8:
                    stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                    {
                        "bool ",
                        columnName,
                        "=this.chk",
                        columnName,
                        ".Checked;"
                    }));
                    break;

                case 9:
                    stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                    {
                        "byte[] ",
                        columnName,
                        "= new UnicodeEncoding().GetBytes(this.txt",
                        columnName,
                        ".Text);"
                    }));
                    break;

                case 10:
                case 11:
                    stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                    {
                        "Guid ",
                        columnName,
                        "= new Guid(this.lbl",
                        columnName,
                        ".Text);"
                    }));
                    break;

                default:
                    goto IL_583;
                }
IL_658:
                stringPlus4.AppendSpaceLine(3, string.Concat(new string[]
                {
                    "model.",
                    columnName,
                    "=",
                    columnName,
                    ";"
                }));
                continue;
IL_583:
                if (isPrimaryKey || isIdentity)
                {
                    stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                    {
                        "string ",
                        columnName,
                        "=this.lbl",
                        columnName,
                        ".Text;"
                    }));
                    goto IL_658;
                }
                stringPlus2.AppendSpaceLine(3, string.Concat(new string[]
                {
                    "string ",
                    columnName,
                    "=this.txt",
                    columnName,
                    ".Text;"
                }));
                stringPlus3.AppendSpaceLine(3, "if(this.txt" + columnName + ".Text.Trim().Length==0)");
                stringPlus3.AppendSpaceLine(3, "{");
                stringPlus3.AppendSpaceLine(4, "strErr+=\"" + text + "不能为空!\\\\n\";\t");
                stringPlus3.AppendSpaceLine(3, "}");
                goto IL_658;
            }
            stringPlus.AppendLine(stringPlus3.ToString());
            stringPlus.AppendSpaceLine(3, "if(strErr!=\"\")");
            stringPlus.AppendSpaceLine(3, "{");
            stringPlus.AppendSpaceLine(4, "MessageBox.Show(this,strErr);");
            stringPlus.AppendSpaceLine(4, "return;");
            stringPlus.AppendSpaceLine(3, "}");
            stringPlus.AppendLine(stringPlus2.ToString());
            stringPlus.AppendLine();
            stringPlus.AppendSpaceLine(3, this.ModelSpace + " model=new " + this.ModelSpace + "();");
            stringPlus.AppendLine(stringPlus4.ToString());
            stringPlus.AppendSpaceLine(3, this.BLLSpace + " bll=new " + this.BLLSpace + "();");
            stringPlus.AppendSpaceLine(3, "bll.Update(model);");
            stringPlus.AppendSpaceLine(3, "Maticsoft.Common.MessageBox.ShowAndRedirect(this,\"保存成功!\",\"list.aspx\");");
            return(stringPlus.ToString());
        }
Ejemplo n.º 8
0
        public string GetUpdateAspx()
        {
            StringPlus stringPlus = new StringPlus();

            stringPlus.AppendLine("");
            stringPlus.AppendLine("<table cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\">");
            bool flag = false;

            foreach (ColumnInfo current in this.Fieldlist)
            {
                string columnName   = current.ColumnName;
                string typeName     = current.TypeName;
                string text         = current.Description;
                bool   isPrimaryKey = current.IsPrimaryKey;
                bool   isIdentity   = current.IsIdentity;
                text = CodeCommon.CutDescText(text, 15, columnName);
                if (!this.isFilterColume(columnName))
                {
                    if (!isPrimaryKey && !isIdentity && !(typeName.Trim().ToLower() == "uniqueidentifier"))
                    {
                        stringPlus.AppendSpaceLine(1, "<tr>");
                        stringPlus.AppendSpaceLine(1, "<td height=\"25\" width=\"30%\" align=\"right\">");
                        stringPlus.AppendSpaceLine(2, text);
                        stringPlus.AppendSpaceLine(1, ":</td>");
                        stringPlus.AppendSpaceLine(1, "<td height=\"25\" width=\"*\" align=\"left\">");
                        string a;
                        if ((a = typeName.Trim().ToLower()) == null)
                        {
                            goto IL_1DA;
                        }
                        if (!(a == "datetime") && !(a == "smalldatetime"))
                        {
                            if (!(a == "bit"))
                            {
                                goto IL_1DA;
                            }
                            stringPlus.AppendSpaceLine(2, string.Concat(new string[]
                            {
                                "<asp:CheckBox ID=\"chk",
                                columnName,
                                "\" Text=\"",
                                text,
                                "\" runat=\"server\" Checked=\"False\" />"
                            }));
                        }
                        else
                        {
                            stringPlus.AppendSpaceLine(2, "<asp:TextBox ID=\"txt" + columnName + "\" runat=\"server\" Width=\"70px\"  onfocus=\"setday(this)\"></asp:TextBox>");
                            flag = true;
                        }
IL_1F2:
                        stringPlus.AppendSpaceLine(1, "</td></tr>");
                        continue;
IL_1DA:
                        stringPlus.AppendSpaceLine(2, "<asp:TextBox id=\"txt" + columnName + "\" runat=\"server\" Width=\"200px\"></asp:TextBox>");
                        goto IL_1F2;
                    }
                    stringPlus.AppendSpaceLine(1, "<tr>");
                    stringPlus.AppendSpaceLine(1, "<td height=\"25\" width=\"30%\" align=\"right\">");
                    stringPlus.AppendSpaceLine(2, text);
                    stringPlus.AppendSpaceLine(1, ":</td>");
                    stringPlus.AppendSpaceLine(1, "<td height=\"25\" width=\"*\" align=\"left\">");
                    stringPlus.AppendSpaceLine(2, "<asp:label id=\"lbl" + columnName + "\" runat=\"server\"></asp:label>");
                    stringPlus.AppendSpaceLine(1, "</td></tr>");
                }
            }
            stringPlus.AppendLine("</table>");
            if (flag)
            {
                stringPlus.AppendLine("<script src=\"/js/calendar1.js\" type=\"text/javascript\"></script>");
            }
            return(stringPlus.Value);
        }