Пример #1
0
        //
        private string CreateDeleteCommandHandler()
        {
            string dataGridID = "dg" + global.TableProgramatlyName;
            string id         = Globals.GetProgramatlyName(ID.Name);

            id = Globals.ConvetStringToCamelCase(id);
            StringBuilder pageIndexHandler = new StringBuilder();

            pageIndexHandler.Append("\n\tprotected void " + dataGridID + "_DeleteCommand(object source, DataGridCommandEventArgs e)");
            pageIndexHandler.Append("\n\t{");
            //	pageIndexHandler.Append("\n\t\tTestData.Tables[0].Rows.Remove(TestData.Tables[0].Rows.Find(" + global.ViewAllDataGrid + ".DataKeys[e.Item.ItemIndex]));");
            pageIndexHandler.Append("\n\t\t" + Globals.GetAliasDataType(ID.Datatype) + " " + id + " = Convert.To" + Globals.GetDataType(ID.Datatype) + "(" + dataGridID + ".DataKeys[e.Item.ItemIndex]);");
            pageIndexHandler.Append("\n\t\tif(" + global.TableFactoryClass + "." + MethodType.Delete.ToString() + "(" + id + "))");
            pageIndexHandler.Append("\n\t\t{");
            pageIndexHandler.Append("\n\t\tint x = " + dataGridID + ".CurrentPageIndex;");
            pageIndexHandler.Append("\n\t\tif (" + dataGridID + ".PageCount - 1 > x) " + dataGridID + ".CurrentPageIndex = x;");
            pageIndexHandler.Append("\n\t\telse");
            pageIndexHandler.Append("\n\t\t{");
            pageIndexHandler.Append("\n\t\tif (" + dataGridID + ".PageCount != 1)" + dataGridID + ".CurrentPageIndex = x - 1;");
            pageIndexHandler.Append("\n\t\t}");
            pageIndexHandler.Append("\n\t\t\tLoadData();");
            pageIndexHandler.Append("\n\t\t}");
            pageIndexHandler.Append("\n\t}");
            return(pageIndexHandler.ToString());
            //
        }
