Пример #1
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());
        }
Пример #2
0
        //--------------------------------
        private TableConstraint PopulateConstaraintFromIDataReader(IDataReader dr)
        {
            TableConstraint cnstrnt = new TableConstraint();

            cnstrnt.ChildTable     = dr["ChildTable"].ToString();
            cnstrnt.ChildColID     = dr["ChildColID"].ToString();
            cnstrnt.ConstraintName = dr["ConstraintName"].ToString();
            cnstrnt.ParentTable    = dr["ParentTable"].ToString();
            cnstrnt.ParentColID    = dr["ParentColID"].ToString();
            cnstrnt.UpdateRule     = dr["UpdateRule"].ToString();
            cnstrnt.DeleteRule     = dr["DeleteRule"].ToString();
            return(cnstrnt);
        }
        //
        private void CreateSupLoadMethod(TableConstraint cnstr)
        {
            string ddl = "ddl" + Globals.GetProgramatlyName(cnstr.ParentTable);

            loadMethodsBuilder.Append("\n\t\tprivate void Load_" + ddl + "()");
            loadMethodsBuilder.Append("\n\t\t{");
            loadMethodsBuilder.Append("\n\t\t\tDataTable dtSource= " + Globals.GetProgramatlyName(cnstr.ParentTable) + "Factory.GetAll();");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".DataSource=dtSource;");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".DataTextField=\"" + SqlProvider.obj.GetExpectedNameForParent(cnstr.ParentTable) + "\";");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".DataValueField=\"" + Globals.GetProgramatlyName(cnstr.ParentColID) + "\";");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".DataBind();");
            loadMethodsBuilder.Append("\n\t\t}");
            //
            loadDataMethodBody.Append("\n\t\t\tLoad_" + ddl + "();");
        }
Пример #4
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);
                        }
                    }
                }
            }
        }
Пример #5
0
        //
        private void CreateSupLoadMethod(TableConstraint cnstr)
        {
            string ddl = "ddl" + Globals.GetProgramatlyName(cnstr.ParentTable);

            loadMethodsBuilder.Append("\n\t\tprivate void Load_" + ddl + "()");
            loadMethodsBuilder.Append("\n\t\t{");
            loadMethodsBuilder.Append("\n\t\t\tDataTable dtSource= " + Globals.GetProgramatlyName(cnstr.ParentTable) + "Factory.GetAll();");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".DataSource=dtSource;");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".DataTextField=\"" + SqlProvider.obj.GetExpectedNameForParent(cnstr.ParentTable) + "\";");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".DataValueField=\"" + Globals.GetProgramatlyName(cnstr.ParentColID) + "\";");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".DataBind();");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".UpdateAfterCallBack = true;");
            loadMethodsBuilder.Append("\n\t\t\tif (" + ddl + ".Items.Count > 0)");
            loadMethodsBuilder.Append("\n\t\t\t{");
            loadMethodsBuilder.Append("\n\t\t\t" + ddl + ".Items.Insert(0, new ListItem(\"----ÇÎÊÜÜÜÑ----\",\" \"));");
            loadMethodsBuilder.Append("\n\t\t\t}");

            loadMethodsBuilder.Append("\n\t\t}");
            //
            loadDataMethodBody.Append("\n\t\t\tLoad_" + ddl + "();");
        }
Пример #6
0
        //----------------------------------------------------------
        #endregion
        //----------------------------------------------------------
        #region GenerateReletionalGetData
        private string GenerateReletionalGetData()
        {
            StringBuilder relationalMethods = new StringBuilder();
            bool          hasIsAvailable    = SqlProvider.CheckIsATableHasIsAvailableColumnName(SqlProvider.obj.TableName);

            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))
                {
                    TableConstraint cnstr = SqlProvider.obj.GetParentColumn(column.Name);
                    if (cnstr != null)
                    {
                        relationalMethods.Append("\n" + CreateGetAllMethod(column, false));


                        relationalMethods.Append("\n" + CreateGetCountMethod(column, false));
                    }
                }
            }
            return(relationalMethods.ToString());
        }
Пример #7
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());
        }
Пример #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
        //
        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());
        }
        //
        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());
        }
Пример #11
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());
        }
        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());
        }
        //
        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());
        }
        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());
        }
Пример #16
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());
        }
Пример #17
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());
        }