private async Task DeleteImageCommandCommandExecute(BindingModel parm)
        {
            var result = await Shell.Current.DisplayAlert(
                "Alert",
                "Are you sure you want to remove?",
                "Yes", "No");



            if (result)
            {
                if (parm.GetType() == typeof(VisualProjectLocationPhoto))
                {
                    VisualProjectLocationPhoto obj = parm as VisualProjectLocationPhoto;
                    await VisualProjectLocationPhotoDataStore.DeleteItemAsync(obj, IsEdit);
                }
                if (parm.GetType() == typeof(VisualBuildingLocationPhoto))
                {
                    VisualBuildingLocationPhoto obj = parm as VisualBuildingLocationPhoto;
                    await VisualBuildingLocationPhotoDataStore.DeleteItemAsync(obj);
                }
                if (parm.GetType() == typeof(VisualApartmentLocationPhoto))
                {
                    VisualApartmentLocationPhoto obj = parm as VisualApartmentLocationPhoto;
                    await VisualApartmentLocationPhotoDataStore.DeleteItemAsync(obj);
                }
                await LoadAsync();
            }
        }
        public async Task <ActionResult <Delivery> > GetClientDelivery(BindingModel B)
        {
            Delivery D = null;

            try
            {
                D = await _context.Deliveries.Where(d => d.Id == B.id &&
                                                    d.Client.Username == B.username &&
                                                    d.Client.Password == B.password
                                                    ).Include(d => d.Vehicle).SingleAsync();

                if (D.Vehicle != null)
                {
                    D.Vehicle.Deliveries = null;

                    D.Vehicle.ScheduledActivities = null;
                    D.Vehicle.Bills = null;
                }
            }
            catch (Exception)
            {
                return(BadRequest("Invalid"));
            }

            if (D == null)
            {
                return(BadRequest("Invalid"));
            }

            return(D);
        }
        public static string Serialize(BindingModel model)
        {
            string output = JsonSerializer.Serialize(model);

            Console.WriteLine(output);
            return(output);
        }
 private async Task ImageDetailCommandCommandExecute(BindingModel parm)
 {
     if (parm.GetType() == typeof(VisualProjectLocationPhoto))
     {
         VisualProjectLocationPhoto = parm as VisualProjectLocationPhoto;
         // VisualProjectLocationPhoto = parm;
         ImgData.Path     = VisualProjectLocationPhoto.ImageUrl;
         ImgData.ParentID = VisualProjectLocationPhoto.VisualLocationId;
         ImgData.VisualProjectLocationPhoto = VisualProjectLocationPhoto;
         ImgData.IsEditVisual = IsEdit;
         //ImgData.VisualProjectLocationPhotos = VisualProjectLocationPhotoItems;
         ImgData.FormType = "VP";
         await CurrentWithoutDetail.EditImage(ImgData, GetImage);
     }
     if (parm.GetType() == typeof(VisualBuildingLocationPhoto))
     {
         VisualBuildingLocationPhoto = parm as VisualBuildingLocationPhoto;
         ImgData.Path         = VisualBuildingLocationPhoto.ImageUrl;
         ImgData.FormType     = "VB";
         ImgData.IsEditVisual = IsEdit;
         ImgData.VisualBuildingLocationPhoto = VisualBuildingLocationPhoto;
         await CurrentWithoutDetail.EditImage(ImgData, GetImage);
     }
     if (parm.GetType() == typeof(VisualApartmentLocationPhoto))
     {
         VisualApartmentLocationPhoto = parm as VisualApartmentLocationPhoto;
         ImgData.Path         = VisualApartmentLocationPhoto.ImageUrl;
         ImgData.FormType     = "VA";
         ImgData.IsEditVisual = IsEdit;
         ImgData.VisualApartmentLocationPhoto = VisualApartmentLocationPhoto;
         await CurrentWithoutDetail.EditImage(ImgData, GetImage);
     }
 }
Exemple #5
0
        public override void SetUp()
        {
            base.SetUp();

            this.subscriber   = new Mock <ISubscriber>();
            this.bindingModel = new BindingModel();
        }
