예제 #1
0
 public static void TypeFlightDestination(string destination)
 {
     Logger.AddTypeAction("FlightDestination", destination);
     //Enter destination in destination text field
     WebControls.TypeAndSelectDropDown("DestinationAirportName", "ui-id-2", destination);
     HomePage.Data.Destination = destination;
 }
예제 #2
0
        //public static void TypeHotelDestination(string destination)
        //{
        //    Logger.AddTypeAction("HotelDestination", destination);
        //    //Enter destination in destination text field
        //    WebControls.TypeAndSelectDropDown("Destination", "ui-id-1", destination);
        //    HomePage.Data.Destination = destination;
        //}

        public static void TypeHotelDestination(string destination, bool isHotel)
        {
            Logger.AddTypeAction("HotelDestination", destination);
            //Enter destination in destination text field
            WebControls.TypeAndSelectDestinationDropDown("Destination", "ui-id-1", destination, isHotel);
            HomePage.Data.Destination = destination;
        }
예제 #3
0
        /// <summary>
        /// Handles the OnBeforeUnBindControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        protected bool wwDataBinder_BeforeUnbindControl(WebControls.wwDataBindingItem item)
        {
            // Disabled HTML items are not posted during a postback, so we don't have accurate information about their states.
            // Look for the checkboxes that cause other controls to be disabled, and assign the value of the disabled control to their
            // database setting. This allows disabled controls to retain their original value if an admin later re-enables them.
            if (!this.chkEnableSlideShow.Checked)
            {
                // When the slide show is unchecked, the slide show interval textbox is disabled via javascript.
                if (item.ControlId == this.txtSlideShowInterval.ID)
                {
                    this.txtSlideShowInterval.Text = GallerySettings.SlideshowInterval.ToString(CultureInfo.CurrentCulture);
                    return false;
                }
            }

            if (!this.chkEnableGoZipDownload.Checked)
            {
                // When the download ZIP objects feature is unchecked, the download albums in ZIP file checkbox is disabled via javascript.
                if (item.ControlId == this.chkEnableAlbumZipDownload.ID)
                {
                    this.chkEnableAlbumZipDownload.Checked = GallerySettings.EnableAlbumZipDownload;
                    return false;
                }
            }

            return true;
        }
예제 #4
0
 private void ClearForm()
 {
     TeamId     = string.Empty;
     TeamName   = string.Empty;
     Categories = WebControls.SetCheckboxListSelectedItem(Categories, null);
     Users      = WebControls.SetCheckboxListSelectedItem(Users, null);
 }
예제 #5
0
        public BaseSteps(NgWebDriver ngDriver)
        {
            _ngDriver    = ngDriver;
            _webControls = new WebControls(_ngDriver);

            _sharedPageElements = new SharedPageElements(_webControls);
        }
예제 #6
0
        public NavBarLinksSteps(NgWebDriver ngDriver, WebControls webControls)
        {
            _ngDriver    = ngDriver;
            _webControls = webControls;

            _sharedPageElements = new SharedPageElements(webControls);
        }
예제 #7
0
        public void LoadDropDown(DropDownList argsDdl, KeyValuePairItems argsFilters, StringList argsSort,
                                 DDLTypes argsType, DataBaseInfo dataBaseInfo, KeyValuePairItems datasource = null)
        {
            KeyValuePairItems dt;

            if (datasource != null)// && argsType == DDLTypes.None)
            {
                dt = datasource;
            }
            else
            {
                var queryArgument = new QueryArgument(dataBaseInfo)
                {
                    DdlType = argsType,
                    Filters = argsFilters,
                    Sort    = argsSort
                };
                dt = _genericModel.GetData(queryArgument);
            }
            WebControls.ClearDdl(argsDdl, string.Empty);
            foreach (var dr in dt)
            {
                argsDdl.Items.Add(new ListItem(dr.Value, dr.Key));
            }
        }
예제 #8
0
        //public static void TypeHotelDestination(string destination)
        //{
        //    Logger.AddTypeAction("HotelDestination", destination);
        //    //Enter destination in destination text field
        //    WebControls.TypeAndSelectDropDown("Destination", "ui-id-1", destination);
        //    HomePage.Data.Destination = destination;
        //}

        public static void TypeHotelDestination(string destination, bool isHotel)
        {
            Logger.AddTypeAction("HotelDestination", destination);
            //Enter destination in destination text field
            WebControls.TypeAndSelectDestinationDropDown("Destination", "ul#ui-id-1.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-content.ui-corner-all.Destination_autocomplete", destination, isHotel);
            HomePage.Data.Destination = destination;
        }
