示例#1
0
        public void TestThree()
        {
            SelectPage page       = new SelectPage(_driver).SelectOptions(new int[] { 2, 1, 3 }).ClickFirstSelected();
            string     firstValue = page.dropdown.AllSelectedOptions[2].GetAttribute("value");

            Assert.IsTrue(page.AllSelectedElement.Text.Contains(firstValue), "Shows first selected state");
        }
示例#2
0
        public void TestAllSelectedForFour()
        {
            SelectPage page       = new SelectPage(_driver).SelectOptions(new int[] { 2, 1, 3, 0 }).ClickAllSelected();
            bool       intersects = page.GetSelectedArray().Intersect(page.AllSelectedElement.Text.Split(" ")).Any();

            Assert.IsTrue(intersects);
        }
示例#3
0
        /// <summary>
        /// 设置搜索成员
        /// </summary>
        /// <returns></returns>
        private string GetSearchAttr(SelectPage control)
        {
            StringBuilder result = new StringBuilder();

            if (!IsPreview && control.Bindings.Count > 0)
            {
                foreach (var item in control.Bindings)
                {
                    string bindPath     = item.Path == null ? "" : item.Path;
                    string bindProperty = item.Property == null ? "" : item.Property;
                    string field        = bindPath.Split('.')[bindPath.Split('.').Length - 1];
                    if (bindProperty.ToLower() == "searchvalue" && !string.IsNullOrEmpty(bindPath) && !string.IsNullOrEmpty(bindProperty))
                    {
                        string path = string.Empty;
                        if (bindPath.Split('.').Length > 1)
                        {
                            path = bindPath.Split('.')[0];
                        }
                        result.AppendFormat("{0}: at('rel:{1}','{2}')", "searchField", path, field);
                    }
                }
            }
            if (result.ToString().Length == 0)
            {
                if (!string.IsNullOrEmpty(control.SearchValue))
                {
                    result.AppendFormat("{0}:'@{1}',", "searchField", control.SearchValue);
                }
                else if (!string.IsNullOrEmpty(control.DisplayMember))
                {
                    result.AppendFormat("{0}:'@{1}'", "searchField", control.DisplayMember);
                }
            }
            return(result.ToString());
        }
示例#4
0
        /// <summary>
        /// 选中页面
        /// </summary>
        private void pageSelectBackground(SelectPage elPage)
        {
            btnHome.Background    = new SolidColorBrush(Colors.Black);
            btnMessage.Background = new SolidColorBrush(Colors.Black);
            btnSearch.Background  = new SolidColorBrush(Colors.Black);
            btnCreate.Background  = new SolidColorBrush(Colors.Black);
            switch (elPage)
            {
            case SelectPage.Home:
                CurrentPageIndex   = 0;
                btnHome.Background = new SolidColorBrush(Colors.Red);
                break;

            case SelectPage.Msg:
                CurrentPageIndex      = 1;
                btnMessage.Background = new SolidColorBrush(Colors.Red);
                break;

            case SelectPage.Search:
                CurrentPageIndex     = 2;
                btnSearch.Background = new SolidColorBrush(Colors.Red);
                break;

            case SelectPage.Create:
                CurrentPageIndex     = 3;
                btnCreate.Background = new SolidColorBrush(Colors.Red);
                break;

            default:
                break;
            }
            this.LoadPages();
        }
示例#5
0
        public void Exercise_Select_Multi_Two_Test()
        {
            // TODO: Add your test code here
            var internetPage = new InternetPage(this.DriverContext);

            internetPage.GoToPageNew(ProjectBaseConfiguration.NewPage);
            this.DriverContext.WindowMaximize();
            var selectPage = new SelectPage(this.DriverContext);

            selectPage.SelectMulti("Florida", "Texas");
            Verify.That(
                this.DriverContext,
                () => Assert.AreEqual("This would be your first example on select dropd down list to with Selenium.", selectPage.GetHeader()),
                () => Assert.AreEqual("Options selected are : Florida,Texas", selectPage.GetTextSelected("getall-selected")));
        }