Exemple #6
0
        public Registration()
        {
            InitializeComponent();
            bm = new Validations.BindingModel();
            LayoutRoot.DataContext = bm;
            for (int i = 1; i <= 12; i++)
            {
                cbMM.Items.Add(i);
            }
            for (int i = 1900; i <= 2014; i++)
            {
                cbYYYY.Items.Add(i);
            }


            cbPrefix.Items.Add("050");
            cbPrefix.Items.Add("052");
            cbPrefix.Items.Add("053");
            cbPrefix.Items.Add("054");
            cbPrefix.Items.Add("057");

            cbSQ.Items.Add("where you have borned ?");
            cbSQ.Items.Add("what is the name of your favirate teacher ?");
            cbSQ.Items.Add("where your parnets borned ?");
            cbSQ.Items.Add("when you said your first words ?");
            usrVal.MessageHeader = "Username: "******"Email: ";

            cbDD.SelectedItem      = 1;
            cbMM.SelectedItem      = 1;
            cbYYYY.SelectedIndex   = 0;
            cbPrefix.SelectedIndex = 0;
            cbSQ.SelectedIndex     = 0;
        }
        private void ResponsesReceived(ReceivedResponses receivedResponses)
        {
            if (receivedResponses.HasResponse <GetUserGroupResponse>())
            {
                BindingModel.Populate(receivedResponses.Get <GetSuitableParentUserGroupsResponse>().SuitableParentUserGroups,
                                      receivedResponses.Get <GetUserGroupResponse>().UserGroup);
            }
            else
            {
                BindingModel.Populate(receivedResponses.Get <GetSuitableParentUserGroupsResponse>().SuitableParentUserGroups);
            }

            if (receivedResponses.HasResponse <CheckPermissionsResponse>())
            {
                var response = receivedResponses.Get <CheckPermissionsResponse>();
                if (!response.AuthorizationResults[Permissions.DeleteUserGroup])
                {
                    View.PreventDeletion();
                }
                if (!response.AuthorizationResults[Permissions.EditUserGroup])
                {
                    View.PreventModification();
                }
            }

            View.Show();
        }
Exemple #8
0
        public ActionResult AccountBindingSuccess()
        {
            var viewModel = new BindingModel();

            viewModel.Session = Session;
            return(View(viewModel));
        }
Exemple #9
0
		public void UpdateUserGroup_WithoutParentAndParentIsNowSet_AddsFormerRootToCorrectParent()
		{
			BindingModel.UpdateUserGroup(topLevel2.Id, "name", topLevel1.Id);
			Assert.AreEqual(1, BindingModel.UserGroups.Count);
			Assert.AreNotEqual(topLevel2.Id, BindingModel.UserGroups[0].Id);
			Assert.IsTrue(BindingModel.UserGroups[0].Children.Any(c => c.Id == topLevel2.Id));
		}
Exemple #10
0
        public ActionResult AccountBinding(BindingModel model, string site)
        {
            switch (site)
            {
            case "twitter":
                var client = new TwitterClient(ProvidersLocator.TwitterTokenManager);
                client.StartAuthentication(Request.Url);
                break;

            case "google":
                TransferToOpenIdProvider(OpenIdProviderEndPoints.Google.EndPoint);
                break;

            case "vkontakte":
                TransferToOpenIdProvider(OpenIdProviderEndPoints.VKontakte.EndPoint);
                break;

            case "linkedin":
                var authorization = new WebOAuthAuthorization(ProvidersLocator.LinkedinTokenManager, null);
                var callback      = Request.Url;
                authorization.BeginAuthorize(callback);
                break;

            case "myspace":
                TransferToOpenIdProvider(OpenIdProviderEndPoints.MySpace.EndPoint);
                break;

            default:
                int    curProviderId;
                string curProviderUserId;

                userBind = userModule.GetUserByProviderUserId(model.AccountBinding.ProviderUserId);
                if (userBind != null)
                {
                    userModule.CleanProvider(model.AccountBinding.ProviderUserId);
                }
                curProviderId     = model.AccountBinding.ProviderId;
                curProviderUserId = model.AccountBinding.ProviderUserId;

                if (userModule.AddProvider(curProviderId, curProviderUserId, Session.User.Id))
                {
                    HttpCookie providerCookie = new HttpCookie("SkynerCookie");

                    Session.User.ProviderId     = curProviderId;
                    Session.User.ProviderUserId = curProviderUserId;

                    providerCookie.Value = providerModule.GetProvider(Session.User.ProviderId).Name;
                    Response.Cookies.Add(providerCookie);

                    ViewData["UserName"] = Session.User.UserName;
                    ViewData.Model       = null;
                    return(RedirectToAction("AccountBindingSuccess", "Account"));
                }
                break;
            }
            model.Session = Session;
            return(View());
        }
Exemple #11
0
        public Message(string username, string subject)
        {
            InitializeComponent();
            bm = new Validations.BindingModel();
            LayoutRoot.DataContext = bm;

            txtSentTo.Text  = username;
            txtSubject.Text = subject;
        }