예제 #9
0
        public KeyValuePairItems LoadDropDown(DropDownList argsDdl, KeyValuePairItems argsFilters, StringList argsSort,
                                              DataBaseInfo dataBaseInfo, KeyValuePairItems datasource = null)
        {
            KeyValuePairItems dt;

            if (datasource != null)
            {
                dt = datasource;
            }
            else
            {
                var queryArgument = new QueryArgument(dataBaseInfo)
                {
                    Filters = argsFilters,
                    Sort    = argsSort
                };
                dt = GetData(queryArgument);
            }
            if (argsDdl == null)
            {
                return(dt);
            }
            WebControls.ClearDdl(argsDdl, string.Empty);
            foreach (var dr in dt)
            {
                argsDdl.Items.Add(new ListItem(dr.Value, dr.Key));
            }
            return(dt);
        }
예제 #10
0
 public static void TypeFlightDestination(string destination)
 {
     Logger.AddTypeAction("FlightDestination", destination);
     //Enter destination in destination text field
     WebControls.TypeAndSelectDropDown("DestinationAirportName", "ul#ui-id-2.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-content.ui-corner-all.DestinationAirportName_autocomplete li.ui-menu-item", destination);
     HomePage.Data.Destination = destination;
 }
예제 #11
0
        public bool LoadDropDownIfMorereturnFalse(DropDownList argsDdl, KeyValuePairItems argsFilters, StringList argsSort,
                                                  DataBaseInfo dataBaseInfo)
        {
            KeyValuePairItems dt;
            var more = false;

            var queryArgument = new QueryArgument(dataBaseInfo)
            {
                Filters = argsFilters,
                Sort    = argsSort
            };

            dt = GetData(queryArgument);
            WebControls.ClearDdl(argsDdl, string.Empty);
            if (dt.Count > 10000)
            {
                more = true;
            }
            else
            {
                foreach (var dr in dt)
                {
                    argsDdl.Items.Add(new ListItem(dr.Value, dr.Key));
                }
            }
            return(more);
        }
 public void TypeHotelDestination(string destination)
 {
     Logger.AddTypeAction("HotelDestination", destination);
     //Enter destination in destination text field
     WebControls.TypeAndSelectDropDown("Destination", "ui-id-1", destination);
     data.Destination = destination;
 }
        public NavBarExistsSteps(NgWebDriver ngDriver)
        {
            this._ngDriver = ngDriver;
            _webControls   = new WebControls(ngDriver);

            _sharedPageElements = new SharedPageElements(_webControls);
        }
예제 #14
0
        public static void SelectAirportFlightOnly(string deptAirport)
        {
            Logger.AddSelectAction("Airport", deptAirport);
            var dropdownDepartureAirport = Driver.Instance.FindElement(By.Id("departureAirportNameFlightOnly"));

            WebControls.SelectDropDown(dropdownDepartureAirport, deptAirport);
            HomePage.Data.DepartureAirport = deptAirport;
        }
예제 #15
0
 private void ClearForm()
 {
     StageId        = string.Empty;
     StageName      = string.Empty;
     Link           = string.Empty;
     Teams          = WebControls.SetCheckboxListSelectedItem(Teams, null);
     ReferencesData = new WFComponentSubs();
 }
예제 #16
0
        public static void SelectAirport(string deptAirport)
        {
            Logger.AddSelectAction("Airport", deptAirport);
            var dropdownDepartureAirport = Driver.Instance.FindElement(By.XPath("//*[@data-id='departureAirportName']"));

            WebControls.SelectDropDown(dropdownDepartureAirport, deptAirport);
            HomePage.Data.DepartureAirport = deptAirport;
        }
예제 #17
0
 public void AddInterfaceScript(WebControlScript script)
 {
     if (loadedScripts.ContainsKey(script))
     {
         return;
     }
     loadedScripts.Add(script, true);
     interfaceScripts.Add(new RankedString(WebControls.GetScript(script), -1));
 }
예제 #18
0
 public void AddInterfaceScript(WebControlScript script)
 {
     if (loadedScripts.ContainsKey(script))
     {
         return;
     }
     loadedScripts.Add(script, true);
     interfaceScripts.Add(new AdminSection(WebControls.GetScript(script), ObjectRank.First));
 }