Пример #2
0
        //
        private string CreateClearControlsMethod()
        {
            //
            StringBuilder method = new StringBuilder();

            method.Append("\n\tprivate void " + global.ClearControlsMethod);
            method.Append("\n\t{");
            string datatype;

            foreach (SQLDMO.Column column in Fields)
            {
                if (ID == null || column.Name != ID.Name || !Globals.CheckIsAddedBySql(ID))
                {
                    if (allParameters != null && !allParameters.Contains(column.Name))
                    {
                        continue;
                    }
                    datatype = Globals.GetAliasDataType(column.Datatype);

                    if (datatype == "bool")
                    {
                        method.Append("\n\t\tcb" + Globals.GetProgramatlyName(column.Name) + ".Checked=false;");
                    }
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                    {
                        method.Append("\n\t\tfck" + Globals.GetProgramatlyName(column.Name) + ".Value=\"\";");
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid")
                    {
                        TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                        if (cnstr == null)
                        {
                            //dateTime
                            if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.DateTime)
                            {
                                method.Append("\n\t\ttxt" + Globals.GetProgramatlyName(column.Name) + ".Value=\"\";");
                            }
                            //datetime
                            else
                            {
                                method.Append("\n\t\ttxt" + Globals.GetProgramatlyName(column.Name) + ".Text=\"\";");
                            }
                        }
                        else
                        {
                            method.Append("\n\t\tddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + ".SelectedIndex=-1;");
                            method.Append("\n\t\tddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + ".DataBind();");
                        }
                    }
                }
            }
            method.Append("\n\t}");
            return(method.ToString());
        }
        //
        #region ClassMember
        public string CreateEntityPropreties()
        {
            try
            {
                string xmlDocumentation = "";
                //
                StringBuilder EntityPropreties = new StringBuilder();
                //
                string dataType;
                foreach (Column colCurrent in Fields)
                {
                    dataType = Globals.GetAliasDataType(colCurrent.Datatype);
                    if (dataType == "string")
                    {
                        EntityPropreties.Append("\n\tprivate " + Globals.GetAliasDataType(colCurrent.Datatype) + " _" + Globals.GetProgramatlyName(colCurrent.Name) + "= \"\";");
                    }
                    else if (dataType == "Guid")
                    {
                        EntityPropreties.Append("\n\tprivate " + Globals.GetAliasDataType(colCurrent.Datatype) + " _" + Globals.GetProgramatlyName(colCurrent.Name) + "= Guid.NewGuid();");
                    }
                    else
                    {
                        EntityPropreties.Append("\n\tprivate " + Globals.GetAliasDataType(colCurrent.Datatype) + " _" + Globals.GetProgramatlyName(colCurrent.Name) + ";");
                    }
                    //XML Documentaion
                    xmlDocumentation  = "\n";
                    xmlDocumentation += "\t/// <summary>\n";
                    xmlDocumentation += "\t/// Gets or sets " + SqlProvider.obj.TableName + " " + Globals.GetProgramatlyName(colCurrent.Name) + ". \n";
                    xmlDocumentation += "\t/// </summary>";
                    EntityPropreties.Append(xmlDocumentation);
                    //Propretie body
                    EntityPropreties.Append("\n\tpublic " + Globals.GetAliasDataType(colCurrent.Datatype) + " " + Globals.GetProgramatlyName(colCurrent.Name));
                    EntityPropreties.Append("\n\t{");
                    EntityPropreties.Append("\n\t\tget { return _" + Globals.GetProgramatlyName(colCurrent.Name) + " ; }");
                    EntityPropreties.Append("\n\t\tset { _" + Globals.GetProgramatlyName(colCurrent.Name) + "= value ; }");
                    EntityPropreties.Append("\n\t}");
                    EntityPropreties.Append("\n\t" + Globals.MetthodsSeparator);
                }
                //

                EntityPropreties.Append("\n");
                return(EntityPropreties.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("My Generated Code Exception:" + ex.Message);
                return("");
            }
        }
Пример #4
0
 //-------------------------------------
 #endregion
 //----------------------------------------------------------
 #region CreateDeleteMethod
 public string CreateDeleteMethod()
 {
     try
     {
         string id = Globals.GetProgramatlyName(ID.Name);
         id = Globals.ConvetStringToCamelCase(id);
         string MethodName = StoredProcedureTypes.Delete.ToString();
         string sqlDataProviderMethodName = StoredProcedureTypes.Delete.ToString();
         string MethodParameters          = "(" + Globals.GetAliasDataType(ID.Datatype) + " " + id + ")";
         //XML Documentaion
         string xmlDeleteDocumentation = "\n\t/// <summary>\n";
         xmlDeleteDocumentation += "\t/// Deletes single " + SqlProvider.obj.TableName + " object .\n";
         xmlDeleteDocumentation += "\t/// <example>[Example]bool status=" + ClassName + "." + MethodName + "(" + id + ");.</example>\n";
         xmlDeleteDocumentation += "\t/// </summary>\n";
         xmlDeleteDocumentation += "\t/// <param name=\"" + id + "\">The " + global.EntityClassObject + " id.</param>\n";
         xmlDeleteDocumentation += "\t/// <returns>Status of delete operation.</returns>";
         //method body
         StringBuilder methodBody = new StringBuilder();
         methodBody.Append("\n\t#region --------------" + MethodName + "--------------");
         methodBody.Append(xmlDeleteDocumentation);
         methodBody.Append("\n\tpublic static bool " + MethodName + MethodParameters);
         methodBody.Append("\n\t{");
         //
         methodBody.Append("\n\t\tbool status =" + global.SqlDataProviderClass + ".Instance." + sqlDataProviderMethodName + "(" + id + ");");
         methodBody.Append("\n\t\tif (status)");
         methodBody.Append("\n\t\t{");
         methodBody.Append("\n\t\t\tstring cacheKey = GetChacheKey(" + id + ");");
         methodBody.Append("\n\t\t\tOurCache.Remove(cacheKey);");
         methodBody.Append("\n\t\t}");
         methodBody.Append("\n\t\treturn status;");
         //
         methodBody.Append("\n\t}");
         methodBody.Append("\n\t" + Globals.MetthodsSeparator);
         methodBody.Append("\n\t#endregion");
         return(methodBody.ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show("My Generated Code Exception:" + ex.Message);
         return("");
     }
 }
Пример #5
0
        //
        public void GenerateSupLoadMethods()
        {
            string datatype;

            foreach (SQLDMO.Column column in Fields)
            {
                if (ID == null || column.Name != ID.Name || !Globals.CheckIsAddedBySql(ID))
                {
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    if (datatype != "bool" && datatype != "byte[]" && datatype != "Object" && datatype != "Guid")
                    {
                        TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                        if (cnstr != null)
                        {
                            CreateSupLoadMethod(cnstr);
                        }
                    }
                }
            }
        }
        //--------------------------------------
        //
        protected string GenerateClass()
        {
            string id = Globals.GetProgramatlyName(ID.Name);

            id = Globals.ConvetStringToCamelCase(id);
            string headerProperity = "";
            string boxHeader       = "";

            if (Fields.Count >= 2)
            {
                SQLDMO.Column headerColumn = (SQLDMO.Column)Fields.Item(1);

                headerProperity = Globals.GetProgramatlyName(headerColumn.Name);
                boxHeader       = global.EntityClassObject + "." + headerProperity;
            }
            else
            {
                boxHeader = "\"\"";
            }
            StringBuilder pageCode = new StringBuilder();

            pageCode.Append("using System;\n");
            pageCode.Append("using System.Data;\n");
            pageCode.Append("using System.Configuration;\n");
            pageCode.Append("using System.Collections;\n");
            pageCode.Append("using System.Web;\n");
            pageCode.Append("using System.Web.Security;\n");
            pageCode.Append("using System.Web.UI;\n");
            pageCode.Append("using System.Web.UI.WebControls;\n");
            pageCode.Append("using System.Web.UI.WebControls.WebParts;\n");
            pageCode.Append("using System.Web.UI.HtmlControls;\n");
            pageCode.Append("using System.Drawing;\n");
            pageCode.Append("\npublic partial class Details : System.Web.UI.Page");
            pageCode.Append("\n{");
            pageCode.Append("\n\t#region --------------LoadData--------------");
            pageCode.Append("\n\t//---------------------------------------------------------");
            pageCode.Append("\n\t//Page_Load");
            pageCode.Append("\n\t//---------------------------------------------------------");
            pageCode.Append("\n\tprotected void Page_Load(object sender, EventArgs e)");
            pageCode.Append("\n\t{");
            pageCode.Append("\n\t\tif (!IsPostBack)");
            pageCode.Append("\n\t\t{");
            if (ProjectBuilder.HasConfiguration)
            {
                pageCode.Append("\n\t\t\tSiteOptions.CheckModuleWithHandling(Resources.SiteOptions." + SiteOptionsBuilder.GetHasPropertyString(Table) + ", ViewerType.User);");
            }
            pageCode.Append("\n\t\t\t//Set Boxes Headers");
            pageCode.Append("\n\t\t\tSetBoxesHeaders();");
            pageCode.Append("\n\t\t}");
            pageCode.Append("\n\t}");
            pageCode.Append("\n\t//--------------------------------------------------------");
            pageCode.Append("\n\t#endregion");
            pageCode.Append("\n\t");
            pageCode.Append("\n\t#region Set Boxes Headers");
            pageCode.Append("\n\t//--------------------------------------------------------");
            pageCode.Append("\n\t//Set Boxes Headers");
            pageCode.Append("\n\t//--------------------------------------------------------");
            pageCode.Append("\n\tprotected void SetBoxesHeaders()");
            pageCode.Append("\n\t{");
            SiteUrlsBuilder.AddParameter(Globals.GetProgramatlyName(ID.Name));
            pageCode.Append("\n\t\tif(MoversFW.Components.UrlManager.ChechIsValidIntegerParameter(" + SiteUrlsBuilder.GetIdentifire() + Globals.GetProgramatlyName(ID.Name) + "))");
            pageCode.Append("\n\t\t{");
            pageCode.Append("\n\t\t\t" + Globals.GetAliasDataType(ID.Datatype) + " " + id + " = Convert.To" + Globals.GetDataType(ID.Datatype) + "(Request.QueryString[" + SiteUrlsBuilder.GetIdentifire() + Globals.GetProgramatlyName(ID.Name) + "]);");

            pageCode.Append("\n\t\t\t" + global.TableEntityClass + " " + global.EntityClassObject + " =" + global.TableFactoryClass + ".Get" + global.TableProgramatlyName + "Object(" + id + ");");
            pageCode.Append("\n\t\t\tif (" + global.EntityClassObject + " != null)");
            pageCode.Append("\n\t\t\t{");
            pageCode.Append("\n\t\t\t\t" + masterBoxID + ".Header = " + boxHeader + ";");
            pageCode.Append("\n\t\t\t}");

            pageCode.Append("\n\t\t\telse");
            pageCode.Append("\n\t\t\t{");
            pageCode.Append("\n\t\t\t\tResponse.Redirect(\"/default.aspx\");");
            pageCode.Append("\n\t\t\t}");
            pageCode.Append("\n\t\t}");
            pageCode.Append("\n\t\telse");
            pageCode.Append("\n\t\t{");
            pageCode.Append("\n\t\t\tResponse.Redirect(\"/default.aspx\");");
            pageCode.Append("\n\t\t}");

            pageCode.Append("\n\t}");
            pageCode.Append("\n\t//--------------------------------------------------------");
            pageCode.Append("\n\t#endregion");
            pageCode.Append("\n}");
            return(pageCode.ToString());
        }
        private string CreateLoadData()
        {
            StringBuilder loadData = new StringBuilder();
            string        id       = Globals.GetProgramatlyName(ID.Name);

            id = Globals.ConvetStringToCamelCase(id);
            loadData.Append("\n\tprivate void LoadData()");
            loadData.Append("\n\t{try{");
            loadData.Append("\n\t\tif(Request.QueryString[\"" + id + "\"]!=null)");
            loadData.Append("\n\t\t{");
            loadData.Append("\n\t\t\t" + Globals.GetAliasDataType(ID.Datatype) + " " + id + " = Convert.To" + Globals.GetDataType(ID.Datatype) + "(Request.QueryString[\"" + id + "\"]);");

            loadData.Append("\n\t\t\t" + global.TableEntityClass + " " + global.EntityClassObject + " =" + global.TableFactoryClass + ".Get" + global.TableProgramatlyName + "Object(" + id + ");");
            string datatype;

            foreach (SQLDMO.Column column in Fields)
            {
                if (allParameters != null && !allParameters.Contains(column.Name))
                {
                    continue;
                }
                if (ID == null || column.Name != ID.Name)          //||!Globals.CheckIsAddedBySql(ID))
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    string ddl = "";
                    if (datatype == "string")
                    {
                        if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                        {
                            loadData.Append("\n\t\t\tfck" + Globals.GetProgramatlyName(column.Name) + ".Value = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ";");
                        }
                        else
                        {
                            if (cnstr == null)
                            {
                                loadData.Append("\n\t\t\ttxt" + Globals.GetProgramatlyName(column.Name) + ".Text = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ";");
                            }
                            else
                            {
                                ddl = "ddl" + Globals.GetProgramatlyName(cnstr.ParentTable);

                                loadData.Append("\n\t\t\tMyDropDownList.LoadDataAndSetSelectedValue(" + ddl + "," + Globals.GetProgramatlyName(cnstr.ParentTable) + "Factory.GetAll(),\"" +
                                                SqlProvider.obj.GetExpectedNameForParent(cnstr.ParentTable) + "\",\"" + Globals.GetProgramatlyName(cnstr.ParentColID) + "\"," + global.EntityClassObject + "." +
                                                Globals.GetProgramatlyName(column.Name) + ".ToString());");
                            }
                        }
                    }
                    //DateTime
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.DateTime)
                    {
                        loadData.Append("\n\t\t\ttxt" + Globals.GetProgramatlyName(column.Name) + ".Value = Convert.ToString(" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ");");
                    }
                    //DateTime
                    else if (datatype == "bool")
                    {
                        loadData.Append("\n\t\t\tcb" + Globals.GetProgramatlyName(column.Name) + ".Checked = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ";");
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid")
                    {
                        if (cnstr == null)
                        {
                            loadData.Append("\n\t\t\ttxt" + Globals.GetProgramatlyName(column.Name) + ".Text = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ".ToString();");
                        }
                        else
                        {
                            ddl = "ddl" + Globals.GetProgramatlyName(cnstr.ParentTable);

                            loadData.Append("\n\t\t\tMyDropDownList.LoadDataAndSetSelectedValue(" + ddl + "," + Globals.GetProgramatlyName(cnstr.ParentTable) + "Factory.GetAll(),\"" +
                                            SqlProvider.obj.GetExpectedNameForParent(cnstr.ParentTable) + "\",\"" + Globals.GetProgramatlyName(cnstr.ParentColID) + "\"," + global.EntityClassObject + "." +
                                            Globals.GetProgramatlyName(column.Name) + ".ToString());");
                        }
                    }
                }
            }

            loadData.Append("\n\t\t}");
            loadData.Append("\n\t\telse");
            loadData.Append("\n\t\tthis.Visible=false;");
            loadData.Append("\n\t}catch{Response.Redirect(\"default.aspx\");}}");
            return(loadData.ToString());
        }
Пример #8
0
        //

        private string GenerateControls()
        {
            StringBuilder controls = new StringBuilder();

            controls.Append("\n\t\t\t\t<tr>");
            controls.Append("\n\t\t\t\t\t<td class=\"Result\" align=\"center\" colspan=\"2\">");
            controls.Append("\n\t\t\t\t\t\t<asp:Label id=\"lblResult\" runat=\"server\"></asp:Label>");
            controls.Append("\n\t\t\t\t\t</td>");
            controls.Append("\n\t\t\t\t</tr>");
            string datatype;

            foreach (Column column in Fields)
            {
                if (allParameters != null && !allParameters.Contains(column.Name))
                {
                    continue;
                }
                if (ID == null || column.Name != ID.Name || !Globals.CheckIsAddedBySql(ID))
                {
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    if (datatype == "bool")
                    {
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Title\">" + column.Name + "</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        controls.Append("\n\t\t\t\t\t\t<asp:CheckBox id=\"cb" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ValidationGroup=\"" + ClassName + "\" ></asp:CheckBox>");
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                    {
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Title\">" + column.Name + "</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        //FREETEXTBOX
                        controls.Append("\n\t\t\t\t\t\t<FTB:FREETEXTBOX id=\"ftb" + Globals.GetProgramatlyName(column.Name) + "\"   runat=\"server\"  TextDirection=\"RightToLeft\" ");
                        controls.Append("\n\t\t\t\t\t\tToolbarLayout=\"Bold,Italic,Underline,Strikethrough,Superscript,Subscript;");
                        controls.Append("\n\t\t\t\t\t\tJustifyLeft,JustifyRight,JustifyCenter,JustifyFull;");
                        controls.Append("\n\t\t\t\t\t\tCut,Copy,Paste,Delete,Undo,Redo,Print,Save,ieSpellCheck|");
                        controls.Append("\n\t\t\t\t\t\tParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontBackColorsMenu,FontForeColorPicker,FontBackColorPicker|StyleMenu,SymbolsMenu,InsertHtmlMenu|InsertRule,InsertDate,InsertTime|WordClean|");
                        controls.Append("\n\t\t\t\t\t\tCreateLink,Unlink;RemoveFormat,BulletedList,NumberedList,Indent,Outdent;InsertTable,EditTable,InsertTableRowBefore,InsertTableRowAfter,DeleteTableRow,InsertTableColumnBefore,InsertTableColumnAfter,DeleteTableColumn|\"");
                        controls.Append("\n\t\t\t\t\t\tSupportFolder=\"/phyEditorImages/FreeTextBox/\" ButtonSet=\"NotSet\"  Width=\"450px\" ButtonWidth=\"21\"></FTB:FREETEXTBOX>");                                           //
                        //-----------
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                        //
                        IshasFreeTextBoxControl = true;
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid")
                    {
                        TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Title\">" + column.Name + "</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        if (cnstr == null)
                        {
                            controls.Append("\n\t\t\t\t\t\t<asp:TextBox id=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\"  CssClass=\"Control\" MaxLength=\"" + Globals.GetTextBoxMaxLength(column) + "\" ValidationGroup=\"" + ClassName + "\" ></asp:TextBox>");
                            if (!column.AllowNulls)
                            {
                                controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator id=\"rfv" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" ValidationGroup=\"" + ClassName + "\">ÃÏÎá åÐÇ ÇáÈíÇä</asp:RequiredFieldValidator>");
                            }
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t\t\t<asp:DropDownList id=\"ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + "\" runat=\"server\" CssClass=\"Control\" ValidationGroup=\"" + ClassName + "\" ></asp:DropDownList>");
                        }

                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                }
            }
            controls.Append("\n\t\t\t\t<tr>");
            controls.Append("\n\t\t\t\t\t<td class=\"Result\" align=\"center\" colspan=\"2\">");
            controls.Append("\n\t\t\t\t\t\t<asp:Button id=\"btnCreate\" runat=\"server\" Width=\"100px\" Text=\"ÅÖÇÝÉ\" CssClass=\"Submit\" OnClick=\"btnCreate_Click\" ValidationGroup=\"" + ClassName + "\"></asp:Button>");
            controls.Append("\n\t\t\t\t\t</td>");
            controls.Append("\n\t\t\t\t</tr>");

            return(controls.ToString());
        }
Пример #9
0
        //
        private string Create_CreateButtonHandler()
        {
            StringBuilder _CreateButtonHandler = new StringBuilder();

            _CreateButtonHandler.Append("\n\tprotected void btnCreate_Click(object sender, System.EventArgs e)");
            _CreateButtonHandler.Append("\n\t{");
            _CreateButtonHandler.Append("\n\t\tif (!Page.IsValid)");
            _CreateButtonHandler.Append("\n\t\t{");
            _CreateButtonHandler.Append("\n\t\t\treturn;");
            _CreateButtonHandler.Append("\n\t\t}");
            _CreateButtonHandler.Append("\n\t\t" + global.TableEntityClass + " " + global.EntityClassObject + " = new " + global.TableEntityClass + "();");
            string datatype;

            foreach (SQLDMO.Column column in Fields)
            {
                if (allParameters != null && !allParameters.Contains(column.Name))
                {
                    continue;
                }
                if (ID == null || column.Name != ID.Name || !Globals.CheckIsAddedBySql(ID))
                {
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    if (datatype == "string")
                    {
                        if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                        {
                            _CreateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = fck" + Globals.GetProgramatlyName(column.Name) + ".Value;");
                        }
                        else
                        {
                            if (cnstr == null)
                            {
                                _CreateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = txt" + Globals.GetProgramatlyName(column.Name) + ".Text;");
                            }
                            else
                            {
                                _CreateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + ".SelectedValue;");
                            }
                        }
                    }
                    //DateTime
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.DateTime)
                    {
                        _CreateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = Convert.To" + Globals.GetDataType(column.Datatype) + "(txt" + Globals.GetProgramatlyName(column.Name) + ".Value);");
                    }
                    //DateTime
                    else if (datatype == "bool")
                    {
                        _CreateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = cb" + Globals.GetProgramatlyName(column.Name) + ".Checked;");
                    }
                    else if (datatype == "Guid")
                    {
                        _CreateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = Guid.NewGuid();");
                    }
                    else if (datatype != "byte[]" && datatype != "Object")
                    {
                        if (cnstr == null)
                        {
                            _CreateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = Convert.To" + Globals.GetDataType(column.Datatype) + "(txt" + Globals.GetProgramatlyName(column.Name) + ".Text);");
                        }
                        else
                        {
                            _CreateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = Convert.To" + Globals.GetDataType(column.Datatype) + "(ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + ".SelectedValue);");
                        }
                    }
                }
            }
            _CreateButtonHandler.Append("\n\t\tbool result = " + global.TableFactoryClass + "." + MethodType.Create.ToString() + "(" + global.EntityClassObject + ");");
            _CreateButtonHandler.Append("\n\t\tif(result)");

            _CreateButtonHandler.Append("\n\t\t{");
            _CreateButtonHandler.Append("\n\t\t\tlblResult.ForeColor=Color.Blue ;");
            _CreateButtonHandler.Append("\n\t\t\tlblResult.Text=\"Êã ÇáÅÖÇÝÉ ÈäÌÇÍ\";");
            _CreateButtonHandler.Append("\n\t\t\t" + global.ClearControlsMethod + ";");
            _CreateButtonHandler.Append("\n\t\t}");
            _CreateButtonHandler.Append("\n\t\telse");
            _CreateButtonHandler.Append("\n\t\t{");
            _CreateButtonHandler.Append("\n\t\t\tlblResult.ForeColor=Color.Red ;");
            _CreateButtonHandler.Append("\n\t\t\tlblResult.Text=\"ÝÔáÊ ÚãáíÉ  ÇáÅÖÇÝÉ\";");
            _CreateButtonHandler.Append("\n\t\t}");
            _CreateButtonHandler.Append("\n\t}");
            return(_CreateButtonHandler.ToString());
        }
Пример #10
0
 //-------------------------------------
 #endregion
 //----------------------------------------------------------
 #region CreateGetChacheKeyMethod
 public string CreateGetChacheKeyMethod()
 {
     if (ID != null)
     {
         try
         {
             string id = Globals.GetProgramatlyName(ID.Name);
             id = Globals.ConvetStringToCamelCase(id);
             //
             string MethodName   = "GetChacheKey";
             string MethodReturn = "string";
             //Method Body
             StringBuilder methodBody = new StringBuilder();
             methodBody.Append("\n\t#region --------------" + MethodName + "--------------");
             methodBody.Append("\n\tpublic static  " + MethodReturn + " " + MethodName + "(" + Globals.GetAliasDataType(ID.Datatype) + " " + id + ")");
             methodBody.Append("\n\t{");
             methodBody.Append("\n\t\treturn \" " + global.TableProgramatlyName + "-\" + " + id + ";");
             methodBody.Append("\n\t}");
             methodBody.Append("\n\t" + Globals.MetthodsSeparator);
             methodBody.Append("\n\t#endregion");
             return(methodBody.ToString());
         }
         catch (Exception ex)
         {
             MessageBox.Show("My Generated Code Exception:" + ex.Message);
             return("");
         }
     }
     else
     {
         return("");
     }
 }
Пример #11
0
        //
        protected string GenerateControls()
        {
            StringBuilder controls = new StringBuilder();
            string        datatype;

            foreach (SQLDMO.Column column in Fields)
            {
                //if (ID == null || column.Name != ID.Name)//||!Globals.CheckIsAddedBySql(ID))
                if ((ID == null || column.Name != ID.Name) && (column.Name.IndexOf("_") < 0) &&
                    column.Name.ToLower().IndexOf("password") < 0 &&
                    column.Name.ToLower().IndexOf("shortdescription") < 0 &&
                    column.Name.ToLower().IndexOf(ProjectBuilder.PriorityColumnName.ToLower()) < 0 &&
                    column.Name.ToLower().IndexOf(ProjectBuilder.IsAvailable.ToLower()) < 0 &&
                    column.Name.ToLower() != ProjectBuilder.LangID)
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    if (datatype == "bool")
                    {
                        controls.Append("\n\t\t\t\t<tr id=\"tr" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\">");
                        controls.Append("\n\t\t\t\t\t<td class=\"text\">");
                        controls.Append("\n\t\t\t\t\t\t<span class=\"text\">");
                        controls.Append("\n\t\t\t\t\t\t\t" + ResourcesTesxtsBuilder.AddUserText(Globals.GetProgramatlyName(column.Name), TextType.HtmlClassic));
                        controls.Append("\n\t\t\t\t\t\t</span>");
                        controls.Append("\n\t\t\t\t\t\t<span class=\"value\">");
                        controls.Append("\n\t\t\t\t\t\t\t<asp:Label id=\"lbl" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ></asp:Label>");
                        controls.Append("\n\t\t\t\t\t\t</span>");
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                    {
                        if (column.Name.ToLower().IndexOf("details") > -1 || column.Name.ToLower().IndexOf("description") > -1)
                        {
                            hasDetails   = true;
                            detailsLabel = "lbl" + Globals.GetProgramatlyName(column.Name);
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t<tr id=\"tr" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\">");
                            controls.Append("\n\t\t\t\t\t<td class=\"text\">");
                            controls.Append("\n\t\t\t\t\t\t<span class=\"text\">");
                            controls.Append("\n\t\t\t\t\t\t\t" + ResourcesTesxtsBuilder.AddUserText(Globals.GetProgramatlyName(column.Name), TextType.HtmlClassic));
                            controls.Append("\n\t\t\t\t\t\t</span>");
                            controls.Append("\n\t\t\t\t\t\t<br />");
                            controls.Append("\n\t\t\t\t\t\t<span class=\"value\">");
                            controls.Append("\n\t\t\t\t\t\t\t<asp:Label id=\"lbl" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ></asp:Label>");
                            controls.Append("\n\t\t\t\t\t\t</span>");
                            controls.Append("\n\t\t\t\t\t</td>");
                            controls.Append("\n\t\t\t\t</tr>");
                        }
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid" && column.Name.ToLower().IndexOf("password") < 0 && column.Name.ToLower() != ProjectBuilder.LangID)
                    {
                        if (column.Name.IndexOf(ProjectBuilder.ExtensionInColumnName) > -1)
                        {
                            if (column.Name == ProjectBuilder.PhotoExtensionColumnName)
                            {
                                hasPhoto = true;
                            }
                            else if (column.Name == "LogoExtension")
                            {
                                hasLogo = true;
                            }
                            else if (column.Name == "FileExtension")
                            {
                                controls.Append("\n\t\t\t\t<tr id=\"tr" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\">");
                                controls.Append("\n\t\t\t\t\t<td class=\"text\">");
                                controls.Append("\n\t\t\t\t\t\t<span class=\"text\">");
                                controls.Append("\n\t\t\t\t\t\t\t" + ResourcesTesxtsBuilder.AddUserText(Globals.GetProgramatlyName(column.Name), TextType.HtmlClassic));
                                controls.Append("\n\t\t\t\t\t\t</span>");
                                controls.Append("\n\t\t\t\t\t\t<span class=\"value\">");
                                controls.Append("\n\t\t\t\t\t\t\t<asp:HyperLink ID=\"" + fileName + "\" runat=\"server\" />");
                                controls.Append("\n\t\t\t\t\t\t</span>");
                                controls.Append("\n\t\t\t\t\t</td>");
                                controls.Append("\n\t\t\t\t</tr>");
                            }
                            else if (column.Name.IndexOf("Extension") > -1)
                            {
                                string[] stringSeparators = new string[] { "Extension" };
                                string[] separatingResult = column.Name.Split(stringSeparators, StringSplitOptions.None);
                                string   propertyName     = separatingResult[0];
                                controls.Append("\n\t\t\t\t<tr id=\"tr" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\">");
                                controls.Append("\n\t\t\t\t\t<td class=\"text\">");
                                controls.Append("\n\t\t\t\t\t\t<span class=\"text\">");
                                controls.Append("\n\t\t\t\t\t\t\t" + ResourcesTesxtsBuilder.AddUserText(Globals.GetProgramatlyName(column.Name), TextType.HtmlClassic));
                                controls.Append("\n\t\t\t\t\t\t</span>");
                                controls.Append("\n\t\t\t\t\t\t<span class=\"value\">");
                                controls.Append("\n\t\t\t\t\t\t\t<asp:HyperLink ID=\"hl" + propertyName + "\" runat=\"server\"   />");
                                controls.Append("\n\t\t\t\t\t\t</span>");
                                controls.Append("\n\t\t\t\t\t</td>");
                                controls.Append("\n\t\t\t\t</tr>");
                            }
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t<tr id=\"tr" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\">");
                            controls.Append("\n\t\t\t\t\t<td class=\"text\">");
                            controls.Append("\n\t\t\t\t\t\t<span class=\"text\">");
                            controls.Append("\n\t\t\t\t\t\t\t" + ResourcesTesxtsBuilder.AddUserText(Globals.GetProgramatlyName(column.Name), TextType.HtmlClassic));
                            controls.Append("\n\t\t\t\t\t\t</span>");
                            controls.Append("\n\t\t\t\t\t\t<span class=\"value\">");
                            controls.Append("\n\t\t\t\t\t\t\t<asp:Label id=\"lbl" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ></asp:Label>");
                            controls.Append("\n\t\t\t\t\t\t</span>");
                            controls.Append("\n\t\t\t\t\t</td>");
                            controls.Append("\n\t\t\t\t</tr>");
                        }
                    }
                }
            }

            //controls.Append("\n\t\t\t\t\t</td>");
            //controls.Append("\n\t\t\t\t</tr>");
            //
            return(controls.ToString());
        }
Пример #12
0
        private string CreateGetOne4ShowMethod(StoredProcedureTypes type)
        {
            if (ID != null)
            {
                try
                {
                    string id = Globals.GetProgramatlyName(ID.Name);
                    id = Globals.ConvetStringToCamelCase(id);
                    //
                    string ProcName     = global.TableProgramatlyName + "_" + type.ToString();
                    string MethodName   = "Get" + global.TableProgramatlyName + "Object4Show";
                    string MethodReturn = global.TableEntityClass;
                    //XML Documentaion
                    string xmlDocumentation = "\t/// <summary>\n";
                    xmlDocumentation += "\t/// Gets single " + SqlProvider.obj.TableName + " object .\n";
                    xmlDocumentation += "\t/// <example>[Example]" + global.TableEntityClass + " " + global.EntityClassObject + "=" + ClassName + ".Instance." + MethodName + "(" + id + ");.</example>\n";
                    xmlDocumentation += "\t/// </summary>\n";
                    xmlDocumentation += "\t/// <param name=\"" + id + "\">The " + global.EntityClassObject + " id.</param>\n";
                    xmlDocumentation += "\t/// <returns>" + SqlProvider.obj.TableName + " object4Show.</returns>";
                    //Method Body
                    StringBuilder methodBody = new StringBuilder();
                    methodBody.Append(xmlDocumentation);
                    methodBody.Append("\n\tpublic  " + MethodReturn + " " + MethodName + "(" + Globals.GetAliasDataType(ID.Datatype) + " " + id + ")");
                    methodBody.Append("\n\t{");
                    methodBody.Append("\n\t\t" + global.TableEntityClass + " " + global.EntityClassObject + " = null;");
                    methodBody.Append("\n\t\tusing( SqlConnection myConnection = GetSqlConnection()) ");
                    methodBody.Append("\n\t\t{");
                    methodBody.Append("\n\t\t\tSqlCommand myCommand = new SqlCommand(\"" + ProcName + "\", myConnection);");
                    methodBody.Append("\n\t\t\tmyCommand.CommandType = CommandType.StoredProcedure;");
                    methodBody.Append("\n\t\t\t// Set the parameters");

                    methodBody.Append("\n\t\t\tmyCommand.Parameters.Add(\"@" + Globals.GetProgramatlyName(ID.Name) + "\", SqlDbType." + Globals.GetSqlDataType(ID.Datatype).ToString() + "," + ID.Length + ").Value = " + id + ";");
                    methodBody.Append("\n\t\t\t// Execute the command");
                    methodBody.Append("\n\t\t\tmyConnection.Open();");
                    methodBody.Append("\n\t\t\tusing(SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))");
                    methodBody.Append("\n\t\t\t{");
                    methodBody.Append("\n\t\t\t\tif(dr.Read())");
                    methodBody.Append("\n\t\t\t\t{");
                    methodBody.Append("\n\t\t\t\t\t" + global.EntityClassObject + " = " + global.PopulateMethodName + "(dr);");
                    methodBody.Append("\n\t\t\t\t}");
                    methodBody.Append("\n\t\t\t\tdr.Close();");
                    methodBody.Append("\n\t\t}");
                    methodBody.Append("\n\t\t\tmyConnection.Close();");
                    //-------------------------------------


                    methodBody.Append("\n\t\t\treturn " + global.EntityClassObject + ";");
                    methodBody.Append("\n\t\t}");
                    methodBody.Append("\n\t}");
                    methodBody.Append("\n\t" + Globals.MetthodsSeparator);
                    return(methodBody.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("My Generated Code Exception:" + ex.Message);
                    return("");
                }
            }
            else
            {
                return("");
            }
        }
        //
        #region ClassMember
        public string CreateInfoPropreties()
        {
            try
            {
                //Add Optional
                if (ProjectBuilder.HasConfiguration)
                {
                    string tableOptional = SiteOptionsBuilder.GetHasPropertyString(global.TableProgramatlyName);
                    SiteOptionsBuilder.AddSiteOption(tableOptional);
                }
                //
                string xmlDocumentation = "";
                //
                StringBuilder EntityPropreties = new StringBuilder();
                //
                string dataType;
                string dataTypeAlias;
                string propertyName;
                string memberName;
                foreach (SQLDMO.Column colCurrent in Fields)
                {
                    //Note dataType for checks & dataTypeAlias for writing
                    dataType      = Globals.GetAliasDataType(colCurrent.Datatype);
                    dataTypeAlias = dataType;
                    propertyName  = Globals.GetProgramatlyName(colCurrent.Name);
                    memberName    = " _" + Globals.GetProgramatlyName(colCurrent.Name);
                    #region Base Property
                    EntityPropreties.Append("\n\t#region --------------" + propertyName + "--------------");
                    if (colCurrent.Name.ToLower() == "langid")
                    {
                        dataTypeAlias = "Languages";
                    }
                    if (dataType == "string")
                    {
                        EntityPropreties.Append("\n\tprivate " + dataTypeAlias + memberName + "= \"\";");
                    }
                    else if (dataType == "Guid")
                    {
                        EntityPropreties.Append("\n\tprivate " + dataTypeAlias + memberName + "= Guid.NewGuid();");
                    }
                    else if (dataType == "DateTime")
                    {
                        EntityPropreties.Append("\n\tprivate " + dataTypeAlias + memberName + "= DateTime.MinValue;");
                    }
                    else
                    {
                        EntityPropreties.Append("\n\tprivate " + dataTypeAlias + memberName + ";");
                    }
                    //XML Documentaion
                    xmlDocumentation  = "\n";
                    xmlDocumentation += "\n\t/// <summary>\n";
                    xmlDocumentation += "\t/// Gets or sets " + SqlProvider.obj.TableName + " " + propertyName + ". \n";
                    xmlDocumentation += "\t/// </summary>";
                    if (ProjectBuilder.AllowXmlDocumentation)
                    {
                        EntityPropreties.Append(xmlDocumentation);
                    }
                    //Propretie body
                    EntityPropreties.Append("\n\tpublic " + dataTypeAlias + " " + propertyName);
                    EntityPropreties.Append("\n\t{");
                    EntityPropreties.Append("\n\t\tget { return " + memberName + " ; }");
                    EntityPropreties.Append("\n\t\tset { " + memberName + "= value ; }");
                    EntityPropreties.Append("\n\t}");
                    EntityPropreties.Append("\n\t" + Globals.MetthodsSeparator);
                    EntityPropreties.Append("\n\t#endregion");
                    #endregion
                    if (ProjectBuilder.HasProprety)
                    {
                        #region ------------HasProperty---------------
                        if ((ID == null || colCurrent.Name != ID.Name))
                        {
                            string hasPropertyString     = SiteOptionsBuilder.GetHasPropertyString(propertyName);
                            string fullHasPropertyString = SiteOptionsBuilder.GetFullHasPropertyString(propertyName);
                            string conditionLine         = "";
                            if (ProjectBuilder.HasConfiguration)
                            {
                                SiteOptionsBuilder.AddTableOption(fullHasPropertyString);
                            }
                            if (dataType == "string" || dataType == "byte[]")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + ".Length > 0" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + ".Length > 0) ";
                                }
                                //--------------------------------------------------
                            }

                            else if (dataType == "bool")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + ") ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "DateTime")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " != DateTime.MinValue" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " != DateTime.MinValue) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "decimal")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " > 0.0" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " > 0.0) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "double")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " > 0.0" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " > 0.0) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "Single")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " != null" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " != null) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "short")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " > 0" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " > 0) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "int")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " > 0" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " > 0) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "long")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " > 0" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " > 0) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "byte")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " > 0" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " > 0) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "Guid")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " != null" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " != null) ";
                                }
                                //--------------------------------------------------
                            }
                            else if (dataType == "Object")
                            {
                                //--------------------------------------------------
                                if (ProjectBuilder.HasConfiguration)
                                {
                                    conditionLine = "if( " + memberName + " != null" + SiteOptionsBuilder.GetOptionalCondition(fullHasPropertyString, true) + ") ";
                                }
                                else
                                {
                                    conditionLine = "if( " + memberName + " != null) ";
                                }
                                //--------------------------------------------------
                            }



                            EntityPropreties.Append("\n\t#region --------------" + hasPropertyString + "--------------");
                            EntityPropreties.Append("\n\tpublic bool " + hasPropertyString);
                            EntityPropreties.Append("\n\t{");
                            EntityPropreties.Append("\n\t\tget");
                            EntityPropreties.Append("\n\t\t{");
                            EntityPropreties.Append("\n\t\t\t" + conditionLine);
                            EntityPropreties.Append("\n\t\t\t{ ");
                            EntityPropreties.Append("\n\t\t\t\treturn true;");
                            EntityPropreties.Append("\n\t\t\t} ");
                            EntityPropreties.Append("\n\t\t\telse");
                            EntityPropreties.Append("\n\t\t\t{");
                            EntityPropreties.Append("\n\t\t\t\treturn false;");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t}");
                            EntityPropreties.Append("\n\t}");
                            EntityPropreties.Append("\n\t" + Globals.MetthodsSeparator);
                            EntityPropreties.Append("\n\t#endregion");
                            //------------------------------------------
                        }
                        #endregion
                    }
                    #region Additional Properties for files properties
                    //Additional Properties for files properties
                    if (dataType == "string" && colCurrent.Name.IndexOf("Extension") > -1)
                    {
                        string[] stringSeparators = new string[] { "Extension" };
                        string[] separatingResult = colCurrent.Name.Split(stringSeparators, StringSplitOptions.None);
                        propertyName = separatingResult[0];

                        //Property
                        EntityPropreties.Append("\n\t#region --------------" + propertyName + "--------------");

                        EntityPropreties.Append("\n\tpublic string " + propertyName);
                        EntityPropreties.Append("\n\t{");
                        EntityPropreties.Append("\n\t\tget");
                        EntityPropreties.Append("\n\t\t{");
                        EntityPropreties.Append("\n\t\t\tif( " + memberName + ".Length > 0) ");
                        EntityPropreties.Append("\n\t\t\t{ ");
                        EntityPropreties.Append("\n\t\t\t\treturn " + global.TableFactoryClass + ".Create" + Table + propertyName + "Name(_" + Globals.GetProgramatlyName(ID.Name) + ")+ " + memberName + ";");
                        EntityPropreties.Append("\n\t\t\t}");
                        EntityPropreties.Append("\n\t\t\telse");
                        EntityPropreties.Append("\n\t\t\t{");
                        EntityPropreties.Append("\n\t\t\t\treturn \"\";");
                        EntityPropreties.Append("\n\t\t\t}");
                        EntityPropreties.Append("\n\t\t}");
                        EntityPropreties.Append("\n\t}");
                        EntityPropreties.Append("\n\t" + Globals.MetthodsSeparator);
                        EntityPropreties.Append("\n\t#endregion");
                        //----------------------------------------------------------
                        //Additional photos Properties
                        if (colCurrent.Name.ToLower().IndexOf("photo") > -1 || colCurrent.Name.ToLower().IndexOf("logo") > -1)
                        {
                            //Micro thumbnail
                            EntityPropreties.Append("\n\t#region --------------Micro" + propertyName + "Thumbs--------------");
                            EntityPropreties.Append("\n\tpublic string Micro" + propertyName + "Thumbs");
                            EntityPropreties.Append("\n\t{");
                            EntityPropreties.Append("\n\t\tget");
                            EntityPropreties.Append("\n\t\t{");
                            EntityPropreties.Append("\n\t\t\tif( " + memberName + ".Length > 0) ");
                            EntityPropreties.Append("\n\t\t\t{ ");
                            EntityPropreties.Append("\n\t\t\t\treturn " + global.TableFactoryClass + ".Create" + Table + propertyName + "Name(_" + Globals.GetProgramatlyName(ID.Name) + ")+  MoversFW.Thumbs.thumbnailExetnsion ;");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t\telse");
                            EntityPropreties.Append("\n\t\t\t{");
                            EntityPropreties.Append("\n\t\t\t\treturn \"\";");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t}");
                            EntityPropreties.Append("\n\t}");
                            EntityPropreties.Append("\n\t" + Globals.MetthodsSeparator);
                            EntityPropreties.Append("\n\t#endregion");
                            //-----------------------------------------------------------
                            //Mini thumbnail
                            EntityPropreties.Append("\n\t#region --------------Mini" + propertyName + "Thumbs--------------");
                            EntityPropreties.Append("\n\tpublic string Mini" + propertyName + "Thumbs");
                            EntityPropreties.Append("\n\t{");
                            EntityPropreties.Append("\n\t\tget");
                            EntityPropreties.Append("\n\t\t{");
                            EntityPropreties.Append("\n\t\t\tif( " + memberName + ".Length > 0) ");
                            EntityPropreties.Append("\n\t\t\t{ ");
                            EntityPropreties.Append("\n\t\t\t\treturn " + global.TableFactoryClass + ".Create" + Table + propertyName + "Name(_" + Globals.GetProgramatlyName(ID.Name) + ")+  MoversFW.Thumbs.thumbnailExetnsion ;");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t\telse");
                            EntityPropreties.Append("\n\t\t\t{");
                            EntityPropreties.Append("\n\t\t\t\treturn \"\";");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t}");
                            EntityPropreties.Append("\n\t}");
                            EntityPropreties.Append("\n\t" + Globals.MetthodsSeparator);
                            EntityPropreties.Append("\n\t#endregion");
                            //-----------------------------------------------------------
                            //Normal thumbnail
                            EntityPropreties.Append("\n\t#region --------------Normal" + propertyName + "Thumbs--------------");
                            EntityPropreties.Append("\n\tpublic string Normal" + propertyName + "Thumbs");
                            EntityPropreties.Append("\n\t{");
                            EntityPropreties.Append("\n\t\tget");
                            EntityPropreties.Append("\n\t\t{");
                            EntityPropreties.Append("\n\t\t\tif( " + memberName + ".Length > 0) ");
                            EntityPropreties.Append("\n\t\t\t{ ");
                            EntityPropreties.Append("\n\t\t\t\treturn " + global.TableFactoryClass + ".Create" + Table + propertyName + "Name(_" + Globals.GetProgramatlyName(ID.Name) + ")+  MoversFW.Thumbs.thumbnailExetnsion ;");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t\telse");
                            EntityPropreties.Append("\n\t\t\t{");
                            EntityPropreties.Append("\n\t\t\t\treturn \"\";");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t}");
                            EntityPropreties.Append("\n\t}");
                            EntityPropreties.Append("\n\t" + Globals.MetthodsSeparator);
                            EntityPropreties.Append("\n\t#endregion");
                            //-----------------------------------------------------------
                            //Big thumbnail
                            EntityPropreties.Append("\n\t#region --------------Big" + propertyName + "Thumbs--------------");
                            EntityPropreties.Append("\n\tpublic string Big" + propertyName + "Thumbs");
                            EntityPropreties.Append("\n\t{");
                            EntityPropreties.Append("\n\t\tget");
                            EntityPropreties.Append("\n\t\t{");
                            EntityPropreties.Append("\n\t\t\tif( " + memberName + ".Length > 0) ");
                            EntityPropreties.Append("\n\t\t\t{ ");
                            EntityPropreties.Append("\n\t\t\t\treturn " + global.TableFactoryClass + ".Create" + Table + propertyName + "Name(_" + Globals.GetProgramatlyName(ID.Name) + ")+  MoversFW.Thumbs.thumbnailExetnsion ;");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t\telse");
                            EntityPropreties.Append("\n\t\t\t{");
                            EntityPropreties.Append("\n\t\t\t\treturn \"\";");
                            EntityPropreties.Append("\n\t\t\t}");
                            EntityPropreties.Append("\n\t\t}");
                            EntityPropreties.Append("\n\t}");
                            EntityPropreties.Append("\n\t" + Globals.MetthodsSeparator);
                            EntityPropreties.Append("\n\t#endregion");
                            //-----------------------------------------------------------
                        }
                    }
                    #endregion
                }
                //

                EntityPropreties.Append("\n");
                return(EntityPropreties.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("My Generated Code Exception:" + ex.Message);
                return("");
            }
        }
        protected string GenerateControls()
        {
            string        propertyName;
            string        trPropertyName;
            string        datatype;
            StringBuilder controls         = new StringBuilder();
            bool          hasPasswordField = false;

            controls.Append("\n\t\t\t\t<tr>");
            controls.Append("\n\t\t\t\t\t<td class=\"Result\" align=\"center\" colspan=\"2\">");
            controls.Append("\n\t\t\t\t\t\t<asp:Label id=\"lblResult\" runat=\"server\"></asp:Label>");
            controls.Append("\n\t\t\t\t\t</td>");
            controls.Append("\n\t\t\t\t</tr>");
            foreach (SQLDMO.Column column in Fields)
            {
                propertyName   = Globals.GetProgramatlyName(column.Name);
                trPropertyName = "tr" + propertyName;
                //if (ID == null || column.Name != ID.Name)//||!Globals.CheckIsAddedBySql(ID))
                if ((ID == null || column.Name != ID.Name) && (column.Name.IndexOf("_") < 0) && column.Name.ToLower() != ProjectBuilder.LangID)
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    if (datatype == "bool")
                    {
                        if (ProjectBuilder.HasConfiguration)
                        {
                            controls.Append("\n\t\t\t\t<tr id=\"" + trPropertyName + "\" runat=\"server\" >");
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t<tr>");
                        }
                        controls.Append("\n\t\t\t\t\t<td class=\"Text\">" + ResourcesTesxtsBuilder.AddUserText(propertyName, TextType.HtmlClassic));
                        if (!column.AllowNulls)
                        {
                            controls.Append("<span class=\"RequiredField\"><asp:Label runat=\"server\" Text=\"*\" /></span>");
                        }
                        controls.Append("</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        if (propertyName.ToLower().IndexOf("isavailable") > -1)
                        {
                            controls.Append("\n\t\t\t\t\t\t<asp:CheckBox id=\"cb" + propertyName + "\" Checked=\"true\" CssClass=\"Controls\" runat=\"server\" ValidationGroup=\"" + Table + "\"></asp:CheckBox>");
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t\t\t<asp:CheckBox id=\"cb" + propertyName + "\" CssClass=\"Controls\" runat=\"server\" ValidationGroup=\"" + Table + "\"></asp:CheckBox>");
                        }

                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                    {
                        if (column.Name.ToLower().IndexOf("details") > -1)
                        {
                            if (ProjectBuilder.HasConfiguration)
                            {
                                controls.Append("\n\t\t\t\t<tr id=\"" + trPropertyName + "\" runat=\"server\" >");
                            }
                            else
                            {
                                controls.Append("\n\t\t\t\t<tr>");
                            }
                            controls.Append("\n\t\t\t\t\t<td class=\"Text\">" + ResourcesTesxtsBuilder.AddUserText(propertyName, TextType.HtmlClassic));
                            if (!column.AllowNulls)
                            {
                                controls.Append("<span class=\"RequiredField\"><asp:Label runat=\"server\" Text=\"*\" /></span>");
                            }
                            controls.Append("</td>");
                            controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                            //FREETEXTBOX
                            if (ProjectBuilder.IsFreeTextBoxEditor)
                            {
                                controls.Append("\n\t\t\t\t\t\t<FTB:FREETEXTBOX id=\"txt" + propertyName + "\"   runat=\"server\"  TextDirection=\"" + ResourcesTesxtsBuilder.AddAdminGlobalText("EditorDirection", TextType.ServerControl) + "\" ");
                                controls.Append("\n\t\t\t\t\t\tToolbarLayout=\"Bold,Italic,Underline,Strikethrough,Superscript,Subscript;");
                                controls.Append("\n\t\t\t\t\t\tJustifyLeft,JustifyRight,JustifyCenter,JustifyFull;");
                                controls.Append("\n\t\t\t\t\t\tCut,Copy,Paste,Delete,Undo,Redo,Print,Save,ieSpellCheck|");
                                controls.Append("\n\t\t\t\t\t\tParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontBackColorsMenu,FontForeColorPicker,FontBackColorPicker|StyleMenu,SymbolsMenu,InsertHtmlMenu|InsertRule,InsertDate,InsertTime|WordClean|");
                                controls.Append("\n\t\t\t\t\t\tCreateLink,Unlink;RemoveFormat,BulletedList,NumberedList,Indent,Outdent;InsertTable,EditTable,InsertTableRowBefore,InsertTableRowAfter,DeleteTableRow,InsertTableColumnBefore,InsertTableColumnAfter,DeleteTableColumn|\"");
                                controls.Append("\n\t\t\t\t\t\tSupportFolder=\"/phyEditorImages/FreeTextBox/\" ButtonSet=\"NotSet\"  Width=\"450px\" ButtonWidth=\"21\"></FTB:FREETEXTBOX>");
                            }
                            else
                            {
                                controls.Append("\n\t\t\t\t\t\t<fckeditorv2:fckeditor id=\"txt" + propertyName + "\" runat=\"server\"></fckeditorv2:fckeditor>");
                            }
                            //-----------
                            controls.Append("\n\t\t\t\t\t</td>");
                            controls.Append("\n\t\t\t\t</tr>");

                            IshasFreeTextBoxControl = true;
                        }
                        else
                        {
                            if (ProjectBuilder.HasConfiguration)
                            {
                                controls.Append("\n\t\t\t\t<tr id=\"" + trPropertyName + "\" runat=\"server\" >");
                            }
                            else
                            {
                                controls.Append("\n\t\t\t\t<tr>");
                            }
                            controls.Append("\n\t\t\t\t\t<td class=\"Text\">" + ResourcesTesxtsBuilder.AddUserText(propertyName, TextType.HtmlClassic));
                            if (!column.AllowNulls)
                            {
                                controls.Append("<span class=\"RequiredField\"><asp:Label runat=\"server\" Text=\"*\" /></span>");
                            }
                            controls.Append("</td>");
                            controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                            controls.Append("\n\t\t\t\t\t\t<asp:TextBox id=\"txt" + propertyName + "\" runat=\"server\" TextMode=\"MultiLine\" CssClass=\"Controls\" ValidationGroup=\"" + Table + "\"></asp:TextBox>");
                            //controls.Append("\n\t\t\t\t\t\t<input type=\"text\"  class=\"Controls\"  name=\"txt" + propertyName + "LengthControler\" id=\"txt" + propertyName + "LengthControler\" style=\"width: 40px;\"  disabled>");
                            //-----------
                            controls.Append("\n\t\t\t\t\t</td>");
                            controls.Append("\n\t\t\t\t</tr>");
                        }
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid")
                    {
                        if (ProjectBuilder.HasConfiguration)
                        {
                            controls.Append("\n\t\t\t\t<tr id=\"" + trPropertyName + "\" runat=\"server\" >");
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t<tr>");
                        }
                        controls.Append("\n\t\t\t\t\t<td class=\"Text\">" + ResourcesTesxtsBuilder.AddUserText(propertyName, TextType.HtmlClassic));
                        if (!column.AllowNulls)
                        {
                            controls.Append("<span class=\"RequiredField\"><asp:Label runat=\"server\" Text=\"*\" /></span>");
                        }
                        controls.Append("</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXDownLoadExistFile
                        if (cnstr == null)
                        {
                            if (column.Name.IndexOf(ProjectBuilder.ExtensionInColumnName) > -1)
                            {
                                if (column.Name == ProjectBuilder.PhotoExtensionColumnName)
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:FileUpload ID=\"" + photoUploadreID + "\" runat=\"server\" CssClass=\"Controls\"  />");
                                    if (!column.AllowNulls)
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator Display=\"Dynamic\" id=\"rfv" + propertyName + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"" + photoUploadreID + "\" ValidationGroup=\"" + Table + "\" Text=\"*\"></asp:RequiredFieldValidator>");
                                    }
                                }
                                else if (column.Name == "LogoExtension")
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:FileUpload ID=\"" + logoUploadreID + "\" runat=\"server\" CssClass=\"Controls\"  />");
                                    if (!column.AllowNulls)
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator Display=\"Dynamic\" id=\"rfv" + propertyName + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"" + logoUploadreID + "\" ValidationGroup=\"" + Table + "\" Text=\"*\"></asp:RequiredFieldValidator>");
                                    }
                                }
                                else if (column.Name == "FileExtension")
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:FileUpload ID=\"" + fileUploadreID + "\" runat=\"server\" CssClass=\"Controls\"  />");

                                    if (!column.AllowNulls)
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator Display=\"Dynamic\" id=\"rfv" + propertyName + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"" + fileUploadreID + "\" ValidationGroup=\"" + Table + "\" Text=\"*\"></asp:RequiredFieldValidator>");
                                    }
                                }
                                else if (column.Name.IndexOf("Extension") > -1)
                                {
                                    string[] stringSeparators = new string[] { "Extension" };
                                    string[] separatingResult = column.Name.Split(stringSeparators, StringSplitOptions.None);
                                    propertyName = separatingResult[0];
                                    string uploaderID = "fu" + propertyName;

                                    controls.Append("\n\t\t\t\t\t\t<asp:FileUpload ID=\"" + uploaderID + "\" runat=\"server\" CssClass=\"Controls\"  />");

                                    if (!column.AllowNulls)
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator Display=\"Dynamic\" id=\"rfv" + propertyName + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"" + uploaderID + "\" ValidationGroup=\"" + Table + "\" Text=\"*\"></asp:RequiredFieldValidator>");
                                    }
                                }
                            }
                            //Check Priority
                            else if (column.Name.ToLower() == ProjectBuilder.PriorityColumnName.ToLower())
                            {
                                controls.Append("\n\t\t\t\t\t\t<asp:DropDownList id=\"" + ProjectBuilder.PriorityDropDownList + "\" runat=\"server\" CssClass=\"Controls\" ValidationGroup=\"" + Table + "\"></asp:DropDownList>");
                            }
                            else
                            {
                                if (column.Name.ToLower().IndexOf("password") > -1)
                                {
                                    hasPasswordField = true;
                                    controls.Append("\n\t\t\t\t\t\t<asp:TextBox MaxLength=\"" + Globals.GetTextBoxMaxLength(column) + "\"  id=\"txt" + propertyName + "\" runat=\"server\" TextMode=\"Password\" CssClass=\"Controls\" ValidationGroup=\"" + Table + "\"></asp:TextBox>");
                                    if (datatype == "int" || datatype == "long" || datatype == "short")
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RegularExpressionValidator Display=\"Dynamic\" ID=\"rev" + propertyName + "\" runat=\"server\" ControlToValidate=\"txt" + propertyName + "\" ErrorMessage=\"\" ValidationGroup=\"" + Table + "\" ValidationExpression=\"\\d*\"></asp:RegularExpressionValidator>");
                                    }
                                    else if (column.Name.ToLower().IndexOf("email") > -1)
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RegularExpressionValidator Display=\"Dynamic\" ID=\"rev" + propertyName + "\" runat=\"server\" ControlToValidate=\"txt" + propertyName + "\" ErrorMessage=\"\" ValidationGroup=\"" + Table + "\" ValidationExpression=\"\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\"></asp:RegularExpressionValidator>");
                                    }
                                }
                                else if (column.Length > 128)
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:TextBox MaxLength=\"" + Globals.GetTextBoxMaxLength(column) + "\" id=\"txt" + propertyName + "\" runat=\"server\" TextMode=\"MultiLine\" CssClass=\"Controls\" ValidationGroup=\"" + Table + "\"  maxlengthS=\"" + Globals.GetTextBoxMaxLength(column) + "\" onkeyup=\"return ismaxlength(this,document.forms[0].txt" + propertyName + "LengthControler)\"  onfocus=\"return ismaxlength(this,document.forms[0].txt" + propertyName + "LengthControler)\"></asp:TextBox>");
                                    controls.Append("\n\t\t\t\t\t\t<input type=\"text\"  class=\"Controls\"  name=\"txt" + propertyName + "LengthControler\" id=\"txt" + propertyName + "LengthControler\" style=\"width: 40px;\"  disabled>");
                                    if (datatype == "int" || datatype == "long" || datatype == "short")
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RegularExpressionValidator Display=\"Dynamic\" ID=\"rev" + propertyName + "\" runat=\"server\" ControlToValidate=\"txt" + propertyName + "\" ErrorMessage=\"\" ValidationGroup=\"" + Table + "\" ValidationExpression=\"\\d*\"></asp:RegularExpressionValidator>");
                                    }
                                    else if (column.Name.ToLower().IndexOf("email") > -1)
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RegularExpressionValidator Display=\"Dynamic\" ID=\"rev" + propertyName + "\" runat=\"server\" ControlToValidate=\"txt" + propertyName + "\" ErrorMessage=\"\" ValidationGroup=\"" + Table + "\" ValidationExpression=\"\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\"></asp:RegularExpressionValidator>");
                                    }
                                }
                                else
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:TextBox MaxLength=\"" + Globals.GetTextBoxMaxLength(column) + "\" id=\"txt" + propertyName + "\" runat=\"server\" CssClass=\"Controls\" ValidationGroup=\"" + Table + "\"></asp:TextBox>");

                                    if (datatype == "int" || datatype == "long" || datatype == "short")
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RegularExpressionValidator Display=\"Dynamic\" ID=\"rev" + propertyName + "\" runat=\"server\" ControlToValidate=\"txt" + propertyName + "\" ErrorMessage=\"\" Text=\"" + ResourcesTesxtsBuilder.AddAdminGlobalText("InvalidNumericalData", TextType.ServerControl) + "\" ValidationGroup=\"" + Table + "\" ValidationExpression=\"\\d*\"></asp:RegularExpressionValidator>");
                                    }
                                    else if (column.Name.ToLower().IndexOf("email") > -1)
                                    {
                                        controls.Append("\n\t\t\t\t\t\t<asp:RegularExpressionValidator Display=\"Dynamic\" ID=\"rev" + propertyName + "\" runat=\"server\" ControlToValidate=\"txt" + propertyName + "\" ErrorMessage=\"\" Text=\"" + ResourcesTesxtsBuilder.AddAdminGlobalText("InvalidEmail", TextType.ServerControl) + "\" ValidationGroup=\"" + Table + "\" ValidationExpression=\"\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\"></asp:RegularExpressionValidator>");
                                    }
                                }

                                if (!column.AllowNulls)
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator Display=\"Dynamic\" id=\"rfv" + propertyName + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"txt" + propertyName + "\" ValidationGroup=\"" + Table + "\" Text=\"*\"></asp:RequiredFieldValidator>");
                                }
                            }
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t\t\t<asp:DropDownList id=\"ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + "\" runat=\"server\" CssClass=\"Controls\" ValidationGroup=\"" + Table + "\"></asp:DropDownList>");
                            if (!column.AllowNulls)
                            {
                                controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator Display=\"Dynamic\" id=\"rfv" + propertyName + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + "\" InitialValue=\"-1\" ValidationGroup=\"" + Table + "\" Text=\"*\"></asp:RequiredFieldValidator>");
                            }
                        }
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                        //--------------------------------------------
                        //Confirm Password
                        //--------------------------------------------
                        if (hasPasswordField)
                        {
                            string propertyConfirm = propertyName + "Confirm";
                            controls.Append("\n\t\t\t\t\t<td class=\"Text\">" + ResourcesTesxtsBuilder.AddUserText(propertyConfirm, TextType.HtmlClassic));
                            if (!column.AllowNulls)
                            {
                                controls.Append("<span class=\"RequiredField\"><asp:Label runat=\"server\" Text=\"*\" /></span>");
                            }
                            controls.Append("</td>");
                            controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                            controls.Append("\n\t\t\t\t\t\t<asp:TextBox MaxLength=\"" + Globals.GetTextBoxMaxLength(column) + "\"  id=\"txt" + propertyConfirm + "\" runat=\"server\" TextMode=\"Password\" CssClass=\"Controls\" ValidationGroup=\"" + Table + "\"></asp:TextBox>");
                            if (!column.AllowNulls)
                            {
                                controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator Display=\"Dynamic\" id=\"rfv" + propertyConfirm + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"txt" + propertyName + "\" ValidationGroup=\"" + Table + "\" Text=\"*\"></asp:RequiredFieldValidator>");
                            }
                            controls.Append("\n\t\t\t\t\t\t <asp:CompareValidator ID=\"cv" + propertyConfirm + "\" runat=\"server\" ControlToCompare=\"txt" + propertyName + "\" ControlToValidate=\"txt" + propertyConfirm + "\" ErrorMessage=\"" + ResourcesTesxtsBuilder.AddUserText("InvalidConfirmPassord", TextType.ServerControl) + "\" Text=\"" + ResourcesTesxtsBuilder.AddUserText("InvalidConfirmPassord", TextType.ServerControl) + "\" ValidationGroup=\"" + Table + "\"></asp:CompareValidator>");
                            controls.Append("\n\t\t\t\t\t</td>");
                            controls.Append("\n\t\t\t\t</tr>");
                            hasPasswordField = false;
                        }
                    }
                }
            }
            controls.Append("\n\t\t\t\t<tr>");
            controls.Append("\n\t\t\t\t\t<td class=\"Result\" align=\"center\" colspan=\"2\">");
            //New
            controls.Append("\n\t\t\t\t\t\t<asp:HyperLink ID=\"hlCancel\" ImageUrl=\"/App_Design/Admin/Icons/Buttons/Cancel.jpg\"  runat=\"server\" Text=\"" + ResourcesTesxtsBuilder.AddAdminGlobalText("Cancel", TextType.ServerControl) + "\" NavigateUrl=\"default.aspx\"></asp:HyperLink>");
            controls.Append("\n\t\t\t\t\t\t<asp:ImageButton ID=\"ibtnCreateThenNew\"    ImageUrl=\"/App_Design/Admin/Icons/Buttons/CreateNew.png\"    runat=\"server\" AlternateText=\"" + ResourcesTesxtsBuilder.AddAdminGlobalText("CreateThenNew", TextType.ServerControl) + "\" onclick=\"ibtnCreateThenNew_Click\" ValidationGroup=\"" + Table + "\" />");
            controls.Append("\n\t\t\t\t\t\t<asp:ImageButton ID=\"ibtnCreateThenFinish\" ImageUrl=\"/App_Design/Admin/Icons/Buttons/CreateFinish.png\" runat=\"server\" AlternateText=\"<" + ResourcesTesxtsBuilder.AddAdminGlobalText("CreateThenFinish", TextType.ServerControl) + "\" onclick=\"ibtnCreateThenFinish_Click\" ValidationGroup=\"" + Table + "\" />");
            //OLD
            //controls.Append("\n\t\t\t\t\t\t<asp:Button id=\"btnCreate\" runat=\"server\" Width=\"100px\" Text=\"\" CssClass=\"Button\" OnClick=\"btnCreate_Click\" ValidationGroup=\"" + Table + "\"></asp:Button>");
            controls.Append("\n\t\t\t\t\t</td>");
            controls.Append("\n\t\t\t\t</tr>");

            //

            return(controls.ToString());
        }
