예제 #1
0
        //----------------------------------------------------------------------------------------------------
        public void Instantiate_Sub()
        {
            this.jRoot = J("<tr class='RowUI jRoot'>");
            this.jRoot.append(this.GetHtmlRoot());

            if (this.IsOdd)
            {
                this.jRoot.addClass("RowUI_Alt");
            }

            for (int i = 0; i < this.Model.Values.Length; i++)
            {
                string value = this.Model.Values[i];
                if (this.ViewModel.TableType == GridRequest.TableTypes.View)
                {
                    if (value.Length > 100)
                    {
                        value = st.New(value).TruncateRight(value.Length - 99).TheString + "...";
                    }
                }
                this.jRoot.append(JsStr.StrFormat1("<td>{0}</td>", value));
            }

            if (this.ViewModel.TableType == GridRequest.TableTypes.Table)
            {
                jF(".Bttn_Open").attr("href", "#00-Record-" + this.Model.UniqueKey);
            }
            else
            {
                jF(".Bttn_Open").hide();
                jF(".Bttn_Open2").show();
            }


            var thisObj  = this;
            var jRootObj = this.jRoot;

            eval(@"
                jRootObj.find('td').click(function() { thisObj.Td_Clicked(this); });
                jRootObj.find('td').dblclick(function() { thisObj.Td_DoubleClicked(this); });
            ");
        }
예제 #2
0
        //------------------------------------------------------------------------------------------ Events --
        public void GetInfo_ForCreateNew_Return(ASPdb.Ajax.AjaxResponse ajaxResponse)
        {
            if (UI.Errors.ExceptionHandler.Check(ajaxResponse))
            {
                return;
            }

            var response = ajaxResponse.ReturnObj.As <TableDesignResponse>();

            this.ViewModel.Set(response);
            this.ViewModel.IsCreateNew = true;

            this.Model = new TableStructure();
            this.Model.ConnectionId       = this.ViewModel.ConnectionId;
            this.ColumnsPanel.Model       = this.Model;
            this.ViewModel.TableStructure = this.Model;


            jF2(".TopSection_CreateTable").show();
            jF2(".Label1_ConnectionName").html(response.ConnectionName);
            jF2(".Txt_TableName").focus().val("");
            jF2(".Tab_ForCreate").show();
            jF2(".PanelsHolder").show();

            var select_Schema = jF2(".Select_Schema");

            select_Schema.html("");
            for (int i = 0; i < response.Schemas.Length; i++)
            {
                if (JsStr.S(response.Schemas[i]).ToLower().String == "dbo")
                {
                    select_Schema.append("<option selected='selected'>" + response.Schemas[i] + "</option>");
                }
                else
                {
                    select_Schema.append("<option>" + response.Schemas[i] + "</option>");
                }
            }
            this.TabClick_Columns();

            ASPdatabaseNET.UI.PagesFramework.BasePage.WindowResized();
        }
예제 #3
0
        //----------------------------------------------------------------------------------------------------
        public void Instantiate_Sub()
        {
            jRoot = J("<div class='SectionBox jRoot'>");
            jRoot.append(this.GetHtmlRoot());

            if (this.Model != null && this.Model.IsOpen)
            {
                jF2(".SectionLinks").show();
            }

            var holder = jF2(".SectionLinks").html("");

            if (this.Model != null && this.Model.Items != null)
            {
                string previousSchema = "";
                int    schemasCount   = 0;
                for (int i = 0; i < this.Model.Items.Length; i++)
                {
                    if (previousSchema != this.Model.Items[i].Schema)
                    {
                        previousSchema = this.Model.Items[i].Schema;
                        schemasCount++;
                    }
                }
                previousSchema = "";
                for (int i = 0; i < this.Model.Items.Length; i++)
                {
                    var itemInfo = this.Model.Items[i];
                    if (schemasCount > 1)
                    {
                        if (previousSchema != itemInfo.Schema)
                        {
                            holder.append("<div class='Schema' title='Schema: [" + itemInfo.Schema + "]'>" + itemInfo.Schema + "</div>");
                        }
                    }
                    previousSchema = itemInfo.Schema;
                    holder.append(JsStr.StrFormat2("<a href='{0}'>{1}</a>", itemInfo.URL, itemInfo.Name));
                }
            }
            this.BindUI();
        }
예제 #4
0
        //----------------------------------------------------------------------------------------------------
        private void Populate_SelectOptions(jQuery jSelectElement, string listPropertiesSetting, object[] optionsObjects, ModelListCommand cmd)
        {
            jSelectElement.html("");

            for (int i = 0; i < optionsObjects.Length; i++)
            {
                var optionsObj = JsObj.O(optionsObjects[i]);

                string value = optionsObj.Property2(cmd.Item_Value, "");
                string text  = optionsObj.Property2(cmd.Item_Text, "");
                string style = optionsObj.Property2(cmd.Item_Style, "");

                string styleAttribute = "";
                if (style.Length > 0)
                {
                    styleAttribute = "style='" + style + "'";
                }

                jSelectElement.append(JsStr.StrFormat3("<option value='{0}' {1} >{2}</option>", value, styleAttribute, text));
            }
        }
예제 #5
0
        //----------------------------------------------------------------------------------------------------
        public void Open_Sub()
        {
            this.jRoot.html("");
            if (this.ViewModel == null || this.ViewModel.List == null || this.ViewModel.List.Length < 1)
            {
                return;
            }

            for (int i = 0; i < this.ViewModel.List.Length; i++)
            {
                var    item       = this.ViewModel.List[i];
                string indexClass = "ItemIndex_" + i;

                string html = JsStr.StrFormat4(@"
                    <div class='Item {0}'>
                        <input type='radio' name='{1}' value='{2}' /> 
                        {3}
                    </div>",
                                               indexClass, this.RadioGroupName, item.Value, item.Text);
                this.jRoot.append(html);
                Evt.Attach_Click(this, indexClass, "Div_Click", i);
            }
            this.UpdateUI();
        }
예제 #6
0
        //----------------------------------------------------------------------------------------------------
        public void Instantiate_Sub()
        {
            this.jRoot = J("<tr class='FieldUI jRoot'>");
            this.jRoot.append(this.GetHtmlRoot());

            this.EditModel        = new FieldValue();
            this.EditModel.Index  = this.Model.Index;
            this.EditModel.Value  = this.Model.Value;
            this.EditModel.IsNull = this.Model.IsNull;

            this.Column = this.ViewModel.RecordInfo.Columns[this.Model.Index];

            this.InputType = InputTypes.SingleLine;
            bool isFixedText = false;

            switch (this.Column.DataType_Name.As <JsString>().toLowerCase())
            {
            case "bit": this.InputType = InputTypes.TrueFalse; break;

            case "ntext": this.InputType = InputTypes.MultiLineBig; break;

            case "text": this.InputType = InputTypes.MultiLineBig; break;

            case "image": this.InputType = InputTypes.MultiLineBig; break;

            case "xml": this.InputType = InputTypes.MultiLineBig; break;

            //case "nvarchar": this.InputType = InputTypes.MultiLineSmall; break;
            //case "nchar": this.InputType = InputTypes.MultiLineSmall; break;
            //case "char": this.InputType = InputTypes.MultiLineSmall; break;
            //case "varbinary": this.InputType = InputTypes.MultiLineSmall; break;
            //case "varchar": this.InputType = InputTypes.MultiLineSmall; break;
            case "nvarchar": this.InputType = InputTypes.SingleLine; break;

            case "nchar": this.InputType = InputTypes.SingleLine; break;

            case "char": this.InputType = InputTypes.SingleLine; break;

            case "varbinary": this.InputType = InputTypes.SingleLine; break;

            case "varchar": this.InputType = InputTypes.SingleLine; break;
            }
            if (isFixedText)
            {
                if (this.Column.MaxLength > 99)
                {
                    this.InputType = InputTypes.MultiLineSmall;
                }
            }

            jF(".NameDiv").html(this.Column.ColumnName);

            jF(".ValueDiv").text(this.Model.Value);
            string value = jF(".ValueDiv").html();

            value = JsStr.S(value).Replace1("\n", "<br />");
            jF(".ValueDiv").html(value);


            if (this.Column.IsPrimaryKey)
            {
                jF(".NameDiv").addClass("PrimaryKeyDiv");
            }

            if (!this.Column.AllowNulls)
            {
                jF(".NullHolder").hide();
            }
            else if (this.EditModel.IsNull)
            {
                this.EditModel.IsNull = false; // used because of toggle in next line
                this.Null_Click();
            }


            var thisObj  = this;
            var jRootObj = this.jRoot;

            eval("jRootObj.find('.TextInput').keyup(function(event) { thisObj.Input_Changed(event, true) });");
        }
예제 #7
0
        public void GetGrid_Return(ASPdb.Ajax.AjaxResponse response)
        {
            if (UI.Errors.ExceptionHandler.Check(response))
            {
                if (response.Error.Message == "Invalid FilterField." && !this.LastAttemptWas_InvalidFilterField)
                {
                    this.LastAttemptWas_InvalidFilterField    = true;
                    this.ViewModel.FilterAndSort              = new FilterAndSort();
                    this.ViewModel.FilterAndSort.FilterFields = new ViewOptions_FilterField[0];
                    this.ViewModel.FilterAndSort.SortFields   = new ViewOptions_SortField[0];
                    this.ViewOptions.BttnClick_ApplyAndRefresh();
                }
                else
                {
                    return;
                }
            }
            this.LastAttemptWas_InvalidFilterField = false;

            if (this.RecordViewerUI != null)
            {
                this.RecordViewerUI = null;
            }

            this.Model = response.ReturnObj.As <GridResponse>();

            document.title = "[" + this.Model.TableName + "] - ASPdatabase.NET";

            if (this.ViewModel.FilterAndSort.FilterFields != null && this.ViewModel.FilterAndSort.FilterFields.Length > 0)
            {
                this.GridToolBar.SetFilterCount(this.ViewModel.FilterAndSort.FilterFields.Length);
            }
            else if (this.ViewModel.FilterAndSort.SortFields != null && this.ViewModel.FilterAndSort.SortFields.Length > 0)
            {
                this.GridToolBar.SetFilterCount(0);
            }
            else
            {
                this.GridToolBar.SetFilterCount(-1);
            }

            this.ViewModel.SelectionCount = 0;
            this.ViewModel.AllColumnNames = new string[0];
            for (int i = 0; i < this.Model.HeaderItems.Length; i++)
            {
                this.ViewModel.AllColumnNames[i] = this.Model.HeaderItems[i].FieldName;
            }
            this.BindUI();

            this.GridToolBar.Model = this.Model;
            this.GridToolBar.Open();


            var tableGridTable = jF(".TableGridTable").html("");

            string headerHTML = "<tr>" + "<th class='SelectAllBox' title='Select/Deselect All'><span></span></th>" + "<th></th>";

            for (int i = 0; i < this.Model.HeaderItems.Length; i++)
            {
                headerHTML += JsStr.StrFormat1("<th>{0}</th>", this.Model.HeaderItems[i].FieldName);
            }
            headerHTML += "</tr>";
            tableGridTable.html(headerHTML);
            var thisObj  = this;
            var jRootObj = this.jRoot;

            eval("jRootObj.find('.SelectAllBox').click(function(){ thisObj.SelectAllBox_Click(); });");

            this.RowUIs = new RowUI[0];
            for (int i = 0; i < this.Model.Rows.Length; i++)
            {
                this.RowUIs[i]                    = new RowUI();
                this.RowUIs[i].IsOdd              = (i % 2 == 1);
                this.RowUIs[i].ViewModel          = this.ViewModel;
                this.RowUIs[i].Model              = this.Model.Rows[i];
                this.RowUIs[i].Model.DisplayIndex = i;
                this.RowUIs[i].OnSelection.After.AddHandler(this, "RowUI_OnSelection", 0);
                this.RowUIs[i].OnOpenViewer.After.AddHandler(this, "RowUI_OnOpenViewer", 1);
                this.RowUIs[i].Instantiate();
                tableGridTable.append(this.RowUIs[i].jRoot);
            }

            UI.PagesFramework.BasePage.WindowResized();
        }