Пример #1
0
        //----------------------------------------------------------------------------------------------------
        private void Get_HashInputs()
        {
            this.ViewModel.ConnectionId = -1;
            this.ViewModel.TableId      = -1;
            try
            {
                string input1 = PagesFramework.PageIdentifier.GetFromUrlHash().PageParam2;
                string input2 = PagesFramework.PageIdentifier.GetFromUrlHash().PageParam3;

                string input1_L = JsStr.S(input1).ToLower().String;
                if (input1_L == "new")
                {
                    this.ViewModel.IsCreateNew = true;
                    if (!isNaN(input2))
                    {
                        this.ViewModel.ConnectionId = 1 * input2.As <JsNumber>();
                    }
                }
                else
                {
                    this.ViewModel.IsCreateNew = false;
                    if (!isNaN(input1))
                    {
                        this.ViewModel.TableId = 1 * input1.As <JsNumber>();
                    }
                }
            }
            catch { }
        }
Пример #2
0
        private int HowManyBottomColumnsAreEmpty()
        {
            int rtn      = 0;
            var elements = jF2(".ColumnsRow");

            for (int i = elements.length - 1; i >= 0; i--)
            {
                var columnsRow = ColumnsRow.Get_UIObject(elements[i]);
                if (JsStr.S(columnsRow.ColumnName_Property).Trim().String.Length < 1)
                {
                    rtn++;
                }
                else
                {
                    i = -1; // end loop;
                }
            }
            return(rtn);
        }
Пример #3
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();
        }
Пример #4
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) });");
        }