Пример #15
0
        private string CreateLoadData()
        {
            StringBuilder loadDataStart  = new StringBuilder();
            StringBuilder loadDataChecks = new StringBuilder();
            StringBuilder loadDataBody   = new StringBuilder();
            StringBuilder loadDataEnd    = new StringBuilder();
            string        id             = Globals.GetProgramatlyName(ID.Name);

            id = Globals.ConvetStringToCamelCase(id);
            loadDataStart.Append("\n\t#region ---------------LoadData---------------");
            loadDataStart.Append("\n\t//-----------------------------------------------");
            loadDataStart.Append("\n\t//LoadData");
            loadDataStart.Append("\n\t//-----------------------------------------------");
            loadDataStart.Append("\n\tprotected void LoadData()");
            loadDataStart.Append("\n\t{");
            //Add Urls Property
            SiteUrlsBuilder.AddParameter(Globals.GetProgramatlyName(ID.Name));
            loadDataStart.Append("\n\t\tif(MoversFW.Components.UrlManager.ChechIsValidIntegerParameter(" + SiteUrlsBuilder.GetIdentifire() + Globals.GetProgramatlyName(ID.Name) + "))");
            loadDataStart.Append("\n\t\t{");
            loadDataStart.Append("\n\t\t\t" + Globals.GetAliasDataType(ID.Datatype) + " " + id + " = Convert.To" + Globals.GetDataType(ID.Datatype) + "(Request.QueryString[" + SiteUrlsBuilder.GetIdentifire() + Globals.GetProgramatlyName(ID.Name) + "]);");

            loadDataStart.Append("\n\t\t\t" + global.TableEntityClass + " " + global.EntityClassObject + " =" + global.TableFactoryClass + ".Get" + global.TableProgramatlyName + "Object(" + id + ");");
            loadDataChecks.Append("\n\t\t\tif (" + global.EntityClassObject + " != null)");
            loadDataChecks.Append("\n\t\t\t{");
            if (ProjectBuilder.HasMultiLanguages && SqlProvider.CheckISATableIsMultiLanguage(SqlProvider.obj.TableName))
            {
                loadDataChecks.Append("\n\t\t\t\t//");
                loadDataChecks.Append("\n\t\t\t\t//Check Valid Language to avoid changing query string manualy");
                loadDataChecks.Append("\n\t\t\t\tLanguages langid = (Languages)ResourceManager.GetCurrentLanguage();");
                loadDataChecks.Append("\n\t\t\t\tif (langid != " + global.EntityClassObject + ".LangID)");
                loadDataChecks.Append("\n\t\t\t\t{");
                loadDataChecks.Append("\n\t\t\t\t\tResponse.Redirect(\"default.aspx\");");
                loadDataChecks.Append("\n\t\t\t\t}");
            }
            //----------------------------------------------------------*/
            string datatype;
            string propertyName;
            string trPropertyName;
            string lblPropertyName;
            string optionalPropertyName;

            foreach (SQLDMO.Column column in Fields)
            {
                propertyName         = Globals.GetProgramatlyName(column.Name);
                trPropertyName       = "tr" + propertyName;
                lblPropertyName      = "lbl" + propertyName;
                optionalPropertyName = SiteOptionsBuilder.GetHasPropertyString(propertyName);
                //if ((ID == null || column.Name != ID.Name) && (column.Default == null || column.Default.Length != 0) && column.Name.ToLower() != ProjectBuilder.LangID)
                if ((ID == null || column.Name != ID.Name) && (column.Name.IndexOf("_") < 0) &&
                    column.Name.ToLower().IndexOf("password") < 0 &&
                    column.Name.ToLower().IndexOf("shortdescription") < 0 &&
                    column.Name.ToLower().IndexOf(ProjectBuilder.PriorityColumnName.ToLower()) < 0 &&
                    column.Name.ToLower().IndexOf(ProjectBuilder.IsAvailable.ToLower()) < 0 &&
                    column.Name.ToLower() != ProjectBuilder.LangID)
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    if (datatype == "string")
                    {
                        if (cnstr == null)
                        {
                            if (column.Name == ProjectBuilder.PhotoExtensionColumnName)
                            {
                                //	hasPhoto = true;
                                loadDataBody.Append("\n\t\t\t\tif (" + global.EntityClassObject + ".HasPhotoExtension)");
                                loadDataBody.Append("\n\t\t\t\t{");
                                //Add Urls Property

                                SiteUrlsBuilder.AddDirectoryUrl("PhotoNormalThumbs", SiteUrlsBuilder.photoNormalUrl, Globals.GetProgramatlyName(Table), "");

                                loadDataBody.Append("\n\t\t\t\t\t" + imageName + ".Text = \" <a href='\" + " + SiteUrlsBuilder.GetIdentifire() + "BigPhotoThumbs + " + global.EntityClassObject + ".BigPhotoThumbs+\"' rel='lightbox'>\";");
                                loadDataBody.Append("\n\t\t\t\t\t" + imageName + ".Text += \"<img border='0' src='\" +" + SiteUrlsBuilder.GetIdentifire() + "PhotoNormalThumbs + " + global.EntityClassObject + ".NormalPhotoThumbs+\"'   class='Image' alt='\" + " + global.EntityClassObject + ".Title+\"' /></a>\";");

                                loadDataBody.Append("\n\t\t\t\t}");
                                loadDataBody.Append("\n\t\t\t\telse");
                                loadDataBody.Append("\n\t\t\t\t{");
                                loadDataBody.Append("\n\t\t\t\t\t" + PhotoContainerTr + ".Visible = false;");
                                loadDataBody.Append("\n\t\t\t\t}");
                                //loadDataBody.Append("\n\t\t\t\t//------------------------------------------");
                                //loadDataBody.Append("\n\t\t\t\tViewState[\"" + ProjectBuilder.PhotoExtensionColumnName + "\"] = " + global.EntityClassObject + "." + ProjectBuilder.PhotoExtensionColumnName + ";");
                                //loadDataBody.Append("\n\t\t\t\t//------------------------------------------");
                            }
                            else if (column.Name == "LogoExtension")
                            {
                                //hasPhoto = true;
                                loadDataBody.Append("\n\t\t\t\tif (" + global.EntityClassObject + ".HasLogoExtension)");
                                loadDataBody.Append("\n\t\t\t\t{");
                                //Add Urls Property
                                SiteUrlsBuilder.AddDirectoryUrl("LogoNormalThumbs", SiteUrlsBuilder.logoNormalUrl, Globals.GetProgramatlyName(Table), "");


                                loadDataBody.Append("\n\t\t\t\t\t" + logoName + ".Text = \" <a href='\" + " + SiteUrlsBuilder.GetIdentifire() + "BigLogoThumbs + " + global.EntityClassObject + ".BigLogoThumbs+\"' rel='lightbox'>\";");
                                loadDataBody.Append("\n\t\t\t\t\t" + logoName + ".Text += \"<img border='0' src='\" +" + SiteUrlsBuilder.GetIdentifire() + "LogoNormalThumbs + " + global.EntityClassObject + ".NormalLogoThumbs+\"'   class='Image' alt='\" + " + global.EntityClassObject + ".Title+\"' /></a>\";");


                                loadDataBody.Append("\n\t\t\t\t}");
                                loadDataBody.Append("\n\t\t\t\telse");
                                loadDataBody.Append("\n\t\t\t\t{");
                                loadDataBody.Append("\n\t\t\t\t\t" + LogoContainerTr + ".Visible = false;");
                                loadDataBody.Append("\n\t\t\t\t}");
                                //loadDataBody.Append("\n\t\t\t\t//------------------------------------------");
                                //loadDataBody.Append("\n\t\t\t\tViewState[\"" + ProjectBuilder.LogoExtensionColumnName + "\"] = " + global.EntityClassObject + "." + ProjectBuilder.LogoExtensionColumnName + ";");
                                //loadDataBody.Append("\n\t\t\t\t//------------------------------------------");
                            }
                            else if (column.Name == "FileExtension")
                            {
                                //hasFile = true;
                                loadDataBody.Append("\n\t\t\t\tif (" + global.EntityClassObject + ".HasFileExtension)");
                                loadDataBody.Append("\n\t\t\t\t{");
                                //Add Urls Property
                                SiteUrlsBuilder.AddDirectoryUrl("Files", SiteUrlsBuilder.filesUrl, Globals.GetProgramatlyName(Table), "");
                                loadDataBody.Append("\n\t\t\t\t\t" + fileName + ".NavigateUrl = " + SiteUrlsBuilder.GetIdentifire() + "Files + " + global.EntityClassObject + ".File;");
                                loadDataBody.Append("\n\t\t\t\t\t" + fileName + ".Text = " + ResourcesTesxtsBuilder.AddAdminGlobalText("DownLoadExistFile", TextType.Text) + ";");
                                loadDataBody.Append("\n\t\t\t\t}");
                                loadDataBody.Append("\n\t\t\t\telse");
                                loadDataBody.Append("\n\t\t\t\t{");
                                loadDataBody.Append("\n\t\t\t\t\t" + trPropertyName + ".Visible=false ;");
                                loadDataBody.Append("\n\t\t\t\t}");
                                //loadDataBody.Append("\n\t\t\t\t//------------------------------------------");
                                //loadDataBody.Append("\n\t\t\t\tViewState[\"" + ProjectBuilder.FileExtensionColumnName + "\"] = " + global.EntityClassObject + "." + ProjectBuilder.FileExtensionColumnName + ";");
                                //loadDataBody.Append("\n\t\t\t\t//------------------------------------------");
                            }
                            else if (column.Name.IndexOf("Extension") > -1)
                            {
                                string[] stringSeparators = new string[] { "Extension" };
                                string[] separatingResult = column.Name.Split(stringSeparators, StringSplitOptions.None);
                                propertyName = separatingResult[0];
                                string uploaderID     = "fu" + propertyName;
                                string downloadLinkID = "hl" + propertyName;

                                //hasFile = true;
                                loadDataBody.Append("\n\t\t\t\tif (" + global.EntityClassObject + ".Has" + propertyName + "Extension)");
                                loadDataBody.Append("\n\t\t\t\t{");
                                //Add Urls Property
                                SiteUrlsBuilder.AddDirectoryUrl(propertyName + "s", SiteUrlsBuilder.otherFilesUrl, Globals.GetProgramatlyName(Table), propertyName + "s");
                                loadDataBody.Append("\n\t\t\t\t\t" + downloadLinkID + ".NavigateUrl = " + SiteUrlsBuilder.GetIdentifire() + propertyName + "s + " + global.EntityClassObject + "." + propertyName + ";");
                                loadDataBody.Append("\n\t\t\t\t\t" + downloadLinkID + ".Text =" + ResourcesTesxtsBuilder.AddAdminGlobalText("DownLoadExistFile", TextType.Text) + ";");
                                loadDataBody.Append("\n\t\t\t\t}");
                                loadDataBody.Append("\n\t\t\t\telse");
                                loadDataBody.Append("\n\t\t\t\t{");
                                loadDataBody.Append("\n\t\t\t\t\t" + trPropertyName + ".Visible=false ;");
                                loadDataBody.Append("\n\t\t\t\t}");
                                //loadDataBody.Append("\n\t\t\t\t//------------------------------------------");
                                //loadDataBody.Append("\n\t\t\t\tViewState[\"" + Globals.GetProgramatlyName(column.Name) + "\"] = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ";");
                                //loadDataBody.Append("\n\t\t\t\t//------------------------------------------");
                            }
                            else if (column.Name.IndexOf("Date") > -1)
                            {
                                loadDataBody.Append("\n\t\t\t\t//-------------------------------");
                                loadDataBody.Append("\n\t\t\t\t//" + Globals.GetProgramatlyName(column.Name));
                                loadDataBody.Append("\n\t\t\t\tif (" + global.EntityClassObject + "." + optionalPropertyName + ")");
                                loadDataBody.Append("\n\t\t\t\t\tlbl" + Globals.GetProgramatlyName(column.Name) + ".Text = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ".ToString();");
                                loadDataBody.Append("\n\t\t\t\telse");
                                loadDataBody.Append("\n\t\t\t\t\t" + trPropertyName + ".Visible=false ;");
                                loadDataBody.Append("\n\t\t\t\t//-------------------------------");
                            }
                            else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                            {
                                loadDataBody.Append("\n\t\t\t\t//-------------------------------");
                                loadDataBody.Append("\n\t\t\t\t//" + Globals.GetProgramatlyName(column.Name));
                                loadDataBody.Append("\n\t\t\t\tif (" + global.EntityClassObject + "." + optionalPropertyName + ")");
                                loadDataBody.Append("\n\t\t\t\t\tlbl" + Globals.GetProgramatlyName(column.Name) + ".Text = Globals.SetLines(" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ");");
                                loadDataBody.Append("\n\t\t\t\telse");
                                loadDataBody.Append("\n\t\t\t\t\t" + lblPropertyName + ".Visible=false ;");

                                loadDataBody.Append("\n\t\t\t\t//-------------------------------");
                            }
                            else
                            {
                                loadDataBody.Append("\n\t\t\t\t//-------------------------------");
                                loadDataBody.Append("\n\t\t\t\t//" + Globals.GetProgramatlyName(column.Name));
                                loadDataBody.Append("\n\t\t\t\tif (" + global.EntityClassObject + "." + optionalPropertyName + ")");
                                loadDataBody.Append("\n\t\t\t\t\tlbl" + Globals.GetProgramatlyName(column.Name) + ".Text = Globals.SetLines(" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ");");
                                loadDataBody.Append("\n\t\t\t\telse");
                                loadDataBody.Append("\n\t\t\t\t\t" + trPropertyName + ".Visible=false ;");
                                loadDataBody.Append("\n\t\t\t\t//-------------------------------");
                            }
                        }
                        else
                        {
                        }
                    }
                    else if (datatype == "bool")
                    {
                        //loadDataBody.Append("\n\t\t\t\tcb" + Globals.GetProgramatlyName(column.Name) + ".Checked = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ";");
                        loadDataBody.Append("\n\t\t\t\tlbl" + Globals.GetProgramatlyName(column.Name) + ".Text = " + ResourcesTesxtsBuilder.AddUserText("True", TextType.Text) + ";");
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid")
                    {
                        if (cnstr == null)
                        {
                            loadDataBody.Append("\n\t\t\t\tlbl" + Globals.GetProgramatlyName(column.Name) + ".Text = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ".ToString();");
                        }
                        else
                        {
                            //string text = SqlProvider.obj.GetExpectedNameForParent(cnstr.ParentTable);
                            //string _value = Globals.GetProgramatlyName(cnstr.ParentColID);
                            //string ddl;
                            //string methodName;
                            //BuildDropDownListsLoaderMethod(cnstr.ParentTable, text, _value, out ddl, out methodName);
                            //loadDataBody.Append("\n\t\t\t\t" + methodName + ";");
                            //loadDataBody.Append("\n\t\t\t\t" + ddl + ".SelectedValue = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + ".ToString();");
                        }
                    }
                }
            }
            //End of object null value check
            loadDataEnd.Append("\n\t\t\t}");
            loadDataEnd.Append("\n\t\t\telse");
            loadDataEnd.Append("\n\t\t\t{");
            loadDataEnd.Append("\n\t\t\t\tResponse.Redirect(\"default.aspx\");");
            loadDataEnd.Append("\n\t\t\t}");
            //-------------------------------------
            //End of envalid parammeter check
            loadDataEnd.Append("\n\t\t}");
            loadDataEnd.Append("\n\t\telse");
            loadDataEnd.Append("\n\t\t{");
            loadDataEnd.Append("\n\t\t\tResponse.Redirect(\"default.aspx\");");
            loadDataEnd.Append("\n\t\t}");
            loadDataEnd.Append("\n\t}");
            loadDataEnd.Append("\n\t//-----------------------------------------------");
            loadDataEnd.Append("\n\t#endregion");

            return(loadDataStart.ToString() + loadDataChecks.ToString() + loadDataBody.ToString() + loadDataEnd.ToString());
        }
        //
        private string Create_CreateButtonHandler()
        {
            StringBuilder _UpdateButtonHandler = new StringBuilder();
            string        id = Globals.GetProgramatlyName(ID.Name);

            _UpdateButtonHandler.Append("\n\tprotected void btnUpdate_Click(object sender, System.EventArgs e)");
            _UpdateButtonHandler.Append("\n\t{");
            _UpdateButtonHandler.Append("\n\t\tif (!Page.IsValid)");
            _UpdateButtonHandler.Append("\n\t\t{");
            _UpdateButtonHandler.Append("\n\t\t\treturn;");
            _UpdateButtonHandler.Append("\n\t\t}");
            //_UpdateButtonHandler.Append("\n\t\t"+global.TableEntityClass+" "+global.EntityClassObject+" = new "+global.TableEntityClass+"();");
            //_UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(ID.Name) + " = Convert.To" + Globals.GetDataType(ID.Datatype) + "(Request.QueryString[\"" + Globals.GetProgramatlyName(ID.Name) + "\"]);");
            //Diver
            _UpdateButtonHandler.Append("\n\t\t\t" + Globals.GetAliasDataType(ID.Datatype) + " " + id + " = Convert.To" + Globals.GetDataType(ID.Datatype) + "(Request.QueryString[\"" + id + "\"]);");
            _UpdateButtonHandler.Append("\n\t\t\t" + global.TableEntityClass + " " + global.EntityClassObject + " =" + global.TableFactoryClass + ".Get" + global.TableProgramatlyName + "Object(" + id + ");");
            //Diver

            string datatype;

            foreach (SQLDMO.Column column in Fields)
            {
                if (ID == null || column.Name != ID.Name)          //||!Globals.CheckIsAddedBySql(ID))
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);

                    if (datatype == "string")
                    {
                        if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                        {
                            _UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = fck" + Globals.GetProgramatlyName(column.Name) + ".Value;");
                        }
                        else
                        {
                            if (cnstr == null)
                            {
                                _UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = txt" + Globals.GetProgramatlyName(column.Name) + ".Text;");
                            }
                            else
                            {
                                _UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + ".SelectedValue;");
                            }
                        }
                    }
                    //DateTime
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.DateTime)
                    {
                        _UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = Convert.To" + Globals.GetDataType(column.Datatype) + "(txt" + Globals.GetProgramatlyName(column.Name) + ".Value);");
                    }
                    //DateTime
                    else if (datatype == "bool")
                    {
                        _UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = cb" + Globals.GetProgramatlyName(column.Name) + ".Checked;");
                    }
                    else if (datatype == "Guid")
                    {
                        _UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = Guid.NewGuid();");
                    }
                    else if (datatype != "byte[]" && datatype != "Object")
                    {
                        if (cnstr == null)
                        {
                            _UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = Convert.To" + Globals.GetDataType(column.Datatype) + "(txt" + Globals.GetProgramatlyName(column.Name) + ".Text);");
                        }
                        else
                        {
                            _UpdateButtonHandler.Append("\n\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(column.Name) + " = Convert.To" + Globals.GetDataType(column.Datatype) + "(ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + ".SelectedValue);");
                        }
                    }
                }
            }
            _UpdateButtonHandler.Append("\n\t\tbool result = " + global.TableFactoryClass + "." + MethodType.Update.ToString() + "(" + global.EntityClassObject + ");");
            _UpdateButtonHandler.Append("\n\t\tif(result)");
            _UpdateButtonHandler.Append("\n\t\t{");
            //_UpdateButtonHandler.Append("\n\t\t\tlblResult.ForeColor=Color.Blue ;");
            //_UpdateButtonHandler.Append("\n\t\t\tlblResult.Text=\"Êã ÇáÊÚÏíá ÈäÌÇÍ\";");
            _UpdateButtonHandler.Append("\n\t\t\tResponse.Redirect(\"default.aspx\");");

            _UpdateButtonHandler.Append("\n\t\t}");
            _UpdateButtonHandler.Append("\n\t\telse");
            _UpdateButtonHandler.Append("\n\t\t{");
            _UpdateButtonHandler.Append("\n\t\t\tlblResult.ForeColor=Color.Red ;");
            _UpdateButtonHandler.Append("\n\t\t\tlblResult.Text=\"ÝÔáÊ ÚãáíÉ ÇáÊÚÏíá\";");
            _UpdateButtonHandler.Append("\n\t\t}");
            _UpdateButtonHandler.Append("\n\t}");
            return(_UpdateButtonHandler.ToString());
        }
