예제 #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";
        }
예제 #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";
        }
예제 #3
0
        protected void btnAssociateUserToOrg_Click(object sender, EventArgs e)
        {
            MyFileIt.MyFileItAppServiceClient obj    = new MyFileIt.MyFileItAppServiceClient();
            MyFileIt.MyFileItResult           result = new MyFileIt.MyFileItResult();
            int appUserTypeId = 5;
            var message       = "";
            var res           = obj.AssociateAppUserToOrganization(appGlobal.username, appGlobal.password, 1, appUserTypeId, 2, DateTime.Now, DateTime.Now.AddDays(10), 2015, 1);

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