Ejemplo n.º 1
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());
        }
Ejemplo n.º 2
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());
        }
Ejemplo n.º 3
0
        //
        private string CreateDeleteCommandHandler()
        {
            string dataGridID = "dg" + global.TableProgramatlyName;
            string id         = Globals.GetProgramatlyName(ID.Name);

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

            pageIndexHandler.Append("\n\tprotected void " + dataGridID + "_DeleteCommand(object source, DataGridCommandEventArgs e)");
            pageIndexHandler.Append("\n\t{");
            //	pageIndexHandler.Append("\n\t\tTestData.Tables[0].Rows.Remove(TestData.Tables[0].Rows.Find(" + global.ViewAllDataGrid + ".DataKeys[e.Item.ItemIndex]));");
            pageIndexHandler.Append("\n\t\t" + Globals.GetAliasDataType(ID.Datatype) + " " + id + " = Convert.To" + Globals.GetDataType(ID.Datatype) + "(" + dataGridID + ".DataKeys[e.Item.ItemIndex]);");
            pageIndexHandler.Append("\n\t\tif(" + global.TableFactoryClass + "." + MethodType.Delete.ToString() + "(" + id + "))");
            pageIndexHandler.Append("\n\t\t{");
            pageIndexHandler.Append("\n\t\tint x = " + dataGridID + ".CurrentPageIndex;");
            pageIndexHandler.Append("\n\t\tif (" + dataGridID + ".PageCount - 1 > x) " + dataGridID + ".CurrentPageIndex = x;");
            pageIndexHandler.Append("\n\t\telse");
            pageIndexHandler.Append("\n\t\t{");
            pageIndexHandler.Append("\n\t\tif (" + dataGridID + ".PageCount != 1)" + dataGridID + ".CurrentPageIndex = x - 1;");
            pageIndexHandler.Append("\n\t\t}");
            pageIndexHandler.Append("\n\t\t\tLoadData();");
            pageIndexHandler.Append("\n\t\t}");
            pageIndexHandler.Append("\n\t}");
            return(pageIndexHandler.ToString());
            //
        }
        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());
        }
        //
        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());
        }
Ejemplo n.º 6
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 GenerateClass()
        {
            string id = Globals.GetProgramatlyName(ID.Name);

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

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

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

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

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

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

            pageCode.Append("\n\t}");
            pageCode.Append("\n\t//--------------------------------------------------------");
            pageCode.Append("\n\t#endregion");
            pageCode.Append("\n}");
            return(pageCode.ToString());
        }