예제 #19
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            var param = new string[3]
            {
                ViewState["LastSortColumn"].ToString(), ViewState["LastSortOrder"].ToString(), ViewState["LastFilter"].ToString()
            };

            WebControls.PreparaVista(ref view, param);

            dg1.DataBind();
        }
예제 #20
0
 public static void SelectCheckIn(string checkIn)
 {
     Logger.AddSelectAction("CheckIn", checkIn);
     if (string.IsNullOrEmpty(checkIn))
     {
         throw new ArgumentNullException("checkIn");
     }
     //if (DateTime.Parse(checkIn) < DateTime.Today) throw new ArgumentOutOfRangeException("checkIn", checkIn, "Checkin date cannot be in the past.");
     //Logger.AddSelectAction("CheckIn", checkIn);
     WebControls.SelectDateBox("fromDate", "/html/body/div[4]", checkIn);
     HomePage.Data.CheckInDate = Calendar.FormatDate(checkIn);
 }
예제 #21
0
 public static void SelectCheckOut(string checkOut)
 {
     if (string.IsNullOrEmpty(checkOut))
     {
         throw new ArgumentNullException("checkOut");
     }
     if (DateTime.Parse(checkOut) < DateTime.Today)
     {
         throw new ArgumentOutOfRangeException("checkOut", checkOut, "Checkout date cannot be in the past.");
     }
     Logger.AddSelectAction("CheckOut", checkOut);
     WebControls.SelectDateBox("toDate", "/html/body/div[5]", checkOut);
     HomePage.Data.CheckOutDate = Calendar.FormatDate(checkOut);
 }
예제 #22
0
 /// <summary>
 /// Handles the OnBeforeUnBindControl event of the wwDataBinder control.
 /// </summary>
 /// <param name="item">The wwDataBindingItem item.</param>
 protected bool wwDataBinder_BeforeUnbindControl(WebControls.wwDataBindingItem item)
 {
     // Disabled HTML items are not posted during a postback, so we don't have accurate information about their states.
     // Look for the checkboxes that cause other controls to be disabled, and assign the value of the disabled control to the
     // desired setting.
     if (!this.chkExtractMetadata.Checked)
     {
         // When the metadata feature is unchecked, the enhanced metadata checkbox must be false as well.
         if (item.ControlId == this.chkExtractMetadataUsingWpf.ID)
         {
             this.chkExtractMetadataUsingWpf.Checked = false;
         }
     }
     return true;
 }
예제 #23
0
        public void BindData(BindType bindType)
        {
            var queryArgument = new QueryArgument(UserContext.DataBaseInfo)
            {
                Key       = TeamId.ToString(),
                filter1   = Type,
                filter4   = bindType == BindType.List ? Constants.RetriveList : Constants.RetriveForm,
                FilterKey = Constants.TableWFComponents
            };
            var teamMasters = _controlPanel.GetTeams(queryArgument);

            if (teamMasters != null)
            {
                if (bindType == BindType.Form)
                {
                    var firstOrDefault = teamMasters.FirstOrDefault();
                    if (firstOrDefault == null)
                    {
                        return;
                    }
                    TeamId     = firstOrDefault.ComponentId;
                    TeamName   = firstOrDefault.ComponentDesp;
                    Categories = WebControls.SetCheckboxListSelectedItem(Categories, firstOrDefault.Relation1.SplitTo <string>(new string[] { Constants.DelimeterSinglePipe }).ToList());

                    Users = WebControls.SetCheckboxListSelectedItem(Users, firstOrDefault.wfComponentSubs.Select(x => x.WFCSCode).ToList());
                    uplForm.Update();
                }
                else
                {
                    var team = teamMasters.ToList();
                    if (UserContext.UserProfile.Designation.Id.Trim() != "SA")
                    {
                        if (teamMasters.Any())
                        {
                            team = teamMasters.Where(x => x.ComponentId.Trim() != "13").ToList();
                        }
                    }
                    GridViewTable.DataSource = team;
                    if (_newPageIndex >= 0)
                    {
                        GridViewTable.PageIndex = _newPageIndex;
                    }
                    GridViewTable.DataSource = team;
                    GridViewTable.DataBind();
                    UplView.Update();
                }
            }
        }