示例#6
0
        public void Exercise_Select_Single_Test()
        {
            // TODO: Add your test code here
            var internetPage = new InternetPage(this.DriverContext);

            internetPage.GoToPageNew(ProjectBaseConfiguration.NewPage);
            this.DriverContext.WindowMaximize();
            var selectPage = new SelectPage(this.DriverContext);

            selectPage.SelectSingle("Friday");
            Verify.That(
                this.DriverContext,
                () => Assert.AreEqual("This would be your first example on select dropd down list to with Selenium.", selectPage.GetHeader()),
                () => Assert.AreEqual("Day selected :- Friday", selectPage.GetTextSelected("selected-value")));
        }
示例#7
0
        private void ChangePage(int step)
        {
            this.CurrentPageIndex += step;

            this.LoadPages();

            SelectPage elPage = (SelectPage)this.CurrentPageIndex;

            pageSelectBackground(elPage);

            this.PanoramaContentTranslate.X += PageWidth * step;

            this.SlideTitleDoubleAnimation.To = this.CurrentPageIndex * PageWidth / 2 * -1;

            this.PageChangeAnimation.Begin();
        }
示例#8
0
        /// <summary>
        /// 设置Store
        /// </summary>
        /// <returns></returns>
        private string GetStore()
        {
            StringBuilder sb = new StringBuilder();
            bool          bindingDataSource          = false;
            SelectPage    control                    = this.ControlHost.Content as SelectPage;
            Dictionary <string, string> dictProperty = control.GetPropertyBindValue();

            if (!IsPreview && control.Bindings.Count > 0)
            {
                foreach (var item in control.Bindings)
                {
                    string bindPath     = item.Path == null ? "" : item.Path;
                    string bindProperty = item.Property == null ? "" : item.Property;
                    if (bindProperty.ToLower() == "datasource")
                    {
                        string property = string.Empty;
                        if (dictProperty.ContainsKey(bindProperty))
                        {
                            if (dictProperty.TryGetValue(bindProperty, out property))
                            {
                                bindProperty = property;
                            }
                        }
                        if (!string.IsNullOrEmpty(bindPath) && !string.IsNullOrEmpty(bindProperty))
                        {
                            string path = bindPath;
                            sb.AppendFormat("at('rel:{0}', '{1}').direction(1),", "", path);
                            bindingDataSource = true;
                        }
                    }
                }
            }
            if (!IsPreview && control.ExistProperty("DataSource") && !bindingDataSource)
            {
                string bindPath = control.DataSource;
                if (!string.IsNullOrEmpty(bindPath))
                {
                    sb.AppendFormat("at('rel:{0}', '{1}').direction(1),", "", bindPath);
                }
            }
            string result = sb.ToString().Length == 0 ? "" : sb.ToString().Substring(0, sb.Length - 1);

            return(result);
        }
示例#9
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtUsername.Text.Trim() == "admin" && txtPassword.Text.Trim() == "admin")
     {
         SelectPageAdmin selectPageAdmin = new SelectPageAdmin();
         this.Hide();
         selectPageAdmin.Show();
         MessageBox.Show("Login as admin");
     }
     else
     {
         if (loginHandler.GetDataFromDb(txtUsername.Text.Trim(), txtPassword.Text.Trim()))
         {
             SelectPage selectPage = new SelectPage();
             this.Hide();
             selectPage.Show();
             MessageBox.Show("Login as client");
         }
         else
         {
             MessageBox.Show("Incorect username or password");
         }
     }
 }
