Exemplo n.º 1
0
        protected void btnAddRemoveOrganization_Click(object sender, EventArgs e)
        {
            MyFileIt.MyFileItAppServiceClient svc    = new MyFileIt.MyFileItAppServiceClient();
            MyFileIt.MyFileItResult           result = new MyFileIt.MyFileItResult();

            //get all the associations for the user
            int        appUserIDLookup   = 5; //this id is valid on my LOCAL DB, NOT server
            int        newOrganizationID = 25;
            int        oldOrganizationID = 21;
            DateTime   startDate         = DateTime.Now;
            DateTime   expiresDate       = DateTime.Now.AddDays(10);
            int        yearCode          = 2015;
            int        sportTypeID       = 2;
            int        appUserTypeID     = 5;
            AppUserDTO user = null;

            result = svc.GetAppUsers(appGlobal.username, appGlobal.password, appUserIDLookup, null);
            user   = result.AppUsers.First();

            //loop all associated organization and remove specific organization
            //NOTE: I skipped all success / fail catch logic just to run the routine
            user.Organizations.Where(o => o.ID == oldOrganizationID || o.ID == newOrganizationID).ToList().ForEach(o =>
            {
                svc.RemoveAppUserFromOrganization(appGlobal.username, appGlobal.password, user.ID, o.ID);
            });

            //add the new organization link into the table
            result          = svc.AssociateAppUserToOrganization(appGlobal.username, appGlobal.password, user.ID, appUserTypeID, newOrganizationID, startDate, expiresDate, yearCode, sportTypeID);
            lblMessage.Text = result.Success ? "Worked" : "Failed";
        }
Exemplo n.º 2
0
        private void aftabTest()
        {
            MyFileIt.MyFileItAppServiceClient obj    = new MyFileIt.MyFileItAppServiceClient();
            MyFileIt.MyFileItResult           result = new MyFileIt.MyFileItResult();
            var message = "";

            int        appUserIDLookup   = 3;
            int        newOrganizationID = 12;
            int        oldOrganizationID = 10;
            DateTime   startDate         = DateTime.Now;
            DateTime   expiresDate       = DateTime.Now.AddDays(10);
            int        yearCode          = 2015;
            int        sportTypeID       = 2;
            int        appUserTypeId     = 5;
            AppUserDTO user = null;

            result = obj.GetAppUsers(appGlobal.username, appGlobal.password, appUserIDLookup, null);
            user   = result.AppUsers.First();

            user.Organizations.Where(o => o.ID == oldOrganizationID || o.ID == newOrganizationID).ToList().ForEach(o =>
            {
                obj.RemoveAppUserFromOrganization(appGlobal.username, appGlobal.password, user.ID, o.ID);
            });

            //  add the new organization link into the table
            result  = obj.AssociateAppUserToOrganization(appGlobal.username, appGlobal.password, user.ID, appUserTypeId, newOrganizationID, startDate, expiresDate, yearCode, sportTypeID);
            message = result.Success ? "Worked" : "Failed";
        }
Exemplo n.º 3
0
        protected void btnRemoveUserOrg_Click(object sender, EventArgs e)
        {
            MyFileIt.MyFileItAppServiceClient obj    = new MyFileIt.MyFileItAppServiceClient();
            MyFileIt.MyFileItResult           result = new MyFileIt.MyFileItResult();
            var message = "";
            var res     = obj.RemoveAppUserFromOrganization(appGlobal.username, appGlobal.password, 1, 2);

            lblMessage.Text = res.Success.ToString();
        }