예제 #24
0
 /// <summary>
 /// Handles the OnBeforeUnBindControl event of the wwDataBinder control.
 /// </summary>
 /// <param name="item">The wwDataBindingItem item.</param>
 protected bool wwDataBinder_BeforeUnbindControl(WebControls.wwDataBindingItem item)
 {
     // Disabled HTML items are not posted during a postback, so we don't have accurate information about their states.
     // Look for the checkboxes that cause other controls to be disabled, and assign the value of the disabled control to their
     // database setting. This allows disabled controls to retain their original value if an admin later re-enables them.
     if (!this.chkExtractMetadata.Checked)
     {
         // When the metadata feature is unchecked, the enhanced metadata checkbox is disabled via javascript.
         if (item.ControlId == this.chkExtractMetadataUsingWpf.ID)
         {
             this.chkExtractMetadataUsingWpf.Checked = GallerySettings.ExtractMetadataUsingWpf;
             return false;
         }
     }
     return true;
 }
예제 #25
0
        public void fillDdl(DropDownList ddl, KeyValuePairItems datasource)
        {
            KeyValuePairItems dt;

            if (datasource == null)
            {
                return;
            }

            dt = datasource;
            WebControls.ClearDdl(ddl, Constants.DdlDefaultTextPartNo);
            foreach (var dr in dt)
            {
                ddl.Items.Add(new ListItem(dr.Key, dr.Value));
            }
        }
예제 #26
0
        public void BindData(BindType bindType)
        {
            var queryArgument = new QueryArgument(UserContext.DataBaseInfo)
            {
                Key       = StageId.ToString(),
                filter1   = Type,
                filter4   = bindType == BindType.List ? Constants.RetriveList : Constants.RetriveForm,
                FilterKey = Constants.TableWFComponents
            };
            var stageMasters = _controlPanel.GetStages(queryArgument);

            if (stageMasters != null)
            {
                if (bindType == BindType.Form)
                {
                    var firstOrDefault = stageMasters.FirstOrDefault();
                    if (firstOrDefault == null)
                    {
                        return;
                    }
                    StageId        = firstOrDefault.Id;
                    StageName      = firstOrDefault.Stage;
                    Link           = firstOrDefault.ActionLink;
                    Teams          = WebControls.SetCheckboxListSelectedItem(Teams, firstOrDefault.Relation1.SplitTo <string>(new string[] { Constants.DelimeterSinglePipe }).ToList());
                    ReferencesData = firstOrDefault.Referances.FirstOrDefault().WFCDesp == null ? new WFComponentSubs() : firstOrDefault.Referances;
                    SubLink        = firstOrDefault.Relation2;
                    uplForm.Update();
                }
                else
                {
                    GridViewTable.DataSource = stageMasters;
                    if (_newPageIndex >= 0)
                    {
                        GridViewTable.PageIndex = _newPageIndex;
                    }
                    GridViewTable.DataSource = stageMasters;
                    GridViewTable.DataBind();
                    UplView.Update();
                }
            }
        }
예제 #27
0
        internal static void SelectChildren(int noOfChildren, int[] childrenAges, int roomIndex)
        {
            string childrenAgesString = null;

            Logger.AddSelectAction(noOfChildren, " child(rens) for room ", roomIndex + 1);
            foreach (int childage in childrenAges)
            {
                childrenAgesString += childage.ToString();
                childrenAgesString += ",";
            }

            Logger.AddCustomMsg("Add the following child(rens) ages respectivley " + childrenAgesString);

            if (noOfChildren < 0 || noOfChildren > 4)
            {
                throw new ArgumentOutOfRangeException("children", noOfChildren, "The number of children must be between 0 and 4.");
            }
            if (childrenAges == null)
            {
                throw new ArgumentNullException("childrenAges");
            }
            if (noOfChildren != childrenAges.Length)
            {
                throw new ArgumentException("children ages must have the same number of elements as number of children.");
            }
            if (childrenAges.Any(i => i < 0 || i > 17))
            {
                throw new ArgumentOutOfRangeException("Children age must be between 0 and 12.");
            }

            IWebElement roomPanel = AddRemovePassangers(noOfChildren, roomIndex, 2);

            for (int i = 0; i < (childrenAges.Length); i++)
            {
                IWebElement childageDropDown = roomPanel.FindElement(By.XPath(string.Format("//div[{0}]/div[2]/div/div/ul/li[{1}]/div/select", (roomIndex + 1), (i + 1))));
                WebControls.SelectDropDown(childageDropDown, childrenAges[i].ToString());
            }
        }