示例#10
0
        /// <summary>
        /// 设置属性
        /// </summary>
        protected override void SetAttributes()
        {
            SelectPage control = this.ControlHost.Content as SelectPage;

            this.HtmlWriter.AddAttribute("dojoType", "Controls/SelectPage");
            if (!IsPreview && !string.IsNullOrEmpty(this.ControlHost.Name))
            {
                this.HtmlWriter.AddAttribute("id", this.ControlHost.Name);
                this.HtmlWriter.AddAttribute("name", this.ControlHost.Name);
            }
            if (!IsPreview)
            {
                this.HtmlWriter.AddAttribute("forScreen", this.ProjectDocument.Name);
            }

            string stores = GetStore();

            if (!string.IsNullOrEmpty(stores))
            {
                this.HtmlWriter.AddAttribute("store", stores, false);
            }
            StringBuilder sbProps       = new StringBuilder();
            StringBuilder returnContent = new StringBuilder();
            string        props         = control.BuildControlProps(this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent);

            if (!string.IsNullOrEmpty(props))
            {
                sbProps.AppendFormat("{0},", props);
            }
            string searchAttr = GetSearchAttr();

            if (!string.IsNullOrEmpty(searchAttr))
            {
                sbProps.AppendFormat("{0},", searchAttr);
            }
            sbProps.AppendFormat("{0},", "multiple:" + control.Multiple.ToString().ToLower());
            sbProps.AppendFormat("{0},", "pagination:" + control.Pagination.ToString().ToLower());
            sbProps.AppendFormat("{0},", "dropButton:" + control.DropButton.ToString().ToLower());
            sbProps.AppendFormat("{0},", "selectToCloseList:" + control.SelectToCloseList.ToString().ToLower());
            sbProps.AppendFormat("{0},", "autoSelectFirst:" + control.AutoSelectFirst.ToString().ToLower());
            sbProps.AppendFormat("{0},", "maxSelectLimit:" + control.MaxSelectLimit.ToString());
            sbProps.AppendFormat("{0},", "inputDelay:" + control.InputDelay.ToString());
            if (control.ShowSearch)
            {
                sbProps.AppendFormat("{0},", "showSearch:false");
            }
            else
            {
                sbProps.AppendFormat("{0},", "showSearch:true");
            }
            if (!string.IsNullOrEmpty(control.SelectIndex))
            {
                sbProps.AppendFormat("{0},", "selectIndex:'" + control.SelectIndex.ToString() + "'");
            }
            string dropDownButtonName = string.Empty;

            if (!IsPreview && this.Parent != null)
            {
                dropDownButtonName = BuildCommonMethod.GetIsDropDownButton(this.Parent);
            }
            sbProps.AppendFormat("{0},", "dropDownButtonName:'" + dropDownButtonName + "'");

            if (sbProps.ToString().Length > 0)
            {
                this.HtmlWriter.AddAttribute("data-dojo-props", sbProps.ToString().Substring(0, sbProps.ToString().Length - 1), false);
            }

            base.SetAttributes();
        }
示例#11
0
        private void LoginAction(object obj)
        {
            if (obj == null)
            {
                ErrorMessage = "null object error";
                return;
            }
            PM = Trader = Admin = false;
            List <Role> role       = Entity.Roles.ToList();
            var         parameters = (object[])obj;
            dynamic     password   = parameters[1];

            Login_Model.Login cred = parameters[0] as Login_Model.Login;
            if (String.IsNullOrEmpty(cred.UserName) || String.IsNullOrEmpty(password.Password.ToString()))
            {
                ErrorMessage = String.IsNullOrEmpty(cred.UserName) ? "Username can not be empty !!" : "Password can not be empty !!";
                return;
            }

            cred.Password = password.Password;
            List <User_Role> urole = Entity.User_Role.ToList();
            List <User>      users = Entity.Users.ToList();

            if (users.Exists(u => (u.UserName == cred.UserName)))
            {
                User u = users.First(u2 => (u2.UserName == cred.UserName));
                if (u.PassWord == cred.Password)
                {
                    if (u.ISActive)
                    {
                        Session.CurrentUser = u;
                        List <User_Role> roles = urole.FindAll(user => (user.UserID == u.UserID));

                        foreach (var item in roles)
                        {
                            switch (item.RoleID)
                            {
                            case 1:
                                PM = true;
                                break;

                            case 2:
                                Trader = true;
                                break;

                            case 3:
                                Admin = true;
                                break;
                            }
                        }
                        if (roles.Count > 1)
                        {
                            var oldCurrentWindow = App.Current.MainWindow;
                            //App.Current.MainWindow.Hide();
                            SelectPage sp = new SelectPage();
                            App.Current.MainWindow = sp;
                            App.Current.MainWindow.Show();
                            //sp.Show();
                            oldCurrentWindow.Close();
                        }
                        else
                        {
                            if (PM)
                            {
                                var oldCurrentWindow = App.Current.MainWindow;
                                //App.Current.MainWindow.Hide();
                                Dashboard d = new Dashboard();
                                App.Current.MainWindow = d;
                                App.Current.MainWindow.Show();
                                Session.CurrentRole = Entity.Roles.Find(2);
                                oldCurrentWindow.Close();
                            }
                            else if (Trader)
                            {
                                var oldCurrentWindow = App.Current.MainWindow;
                                //App.Current.MainWindow.Hide();
                                TraderDashboard d = new TraderDashboard();
                                App.Current.MainWindow = d;
                                App.Current.MainWindow.Show();
                                Session.CurrentRole = Entity.Roles.Find(1);
                                oldCurrentWindow.Close();
                            }
                            else if (Admin)
                            {
                                var oldCurrentWindow = App.Current.MainWindow;
                                //App.Current.MainWindow.Hide();
                                Dashboard_Admin d = new Dashboard_Admin();
                                App.Current.MainWindow = d;
                                App.Current.MainWindow.Show();
                                Session.CurrentRole = Entity.Roles.Find(3);
                                oldCurrentWindow.Close();
                            }
                        }
                    }
                }
                else
                {
                    ErrorMessage = "Invalid UserName/Password";
                    return;
                }
            }
            else
            {
                ErrorMessage = "Invalid UserName/Password";
                return;
            }
        }