Exemple #12
0
        public IActionResult Safe3(BindingModel bindingModel)
        {
            var model = new UserModel();

            // can be simplified using AutoMapper
            model.Name    = bindingModel.Name;
            model.IsAdmin = false; // no IsAdmin property on bindingModel

            return(View("Index", model));
        }
 public void Handle(UserGroupChangedEvent receivedEvent)
 {
     if (receivedEvent.IsNew)
     {
         View.SelectItemInTreeView(BindingModel.AddUserGroup(receivedEvent.Id, receivedEvent.Name, receivedEvent.ParentId));
     }
     else
     {
         BindingModel.UpdateUserGroup(receivedEvent.Id, receivedEvent.Name, receivedEvent.ParentId);
     }
 }
Exemple #14
0
        public void Populate_SetsIdAndNameProperties()
        {
            var currentUserGroup = new UserGroupDto {
                Id = Guid.NewGuid(), Name = "group1"
            };

            BindingModel.Populate(new UserGroupDto[0], currentUserGroup);

            Assert.AreEqual(currentUserGroup.Id, BindingModel.Id);
            Assert.AreEqual(currentUserGroup.Name, BindingModel.Name);
        }
Exemple #15
0
        public IActionResult Safe4(BindingModel bindingModel)
        {
            var model = new DerivedUserModel();

            // can be simplified using AutoMapper
            model.Name    = bindingModel.Name;
            model.IsAdmin = false; // no IsAdmin property on bindingModel

            //note this will error as wrong model type
            return(View("Index", model));
        }
Exemple #16
0
        public Update()
        {
            InitializeComponent();

            bm = new Validations.BindingModel();
            LayoutRoot.DataContext = bm;
            for (int i = 1; i <= 12; i++)
            {
                cbMM.Items.Add(i);
            }
            for (int i = 1900; i <= 2014; i++)
            {
                cbYYYY.Items.Add(i);
            }
            for (int i = 1; i <= 31; i++)
            {
                cbDD.Items.Add(i);
            }

            cbPrefix.Items.Add("050");
            cbPrefix.Items.Add("052");
            cbPrefix.Items.Add("053");
            cbPrefix.Items.Add("054");
            cbPrefix.Items.Add("057");

            string details = App.Current.Resources["Details"].ToString();

            txtUser.Text = details.Substring(0, details.IndexOf(",")).Trim();
            details      = details.Remove(0, details.IndexOf(",") + 1);

            txtEmail.Text = details.Substring(0, details.IndexOf(","));
            details       = details.Remove(0, details.IndexOf(",") + 1);

            txtPass.Password = details.Substring(0, details.IndexOf(",")).Trim();
            details          = details.Remove(0, details.IndexOf(",") + 1);

            cbDD.SelectedValue = int.Parse(details.Substring(0, details.IndexOf("/")).ToString());
            details            = details.Remove(0, details.IndexOf("/") + 1);

            cbMM.SelectedValue = int.Parse(details.Substring(0, details.IndexOf("/")).ToString());
            details            = details.Remove(0, details.IndexOf("/") + 1);

            cbYYYY.SelectedValue = int.Parse(details.Substring(0, details.IndexOf(",")).ToString());
            details = details.Remove(0, details.IndexOf(",") + 1);

            txtAddress.Text = details.Substring(0, details.IndexOf(","));
            details         = details.Remove(0, details.IndexOf(",") + 1);

            cbPrefix.SelectedValue = details.Substring(0, details.IndexOf("-")).ToString();
            details = details.Remove(0, details.IndexOf("-") + 1);

            txtPN.Text = details.Substring(0, details.Length);
        }
Exemple #17
0
 public Message()
 {
     InitializeComponent();
     bm = new Validations.BindingModel();
     LayoutRoot.DataContext  = bm;
     Back.MouseEnter        += Back_MouseEnter;
     Back.MouseLeave        += Back_MouseLeave;
     Back.MouseLeftButtonUp += Back_MouseLeftButtonUp;
     Send.MouseEnter        += Send_MouseEnter;
     Send.MouseLeave        += Send_MouseLeave;
     Send.MouseLeftButtonUp += Send_MouseLeftButtonUp;
 }