예제 #28
0
        public static void SelectAdults(int adults)
        {
            if (adults < 1 || adults > 6)
            {
                throw new ArgumentOutOfRangeException("adults", adults, "The number of adults must be between 1 and 6.");
            }
            Logger.AddSelectAction("Adults", adults);
            string adultsl = "0 Adults";

            if (adults == 1)
            {
                adultsl = string.Format("{0} Adult", adults);
            }
            else if (adults > 1)
            {
                adultsl = string.Format("{0} Adults", adults);
            }
            ReadOnlyCollection <IWebElement> dropdownAdults = Driver.Instance.FindElements(By.XPath("//button[contains(@data-id, 'adultList')]"));
            IWebElement dropdownAdult = dropdownAdults.Last();

            WebControls.SelectDropDown(dropdownAdult, adultsl);
            HomePage.Data.Rooms.Last().AdultsLabel = adultsl;
            HomePage.Data.Rooms.Last().Adults      = adults;
        }
        /// <summary>
        /// Handles the OnBeforeUnBindControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        protected bool wwDataBinder_BeforeUnbindControl(WebControls.wwDataBindingItem item)
        {
            if (!BeforeUnbind_ProcessDisplayBehaviorControls(item))
                return false;

            return true;
        }
예제 #30
0
 public SharedPageElements(WebControls webControls) => _webControls = webControls;
예제 #31
0
 internal static void InitSecurityContext(WebControls.BannerNotice notice)
 {
     if (TimePointContext.Current.UseCurrentTime)
     {
         // switch (MCS.Library.PCPassport.Principal.PCPrincipal.PCCurrent.KeyRoleStatus)
         // {
         //    case MCS.Library.PCPassport.Principal.SecurityStatus.Ready:
         //        break;
         //    case MCS.Library.PCPassport.Principal.SecurityStatus.ConfigNotReady:
         //        notice.Text = "尚未配置管理应用或管理角色,操作将不受ACL控制,请联系管理员处理此安全风险。";
         //        break;
         //    case MCS.Library.PCPassport.Principal.SecurityStatus.KeyRoleEmpty:
         //        notice.Text = "管理角色中无任何人员,操作将不受ACL控制,请联系管理员处理此安全风险。";
         //        break;
         //    default:
         //        break;
         // } 
     }
 }
예제 #32
0
 void gameBoard_GameBoardButtonClicked(object sender, WebControls.GameBoardButtonClickedEventArgs e)
 {
     solver.UpdateFormat(e.Word, e.Character, gameBoard.ActiveCharacter.LowerCase, true);
     prediction.Solver = solver;
     prediction.DataBind();
 }
예제 #33
0
        private void FillDataCellWhenEditMode(IField field, TableCell cell)
        {
            Card currentCard;

            if (field is CardRelationField)
            {
                var f = field as CardRelationField;

                var label = new Label {
                    Text = f.Value
                };

                cell.Controls.Add(label);

                Cards.TryGetValue(Convert.ToInt32(f.Card.Entity.ID), out currentCard);

                if (currentCard.EntityInstance == null)
                {
                    DataBaseReader.FillEntityInstance(currentCard, "");
                }

                Constraint constraint = currentCard.EntityInstance.Constraints.First(c => c.ConstraintName == field.SystemName);


                //если режим создания объекта
                if (string.IsNullOrEmpty(currentCard.EntityInstance.EntityInstanceID))
                {
                    var RelationEditedButton = CreateRelationEditedButton(f);
                    cell.Controls.Add(RelationEditedButton);

                    if (constraint.IsNullable)
                    {
                        var RelationClearedButton = CreateRelationClearedButton(f);
                        cell.Controls.Add(RelationClearedButton);
                    }
                }
                else if (!constraint.IsIdentified)
                {
                    var RelationEditedButton = CreateRelationEditedButton(f);
                    cell.Controls.Add(RelationEditedButton);

                    if (constraint.IsNullable)
                    {
                        var RelationClearedButton = CreateRelationClearedButton(f);
                        cell.Controls.Add(RelationClearedButton);
                    }
                }
            }
            else if (field is CardSelfField)
            {
                WebControl control = null;

                var f = field as CardSelfField;

                Cards.TryGetValue(Convert.ToInt32(f.Card.Entity.ID), out currentCard);

                if (f.IsReadOnly(CurrentMode))
                {
                    control = new Label {
                        Text = f.Value.ToString()
                    }
                }
                ;
                else
                {
                    switch (f.TypeCode)
                    {
                    case CardSelfField.Type.Object:
                        control = new TextBox
                        {
                            TextMode = TextBoxMode.MultiLine,
                            Text     = f.Value.ToString()
                        };
                        break;

                    case CardSelfField.Type.Boolean:
                        if (f.Value == "")
                        {
                            f.Value = false;         // очень явно, для случая очистки всех полей при создании
                        }
                        control = new CheckBox {
                            Checked = (bool)f.Value
                        };
                        break;

                    case CardSelfField.Type.FileName:
                        control = new FileUpload();

                        if (f.ContainsNonEmptyValue())
                        {
                            cell.Controls.Add(new Literal {
                                Text = (f.Value as File).FileName
                            });
                        }
                        break;

                    case CardSelfField.Type.Float:
                    case CardSelfField.Type.ShortString:
                    case CardSelfField.Type.Numeric:
                        control = new TextBox {
                            Text = f.Value.ToString()
                        };
                        break;

                    case CardSelfField.Type.DateTime:
                        var textBox = new TextBox();
                        control = textBox;

                        if (f.ContainsNonEmptyValue())
                        {
                            var date = DateTime.Parse(f.Value.ToString());

                            textBox.Text = date.ToString("yyyy-MM-dd");
                        }
                        break;

                    default:
                        throw new NotImplementedException("Не реализована часть для варианта " + f.TypeCode.ToString());
                    }
                }
                if (control != null)
                {
                    if (control is TextBox)
                    {
                        var textBox = control as TextBox;

                        var entityType = Schema.Entities.First(e => e.ID.ToString() == currentCard.Entity.ID.ToString());
                        var attribute  = entityType.Attributes.Single(a => a.ID.ToString() == f.ID);

                        textBox.ApplyType(attribute.Type);
                    }

                    cell.Controls.Add(control);
                    WebControls.Add(field.SystemName, control);
                }
            }
        }