示例#12
0
        /// <summary>
        /// 生成列内容
        /// </summary>
        /// <param name="content"></param>
        /// <param name="child"></param>
        /// <returns></returns>
        private string BuildCellContent(DataGrid content, ControlHost child, bool isGroupHeader)
        {
            StringBuilder cellContent = new StringBuilder();
            StringBuilder sbProps     = new StringBuilder();
            ControlBase   control     = child.Content;
            dynamic       c           = control;
            string        controlName = control.GetType().Name;

            StringBuilder sbStyle = new StringBuilder();

            #region title
            string controlTitle = child.Title == null ? "" : child.Title;
            cellContent.AppendFormat("label:'{0}',", child.Title);
            #endregion
            #region width
            if (control.ExistProperty("Width"))
            {
                if (c.Width > 0)
                {
                    cellContent.AppendFormat("width:{0},", c.Width.ToString());
                }
            }
            if (control.ExistProperty("MinWidth"))
            {
                if (c.MinWidth > 0)
                {
                    cellContent.AppendFormat("minWidth:{0},", c.MinWidth.ToString());
                }
            }
            #endregion
            #region editable
            bool     editable    = true;
            DataGrid gridControl = (DataGrid)this.ControlHost.Content;
            if (gridControl.IsReadOnly || !gridControl.IsEnable)
            {
                editable = false;
            }
            if (editable)
            {
                if (control.ExistProperty("IsReadOnly"))
                {
                    if (c.IsReadOnly)
                    {
                        editable = false;
                    }
                }
                if (editable)
                {
                    if (control.ExistProperty("IsEnable"))
                    {
                        if (!c.IsEnable)
                        {
                            editable = false;
                        }
                    }
                }
            }
            if (controlName == "CheckBox" || controlName == "RadioBox")
            {
                editable = true;
            }
            if (controlName == "Hyperlink" || controlName == "Button")
            {
                editable = false;
            }
            #endregion
            #region sortable
            if (!gridControl.ColumnSort)
            {
                cellContent.Append("sortable:false,");
            }
            #endregion
            #region AttachObject
            bool   editHead   = false;
            string formatText = string.Empty;
            if (child.AttachObject != null)
            {
                var dataGridAttach = child.AttachObject as DataGridAttach;
                if (dataGridAttach != null)
                {
                    editHead = dataGridAttach.EditHead;
                    if (editHead)
                    {
                        cellContent.AppendFormat("editHead:{0},", editHead.ToString().ToLower());
                    }
                    cellContent.AppendFormat("titleDock:'{0}',", dataGridAttach.TitlePosition.ToString().ToLower());
                    cellContent.AppendFormat("contentDock:'{0}',", dataGridAttach.ContentPosition.ToString().ToLower());
                    if (!string.IsNullOrEmpty(dataGridAttach.FormatText))
                    {
                        formatText = dataGridAttach.FormatText.Replace("\r\n", "").Replace("\"", "\'").Replace("this", "inDatum").Trim();
                    }
                }
                else
                {
                    var dataGridHeaderAtt = child.AttachObject as DataGridHeaderAttach;
                    if (dataGridHeaderAtt != null)
                    {
                        cellContent.AppendFormat("titleDock:'{0}',", dataGridHeaderAtt.TitlePosition.ToString().ToLower());
                        cellContent.AppendFormat("contentDock:'{0}',", dataGridHeaderAtt.ContentPosition.ToString().ToLower());
                        #region
                        //if (dataGridHeaderAtt.ColumnSpan > 1)
                        //{
                        //    cellContent.AppendFormat("colSpan:{0},isgroup:true,sortable:false,", dataGridHeaderAtt.ColumnSpan.ToString().ToLower());
                        //}
                        //if (dataGridHeaderAtt.RowSpan > 1)
                        //{
                        //    isBuildFied = false;
                        //    cellContent.AppendFormat("rowSpan:{0},isgroup:true,sortable:false,", dataGridHeaderAtt.RowSpan.ToString().ToLower());
                        //}
                        #endregion
                    }
                }
            }
            #endregion
            #region style
            if (control.ExistProperty("BackColor"))
            {
                string backColor = c.BackColor.R.ToString() + "," + c.BackColor.G.ToString() + "," + c.BackColor.B.ToString() + "," + c.BackColor.A.ToString();
                if (c.BackColor.ToString() != "#FFFFFFFF")
                {
                    sbStyle.AppendFormat("backgroundColor:'rgba({0})',", backColor);
                }
            }
            if (control.ExistProperty("ForeColor"))
            {
                string foreColor = c.ForeColor.R.ToString() + "," + c.ForeColor.G.ToString() + "," + c.ForeColor.B.ToString() + "," + c.ForeColor.A.ToString();
                if (c.ForeColor.ToString() != "#FF000000")
                {
                    sbStyle.AppendFormat("color:'rgba({0})',", foreColor);
                }
            }
            if (control.ExistProperty("FontSize"))
            {
                if (c.FontSize != null && c.FontSize > 0)
                {
                    sbStyle.AppendFormat("fontSize:{0},", c.FontSize.ToString());
                }
            }

            if (sbStyle.ToString().Length > 0)
            {
                cellContent.Append("style:{" + sbStyle.ToString().Substring(0, sbStyle.ToString().Length - 1) + "},");
            }
            #endregion
            if (!this.IsPreview)
            {
                StringBuilder sbConstraints = new StringBuilder();
                StringBuilder returnContent = new StringBuilder();
                bool          isGridFormat  = false;
                if (!string.IsNullOrEmpty(formatText))
                {
                    isGridFormat = true;
                }
                string props = ControlExtend.BuildControlProps(control, this.ScreenDefinition, this.IsPreview, this.PermissionData, returnContent, sbConstraints, true, false, isGridFormat);
                if (!string.IsNullOrEmpty(props))
                {
                    sbProps.AppendFormat("{0},", props);
                }
                if (returnContent.ToString().Length > 0)
                {
                    cellContent.Append(returnContent.ToString());
                }
                if (!isGroupHeader)
                {
                    bool arrowButton = false;
                    if (controlName == "DatePicker")
                    {
                        string     datePattern = "yyyy-MM-dd";
                        DatePicker dp          = control as DatePicker;
                        if (!string.IsNullOrEmpty(dp.DatePattern))
                        {
                            datePattern = dp.DatePattern;
                        }
                        string field = string.Empty;
                        foreach (var item in dp.Bindings)
                        {
                            string bindPath     = item.Path == null ? "" : item.Path.Replace("CurrentItem", "SelectedItem");
                            string bindProperty = item.Property == null ? "" : item.Property;
                            if (bindProperty.ToLower() == "value" && bindPath.Split('.').Length >= 4)
                            {
                                field = bindPath.Split('.')[bindPath.Split('.').Length - 1];
                                break;
                            }
                        }
                        if (!string.IsNullOrEmpty(field))
                        {
                            cellContent.AppendFormat("{0},", "formatter:function(inDatum){if(inDatum){return dojo.date.locale.format(new Date(inDatum." + field + "),this.constraint);}else{return '';}},constraint:{formatLength:'long',selector:'date',datePattern:'" + datePattern + "'}");
                        }
                        else
                        {
                            cellContent.AppendFormat("{0},", "formatter:function(inDatum){if(inDatum){return dojo.date.locale.format(new Date(inDatum),this.constraint);}else{return '';}},constraint:{formatLength:'long',selector:'date',datePattern:'" + datePattern + "'}");
                        }
                    }
                    if (controlName == "TimePicker")
                    {
                        string     timePattern = "MM-dd";
                        TimePicker dp          = control as TimePicker;
                        string     field       = string.Empty;
                        foreach (var item in dp.Bindings)
                        {
                            string bindPath     = item.Path == null ? "" : item.Path.Replace("CurrentItem", "SelectedItem");
                            string bindProperty = item.Property == null ? "" : item.Property;
                            if (bindProperty.ToLower() == "value" && bindPath.Split('.').Length >= 4)
                            {
                                field = bindPath.Split('.')[bindPath.Split('.').Length - 1];
                                break;
                            }
                        }
                        if (!string.IsNullOrEmpty(field))
                        {
                            cellContent.AppendFormat("{0},", "formatter:function(inDatum){if(inDatum){return dojo.date.locale.format(new Date(inDatum." + field + "),this.constraint);}else{return '';}},constraint:{formatLength:'short',selector:'time',timePattern:'" + timePattern + "'}");
                        }
                        else
                        {
                            cellContent.AppendFormat("{0},", "formatter:function(inDatum){if(inDatum){return dojo.date.locale.format(new Date(inDatum),this.constraint);}else{return '';}},constraint:{formatLength:'short',selector:'time',timePattern:'" + timePattern + "'}");
                        }
                    }
                    if (controlName == "SelectBox")
                    {
                        SelectBox selectBoxControl = control as SelectBox;
                        sbProps.AppendFormat("isMultiSelect:{0},", selectBoxControl.IsMultiSelect.ToString().ToLower());
                        sbProps.AppendFormat("clearTip:{0},", selectBoxControl.ClearTip.ToString().ToLower());
                        if (selectBoxControl.ScreenTitle != null)
                        {
                            sbProps.AppendFormat("screenTitle:'{0}',", selectBoxControl.ScreenTitle);
                        }
                        if (selectBoxControl.ScreenName != null)
                        {
                            sbProps.AppendFormat("screenName:'{0}',", selectBoxControl.ScreenName);
                        }
                        if (selectBoxControl.ScreenInParameter != null)
                        {
                            sbProps.AppendFormat("inputParameter:'{0}',", selectBoxControl.ScreenInParameter);
                        }
                        if (selectBoxControl.ScreenOutParameter != null)
                        {
                            sbProps.AppendFormat("outputParameter:'{0}',", selectBoxControl.ScreenOutParameter);
                        }
                        if (selectBoxControl.ScreenOtherParameter != null)
                        {
                            sbProps.AppendFormat("otherParameter:'{0}',", selectBoxControl.ScreenOtherParameter);
                        }
                        if (selectBoxControl.ScreenWidth != 0)
                        {
                            sbProps.AppendFormat("screenWidth:{0},", selectBoxControl.ScreenWidth);
                        }
                        if (selectBoxControl.ScreenHeight != 0)
                        {
                            sbProps.AppendFormat("screenHeight:{0},", selectBoxControl.ScreenHeight);
                        }
                        string showModel = selectBoxControl.ShowModel ? "dialog" : "tooltip";
                        sbProps.AppendFormat("showModel:'{0}',", showModel);
                    }
                    if (controlName == "SelectPage")
                    {
                        SelectPage selectPageControl = control as SelectPage;
                        string     searchAttr        = GetSearchAttr(selectPageControl);
                        if (!string.IsNullOrEmpty(searchAttr))
                        {
                            sbProps.AppendFormat("{0},", searchAttr);
                        }
                        sbProps.AppendFormat("{0},", "multiple:" + selectPageControl.Multiple.ToString().ToLower());
                        sbProps.AppendFormat("{0},", "pagination:" + selectPageControl.Pagination.ToString().ToLower());
                        sbProps.AppendFormat("{0},", "dropButton:" + selectPageControl.DropButton.ToString().ToLower());
                        sbProps.AppendFormat("{0},", "selectToCloseList:" + selectPageControl.SelectToCloseList.ToString().ToLower());
                        sbProps.AppendFormat("{0},", "autoSelectFirst:" + selectPageControl.AutoSelectFirst.ToString().ToLower());
                        sbProps.AppendFormat("{0},", "maxSelectLimit:" + selectPageControl.MaxSelectLimit.ToString());
                        sbProps.AppendFormat("{0},", "inputDelay:" + selectPageControl.InputDelay.ToString());
                        sbProps.AppendFormat("{0},", "showSearch:" + selectPageControl.ShowSearch.ToString().ToLower());
                        if (!string.IsNullOrEmpty(selectPageControl.SelectIndex))
                        {
                            sbProps.AppendFormat("{0},", "selectIndex:'" + selectPageControl.SelectIndex.ToString() + "'");
                        }
                        string dropDownButtonName = string.Empty;
                        sbProps.AppendFormat("{0},", "dropDownButtonName:'" + dropDownButtonName + "'");
                    }
                    if (controlName == "Numeric")
                    {
                        Numeric numericCtl = control as Numeric;
                        arrowButton = numericCtl.ArrowButton;
                    }

                    if (editable)
                    {
                        if (controlName == "CheckBox" || controlName == "RadioBox")
                        {
                            if (!string.IsNullOrEmpty(formatText))
                            {
                                cellContent.AppendFormat("{0},", "formatter:function(inDatum){" + formatText + "}");
                            }
                            else
                            {
                                #region
                                bool isReadOnly = false;
                                if (control.ExistProperty("IsReadOnly"))
                                {
                                    if (c.IsReadOnly)
                                    {
                                        isReadOnly = true;
                                    }
                                }
                                if (!isReadOnly)
                                {
                                    if (control.ExistProperty("IsEnable"))
                                    {
                                        if (!c.IsEnable)
                                        {
                                            isReadOnly = true;
                                        }
                                    }
                                }
                                if (isReadOnly)
                                {
                                    sbProps.AppendFormat("{0},", "readOnly:true");
                                }
                                #endregion
                                cellContent.AppendFormat("{0},", control.GetGridCellTypeNewGrid(controlTitle, arrowButton));
                            }
                        }
                        else
                        {
                            cellContent.AppendFormat("{0},", control.GetGridCellTypeNewGrid(controlTitle, arrowButton));
                            if (content.SingleClickEdit)
                            {
                                cellContent.AppendFormat("editOn:'click',");
                            }
                            else
                            {
                                cellContent.AppendFormat("editOn:'dblclick',");
                            }
                        }
                        if (sbConstraints.ToString().Length > 0)
                        {
                            string constrains = sbConstraints.ToString().Substring(0, sbConstraints.ToString().Length - 1);
                            sbProps.Append("constraints:{" + constrains + "},");
                        }
                        sbProps.AppendFormat("{0},", "context:at('rel:','VM')");
                        if (sbProps.ToString().Length > 0)
                        {
                            cellContent.Append("editorArgs:{" + sbProps.ToString().Substring(0, sbProps.ToString().Length - 1) + "},");
                        }
                        if (editHead)
                        {
                            StringBuilder batchEditCondition = new StringBuilder();
                            foreach (var item in control.Bindings)
                            {
                                string bindPath     = item.Path == null ? "" : item.Path.Replace("CurrentItem", "SelectedItem");
                                string bindProperty = item.Property == null ? "" : item.Property;
                                string path         = bindPath;
                                string field        = bindPath.Split('.')[bindPath.Split('.').Length - 1];
                                if (bindProperty.ToLower() == "batcheditcondition")
                                {
                                    batchEditCondition.AppendFormat("{0}: at('rel:{1}','{2}')", bindProperty.ToLower(), "", field);
                                    break;
                                }
                            }
                            sbProps.AppendFormat("{0},", batchEditCondition.ToString());
                            cellContent.Append("editorHeadArgs:{ " + sbProps.ToString().Substring(0, sbProps.ToString().Length - 1) + "},");
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(formatText))
                        {
                            cellContent.AppendFormat("{0},", "formatter:function(inDatum){" + formatText + "}");
                        }
                    }
                }
            }
            return(cellContent.ToString());
        }
示例#13
0
 protected override void OnSetUp()
 {
     page = Go.To<SelectPage>();
 }