Exemple #18
0
        private async Task DeleteImageCommandCommandExecute(BindingModel parm)
        {
            try {
                var result = await Shell.Current.DisplayAlert(
                    "Alert",
                    "Are you sure you want to remove?",
                    "Yes", "No");



                if (result)
                {
                    if (parm.GetType() == typeof(VisualProjectLocationPhoto))
                    {
                        VisualProjectLocationPhoto obj = parm as VisualProjectLocationPhoto;
                        await VisualProjectLocationPhotoDataStore.DeleteItemAsync(obj, IsEdit).ConfigureAwait(false);

                        VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(ProjectLocation_Visual.Id, false));
                        if (VisualProjectLocationPhotoItems.Count == 0)
                        {
                            await Shell.Current.Navigation.PopAsync();
                        }
                    }
                    if (parm.GetType() == typeof(VisualBuildingLocationPhoto))
                    {
                        VisualBuildingLocationPhoto obj = parm as VisualBuildingLocationPhoto;
                        await VisualBuildingLocationPhotoDataStore.DeleteItemAsync(obj).ConfigureAwait(false);;

                        VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(BuildingLocation_Visual.Id, false));
                        if (VisualBuildingLocationPhotoItems.Count == 0)
                        {
                            await Shell.Current.Navigation.PopAsync();
                        }
                    }
                    if (parm.GetType() == typeof(VisualApartmentLocationPhoto))
                    {
                        VisualApartmentLocationPhoto obj = parm as VisualApartmentLocationPhoto;
                        await VisualApartmentLocationPhotoDataStore.DeleteItemAsync(obj).ConfigureAwait(false);;

                        VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(Apartment_Visual.Id, false));
                        if (VisualApartmentLocationPhotoItems.Count == 0)
                        {
                            await Shell.Current.Navigation.PopAsync();
                        }
                    }
                    //   await LoadAsync();
                }
            }
            catch (Exception)
            {
            }
        }
Exemple #19
0
        public void Populate_SetsSelectedParentUserGroupIfCurrentGroupHasParent()
        {
            var currentUserGroup = new UserGroupDto {
                Id = Guid.NewGuid(), ParentId = Guid.NewGuid()
            };
            var suitableParents = new[] { new UserGroupDto {
                                              Id = currentUserGroup.ParentId.Value
                                          } };

            BindingModel.Populate(suitableParents, currentUserGroup);

            Assert.AreEqual(currentUserGroup.ParentId.Value, BindingModel.SelectedParentUserGroup.Id);
        }
 public ResetPassword()
 {
     InitializeComponent();
     bm = new Validations.BindingModel();
     LayoutRoot.DataContext = bm;
     txtAns.Visibility      = System.Windows.Visibility.Collapsed;
     lblSq.Visibility       = System.Windows.Visibility.Collapsed;
     Next.Visibility        = System.Windows.Visibility.Collapsed;
     nxt.Visibility         = System.Windows.Visibility.Collapsed;
     reset.Visibility       = System.Windows.Visibility.Collapsed;
     newPass.Visibility     = System.Windows.Visibility.Collapsed;
     pls.Visibility         = System.Windows.Visibility.Collapsed;
 }
Exemple #21
0
		protected override void AfterSetUp()
		{
			topLevel1 = new UserGroupDto { Id = Guid.NewGuid(), Name = "topLevel1" };
			secondLevel1 = new UserGroupDto { Id = Guid.NewGuid(), Name = "secondLevel1", ParentId = topLevel1.Id };
			secondLevel2 = new UserGroupDto { Id = Guid.NewGuid(), Name = "secondLevel2", ParentId = topLevel1.Id };
			thirdLevel1 = new UserGroupDto { Id = Guid.NewGuid(), Name = "thirdLevel1", ParentId = secondLevel2.Id };
			topLevel2 = new UserGroupDto { Id = Guid.NewGuid(), Name = "topLevel2" };

			// the order is sorta randomized to make sure the Populate method correctly deals with it
			// (as in: when a child is located in the result before its parent)
			var dtos = new[] { thirdLevel1, secondLevel1, topLevel2, secondLevel2, topLevel1 };

			BindingModel.PopulateFrom(dtos);
		}