예제 #34
0
		protected bool wwDataBinder_BeforeUnbindControl(WebControls.wwDataBindingItem item)
		{
			if (!this.chkEnableSlideShow.Checked)
			{
				// When the slide show is unchecked, the slide show interval textbox is disabled via javascript. Disabled HTML items are not
				// posted during a postback, so we don't have accurate information about their states. For this control don't save
				// anything by returning false. Furthermore, to prevent these child controls from incorrectly reverting to an
				// empty or unchecked state in the UI, assign their properties to their config setting. 
				if (item.ControlId == this.txtSlideShowInterval.ID)
				{
					this.txtSlideShowInterval.Text = Core.SlideshowInterval.ToString();
					return false;
				}
			}

			if (!this.chkEnableMetadata.Checked)
			{
				// When the metadata feature is unchecked, the enhanced metadata checkbox is disabled via javascript. Disabled HTML items are not
				// posted during a postback, so we don't have accurate information about their states. For this control don't save
				// anything by returning false. Furthermore, to prevent these child controls from incorrectly reverting to an
				// empty or unchecked state in the UI, assign their properties to their config setting. 
				if (item.ControlId == this.chkEnableWpfMetadataExtraction.ID)
				{
					this.chkEnableWpfMetadataExtraction.Checked = Core.EnableWpfMetadataExtraction;
					return false;
				}
			}

			return true;
		}