Пример #17
0
        //
        private string CreateDeleteCommandHandler()
        {
            string dataGridID = "dg" + global.TableProgramatlyName;
            string id         = Globals.GetProgramatlyName(ID.Name);

            id = Globals.ConvetStringToCamelCase(id);
            StringBuilder pageIndexHandler = new StringBuilder();

            pageIndexHandler.Append("\n\t#region --------------" + dataGridID + "_DeleteCommand--------------");
            pageIndexHandler.Append("\n\t//---------------------------------------------------------");
            pageIndexHandler.Append("\n\t//" + dataGridID + "_DeleteCommand");
            pageIndexHandler.Append("\n\t//---------------------------------------------------------");


            pageIndexHandler.Append("\n\tprotected void " + dataGridID + "_DeleteCommand(object source, DataGridCommandEventArgs e)");
            pageIndexHandler.Append("\n\t{");
            pageIndexHandler.Append("\n\t\t" + Globals.GetAliasDataType(ID.Datatype) + " " + id + " = Convert.To" + Globals.GetDataType(ID.Datatype) + "(" + dataGridID + ".DataKeys[e.Item.ItemIndex]);");
            pageIndexHandler.Append("\n\t\t" + global.TableEntityClass + " " + global.EntityClassObject + " =" + global.TableFactoryClass + ".Get" + global.TableProgramatlyName + "Object(" + id + ");");
            pageIndexHandler.Append("\n\t\tif(" + global.TableFactoryClass + "." + MethodType.Delete.ToString() + "(" + id + "))");
            pageIndexHandler.Append("\n\t\t{");
            //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX//
            #region XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
            string datatype;
            bool   siteurlObject = false;
            foreach (SQLDMO.Column column in Fields)
            {
                //if ((ID == null || column.Name != ID.Name) && (column.Default == null || column.Default.Length != 0) && column.Name.ToLower() != ProjectBuilder.LangID)
                if ((ID == null || column.Name != ID.Name) && (column.Name.IndexOf("_") < 0) && column.Name.ToLower() != ProjectBuilder.LangID)
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    if (datatype == "string")
                    {
                        if (cnstr == null)
                        {
                            if (column.Name.IndexOf("Extension") > 0 && !siteurlObject)
                            {
                                pageIndexHandler.Append("\n\t\t\t" + SiteUrlsBuilder.GetFullDeclaration());
                                siteurlObject = true;
                            }
                            //--------------------------------------------
                            if (column.Name == ProjectBuilder.PhotoExtensionColumnName)
                            {
                                pageIndexHandler.Append("\n\t\t\t//Photo-----------------------------");
                                pageIndexHandler.Append("\n\t\t\t//Delete old original photo");
                                //Add Urls Property
                                SiteUrlsBuilder.AddDirectoryUrl("OriginalPhotos", SiteUrlsBuilder.photoOriginalUrl, Globals.GetProgramatlyName(Table), "");
                                SiteUrlsBuilder.AddDirectoryUrl("MicroPhotoThumbs", SiteUrlsBuilder.photoMicroUrl, Globals.GetProgramatlyName(Table), "");
                                SiteUrlsBuilder.AddDirectoryUrl("MiniPhotoThumbs", SiteUrlsBuilder.photoMiniUrl, Globals.GetProgramatlyName(Table), "");
                                SiteUrlsBuilder.AddDirectoryUrl("NormalPhotoThumbs", SiteUrlsBuilder.photoNormalUrl, Globals.GetProgramatlyName(Table), "");
                                SiteUrlsBuilder.AddDirectoryUrl("BigPhotoThumbs", SiteUrlsBuilder.photoBigUrl, Globals.GetProgramatlyName(Table), "");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls.OriginalPhotos) + " + global.EntityClassObject + ".Photo" + ");");
                                pageIndexHandler.Append("\n\t\t\t//Delete old Thumbnails");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls." + "MicroPhotoThumbs) + " + global.TableFactoryClass + ".Create" + Table + "PhotoName(" + id + " ) + MoversFW.Thumbs.thumbnailExetnsion);");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls." + "MiniPhotoThumbs) + " + global.TableFactoryClass + ".Create" + Table + "PhotoName(" + id + " ) + MoversFW.Thumbs.thumbnailExetnsion);");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls." + "NormalPhotoThumbs) + " + global.TableFactoryClass + ".Create" + Table + "PhotoName(" + id + " ) + MoversFW.Thumbs.thumbnailExetnsion);");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls." + "BigPhotoThumbs) + " + global.TableFactoryClass + ".Create" + Table + "PhotoName(" + id + " ) + MoversFW.Thumbs.thumbnailExetnsion);");
                                pageIndexHandler.Append("\n\t\t\t//------------------------------------------------");
                            }
                            else if (column.Name == "LogoExtension")
                            {
                                pageIndexHandler.Append("\n\t\t\t//Logo-----------------------------");
                                pageIndexHandler.Append("\n\t\t\t//Delete old original Logo");
                                //Add Urls Property
                                SiteUrlsBuilder.AddDirectoryUrl("OriginalLogos", SiteUrlsBuilder.logoOriginalUrl, Globals.GetProgramatlyName(Table), "");
                                SiteUrlsBuilder.AddDirectoryUrl("MicroLogoThumbs", SiteUrlsBuilder.logoMicroUrl, Globals.GetProgramatlyName(Table), "");
                                SiteUrlsBuilder.AddDirectoryUrl("MiniLogoThumbs", SiteUrlsBuilder.logoMiniUrl, Globals.GetProgramatlyName(Table), "");
                                SiteUrlsBuilder.AddDirectoryUrl("NormalLogoThumbs", SiteUrlsBuilder.logoNormalUrl, Globals.GetProgramatlyName(Table), "");
                                SiteUrlsBuilder.AddDirectoryUrl("BigLogoThumbs", SiteUrlsBuilder.logoBigUrl, Globals.GetProgramatlyName(Table), "");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls.OriginalLogos)  + " + global.EntityClassObject + ".Logo" + ");");
                                pageIndexHandler.Append("\n\t\t\t//Delete old Thumbnails");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls.MicroLogoThumbs) + " + global.TableFactoryClass + ".Create" + Table + "LogoName(" + id + " ) + MoversFW.Thumbs.thumbnailExetnsion);");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls.MiniLogoThumbs) + " + global.TableFactoryClass + ".Create" + Table + "LogoName(" + id + " ) + MoversFW.Thumbs.thumbnailExetnsion);");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls.NormalLogoThumbs) + " + global.TableFactoryClass + ".Create" + Table + "LogoName(" + id + " ) + MoversFW.Thumbs.thumbnailExetnsion);");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls.BigLogoThumbs) + " + global.TableFactoryClass + ".Create" + Table + "LogoName(" + id + " ) + MoversFW.Thumbs.thumbnailExetnsion);");
                            }
                            else if (column.Name == "FileExtension")
                            {
                                pageIndexHandler.Append("\n\t\t\t//File-----------------------------");
                                pageIndexHandler.Append("\n\t\t\t//Delete old original file");
                                //Add Urls Property
                                SiteUrlsBuilder.AddDirectoryUrl("OriginalFiles", SiteUrlsBuilder.filesUrl, Globals.GetProgramatlyName(Table), "");
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls.OriginalFiles) + " + global.EntityClassObject + ".File" + ");");
                                pageIndexHandler.Append("\n\t\t\t\t//------------------------------------------------");
                            }
                            else if (column.Name.IndexOf("Extension") > 0)
                            {
                                string[] stringSeparators = new string[] { "Extension" };
                                string[] separatingResult = column.Name.Split(stringSeparators, StringSplitOptions.None);
                                string   propertyName     = separatingResult[0];
                                string   uploaderID       = "fu" + propertyName;
                                pageIndexHandler.Append("\n\t\t\t//File-----------------------------");
                                //Add Urls Property
                                SiteUrlsBuilder.AddDirectoryUrl("Original" + propertyName, SiteUrlsBuilder.otherFilesUrl, Globals.GetProgramatlyName(Table), propertyName + "s");
                                pageIndexHandler.Append("\n\t\t\t//Delete old original " + propertyName);
                                pageIndexHandler.Append("\n\t\t\tFile.Delete(Server.MapPath(urls.Original" + propertyName + ") + " + global.EntityClassObject + "." + propertyName + ");");
                            }
                        }
                    }
                }
            }
            #endregion
            //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX//
            pageIndexHandler.Append("\n\t\t\tlblResult.ForeColor = Color.Blue;");
            pageIndexHandler.Append("\n\t\t\tlblResult.Text = " + ResourcesTesxtsBuilder.AddAdminGlobalText("DeletingOprationDone", TextType.Text) + ";");
            pageIndexHandler.Append("\n\t\t\t//if one item in datagrid");
            pageIndexHandler.Append("\n\t\t\tif (" + dataGridID + ".Items.Count == 1)");
            pageIndexHandler.Append("\n\t\t\t{");
            pageIndexHandler.Append("\n\t\t\t\t--pager.CurrentPage;");
            pageIndexHandler.Append("\n\t\t\t}");
            pageIndexHandler.Append("\n\t\t\tLoadData();");
            pageIndexHandler.Append("\n\t\t}");
            pageIndexHandler.Append("\n\t\telse");
            pageIndexHandler.Append("\n\t\t{");
            pageIndexHandler.Append("\n\t\t\tlblResult.ForeColor = Color.Red;");
            pageIndexHandler.Append("\n\t\t\tlblResult.Text =" + ResourcesTesxtsBuilder.AddAdminGlobalText("DeletingOprationFaild", TextType.Text) + ";");

            pageIndexHandler.Append("\n\t\t}");
            pageIndexHandler.Append("\n\t}");
            pageIndexHandler.Append("\n\t//--------------------------------------------------------");
            pageIndexHandler.Append("\n\t#endregion");
            return(pageIndexHandler.ToString());
            //
        }
        //
        protected string GenerateControls()
        {
            StringBuilder controls = new StringBuilder();

            controls.Append("\n\t\t\t\t<tr>");
            controls.Append("\n\t\t\t\t\t<td class=\"Result\" align=\"center\" colspan=\"2\">");
            controls.Append("\n\t\t\t\t\t\t<asp:Label id=\"lblResult\" runat=\"server\"></asp:Label>");
            controls.Append("\n\t\t\t\t\t</td>");
            controls.Append("\n\t\t\t\t</tr>");
            string datatype;

            foreach (SQLDMO.Column column in Fields)
            {
                if (allParameters != null && !allParameters.Contains(column.Name))
                {
                    continue;
                }
                //if (ID == null || column.Name != ID.Name)//||!Globals.CheckIsAddedBySql(ID))
                if ((ID == null || column.Name != ID.Name) && (column.Name.IndexOf("_") < 0) && column.Name.ToLower() != ProjectBuilder.LangID)
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    if (datatype == "bool")
                    {
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Text\"><%=LanguageAdminResource.GetString(\"" + Globals.GetProgramatlyName(column.Name) + "\")%></td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        controls.Append("\n\t\t\t\t\t\t<asp:CheckBox id=\"cb" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ValidationGroup=\"" + ClassName + "\"></asp:CheckBox>");
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                    {
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Text\"><%=LanguageAdminResource.GetString(\"" + Globals.GetProgramatlyName(column.Name) + "\")%></td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        //FREETEXTBOX
                        controls.Append("\n\t\t\t\t\t\t<FTB:FREETEXTBOX id=\"ftb" + Globals.GetProgramatlyName(column.Name) + "\"   runat=\"server\"  TextDirection=\"RightToLeft\" ");
                        controls.Append("\n\t\t\t\t\t\tToolbarLayout=\"Bold,Italic,Underline,Strikethrough,Superscript,Subscript;");
                        controls.Append("\n\t\t\t\t\t\tJustifyLeft,JustifyRight,JustifyCenter,JustifyFull;");
                        controls.Append("\n\t\t\t\t\t\tCut,Copy,Paste,Delete,Undo,Redo,Print,Save,ieSpellCheck|");
                        controls.Append("\n\t\t\t\t\t\tParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontBackColorsMenu,FontForeColorPicker,FontBackColorPicker|StyleMenu,SymbolsMenu,InsertHtmlMenu|InsertRule,InsertDate,InsertTime|WordClean|");
                        controls.Append("\n\t\t\t\t\t\tCreateLink,Unlink;RemoveFormat,BulletedList,NumberedList,Indent,Outdent;InsertTable,EditTable,InsertTableRowBefore,InsertTableRowAfter,DeleteTableRow,InsertTableColumnBefore,InsertTableColumnAfter,DeleteTableColumn|\"");
                        controls.Append("\n\t\t\t\t\t\tSupportFolder=\"/phyEditorImages/FreeTextBox/\" ButtonSet=\"NotSet\"  Width=\"450px\" ButtonWidth=\"21\"></FTB:FREETEXTBOX>");                                           //
                        //-----------
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");

                        IshasFreeTextBoxControl = true;
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid")
                    {
                        //XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                        if (cnstr == null)
                        {
                            if (column.Name.IndexOf(ProjectBuilder.ExtensionInColumnName) > -1)
                            {
                                if (column.Name == ProjectBuilder.PhotoExtensionColumnName)
                                {
                                    controls.Append("\n\t\t\t\t<tr>");
                                    controls.Append("\n\t\t\t\t\t<td class=\"Text\"><%=LanguageAdminResource.GetString(\"" + Globals.GetProgramatlyName(column.Name) + "\")%></td>");
                                    controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                                    controls.Append("\n\t\t\t\t\t\t<asp:FileUpload ID=\"" + photoUploadreID + "\" runat=\"server\" CssClass=\"Controls\"  />");
                                }
                                else if (column.Name == "LogoExtension")
                                {
                                    controls.Append("\n\t\t\t\t<tr>");
                                    controls.Append("\n\t\t\t\t\t<td class=\"Text\"><%=LanguageAdminResource.GetString(\"" + Globals.GetProgramatlyName(column.Name) + "\")%></td>");
                                    controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                                    controls.Append("\n\t\t\t\t\t\t<asp:FileUpload ID=\"" + logoUploadreID + "\" runat=\"server\" CssClass=\"Controls\"  />");
                                }
                                else if (column.Name == "FileExtension")
                                {
                                    controls.Append("\n\t\t\t\t<tr runat=\"server\" id=\"trFile\">");
                                    controls.Append("\n\t\t\t\t\t<td class=\"Text\"><%=LanguageAdminResource.GetString(\"" + Globals.GetProgramatlyName(column.Name) + "\")%></td>");
                                    controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                                    controls.Append("\n\t\t\t\t\t\t<asp:FileUpload ID=\"" + fileUploadreID + "\" runat=\"server\" CssClass=\"Controls\"  />");
                                }
                                else if (column.Name.IndexOf("Extension") > -1)
                                {
                                    string[] stringSeparators = new string[] { "Extension" };
                                    string[] separatingResult = column.Name.Split(stringSeparators, StringSplitOptions.None);
                                    string   propretyName     = separatingResult[0];
                                    string   uploaderID       = "fu" + propretyName;
                                    controls.Append("\n\t\t\t\t<tr runat=\"server\" id=\"tr" + propretyName + ">");
                                    controls.Append("\n\t\t\t\t\t<td class=\"Text\"><%=LanguageAdminResource.GetString(\"" + Globals.GetProgramatlyName(column.Name) + "\")%></td>");
                                    controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                                    controls.Append("\n\t\t\t\t\t\t<asp:FileUpload ID=\"" + uploaderID + "\" runat=\"server\" CssClass=\"Controls\"  />");
                                }

                                if (!column.AllowNulls)
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator id=\"rfv" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" ValidationGroup=\"" + ClassName + "\">*</asp:RequiredFieldValidator>");
                                }
                            }
                            else
                            {
                                controls.Append("\n\t\t\t\t<tr>");
                                controls.Append("\n\t\t\t\t\t<td class=\"Text\"><%=LanguageAdminResource.GetString(\"" + Globals.GetProgramatlyName(column.Name) + "\")%></td>");
                                controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                                if (column.Name.ToLower().IndexOf("password") > -1)
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:TextBox id=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" TextMode=\"Password\" CssClass=\"Control\" ValidationGroup=\"" + ClassName + "\"></asp:TextBox>");
                                }
                                else if (column.Length > 128)
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:TextBox id=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" TextMode=\"MultiLine\" CssClass=\"Control\" ValidationGroup=\"" + ClassName + "\"></asp:TextBox>");
                                }
                                else
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:TextBox id=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" CssClass=\"Control\" ValidationGroup=\"" + ClassName + "\"></asp:TextBox>");
                                }

                                if (!column.AllowNulls)
                                {
                                    controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator id=\"rfv" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" ValidationGroup=\"" + ClassName + "\">*</asp:RequiredFieldValidator>");
                                }
                            }
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t<tr>");
                            controls.Append("\n\t\t\t\t\t<td class=\"Text\"><%=LanguageAdminResource.GetString(\"" + Globals.GetProgramatlyName(column.Name) + "\")%></td>");
                            controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                            controls.Append("\n\t\t\t\t\t\t<asp:DropDownList id=\"ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + "\" runat=\"server\" CssClass=\"Control\" ValidationGroup=\"" + ClassName + "\"></asp:DropDownList>");
                        }
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                }
            }
            controls.Append("\n\t\t\t\t<tr>");
            controls.Append("\n\t\t\t\t\t<td class=\"Result\" align=\"center\" colspan=\"2\">");
            controls.Append("\n\t\t\t\t\t\t<asp:Button id=\"btnUpdate\" runat=\"server\" Width=\"100px\" Text=\"\" CssClass=\"Button\" OnClick=\"btnUpdate_Click\" ValidationGroup=\"" + ClassName + "\"></asp:Button>");
            controls.Append("\n\t\t\t\t\t</td>");
            controls.Append("\n\t\t\t\t</tr>");

            //

            return(controls.ToString());
        }
        //
        #region ClassMember
        public string CreateInsertUpdateDeleteMethod(StoredProcedureTypes type)
        {
            try
            {
                string id = Globals.GetProgramatlyName(ID.Name);
                id = Globals.ConvetStringToCamelCase(id);
                string MethodName = type.ToString();
                string sqlDataProviderMethodName = type.ToString();
                string MethodReturn     = "bool";
                string MethodParameters = "(" + global.TableEntityClass + " " + global.EntityClassObject + ")";
                //
                if (type == StoredProcedureTypes.Delete)
                {
                    MethodParameters = "(" + Globals.GetAliasDataType(ID.Datatype) + " " + id + ")";
                }
                else
                {
                    MethodParameters = "(" + global.TableEntityClass + " " + global.EntityClassObject + ")";
                }
                //XML Documentaion
                string xmlInsertDocumentation = "\t/// <summary>\n";
                xmlInsertDocumentation += "\t/// Creates " + SqlProvider.obj.TableName + " object by calling " + SqlProvider.obj.TableName + " data provider create method.\n";
                xmlInsertDocumentation += "\t/// <example>[Example]bool result=" + ClassName + "." + MethodName + "(" + global.EntityClassObject + ");.</example>\n";
                xmlInsertDocumentation += "\t/// </summary>\n";
                xmlInsertDocumentation += "\t/// <param name=\"" + global.EntityClassObject + "\">The " + SqlProvider.obj.TableName + " object.</param>\n";
                xmlInsertDocumentation += "\t/// <returns>The result of create operation.</returns>";
                //
                string xmlUpdateDocumentation = "\t/// <summary>\n";
                xmlUpdateDocumentation += "\t/// Updates " + SqlProvider.obj.TableName + " object by calling " + SqlProvider.obj.TableName + " data provider update method.\n";
                xmlUpdateDocumentation += "\t/// <example>[Example]bool result=" + ClassName + "." + MethodName + "(" + global.EntityClassObject + ");.</example>\n";
                xmlUpdateDocumentation += "\t/// </summary>\n";
                xmlUpdateDocumentation += "\t/// <param name=\"" + global.EntityClassObject + "\">The " + SqlProvider.obj.TableName + " object.</param>\n";
                xmlUpdateDocumentation += "\t/// <returns>The result of update operation.</returns>";
                //
                string xmlDeleteDocumentation = "\t/// <summary>\n";
                xmlDeleteDocumentation += "\t/// Deletes single " + SqlProvider.obj.TableName + " object .\n";
                xmlDeleteDocumentation += "\t/// <example>[Example]bool result=" + ClassName + "." + MethodName + "(" + id + ");.</example>\n";
                xmlDeleteDocumentation += "\t/// </summary>\n";
                xmlDeleteDocumentation += "\t/// <param name=\"" + id + "\">The " + global.EntityClassObject + " id.</param>\n";
                xmlDeleteDocumentation += "\t/// <returns>The result of delete operation.</returns>";
                //method body
                StringBuilder methodBody = new StringBuilder();
                if (type == StoredProcedureTypes.Create)
                {
                    methodBody.Append(xmlInsertDocumentation);
                }
                else if (type == StoredProcedureTypes.Update)
                {
                    methodBody.Append(xmlUpdateDocumentation);
                }
                else if (type == StoredProcedureTypes.Delete)
                {
                    methodBody.Append(xmlDeleteDocumentation);
                }
                methodBody.Append("\n\tpublic static " + MethodReturn + " " + MethodName + MethodParameters);
                methodBody.Append("\n\t{");
                //
                if (type == StoredProcedureTypes.Delete)
                {
                    methodBody.Append("\n\t\treturn " + global.SqlDataProviderClass + ".Instance." + sqlDataProviderMethodName + "(" + id + ");");
                }
                else
                {
                    methodBody.Append("\n\t\treturn " + global.SqlDataProviderClass + ".Instance." + sqlDataProviderMethodName + "(" + global.EntityClassObject + ");");
                }

                methodBody.Append("\n\t}");
                methodBody.Append("\n\t" + Globals.MetthodsSeparator);
                return(methodBody.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("My Generated Code Exception:" + ex.Message);
                return("");
            }
        }
 //
 public string CreateGetOneMethod(StoredProcedureTypes type)
 {
     if (ID != null)
     {
         try
         {
             string id = Globals.GetProgramatlyName(ID.Name);
             id = Globals.ConvetStringToCamelCase(id);
             //
             string MethodName   = "Get" + global.TableProgramatlyName + "Object";
             string MethodReturn = global.TableEntityClass;
             //XML Documentaion
             string xmlDocumentation = "\t/// <summary>\n";
             xmlDocumentation += "\t/// Gets single " + SqlProvider.obj.TableName + " object .\n";
             xmlDocumentation += "\t/// <example>[Example]" + global.TableEntityClass + " " + global.EntityClassObject + "=" + ClassName + "." + MethodName + "(" + id + ");.</example>\n";
             xmlDocumentation += "\t/// </summary>\n";
             xmlDocumentation += "\t/// <param name=\"" + id + "\">The " + global.EntityClassObject + " id.</param>\n";
             xmlDocumentation += "\t/// <returns>" + SqlProvider.obj.TableName + " object.</returns>";
             //Method Body
             StringBuilder methodBody = new StringBuilder();
             methodBody.Append(xmlDocumentation);
             methodBody.Append("\n\tpublic static  " + MethodReturn + " " + MethodName + "(" + Globals.GetAliasDataType(ID.Datatype) + " " + id + ")");
             methodBody.Append("\n\t{");
             methodBody.Append("\n\t\treturn " + global.SqlDataProviderClass + ".Instance." + MethodName + "(" + id + ");");
             methodBody.Append("\n\t}");
             methodBody.Append("\n\t" + Globals.MetthodsSeparator);
             return(methodBody.ToString());
         }
         catch (Exception ex)
         {
             MessageBox.Show("My Generated Code Exception:" + ex.Message);
             return("");
         }
     }
     else
     {
         return("");
     }
 }
        //
        public void  CreateTemplate()
        {
            StringBuilder template   = new StringBuilder();
            StringBuilder propreties = new StringBuilder();
            string        repeaterID = "dl" + global.TableProgramatlyName;
            //xmlTag

            //template.Append("\n\t\t\t");

            //--------------------------
            string datatype;
            string propertyName;
            string fullOptionalPropertyName;
            string idName          = Globals.GetProgramatlyName(ID.Name);;
            string detailsPageName = "DetailsPage";
            string detailsPagePath = "App_Forms/" + Table + "/details.aspx?" + Globals.GetProgramatlyName(ID.Name) + "={0}";

            SiteUrlsBuilder.AddUrl(detailsPageName, detailsPagePath);

            foreach (SQLDMO.Column column in Fields)
            {
                propertyName             = Globals.GetProgramatlyName(column.Name);
                fullOptionalPropertyName = SiteOptionsBuilder.GetFullHasPropertyString(propertyName);
                if ((ID == null || column.Name != ID.Name) && (column.Name.IndexOf("_") < 0) &&
                    column.Name.ToLower().IndexOf("password") < 0 &&
                    column.Name.ToLower().IndexOf("shortdescription") < 0 &&
                    column.Name.ToLower().IndexOf("priority") < 0 &&
                    column.Name.ToLower().IndexOf("isavailable ") < 0 &&
                    column.Name.ToLower() != ProjectBuilder.LangID)
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    if (datatype == "bool")
                    {
                    }
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                    {
                        if (column.Name.ToLower().IndexOf("details") > -1)
                        {
                            hasDetails      = true;
                            detailsProprety = Globals.GetProgramatlyName(column.Name);
                        }
                        else if (column.Name.ToLower().IndexOf("description") > -1)
                        {
                            hasDescription      = true;
                            descriptionProprety = Globals.GetProgramatlyName(column.Name);
                        }
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid" && column.Name.ToLower().IndexOf("password") < 0 && column.Name.ToLower() != ProjectBuilder.LangID)
                    {
                        if (column.Name.IndexOf(ProjectBuilder.ExtensionInColumnName) > -1)
                        {
                            if (column.Name == ProjectBuilder.PhotoExtensionColumnName)
                            {
                                hasPhoto      = true;
                                photoProprety = Globals.GetProgramatlyName(column.Name);
                            }
                            else if (column.Name == "LogoExtension")
                            {
                                hasLogo      = true;
                                logoProprety = Globals.GetProgramatlyName(column.Name);
                            }
                        }
                        else if (column.Name.ToLower().IndexOf("description") > -1)
                        {
                            hasDescription      = true;
                            descriptionProprety = Globals.GetProgramatlyName(column.Name);
                        }
                        else if (column.Name.ToLower().IndexOf("title") > -1)
                        {
                            hasTitle      = true;
                            titleProprety = Globals.GetProgramatlyName(column.Name);
                        }
                        else
                        {
                            //----------------------------------------
                            if (ProjectBuilder.HasConfiguration)
                            {
                                propreties.Append("\n\t\t\t\t<tr runat=\"server\" visible=\"<%# SiteOptions.CheckOption(" + SiteOptionsBuilder.GetFullPropertyPath(fullOptionalPropertyName) + ") %>\">");
                            }
                            else
                            {
                                propreties.Append("\n\t\t\t\t<tr>");
                            }
                            propreties.Append("\n\t\t\t\t\t<td class=\"GText\">");
                            propreties.Append("\n\t\t\t\t\t\t<span class=\"GText\">" + ResourcesTesxtsBuilder.AddUserText(Globals.GetProgramatlyName(column.Name), TextType.HtmlClassic) + ": </span>");
                            propreties.Append("\n\t\t\t\t\t\t<span class=\"GValue\"><%#Eval(\"" + propertyName + "\") %></span>");
                            propreties.Append("\n\t\t\t\t\t</td>");
                            propreties.Append("\n\t\t\t\t\t</tr>");
                            //----------------------------------------
                        }
                    }
                }
            }
            template.Append("\n<!-- ------------------------ " + repeaterID + " ------------------------ -->");
            template.Append("\n<asp:DataList Width=\"100%\" ID=\"" + repeaterID + "\" RepeatColumns=\"1\" runat=\"server\">");
            template.Append("\n\t<ItemTemplate>");
            template.Append("\n\t\t<table cellspacing=\"0\" cellpadding=\"0\" class=\"GTable\" border=\"0\">");
            template.Append("\n\t\t\t<tr>");
            template.Append("\n\t\t\t\t<td style=\"width: 100%; vertical-align:top;\">");
            template.Append("\n\t\t\t\t\t<table class=\"GData\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\">");
            if (hasTitle)
            {
                string titleFullOptionalPropertyName = SiteOptionsBuilder.GetFullHasPropertyString(titleProprety);
                if (ProjectBuilder.HasConfiguration)
                {
                    template.Append("\n\t\t\t\t\t<tr runat=\"server\" visible=\"<%# SiteOptions.CheckOption(" + SiteOptionsBuilder.GetFullPropertyPath(titleFullOptionalPropertyName) + ") %>\">");
                }
                else
                {
                    template.Append("\n\t\t\t\t\t<tr>");
                }
                template.Append("\n\t\t\t\t\t\t<td class=\"GTitle\">");
                template.Append("\n\t\t\t\t\t\t\t<a class=\"GTitle\" href='<%# " + SiteUrlsBuilder.GetTheGetUrlMethodIdentifire() + "(\"" + detailsPageName + "\",Eval(\"" + idName + "\")) %>'>");
                template.Append("\n\t\t\t\t\t\t\t\t<%# Globals.SubStringByWords(DataBinder.Eval(Container, \"DataItem." + titleProprety + "\"),10) %>");
                template.Append("\n\t\t\t\t\t\t\t</a>");
                template.Append("\n\t\t\t\t\t\t</td>");
                template.Append("\n\t\t\t\t\t</tr>");
            }
            if (hasDetails)
            {
                string detailsFullOptionalPropertyName = SiteOptionsBuilder.GetFullHasPropertyString(detailsProprety);
                if (ProjectBuilder.HasConfiguration)
                {
                    template.Append("\n\t\t\t\t\t<tr runat=\"server\" visible=\"<%# SiteOptions.CheckOption(" + SiteOptionsBuilder.GetFullPropertyPath(detailsFullOptionalPropertyName) + ") %>\">");
                }
                else
                {
                    template.Append("\n\t\t\t\t\t<tr>");
                }
                template.Append("\n\t\t\t\t\t\t<td class=\"GDetails\">");
                template.Append("\n\t\t\t\t\t\t\t\t<%# Globals.SubStringByWords(DataBinder.Eval(Container, \"DataItem." + detailsProprety + "\"), 30)%>");
                template.Append("\n\t\t\t\t\t\t\t</td>");
                template.Append("\n\t\t\t\t\t\t</tr>");
            }
            if (hasDescription)
            {
                string descriptionFullOptionalPropertyName = SiteOptionsBuilder.GetFullHasPropertyString(descriptionProprety);
                if (ProjectBuilder.HasConfiguration)
                {
                    template.Append("\n\t\t\t\t\t<tr runat=\"server\" visible=\"<%# SiteOptions.CheckOption(" + SiteOptionsBuilder.GetFullPropertyPath(descriptionFullOptionalPropertyName) + ") %>\">");
                }
                else
                {
                    template.Append("\n\t\t\t\t\t<tr>");
                }
                template.Append("\n\t\t\t\t\t\t<td class=\"GDetails\">");
                template.Append("\n\t\t\t\t\t\t\t\t<%# Globals.SubStringByWords(DataBinder.Eval(Container, \"DataItem." + descriptionProprety + "\"), 30)%>");
                template.Append("\n\t\t\t\t\t\t\t</td>");
                template.Append("\n\t\t\t\t\t\t</tr>");
            }
            template.Append(propreties.ToString());
            template.Append("\n\t\t\t\t\t</table>");
            template.Append("\n\t\t\t\t</td>");
            if (hasPhoto || hasLogo)
            {
                template.Append("\n\t\t\t\t<td style=\"text-align:center; vertical-align:top;\">");
                if (hasPhoto)
                {
                    string photoFullOptionalPropertyName = SiteOptionsBuilder.GetFullHasPropertyString(photoProprety);
                    if (ProjectBuilder.HasConfiguration)
                    {
                        template.Append("\n\t\t\t\t\t<table runat=\"server\" visible=\"<%# SiteOptions.CheckOption(" + SiteOptionsBuilder.GetFullPropertyPath(photoFullOptionalPropertyName) + ") %>\" cellpadding=\"0\" cellspacing=\"0\" class=\"GImageContainer\">");
                    }
                    else
                    {
                        template.Append("\n\t\t\t\t\t<table  cellpadding=\"0\" cellspacing=\"0\" class=\"GImageContainer\">");
                    }

                    template.Append("\n\t\t\t\t\t\t<tr>");
                    template.Append("\n\t\t\t\t\t\t\t<td>");
                    template.Append("\n\t\t\t\t\t\t\t\t<a href='<%# " + SiteUrlsBuilder.GetTheGetUrlMethodIdentifire() + "(\"" + detailsPageName + "\",Eval(\"" + idName + "\")) %>'>");
                    template.Append("\n\t\t\t\t\t\t\t\t\t<img alt=\"<%# DataBinder.Eval(Container, \"DataItem." + titleProprety + "\") %>\"");
                    template.Append("\n\t\t\t\t\t\t\t\t\t\tclass=\"GImage\" src='<%# " + global.TableFactoryClass + ".Get" + global.TableProgramatlyName + "PhotoThumbnail(Eval(\"" + idName + "\"),Eval(\"" + photoProprety + "\")) %>' /></a>");
                    template.Append("\n\t\t\t\t\t\t\t</td>");
                    template.Append("\n\t\t\t\t\t\t</tr>");
                    template.Append("\n\t\t\t\t\t</table>");
                }
                if (hasLogo)
                {
                    string logoFullOptionalPropertyName = SiteOptionsBuilder.GetFullHasPropertyString(logoProprety);
                    if (ProjectBuilder.HasConfiguration)
                    {
                        template.Append("\n\t\t\t\t\t<table runat=\"server\" visible=\"<%# SiteOptions.CheckOption(" + SiteOptionsBuilder.GetFullPropertyPath(logoFullOptionalPropertyName) + ") %>\" cellpadding=\"0\" cellspacing=\"0\" class=\"GImageContainer\">");
                    }
                    else
                    {
                        template.Append("\n\t\t\t\t\t<table  cellpadding=\"0\" cellspacing=\"0\" class=\"GImageContainer\">");
                    }

                    template.Append("\n\t\t\t\t\t\t<tr>");
                    template.Append("\n\t\t\t\t\t\t\t<td>");

                    template.Append("\n\t\t\t\t\t\t\t\t<a href='<%# " + SiteUrlsBuilder.GetTheGetUrlMethodIdentifire() + "(\"" + detailsPageName + "\",Eval(\"" + idName + "\")) %>'>");
                    template.Append("\n\t\t\t\t\t\t\t\t\t<img alt=\"<%# DataBinder.Eval(Container, \"DataItem." + titleProprety + "\") %>\"");
                    template.Append("\n\t\t\t\t\t\t\t\t\t\tclass=\"GImage\" src='<%# " + global.TableFactoryClass + ".Get" + global.TableProgramatlyName + "LogoThumbnail(Eval(\"" + idName + "\"),Eval(\"" + logoProprety + "\")) %>' /></a>");
                    template.Append("\n\t\t\t\t\t\t\t</td>");
                    template.Append("\n\t\t\t\t\t\t</tr>");
                    template.Append("\n\t\t\t\t\t</table>");
                }
                template.Append("\n\t\t\t\t</td>");
            }
            template.Append("\n\t\t\t</tr>");
            template.Append("\n\t\t</table>");
            template.Append("\n\t</ItemTemplate>");
            template.Append("\n</asp:DataList>");
            template.Append("\n<!-- ------------------------ --------------- ------------------------ -->");
            //
            AppTemplates.Append(template.ToString());
        }
Пример #22
0
        //-------------------------------------
        public string CreateGetAllMethod(SQLDMO.Column conditionalColumn, bool isAvailableMethod)
        {
            try
            {
                string MethodName = StoredProcedureTypes.GetAll.ToString();
                string sqlDataProviderMethodName2  = "GetAll";
                string sqlDataProviderMethodCaller = global.SqlDataProviderClass + ".Instance." + sqlDataProviderMethodName2;
                string methodParameters            = "";
                string sqlMethodParameters         = "";
                string additionalPreviousBodyLines = "";
                //------------------------------
                bool hasPreviousMethodParameter    = false;
                bool hasPreviousSqlMethodParameter = false;
                //------------------------------
                bool isMaultiLanguages = (ProjectBuilder.HasMultiLanguages && SqlProvider.CheckISATableIsMultiLanguage(SqlProvider.obj.TableName));
                if (isMaultiLanguages)
                {
                    if (!isAvailableMethod)
                    {
                        methodParameters          += "Languages langID";
                        hasPreviousMethodParameter = true;
                    }
                    sqlMethodParameters          += "langID";
                    hasPreviousSqlMethodParameter = true;
                }
                //------------------------------
                if (conditionalColumn != null)
                {
                    //Check Previous Parameters
                    if (hasPreviousMethodParameter)
                    {
                        methodParameters += ", ";
                    }
                    if (hasPreviousSqlMethodParameter)
                    {
                        sqlMethodParameters += ", ";
                    }
                    //-----------------------
                    MethodName += "By" + Globals.GetProgramatlyName(conditionalColumn.Name);
                    sqlDataProviderMethodCaller += "By" + Globals.GetProgramatlyName(conditionalColumn.Name);
                    methodParameters            += Globals.GetAliasDataType(conditionalColumn.Datatype) + " " + Globals.ConvetStringToCamelCase(Globals.GetProgramatlyName(conditionalColumn.Name));
                    sqlMethodParameters         += Globals.ConvetStringToCamelCase(Globals.GetProgramatlyName(conditionalColumn.Name));
                    //-----------------------
                    hasPreviousMethodParameter    = true;
                    hasPreviousSqlMethodParameter = true;
                }
                //------------------------------
                bool hasIsAvailable = SqlProvider.CheckIsATableHasIsAvailableColumnName(SqlProvider.obj.TableName);
                if (hasIsAvailable)
                {
                    if (!isAvailableMethod)
                    {
                        //Check Previous Parameters
                        if (hasPreviousMethodParameter)
                        {
                            methodParameters += ", ";
                        }
                        if (hasPreviousSqlMethodParameter)
                        {
                            sqlMethodParameters += ", ";
                        }
                        //-------------------------
                        methodParameters    += "bool " + Globals.ConvetStringToCamelCase(ProjectBuilder.IsAvailableConditionParam);
                        sqlMethodParameters += Globals.ConvetStringToCamelCase(ProjectBuilder.IsAvailableConditionParam);
                        //-----------------------
                        hasPreviousMethodParameter    = true;
                        hasPreviousSqlMethodParameter = true;
                    }
                    else
                    {
                        //Check Previous Parameter
                        if (hasPreviousSqlMethodParameter)
                        {
                            sqlMethodParameters += ", ";
                        }
                        sqlDataProviderMethodCaller = MethodName;
                        //if (userType == UserType.Admin)
                        //{
                        //    MethodName += "ForAdmin";
                        //    sqlMethodParameters += "false";
                        //    additionalPreviousBodyLines = "Languages langID = (Languages) ResourceManager.GetCurrentLanguage();";
                        //}
                        //else
                        //{
                        //    MethodName += "ForUser";
                        //    sqlMethodParameters += "true";
                        //    additionalPreviousBodyLines = "Languages langID = (Languages) ResourceManager.GetCurrentLanguage();";
                        //}
                        ////-----------------------
                        hasPreviousSqlMethodParameter = true;
                    }
                }
                //------------------------------
                //Check Previous Parameters
                if (hasPreviousMethodParameter)
                {
                    methodParameters += ", ";
                }
                if (hasPreviousSqlMethodParameter)
                {
                    sqlMethodParameters += ", ";
                }
                //-------------------------
                methodParameters    += "int pageIndex, int pageSize, out int totalRecords";
                sqlMethodParameters += "pageIndex, pageSize, out totalRecords";
                //XXXXXXXXXXXXXXX
                //XXXXXXXXXXXXXXX
                string MethodReturn = "List<" + global.TableEntityClass + ">";
                //XML Documentaion
                string xmlDocumentation = "\n\t/// <summary>\n";
                xmlDocumentation += "\t/// Gets All " + SqlProvider.obj.TableName + ".\n";
                xmlDocumentation += "\t/// <example>[Example]" + MethodReturn + " " + global.EntityClassList + "=" + ClassName + "." + MethodName + "(" + sqlMethodParameters + ");.</example>\n";

                xmlDocumentation += "\t/// </summary>\n";
                xmlDocumentation += "\t/// <returns>All " + SqlProvider.obj.TableName + ".</returns>";
                //Method Body
                StringBuilder methodBody = new StringBuilder();
                methodBody.Append("\n\t#region --------------" + MethodName + "--------------");
                if (ProjectBuilder.AllowXmlDocumentation)
                {
                    methodBody.Append(xmlDocumentation);
                }
                methodBody.Append("\n\tpublic static " + MethodReturn + " " + MethodName + "(" + methodParameters + ")");
                methodBody.Append("\n\t{");
                methodBody.Append("\n\t\t" + additionalPreviousBodyLines);
                methodBody.Append("\n\t\treturn " + sqlDataProviderMethodCaller + "(" + sqlMethodParameters + ");");
                methodBody.Append("\n\t}");
                methodBody.Append("\n\t" + Globals.MetthodsSeparator);
                methodBody.Append("\n\t#endregion");
                return(methodBody.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("My Generated Code Exception:" + ex.Message);
                return("");
            }
        }
Пример #23
0
        //Scimple Creation Method-----------------------------------
        public string CreateInsertUpdateDeleteMethod(StoredProcedureTypes type, string MethodName, Hashtable allParameters)
        {
            string id = Globals.GetProgramatlyName(ID.Name);

            id = Globals.ConvetStringToCamelCase(id);
            //
            string ProcName     = global.TableProgramatlyName + "_" + MethodName;
            string MethodReturn = "bool";
            //XML Documentaion
            string xmlInsertDocumentation = "\t/// <summary>\n";

            xmlInsertDocumentation += "\t/// Converts the " + SqlProvider.obj.TableName + " object properties to SQL paramters and executes the create " + SqlProvider.obj.TableName + " procedure \n";
            xmlInsertDocumentation += "\t/// and updates the " + SqlProvider.obj.TableName + " object with the SQL data by reference.\n";
            xmlInsertDocumentation += "\t/// <example>[Example]bool result=" + ClassName + ".Instance." + MethodName + "(" + global.EntityClassObject + ");.</example>\n";
            xmlInsertDocumentation += "\t/// </summary>\n";
            xmlInsertDocumentation += "\t/// <param name=\"" + global.EntityClassObject + "\">The " + SqlProvider.obj.TableName + " object.</param>\n";
            xmlInsertDocumentation += "\t/// <returns>The result of create query.</returns>";
            //
            string xmlUpdateDocumentation = "\t/// <summary>\n";

            xmlUpdateDocumentation += "\t/// Converts the " + SqlProvider.obj.TableName + " object properties to SQL paramters and executes the update " + SqlProvider.obj.TableName + " procedure.\n";
            xmlUpdateDocumentation += "\t/// <example>[Example]bool result=" + ClassName + ".Instance." + MethodName + "(" + global.EntityClassObject + ");.</example>\n";
            xmlUpdateDocumentation += "\t/// </summary>\n";
            xmlUpdateDocumentation += "\t/// <param name=\"" + global.EntityClassObject + "\">The " + SqlProvider.obj.TableName + " object.</param>\n";
            xmlUpdateDocumentation += "\t/// <returns>The result of update query.</returns>";
            //
            string xmlDeleteDocumentation = "\t/// <summary>\n";

            xmlDeleteDocumentation += "\t/// Deletes single " + SqlProvider.obj.TableName + " object .\n";
            xmlDeleteDocumentation += "\t/// <example>[Example]bool result=" + ClassName + ".Instance." + MethodName + "(" + id + ");.</example>\n";
            xmlDeleteDocumentation += "\t/// </summary>\n";
            xmlDeleteDocumentation += "\t/// <param name=\"" + id + "\">The " + global.EntityClassObject + " id.</param>\n";
            xmlDeleteDocumentation += "\t/// <returns>The result of delete query.</returns>";
            //method body
            try
            {
                StringBuilder methodBody = new StringBuilder();
                if (type == StoredProcedureTypes.Create)
                {
                    methodBody.Append(xmlInsertDocumentation);
                }
                else if (type == StoredProcedureTypes.Update)
                {
                    methodBody.Append(xmlUpdateDocumentation);
                }
                else if (type == StoredProcedureTypes.Delete)
                {
                    methodBody.Append(xmlDeleteDocumentation);
                }
                //
                if (type == StoredProcedureTypes.Delete)
                {
                    methodBody.Append("\n\tpublic  " + MethodReturn + " " + MethodName + "(" + Globals.GetAliasDataType(ID.Datatype) + " " + id + ")");
                }
                else
                {
                    methodBody.Append("\n\tpublic  " + MethodReturn + " " + MethodName + "(" + global.TableEntityClass + " " + global.EntityClassObject + ")");
                }
                methodBody.Append("\n\t{");
                methodBody.Append("\n\t\tbool result=false;");
                methodBody.Append("\n\t\tusing( SqlConnection myConnection = GetSqlConnection()) ");
                methodBody.Append("\n\t\t{");
                methodBody.Append("\n\t\t\tSqlCommand myCommand = new SqlCommand(\"" + ProcName + "\", myConnection);");
                methodBody.Append("\n\t\t\tmyCommand.CommandType = CommandType.StoredProcedure;");
                methodBody.Append("\n\t\t\t// Set the parameters");
                if (type == StoredProcedureTypes.Delete)
                {
                    methodBody.Append("\n\t\t\tmyCommand.Parameters.Add(\"@" + Globals.GetProgramatlyName(ID.Name) + "\", SqlDbType." + Globals.GetSqlDataType(ID.Datatype).ToString() + "," + ID.Length + ").Value = " + id + ";");
                }
                else
                {
                    foreach (SQLDMO.Column colCurrent in Fields)
                    {
                        if (!allParameters.Contains(colCurrent.Name))
                        {
                            continue;
                        }
                        if (ID != null && colCurrent.Name == ID.Name && type == StoredProcedureTypes.Create && ID.IdentityIncrement > 0)
                        {
                            methodBody.Append("\n\t\t\tmyCommand.Parameters.Add(\"@" + Globals.GetProgramatlyName(colCurrent.Name) + "\", SqlDbType." + Globals.GetSqlDataType(colCurrent.Datatype).ToString() + "," + colCurrent.Length + ").Direction = ParameterDirection.Output;");
                        }
                        else if (colCurrent.Datatype.ToLower() == SqlDbType.NText.ToString().ToLower())
                        {
                            methodBody.Append("\n\t\t\tmyCommand.Parameters.Add(\"@" + Globals.GetProgramatlyName(colCurrent.Name) + "\", SqlDbType." + Globals.GetSqlDataType(colCurrent.Datatype).ToString() + ").Value = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(colCurrent.Name) + ";");
                        }
                        else
                        {
                            methodBody.Append("\n\t\t\tmyCommand.Parameters.Add(\"@" + Globals.GetProgramatlyName(colCurrent.Name) + "\", SqlDbType." + Globals.GetSqlDataType(colCurrent.Datatype).ToString() + "," + colCurrent.Length + ").Value = " + global.EntityClassObject + "." + Globals.GetProgramatlyName(colCurrent.Name) + ";");
                        }
                    }
                }
                methodBody.Append("\n\t\t\t// Execute the command");
                methodBody.Append("\n\t\t\tmyConnection.Open();");
                methodBody.Append("\n\t\t\tif(myCommand.ExecuteNonQuery()>0)");
                methodBody.Append("\n\t\t\t{");
                methodBody.Append("\n\t\t\t\tresult=true;");
                if (ID != null && type == StoredProcedureTypes.Create && ID.IdentityIncrement > 0)
                {
                    methodBody.Append("\n\t\t\t\t//Get ID value from database and set it in object");
                    methodBody.Append("\n\t\t\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(ID.Name) + "= (" + Globals.GetAliasDataType(ID.Datatype) + ") myCommand.Parameters[\"@" + Globals.GetProgramatlyName(ID.Name) + "\"].Value;");
                }
                if (ID.Name.ToLower() == "id" && global.EntityClassObject == "Site_RolesObj")
                {
                    MessageBox.Show(SqlProvider.obj.ID.Name);
                }
                methodBody.Append("\n\t\t\t}");
                methodBody.Append("\n\t\t\tmyConnection.Close();");
                methodBody.Append("\n\t\t\treturn result;");
                methodBody.Append("\n\t\t}");
                methodBody.Append("\n\t}");
                methodBody.Append("\n\t" + Globals.MetthodsSeparator);
                return(methodBody.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("My Generated Code Exception:" + ex.Message);
                return("");
            }
        }
Пример #24
0
        //-------------------------------------
        #endregion
        //----------------------------------------------------------
        //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        //----------------------------------------------------------

        //----------------------------------------------------------
        //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        #region CreateGetOneMethod
        public string CreateGetOneMethod()
        {
            if (ID != null)
            {
                try
                {
                    string id = Globals.GetProgramatlyName(ID.Name);
                    id = Globals.ConvetStringToCamelCase(id);
                    string factoryClass = global.TableFactoryClass;
                    string entityClass  = global.TableEntityClass;
                    string entityObject = global.EntityClassObject;
                    //------------------------------------------------
                    string MethodName          = "GetObject";
                    string MethodReturn        = global.TableEntityClass;
                    string methodParameters    = id;
                    string sqlMethodParameters = id;
                    //XML Documentaion
                    string xmlDocumentation = "\n\t/// <summary>\n";
                    xmlDocumentation += "\t/// Gets single " + SqlProvider.obj.TableName + " object .\n";
                    xmlDocumentation += "\t/// <example>[Example]" + MethodReturn + " " + global.EntityClassList + "=" + ClassName + "." + MethodName + "(" + sqlMethodParameters + ");.</example>\n";
                    xmlDocumentation += "\t/// </summary>\n";
                    xmlDocumentation += "\t/// <param name=\"" + id + "\">The " + global.EntityClassObject + " id.</param>\n";
                    xmlDocumentation += "\t/// <returns>" + SqlProvider.obj.TableName + " object.</returns>";
                    //Method Body
                    StringBuilder methodBody = new StringBuilder();
                    methodBody.Append("\n\t#region --------------" + MethodName + "--------------");
                    if (ProjectBuilder.AllowXmlDocumentation)
                    {
                        methodBody.Append(xmlDocumentation);
                    }
                    methodBody.Append("\n\tpublic static  " + MethodReturn + " " + MethodName + "(" + Globals.GetAliasDataType(ID.Datatype) + " " + methodParameters + ")");
                    methodBody.Append("\n\t{");
                    //------------
                    methodBody.Append("\n\t\tstring cacheKey = GetChacheKey(" + id + ");");
                    methodBody.Append("\n\t\t" + entityClass + " " + entityObject + ";");
                    //methodBody.Append("\n\t\tCache contextCache = HttpContext.Current.Cache;");
                    //methodBody.Append("\n\t\tCache applicationCache = HttpRuntime.Cache;");
                    methodBody.Append("\n\t\tobject cachedObject = OurCache.Get(cacheKey);");

                    methodBody.Append("\n\t\t//Check is object cached into our cache");
                    methodBody.Append("\n\t\tif (cachedObject == null)");
                    methodBody.Append("\n\t\t{");
                    //methodBody.Append("\n\t\t\t//Check is object cached into application cache");
                    // methodBody.Append("\n\t\t\tif (cachedObject == null)");
                    //methodBody.Append("\n\t\t\t{");
                    methodBody.Append("\n\t\t\t" + entityObject + " = " + global.SqlDataProviderClass + ".Instance." + MethodName + "(" + id + ");");
                    methodBody.Append("\n\t\t\tif (" + entityObject + " == null)");
                    methodBody.Append("\n\t\t\t\treturn null;");
                    methodBody.Append("\n\t\t\t//Save object into application cache");
                    methodBody.Append("\n\t\t\tOurCache.Insert(cacheKey, " + entityObject + ", 3 * OurCache.MinuteFactor);");

                    /*
                     *                  methodBody.Append("\n\t\t\t\tapplicationCache[cacheKey] = " + entityObject + ";");
                     *                  methodBody.Append("\n\t\t\t\t//Save object into httpContext cache");
                     *                  methodBody.Append("\n\t\t\t\tcontextCache[cacheKey] = " + entityObject + ";");
                     *                  methodBody.Append("\n\t\t\t}");
                     *                  methodBody.Append("\n\t\t\telse");
                     *                  methodBody.Append("\n\t\t\t{");
                     *                  methodBody.Append("\n\t\t\t\t//get object from application cache");
                     *                  methodBody.Append("\n\t\t\t\t" + entityObject + " = (" + entityClass + ")applicationCache[cacheKey];");
                     *                  methodBody.Append("\n\t\t\t\t//Save object into httpContext cache");
                     *                  methodBody.Append("\n\t\t\t\tcontextCache[cacheKey] = " + entityObject + ";");
                     *                  methodBody.Append("\n\t\t\t}");*/
                    methodBody.Append("\n\t\t}");
                    methodBody.Append("\n\t\telse");
                    methodBody.Append("\n\t\t{");
                    methodBody.Append("\n\t\t\t//get object from httpContext cache");
                    methodBody.Append("\n\t\t\t" + entityObject + " = (" + entityClass + ")cachedObject;");
                    methodBody.Append("\n\t\t}");
                    methodBody.Append("\n\t\t//return the object");
                    methodBody.Append("\n\t\treturn " + entityObject + ";");

                    //------------

                    methodBody.Append("\n\t}");
                    methodBody.Append("\n\t" + Globals.MetthodsSeparator);
                    methodBody.Append("\n\t#endregion");
                    return(methodBody.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("My Generated Code Exception:" + ex.Message);
                    return("");
                }
            }
            else
            {
                return("");
            }
        }
Пример #25
0
 private string CreatePopulateObjectMethod()
 {
     try
     {
         //
         string MethodName   = "Populate" + global.TableEntityClass + "FromIDataReader";
         string MethodReturn = global.TableEntityClass;
         //XML Documentaion
         string xmlDocumentation = "\t/// <summary>\n";
         xmlDocumentation += "\t/// Populates " + SqlProvider.obj.TableName + " Entity From IDataReader .\n";
         xmlDocumentation += "\t/// <example>[Example]" + global.TableEntityClass + global.EntityClassObject + "=" + MethodName + "(reader);.</example>\n";
         xmlDocumentation += "\t/// </summary>\n";
         xmlDocumentation += "\t/// <param name=\"reader\"></param>\n";
         xmlDocumentation += "\t/// <returns>" + SqlProvider.obj.TableName + " object.</returns>";
         //Method Body
         StringBuilder methodBody = new StringBuilder();
         methodBody.Append(xmlDocumentation);
         methodBody.Append("\n\tprivate " + global.TableEntityClass + " " + MethodName + "(IDataReader reader)");
         methodBody.Append("\n\t{");
         methodBody.Append("\n\t\t//Create a new " + SqlProvider.obj.TableName + " object");
         methodBody.Append("\n\t\t" + global.TableEntityClass + " " + global.EntityClassObject + " = new " + global.TableEntityClass + "();");
         methodBody.Append("\n\t\t//Fill the object with data");
         //
         foreach (SQLDMO.Column colCurrent in Fields)
         {
             methodBody.Append("\n\t\tif (reader[\"" + Globals.GetProgramatlyName(colCurrent.Name) + "\"] != DBNull.Value)");
             methodBody.Append("\n\t\t\t" + global.EntityClassObject + "." + Globals.GetProgramatlyName(colCurrent.Name) + " = (" + Globals.GetAliasDataType(colCurrent.Datatype) + ") reader[\"" + Globals.GetProgramatlyName(colCurrent.Name) + "\"];");
         }
         //
         methodBody.Append("\n\t\t//Return the populated object");
         methodBody.Append("\n\t\treturn " + global.EntityClassObject + ";");
         methodBody.Append("\n\t}");
         methodBody.Append("\n\t" + Globals.MetthodsSeparator);
         return(methodBody.ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show("My Generated Code Exception:" + ex.Message);
         return("");
     }
 }
Пример #26
0
        //
        protected string GenerateControls()
        {
            StringBuilder controls = new StringBuilder();

            controls.Append("\n\t\t\t\t<tr>");
            controls.Append("\n\t\t\t\t\t<td class=\"Result\" align=\"center\" colspan=\"2\">");
            controls.Append("\n\t\t\t\t\t\t<asp:Label id=\"lblResult\" runat=\"server\"></asp:Label>");
            controls.Append("\n\t\t\t\t\t</td>");
            controls.Append("\n\t\t\t\t</tr>");
            string datatype;
            int    coulmnNo = 0;

            foreach (SQLDMO.Column column in Fields)
            {
                coulmnNo = coulmnNo + 1;
                if (allParameters != null && !allParameters.Contains(column.Name))
                {
                    continue;
                }
                if (ID == null || column.Name != ID.Name)//||!Globals.CheckIsAddedBySql(ID))
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    datatype = Globals.GetAliasDataType(column.Datatype);
                    //dateTime
                    if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.DateTime)
                    {
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Title\">" + column.Name + "</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\"><script language=\"javascript\" type=\"text/javascript\" src=\"/sitescripts/datetimepicker.js\"></script>");
                        controls.Append("\n\t\t\t\t\t\t<input id=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" class=\"Control\" style=\"width:250px\" type=\"text\" readonly=\"readonly\" /><a href=\"javascript:NewCal('ctl00$BasicContent$txt" + Globals.GetProgramatlyName(column.Name) + "\','ddmmyyyy')\"><img src=\"/images/cal.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"ÇÎÊÑ ÇáÊÇÑíÎ\"></a>");

                        if (!column.AllowNulls)
                        {
                            controls.Append("\n\t\t\t\t\t\t<anthem:RequiredFieldValidator id=\"rfv" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" ValidationGroup=\"" + ClassName + "\">*</anthem:RequiredFieldValidator>");
                        }

                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                    //dateTime
                    else if (datatype == "bool")
                    {
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Title\">" + column.Name + "</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        controls.Append("\n\t\t\t\t\t\t<asp:CheckBox id=\"cb" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ValidationGroup=\"" + ClassName + "\"></asp:CheckBox>");
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                    else if (Globals.GetSqlDataType(column.Datatype) == SqlDbType.NText)
                    {
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Title\">" + column.Name + "</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        //FREETEXTBOX
                        #region OlD FREE
                        //controls.Append("\n\t\t\t\t\t\t<FTB:FREETEXTBOX id=\"ftb" + Globals.GetProgramatlyName(column.Name) + "\"   runat=\"server\"  TextDirection=\"RightToLeft\" ");
                        //controls.Append("\n\t\t\t\t\t\tToolbarLayout=\"Bold,Italic,Underline,Strikethrough,Superscript,Subscript;");
                        //controls.Append("\n\t\t\t\t\t\tJustifyLeft,JustifyRight,JustifyCenter,JustifyFull;");
                        //controls.Append("\n\t\t\t\t\t\tCut,Copy,Paste,Delete,Undo,Redo,Print,Save,ieSpellCheck|");
                        //controls.Append("\n\t\t\t\t\t\tParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontBackColorsMenu,FontForeColorPicker,FontBackColorPicker|StyleMenu,SymbolsMenu,InsertHtmlMenu|InsertRule,InsertDate,InsertTime|WordClean|");
                        //controls.Append("\n\t\t\t\t\t\tCreateLink,Unlink;RemoveFormat,BulletedList,NumberedList,Indent,Outdent;InsertTable,EditTable,InsertTableRowBefore,InsertTableRowAfter,DeleteTableRow,InsertTableColumnBefore,InsertTableColumnAfter,DeleteTableColumn|\"");
                        //controls.Append("\n\t\t\t\t\t\tSupportFolder=\"/phyEditorImages/FreeTextBox/\" ButtonSet=\"NotSet\"  Width=\"450px\" ButtonWidth=\"21\"></FTB:FREETEXTBOX>");						//
                        controls.Append("\n\t\t\t\t\t\t<fckeditorv2:fckeditor id=\"fck" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\"></fckeditorv2:fckeditor>");
                        #endregion
                        //-----------
                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");

                        IshasFreeTextBoxControl = true;
                    }
                    else if (datatype != "byte[]" && datatype != "Object" && datatype != "Guid")
                    {
                        controls.Append("\n\t\t\t\t<tr>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Title\">" + column.Name + "</td>");
                        controls.Append("\n\t\t\t\t\t<td class=\"Control\">");
                        if (cnstr == null)
                        {
                            #region old
                            //controls.Append("\n\t\t\t\t\t\t<asp:TextBox id=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" CssClass=\"Control\" ValidationGroup=\"" + ClassName + "\"></asp:TextBox>");
                            //if (!column.AllowNulls)
                            //    controls.Append("\n\t\t\t\t\t\t<asp:RequiredFieldValidator id=\"rfv" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" ValidationGroup=\"" + ClassName + "\">ÃÏÎá åÐÇ ÇáÈíÇä</asp:RequiredFieldValidator>");
                            #endregion
                            if (Globals.GetTextBoxMaxLength(column) > 499)
                            {
                                controls.Append("\n\t\t\t\t\t\t<anthem:TextBox TextMode=\"MultiLine\"   id=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\"  CssClass=\"Control\" maxlengthS=\"" + Globals.GetTextBoxMaxLength(column) + "\" MaxLength=\"" + Globals.GetTextBoxMaxLength(column) + "\" ValidationGroup=\"" + ClassName + "\" onkeyup=\"return ismaxlength(this,document.forms[0].thelength" + coulmnNo + ")\" onfocus=\"return ismaxlength(this,document.forms[0].thelength" + coulmnNo + ")\" height=150 width=350 ></anthem:TextBox>");
                                controls.Append("\n\t\t\t\t\t\t<input type=\"text\" class=\"Control\" name=\"thelength" + coulmnNo + "\" id=\"thelength" + coulmnNo + "\" style=\"height: 20px; width: 40px;\" disabled> <script src=\"/SiteScripts/textarea.js\"></script>");
                            }
                            else
                            {
                                controls.Append("\n\t\t\t\t\t\t<anthem:TextBox id=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\"  CssClass=\"Control\" MaxLength=\"" + Globals.GetTextBoxMaxLength(column) + "\" ValidationGroup=\"" + ClassName + "\" ></anthem:TextBox>");
                            }
                            if (!column.AllowNulls)
                            {
                                controls.Append("\n\t\t\t\t\t\t<anthem:RequiredFieldValidator id=\"rfv" + Globals.GetProgramatlyName(column.Name) + "\" runat=\"server\" ErrorMessage=\"*\" ControlToValidate=\"txt" + Globals.GetProgramatlyName(column.Name) + "\" ValidationGroup=\"" + ClassName + "\">*</anthem:RequiredFieldValidator>");
                            }
                        }
                        else
                        {
                            controls.Append("\n\t\t\t\t\t\t<asp:DropDownList id=\"ddl" + Globals.GetProgramatlyName(cnstr.ParentTable) + "\" runat=\"server\" CssClass=\"Control\" ValidationGroup=\"" + ClassName + "\"></asp:DropDownList>");
                        }

                        controls.Append("\n\t\t\t\t\t</td>");
                        controls.Append("\n\t\t\t\t</tr>");
                    }
                }
            }
            controls.Append("\n\t\t\t\t<tr>");
            controls.Append("\n\t\t\t\t\t<td class=\"Result\" align=\"center\" colspan=\"2\">");
            controls.Append("\n\t\t\t\t\t\t<asp:Button id=\"btnUpdate\" runat=\"server\" Width=\"100px\" Text=\"ÊÚÏíá\" CssClass=\"Submit\" OnClick=\"btnUpdate_Click\" ValidationGroup=\"" + ClassName + "\"></asp:Button>");
            controls.Append("\n\t\t\t\t\t</td>");
            controls.Append("\n\t\t\t\t</tr>");

            //

            return(controls.ToString());
        }