Exemple #22
0
            private void TryAddParent(BindingModel bindingModel)
            {
                while (bindingModel != null)
                {
                    var options = bindingModel as GroupBindingModel;

                    if (options != null)
                    {
                        AddParent(options);
                    }

                    bindingModel = bindingModel.Parent;
                }
            }
        private void ResponsesReceived(ReceivedResponses receivedResponses)
        {
            if (receivedResponses.HasResponse <GetAllUserGroupsResponse>())
            {
                BindingModel.PopulateFrom(receivedResponses.Get <GetAllUserGroupsResponse>().UserGroups);
                View.ExpandTreeView();
            }

            if (receivedResponses.HasResponse <CheckPermissionsResponse>() &&
                !receivedResponses.Get <CheckPermissionsResponse>().AuthorizationResults[Permissions.CreateUserGroup])
            {
                View.HideAddNewButton();
            }
        }
        public virtual void Navigate(BindingModel bindingModel)
        {
            var groupBindingModel = bindingModel as GroupBindingModel;
            var valueBindingModel = bindingModel as ValueBindingModel;

            if (groupBindingModel != null)
            {
                NavigateGroup(groupBindingModel);
            }

            if (valueBindingModel != null)
            {
                NavigateValue(valueBindingModel);
            }
        }
Exemple #25
0
        private void Fill(BindingModel bindingModel, CommandLineContext ctx)
        {
            var groupBindingModel = bindingModel as GroupBindingModel;
            var valueBindingModel = bindingModel as ValueBindingModel;

            if (groupBindingModel != null)
            {
                FillGroup(groupBindingModel, ctx);
            }

            if (valueBindingModel != null)
            {
                FillValue(valueBindingModel, ctx);
            }
        }
Exemple #26
0
        public void RevertToOriginalValues_SetsIdAndNameToOriginalValues()
        {
            var userGroup = new UserGroupDto {
                Id = Guid.NewGuid(), Name = "some name"
            };

            BindingModel.Populate(new UserGroupDto[0], userGroup);
            BindingModel.Id   = Guid.NewGuid();
            BindingModel.Name = "some other name";

            BindingModel.RevertToOriginalValues();

            Assert.AreEqual(userGroup.Id, BindingModel.Id);
            Assert.AreEqual(userGroup.Name, BindingModel.Name);
        }
Exemple #27
0
        public void RevertToOriginalValues_SetsSelectedUserGroupBackToOriginalParentUserGroup()
        {
            var suitableParentGroups = new[] { new UserGroupDto {
                                                   Id = Guid.NewGuid(), Name = "some parent"
                                               } };
            var userGroup = new UserGroupDto {
                Id = Guid.NewGuid(), Name = "some name", ParentId = suitableParentGroups[0].Id
            };

            BindingModel.Populate(suitableParentGroups, userGroup);
            BindingModel.SelectedParentUserGroup = BindingModel.SuitableParentUserGroups[0];

            BindingModel.RevertToOriginalValues();

            Assert.AreEqual(BindingModel.SelectedParentUserGroup, BindingModel.SuitableParentUserGroups[1]);
        }
        public void PersistChanges()
        {
            BindingModel.ValidateAll();
            if (BindingModel.HasErrors)
            {
                return;
            }

            var dispatcher = RequestDispatcherFactory.CreateAsyncRequestDispatcher();

            dispatcher.Add(new SaveUserGroupRequest
            {
                Id       = BindingModel.Id,
                Name     = BindingModel.Name,
                ParentId = BindingModel.SelectedParentUserGroup.Id != Guid.Empty ? BindingModel.SelectedParentUserGroup.Id : (Guid?)null
            });
            dispatcher.ProcessRequests(PersistChanges_ResponseReceived, PublishRemoteException);
        }
Exemple #29
0
            private void SelectParentPath(BindingModel bindingModel)
            {
                BindingModel lastModel = null;

                while (bindingModel != null)
                {
                    var optionsGroupBinding = bindingModel as OptionsGroupBindingModel;

                    if (optionsGroupBinding != null &&
                        optionsGroupBinding.SelectedOption == null)
                    {
                        optionsGroupBinding.SelectedOption = lastModel;
                    }

                    // next up
                    lastModel    = bindingModel;
                    bindingModel = bindingModel.Parent;
                }
            }
Exemple #30
0
        private void AddElementToCanvas(FrameworkElement element)
        {
            var bindingModel = new BindingModel()
            {
                Source         = this,
                Path           = nameof(Width),
                BindingElement = element,
                Property       = FrameworkElement.WidthProperty,
                BindingMode    = BindingMode.OneWay
            };

            Helper.BindingHelper(bindingModel);
            bindingModel.Path     = nameof(Height);
            bindingModel.Property = FrameworkElement.HeightProperty;
            Helper.BindingHelper(bindingModel);
            //element.AllowFocusOnInteraction = true;
            element.Tapped += Items_Tapped;
            canvas.Children.Add(element);
        }
        public override void SetUp()
        {
            base.SetUp();

            this.subscriber = new Mock<ISubscriber>();
            this.bindingModel = new BindingModel();
        }