예제 #35
0
        public static void SelectChildren(int children, int[] childrenAges)
        {
            if (children < 0 || children > 4)
            {
                throw new ArgumentOutOfRangeException("children", children, "The number of children must be between 0 and 4.");
            }
            if (childrenAges == null)
            {
                throw new ArgumentNullException("childrenAges");
            }
            if (children != childrenAges.Length)
            {
                throw new ArgumentException("children ages must have the same number of elements as number of children.");
            }
            if (childrenAges.Any(i => i < 0 || i > 12))
            {
                throw new ArgumentOutOfRangeException("Children age must be between 0 and 12.");
            }
            Logger.AddSelectAction("Children", children);
            Logger.AddSelectAction("ChildrenAge", childrenAges);
            string Childrenl = "0 Children";

            if (children == 1)
            {
                Childrenl = string.Format("{0} child", children);
            }
            else if (children > 1)
            {
                Childrenl = string.Format("{0} children", children);
            }
            ReadOnlyCollection <IWebElement> dropdownChildrens = Driver.Instance.FindElements(By.XPath("//button[contains(@data-id, 'childrenList') or contains(@data-id, 'childList')]"));
            IWebElement dropdownChildren = dropdownChildrens.Last();

            WebControls.SelectDropDown(dropdownChildren, Childrenl);
            if (Childrenl != "0 Children")
            {
                List <int> childrenAge = new List <int>();
                ReadOnlyCollection <IWebElement> childageDropDownsDivs = Driver.Instance.FindElements(By.XPath("//*[@class='roomform']"));
                IWebElement childageDropDownsDiv = childageDropDownsDivs[childageDropDownsDivs.Count - 1];
                ReadOnlyCollection <IWebElement> childAgeBtnGroup = childageDropDownsDiv.FindElements(By.XPath(".//*[@class='spanfix span3 childAge' or @class='span3 childAge']"));
                if (childAgeBtnGroup.Count == children)
                {
                    int counter = 0;
                    foreach (IWebElement btngroup in childAgeBtnGroup)
                    {
                        try
                        {
                            btngroup.FindElement(By.CssSelector("button.btn")).Click();

                            ReadOnlyCollection <IWebElement> liAgeDropDown = btngroup.FindElements(By.TagName("li"));
                            IWebElement age = liAgeDropDown[childrenAges[counter] + 1];
                            age.FindElement(By.TagName("a")).Click();
                            counter++;
                        }
                        catch (NoSuchElementException)
                        {
                            continue;
                        }
                    }
                }
                else
                {
                    throw new Exception("The number of children selected doesn't match with the number of 'age' boxes appeared on the page");
                }
            }
            HomePage.Data.Rooms.Last().ChildrenLabel = Childrenl;
            HomePage.Data.Rooms.Last().Children      = children;
            HomePage.Data.Rooms.Last().ChildrenAges  = childrenAges;
        }
        /// <summary>
        /// Handles the OnValidateControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        /// <returns>Returns <c>true</c> if the item is valid; otherwise returns <c>false</c>.</returns>
        protected bool wwDataBinder_ValidateControl(WebControls.wwDataBindingItem item)
        {
            if (!ValidateUsersToNotifyWhenErrorOccurs(item))
                return false;

            return true;
        }
예제 #37
0
        /// <summary>
        /// Handles the OnBeforeUnBindControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        protected bool wwDataBinder_BeforeUnbindControl(WebControls.wwDataBindingItem item)
        {
            if (!BeforeUnbind_ProcessEnableSelfRegistrationControls(item))
            return false;

              if (!BeforeUnbind_ProcessEnableUserAlbumsControls(item))
            return false;

              if (!BeforeUnbind_ProcessUserAccountControls(item))
            return false;

              return true;
        }
		protected void Unnamed1_TicketChecking(object sender, WebControls.AccessTicketCheckEventArgs eventArgs)
		{
			
		}
예제 #39
0
		protected bool wwDataBinder_ValidateControl(WebControls.wwDataBindingItem item)
		{
			if (!ValidateDefaultRolesForSelfRegisteredUser(item))
				return false;

			if (!ValidateUsersToNotifyWhenAccountIsCreated(item))
				return false;

			if (!ValidateUserAlbums(item))
				return false;

			return true;
		}
예제 #40
0
        /// <summary>
        /// Handles the OnValidateControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        /// <returns>Returns <c>true</c> if the item is valid; otherwise returns <c>false</c>.</returns>
        protected bool wwDataBinder_ValidateControl(WebControls.wwDataBindingItem item)
        {
            if (!ValidateUserCanEnableSelfRegistration(item))
            return false;

              if (!ValidateUserAlbums(item))
            return false;

              return true;
        }
예제 #41
0
            public void  AsyncAuth()
            {
                string jSonResponse = "null";

                try
                {
                    jSonResponse = WebControls.GetMethod2("https://graph.facebook.com/me?fields=id,name,birthday,locale,location&access_token=" + AppInfo._fbAccessToken);
                }
                catch
                {
                    _errorDialogTitle.Text   = "Ошибка";
                    _errorDialogMessage.Text = "Необходима авторизация приложения.";
                    if (!AppInfo.IsLocaleRu)
                    {
                        _errorDialogTitle.Text   = "Error";
                        _errorDialogMessage.Text = "App authorization required";
                    }
                    _errorDialogReadyButton.Click += delegate { ItsbetaLoginWebViewClient.loadPreviousState = false; _loginWebView.ClearHistory(); _parent.Finish(); _parent.StartActivity(typeof(LoginActivity)); };


                    _parent.RunOnUiThread(() => ShowAlertDialog());
                    _progressDialog.Dismiss();
                    return;
                }
                var jSonUserFb = JsonArray.Parse(jSonResponse);

                try
                {
                    AppInfo._user.FacebookUserID = jSonUserFb["id"];
                }
                catch
                {
                }
                try
                {
                    AppInfo._user.Fullname = jSonUserFb["name"];
                }
                catch
                {
                }
                try
                {
                    AppInfo._user.BirthDate = jSonUserFb["birthday"];
                }
                catch
                {
                    AppInfo._user.BirthDate = "null";
                }
                try
                {
                    AppInfo._user.City = jSonUserFb["location"]["name"];
                }
                catch
                {
                    AppInfo._user.City = "Unknown city";
                }

                ServiceItsBeta itsbetaService = new ServiceItsBeta();

                isPlayerExist = itsbetaService.GetPlayerExistBool(AppInfo._user.FacebookUserID);

                isAppBadgeEarned = itsbetaService.IsPostToFbOnce("059db4f010c5f40bf4a73a28222dd3e3", "other", "itsbeta", "itsbeta",
                                                                 AppInfo._user.FacebookUserID, AppInfo._fbAccessToken);


                try
                {
                    AppInfo._user.ItsBetaUserId = itsbetaService.GetItsBetaUserID(AppInfo._user.FacebookUserID);
                }
                catch (Exception)
                {
                }

                _parent.RunOnUiThread(() => _endlogin.Text = "change");
            }
예제 #42
0
 void keyboard_KeyboardButtonClicked(object sender, WebControls.KeyboardButtonClickedEventArgs e)
 {
     gameBoard.ActiveCharacter = new Character(e.Button.Text[0]);
 }
 protected string ButtonUpload_UploadClick(object sender, WebControls.UploadButtonEventArgs e)
 {
     string message = "";
     try
     {
         if (Session["SSIdProUpload"] == null)
         {
             message = "Xin bạn hãy chọn sản phẩm muốn upload ảnh.";
             return message;
         }
         else
         {
             string strIdAndName = Session["SSIdProUpload"].ToString();
             string[] arrvalue = strIdAndName.Split(',');
             CvalidateImageForPost imgProcess = new CvalidateImageForPost();
             FileUpload file = e.FileUploadControl;
             string file_name = file.PostedFile.FileName;
             if (file_name.Length == 0)
             {
                 message = "Xin bạn hãy chọn file ảnh";
                 return message;
             }
             else
             {
                 if (!imgProcess.TestTypeFile(file))
                 {
                     message = "File Không hợp lệ";
                     return message;
                 }
                 else if (imgProcess.TestMaxSizeImage(file, 20480))
                 {
                     message = "Kích thước ảnh không quá 20 KB";
                     return message;
                 }
                 else
                 {
                     string _path = Server.MapPath("../image/img_pro/");
                     string namepro = "_";
                     if (arrvalue.Length == 3)
                     {
                         namepro = arrvalue[2];
                         namepro = namepro.Replace(" ", "");
                     }
                     string strgetTime = new CGetDataCommon().GetStrMonthDayYearSecondMinuteHour();
                     string nameNew = "pro_" + arrvalue[0] + "_" + strgetTime + "." + imgProcess.GetExtension(file_name);
                     Boolean isUpload = imgProcess.UploadFile(file, _path + nameNew);
                     if (isUpload)
                     {
                         ProductSystem ManagerPro = new ProductSystem();
                         Boolean isUpdate = ManagerPro.ProductUpdateImage(int.Parse(arrvalue[0]), nameNew);
                         if (isUpdate)
                         {
                             message = "";
                             //Xóa ảnh cũ đi:
                             imgProcess.DeleteFile(_path + arrvalue[1]);
                             return message;
                         }
                         else
                         {
                             //Lỗi không thể cập nhật vào cơ sở dữ liệu. Xóa ảnh vừa upload lên đi.
                             imgProcess.DeleteFile(_path + nameNew);
                             message = "Lỗi kết nối SQL server. Không thể cập nhật được ảnh. Xin hãy thử lại";
                             return message;
                         }
                     }
                     else
                     {
                         message = "Lỗi mạng hoặc không có quyền tạo file trong thư mục ảnh sản phẩm. Không thể Upload file ảnh. Xin bạn hãy thử lại";
                         return message;
                     }
                 }
             }
         }
     }
     catch
     {
         message = "Có các lỗi sau đây: Không có quyền tạo file trong thư mục ảnh sản phẩm. Hoặc không cập nhật được vào CSDL. Hoặc ảnh bạn chọn không còn tồn tại. Xin bạn hãy thử lại";
     }
     return message;
 }