public IQueryable <Organization> SuggestOrganization(string phrase, OrganizationType orgType)
 {
     return(UnitOfWork.OrganizationRepository
            .Read(org => org.Type == orgType &&
                  org.Name.Contains(phrase))
            .Take(5));
 }
        public async Task <IHttpActionResult> CreateOrganization(string description,
                                                                 string details,
                                                                 OrganizationType organizationType,
                                                                 ReportingFrequency reportingFrequency,
                                                                 EntityReference parent)
        {
            try
            {
                if (!_userContext.CurrentUserIsSystemUser())
                {
                    return(Unauthorized());
                }

                if (string.IsNullOrWhiteSpace(description))
                {
                    throw new ArgumentException("Value cannot be null or whitespace.", nameof(description));
                }

                if (!_userContext.CurrentUserIsSystemAdmin())
                {
                    return(Unauthorized());
                }

                var cmd = new CreateOrganizationCommand(description, details, organizationType, reportingFrequency, parent);
                await _endpointInstance().SendWithSignalRMetaData(cmd, Request);

                return(this.Accepted());
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(InternalServerError());
            }
        }
        public async Task TestGetOrganizationTypes_CheckProperties()
        {
            var orgType = new OrganizationType
            {
                OrganizationTypeId   = 1,
                OrganizationTypeName = "theme"
            };

            context.OrganizationTypes.Add(orgType);
            Action <PagedQueryResults <OrganizationTypeDTO> > tester = (results) =>
            {
                Assert.AreEqual(1, results.Total);
                Assert.AreEqual(1, results.Results.Count);

                var firstResult = results.Results.First();
                Assert.AreEqual(orgType.OrganizationTypeId, firstResult.Id);
                Assert.AreEqual(orgType.OrganizationTypeName, firstResult.Name);
            };
            var defaultSorter = new ExpressionSorter <OrganizationTypeDTO>(x => x.Id, SortDirection.Ascending);
            var queryOperator = new QueryableOperator <OrganizationTypeDTO>(0, 10, defaultSorter);

            var serviceResults      = service.Get(queryOperator);
            var serviceResultsAsync = await service.GetAsync(queryOperator);

            tester(serviceResults);
            tester(serviceResultsAsync);
        }
예제 #4
0
        private void AddChapter(PageType chapterType)
        {
            var           treeNode = tvItems.SelectedNode;
            var           manNode  = treeNode.Tag as IManifestNode;
            IManifestNode n;

            if (manNode is IItemContainer)
            {
                var newItem = ItemType.CreateNewItem(String.Format("New {0}", chapterType), Guid.NewGuid().ToString(), null, chapterType);
                n = newItem;
                (manNode as IItemContainer).SubItems.Add(newItem);
                tvItems.SelectedNode = treeNode.Nodes.Find(n.UID, true)[0];
            }
            else
            {
                var o = new OrganizationType {
                    Title = String.Format("New {0}", chapterType)
                };
                n = o;
                Course.Manifest.organizations.Organizations.Add(o);
            }

            treeNode = treeNode.Nodes.Find(n.UID, true)[0];
            treeNode.BeginEdit();
        }
예제 #5
0
 /// <summary>
 /// Creates a new EcaOrganization.
 /// </summary>
 /// <param name="user">The user</param>
 /// <param name="website">The website of the organization.</param>
 /// <param name="organizationTypeId">The organization type by id.</param>
 /// <param name="organizationRoleIds">The ids of the organization roles</param>
 /// <param name="contactIds">The ids of the organization contacts.</param>
 /// <param name="parentOrganizationId">The parent organization by id.</param>
 /// <param name="name">The name of the organization.</param>
 /// <param name="description">The description of the organization.</param>
 /// <param name="organizationId">The id of the organization.</param>
 public EcaOrganization(
     User user,
     int organizationId,
     string website,
     int organizationTypeId,
     IEnumerable <int> organizationRoleIds,
     IEnumerable <int> contactIds,
     int?parentOrganizationId,
     string name,
     string description)
 {
     Contract.Requires(user != null, "The user must not be null.");
     if (OrganizationType.GetStaticLookup(organizationTypeId) == null)
     {
         throw new UnknownStaticLookupException(String.Format("The organization type id [{0}] does not exist.", organizationTypeId));
     }
     this.Update               = new Update(user);
     this.Website              = website;
     this.OrganizationTypeId   = organizationTypeId;
     this.OrganizationRoleIds  = organizationRoleIds ?? new List <int>();
     this.ContactIds           = contactIds ?? new List <int>();
     this.ParentOrganizationId = parentOrganizationId;
     this.Name           = name;
     this.Description    = description;
     this.OrganizationId = organizationId;
 }
예제 #6
0
 public ServiceResponse <List <AffiliationType> > ListAffiliationTypes(OrganizationType organizationType)
 {
     return(this.rest.Get <List <AffiliationType> >("/affiliationType", new Dictionary <string, string>()
     {
         { "organizationType", organizationType.ToString() }
     }));
 }
예제 #7
0
        public string GetOrgValue(OrganizationType orgType)
        {
            string orgValue;

            switch (orgType)
            {
            case OrganizationType.Root:
                orgValue = "null";
                break;

            case OrganizationType.Fgsmc:
                orgValue = "0_" + this.FGSMC;
                break;

            case OrganizationType.Cycmc:
                orgValue = "0_" + this.FGSMC + "_" + this.CYCMC;
                break;

            case OrganizationType.Ytmc:
                orgValue = "0_" + this.FGSMC + "_" + this.CYCMC + "_" + this.YTMC;
                break;

            case OrganizationType.Dydm:
            default:
                orgValue = this.DYDM;
                break;
            }

            return(orgValue);
        }
예제 #8
0
 public Organization(string name, OrganizationType type, Guid referenceId, string description = "") : base(referenceId)
 {
     Name        = name;
     Type        = type;
     Description = description;
     ItemType    = MemoryItemType.Organization;
 }
예제 #9
0
        public long SaveDefaultUserforOrganization(long organizationId, OrganizationType type, User user)
        {
            _addressService.SaveAfterSanitizing(user.Address);
            Roles defaultRole = 0;

            switch (type)
            {
            case OrganizationType.Franchisee:
                defaultRole = Roles.FranchiseeAdmin;
                break;

            case OrganizationType.CallCenter:
                defaultRole = Roles.CallCenterManager;
                break;

            case OrganizationType.MedicalVendor:
                defaultRole = Roles.MedicalVendorAdmin;
                break;
            }
            if (user.Id == 0)
            {
                user.DefaultRole = defaultRole;
                user.UserLogin.IsSecurityQuestionVerified = false;
            }
            long userId = _userRepository.SaveUser(user).Id;

            _orgRoleUserRepository.SaveOrganizationRoleUser(new OrganizationRoleUser(userId, (long)defaultRole, organizationId));

            return(userId);
        }
        public async Task <ActionResult <Guid> > Register(RegisterOrganizationDto registerOrganizationDto)
        {
            var logo     = registerOrganizationDto.Logo;
            var images   = registerOrganizationDto.Images;
            var contacts = registerOrganizationDto.Contacts;

            return(Created(string.Empty, await _organizationsService.RegisterOrganizationAsync(
                               await Organization.NewAsync(CreateOrganization.New(
                                                               OrganizationType.GetById(registerOrganizationDto.OrganizationTypeId),
                                                               new CreateOrUpdateContacts(
                                                                   contacts.ActualAddress,
                                                                   contacts.ActualGeoPosition,
                                                                   contacts.PhoneNumber,
                                                                   contacts.Email,
                                                                   contacts.Site,
                                                                   contacts.Telegram,
                                                                   contacts.Instagram,
                                                                   contacts.Vk),
                                                               registerOrganizationDto.LegalName,
                                                               registerOrganizationDto.LegalAddress,
                                                               registerOrganizationDto.ActualName,
                                                               registerOrganizationDto.TIN,
                                                               logo == null ? null : CreateOrganizationLogo.New(logo),
                                                               images == null ? Enumerable.Empty <CreateImage>() : images.Select(CreateImage.New))))));
        }
예제 #11
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] OrganizationType organizationType)
        {
            if (id != organizationType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(organizationType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrganizationTypeExists(organizationType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(organizationType));
        }
예제 #12
0
 public void SetUp()
 {
     this.pattern        = new SequencingPattern();
     this.organization   = new OrganizationType();
     this.chapter        = ItemType.CreateNewItem("Chapter", "chapter_base", null, PageType.Chapter);
     this.controlChapter = ItemType.CreateNewItem("Control Chapter", "control chapter", null, PageType.ControlChapter);
 }
예제 #13
0
 public OrganizationInfo(DepartmentInfo departmentInfo, OrganizationType organizationType)
 {
     this.ID               = departmentInfo.ID;
     this.Name             = departmentInfo.Name;
     this.ParentId         = departmentInfo.ParentId;
     this.OrganizationType = organizationType;
 }
예제 #14
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="address">Address.</param>
 /// <param name="type">Type.</param>
 /// <param name="lastUpdated">Last update time.</param>
 public Organization(string name, Address address, OrganizationType type, DateTime lastUpdated)
 {
     Name        = name;
     Address     = address;
     Type        = type;
     LastUpdated = lastUpdated;
 }
 public static OrganizationTypeModel ToModel(OrganizationType type)
 {
     return(new OrganizationTypeModel {
         Id = type.Id,
         Caption = type.Caption
     });
 }
예제 #16
0
 /**
  * Mark UI status as "Searching...", read search criteria from form and initiate search
  */
 private async void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         pdgvResults.Clear();
         pdgvResults.SetPageDescription("Searching...");
         OrganizationType searchOrgType = null;
         if (cmbOrgType.SelectedIndex != 0)
         {
             searchOrgType = (OrganizationType)cmbOrgType.SelectedItem;
         }
         string searchOrgName = txtOrgName.Text;
         State  searchState   = null;
         if (cmbState.SelectedIndex != 0)
         {
             searchState = (State)cmbState.SelectedItem;
         }
         City   searchCity   = (City)cmbCity.SelectedItem;
         string searchCounty = txtCounty.Text;
         string searchZip    = txtZip.Text;
         await _presenter.SearchOrganizations
         (
             searchOrgType, searchOrgName, searchState,
             searchCity, searchCounty, searchZip
         );
     }
     catch (AggregateException aex)
     {
         HandleAggregateException(aex);
     }
     catch (Exception ex)
     {
         HandleGeneralException(ex);
     }
 }
예제 #17
0
        public static string GetFieldName(OrganizationType orgType)
        {
            string result = null;

            switch (orgType)
            {
            case OrganizationType.Fgsmc:
                result = "fgsmc";
                break;

            case OrganizationType.Cycmc:
                result = "cycmc";
                break;

            case OrganizationType.Ytmc:
                result = "ytmc";
                break;

            case OrganizationType.Dydm:
                result = "dydm";
                break;

            case OrganizationType.Root:
            default:
                result = null;
                break;
            }

            return(result);
        }
예제 #18
0
        public static string GetSqlPartWithList(OrganizationType orgType)
        {
            string result = null;

            switch (orgType)
            {
            case OrganizationType.Fgsmc:
                result = "fgsmc";
                break;

            case OrganizationType.Cycmc:
                result = "fgsmc,cycmc";
                break;

            case OrganizationType.Ytmc:
                result = "fgsmc,cycmc,ytmc";
                break;

            case OrganizationType.Dydm:
                result = "fgsmc,cycmc,ytmc,dydm";
                break;

            case OrganizationType.Root:
            default:
                result = null;
                break;
            }

            return(result);
        }
예제 #19
0
        public async Task TestCreateBookmarkAsync()
        {
            var organizationType = new OrganizationType
            {
                OrganizationTypeId   = OrganizationType.Office.Id,
                OrganizationTypeName = OrganizationType.Office.Value
            };

            var office = new Organization
            {
                OrganizationId   = 1,
                OrganizationType = organizationType
            };

            context.Organizations.Add(office);

            var newBookmark = new NewBookmark(1, null, null, null, null, 1, false);
            var bookmark    = await service.CreateBookmarkAsync(newBookmark);

            Assert.AreEqual(newBookmark.OfficeId, bookmark.OfficeId);
            Assert.AreEqual(newBookmark.ProgramId, bookmark.ProgramId);
            Assert.AreEqual(newBookmark.ProjectId, bookmark.ProjectId);
            Assert.AreEqual(newBookmark.PersonId, bookmark.PersonId);
            Assert.AreEqual(newBookmark.OrganizationId, bookmark.OrganizationId);
            Assert.AreEqual(newBookmark.PrincipalId, bookmark.PrincipalId);
            Assert.AreEqual(newBookmark.Automatic, bookmark.Automatic);
            bookmark.AddedOn.Should().BeCloseTo(DateTimeOffset.Now, 20000);
        }
예제 #20
0
        public static string GetSqlPartWithDistinct(OrganizationType orgType)
        {
            string result = null;

            switch (orgType)
            {
            case OrganizationType.Fgsmc:
                result = "distinct(fgsmc),proid";
                break;

            case OrganizationType.Cycmc:
                result = "distinct(cycmc),fgsmc,proid";
                break;

            case OrganizationType.Ytmc:
                result = "distinct(ytmc),cycmc,fgsmc,proid";
                break;

            case OrganizationType.Dydm:
                result = "distinct(dydm),dymc,ytmc,cycmc,fgsmc,proid";
                break;

            case OrganizationType.Root:
            default:
                result = null;
                break;
            }

            return(result);
        }
예제 #21
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="address">Address.</param>
 /// <param name="type">Type.</param>
 /// <param name="lastUpdated">Last update time.</param>
 public Organization(string name, Address address, OrganizationType type, DateTime lastUpdated)
 {
     Name = name;
     Address = address;
     Type = type;
     LastUpdated = lastUpdated;
 }
예제 #22
0
 public void UpdateOrganizationType(OrganizationType model)
 {
     using (var uow = new LookupsUnitOfWork()) {
         uow.LookupsRespository.UpdateOrganizationType(model);
         uow.Save();
     }
 }
예제 #23
0
        public ActionResult CreateOrganizationType(OrganizationType model, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
            }

            return(RedirectToAction("GetOrganizationTypes"));
        }
예제 #24
0
        private static Report[] GetRecentReports(Report[] reports, OrganizationType organizationType)
        {
            var list = reports.Where(o => o.Organization.OrganizationType == organizationType).Select(o => o).ToArray();

            return(list.GroupBy(o => o.Organization.Id).Select(o =>
                                                               o.OrderByDescending(r => r.ReportingPeriod.EndDate).First()
                                                               ).ToArray());
        }
예제 #25
0
        public static List <NodeEnity> GetLstNodeEntity(DataRow dr, OrganizationType orgType)
        {
            List <NodeEnity> lstNE;
            NodeEnity        neDydm = new NodeEnity()
            {
                OrgType = OrganizationType.Dydm, OrgValue = dr["dydm"].ToString()
            };
            NodeEnity neOil = new NodeEnity()
            {
                OrgType = OrganizationType.Ytmc, OrgValue = "0_" + dr["FGSMC"].ToString() + "_" + dr["CYCMC"].ToString() + "_" + dr["ytmc"].ToString()
            };
            NodeEnity neCycmc = new NodeEnity()
            {
                OrgType = OrganizationType.Cycmc, OrgValue = "0_" + dr["FGSMC"].ToString() + "_" + dr["CYCMC"].ToString()
            };
            NodeEnity neFgsmc = new NodeEnity()
            {
                OrgType = OrganizationType.Fgsmc, OrgValue = "0_" + dr["FGSMC"].ToString()
            };
            NodeEnity neRoot = new NodeEnity()
            {
                OrgType = OrganizationType.Root, OrgValue = "null"
            };

            if (orgType == OrganizationType.Dydm)
            {
                lstNE = new List <NodeEnity>()
                {
                    neDydm, neOil, neCycmc, neFgsmc, neRoot
                }
            }
            ;
            else if (orgType == OrganizationType.Ytmc)
            {
                lstNE = new List <NodeEnity>()
                {
                    neOil, neCycmc, neFgsmc, neRoot
                }
            }
            ;
            else if (orgType == OrganizationType.Cycmc)
            {
                lstNE = new List <NodeEnity>()
                {
                    neCycmc, neFgsmc, neRoot
                }
            }
            ;
            else //if (orgType == OrganizationType.Fgsmc)
            {
                lstNE = new List <NodeEnity>()
                {
                    neFgsmc, neRoot
                }
            };

            return(lstNE);
        }
 public void UpdateModel(OrganizationType organizationType, Person currentPerson)
 {
     organizationType.OrganizationTypeName         = OrganizationTypeName;
     organizationType.OrganizationTypeAbbreviation = OrganizationTypeAbbreviation;
     organizationType.LegendColor               = LegendColor;
     organizationType.ShowOnProjectMaps         = ShowOnProjectMaps ?? false;
     organizationType.IsDefaultOrganizationType = IsDefaultOrganizationType ?? false;
     organizationType.IsFundingType             = IsFundingType ?? false;
 }
예제 #27
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            OrganizationType organizationType = await db.OrganizationTypes.FindAsync(id);

            db.OrganizationTypes.Remove(organizationType);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
예제 #28
0
        public void GetRecent_Returns_Result_AsExpected_WhenEmptyArray(OrganizationType organizationType, ReportingFrequency reportingFrequency)
        {
            var data = new SearchResult <ExcelReportData>(new ExcelReportData[0], new PagingData(1, 100, 1000));
            var recentExcelReportDatas = ExcelReportFactory.GetRecentExcelReportDatas(data.Items, organizationType);
            var expected = new ExcelReportData[0];

            // ReSharper disable once CoVariantArrayConversion
            recentExcelReportDatas.Should().BeEquivalentTo(expected);
        }
예제 #29
0
 public IEnumerable <OrderedPair <string, long> > GetOrganizationRoles(OrganizationType organizationType)
 {
     using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var linqMetaData = new LinqMetaData(myAdapter);
         return(linqMetaData.Role.Where(roleEntity => roleEntity.IsActive && roleEntity.OrganizationTypeId == (long)organizationType).
                Select(roleEntity => new OrderedPair <string, long>(roleEntity.Name, roleEntity.RoleId)).OrderBy(r => r.FirstValue).ToArray());
     }
 }
예제 #30
0
        public static List <PersonalProject> GetOrgProjects(string projectId, OrganizationType organizationType)
        {
            var db  = new PetaPoco.Database("DefaultConnection");
            var sql = new Sql(@"select op.*,o.OrganizationName,op.StudysiteNo, o.SubDomain  from sms_orgProject  op
            left join cts_organization o on op.organizationId=o.id
            where op.projectid=@0 and o.OrganizationType=@1 and isnull(op.isdeleted,0)<>1 and isnull(o.isdeleted,0)<>1", projectId, organizationType);

            return(db.Fetch <PersonalProject>(sql));
        }
예제 #31
0
 public IEnumerable <OrderedPair <string, long> > GetOrganizationIdNamePairs(OrganizationType type)
 {
     using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var linqMetaData = new LinqMetaData(myAdapter);
         return(linqMetaData.Organization.Where(org => org.OrganizationTypeId == (long)type && org.IsActive).
                Select(org => new OrderedPair <string, long>(org.Name, org.OrganizationId)).ToArray().OrderBy(org => org.FirstValue));
     }
 }
예제 #32
0
        private void miAddOrganization_Click(object sender, EventArgs e)
        {
            IOrganizationContainer c = (IOrganizationContainer) tvManifest.SelectedNode.Tag;
            OrganizationType t = new OrganizationType();

            c.Organizations.Add(t);

            Forms.PropertyEditor.Show(t);
            tvManifest.SelectedNode.Expand();
        }
        public IHttpActionResult PostOrganization(OrganizationType organizationType)
        {
            if (!ModelState.IsValid || organizationType == null)
            {
                return BadRequest(ModelState);
            }

            helper.CreateOrganizationType(organizationType);

            return CreatedAtRoute("DefaultApi", new { controller = "OrganizationType", name = organizationType.Name }, organizationType);
        }
        }//OrganizationType

        public static string get_OrganizationType_Description(OrganizationType enu)
        {
            System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(MaintainOrganization));
            System.Globalization.CultureInfo cInfo = System.Globalization.CultureInfo.CurrentCulture;
            string enuName = string.Format("{0}.{1}.{2}", typeof(OrganizationType).BaseType.Name, typeof(OrganizationType).Name, enu.ToString());
            try
            {
                return rm.GetString(enuName, cInfo); ;
            }
            catch
            {
                throw new Exception("Enum Error");
            }
        }//get_OrganizationType _Description
예제 #35
0
        public object CreateOrganizationType(OrganizationType obj)
        {
            Int32 rowsaffected = 0;
            try
            {
                this.OpenConn();
                string sqlQuery = string.Format("INSERT into Organization_Type (NAME, DESCRIPTION) VALUES ('{0}', '{1}')", obj.Name, obj.Description);
                // Execute command
                NpgsqlCommand command = new NpgsqlCommand(sqlQuery, conn);
                rowsaffected = command.ExecuteNonQuery();
                this.CloseConn();

            }
            catch (Exception ne)
            {
                Console.WriteLine("error inserting, Error details {0}", ne.ToString());
            }
            return rowsaffected;
        }
예제 #36
0
        public List<OrganizationType> QueryAllOnOrganizationType()
        {
            try
            {
                this.OpenConn();
                string SQL = "SELECT * FROM Organization_Type";
                NpgsqlCommand command = new NpgsqlCommand(SQL, conn);
                NpgsqlDataReader dr = command.ExecuteReader();
                List<OrganizationType> orgTypes = new List<OrganizationType>();

                while (dr.Read())
                {
                    OrganizationType type = new OrganizationType();
                    type.Name = dr["name"].ToString();
                    type.Description = dr["description"].ToString();
                    orgTypes.Add(type);
                }
                this.CloseConn();
                return orgTypes;
            }
            catch (Exception ne)
            {
                Console.WriteLine("error on query table connecting to server, Error details {0}", ne.ToString());
                return null;
            }
        }
예제 #37
0
        public object UpdateOrganizationType(string name, OrganizationType obj)
        {
            object orgObject = new object();
            try
            {
                this.OpenConn();

                string sqlQuery = string.Format("UPDATE Organization_Type SET NAME = '{0}', DESCRIPTION = '{1}' WHERE Name = {2} RETURNING id; ", obj.Name, obj.Description, name);
                // Execute command
                NpgsqlCommand command = new NpgsqlCommand(sqlQuery, conn);
                orgObject = command.ExecuteScalar();
                this.CloseConn();

            }
            catch (Exception ne)
            {
                Console.WriteLine("error inserting, Error details {0}", ne.ToString());
            }
            return orgObject;
        }
예제 #38
0
        public OrganizationType QueryOnOrganizationTypeBy(string name)
        {
            try
            {
                this.OpenConn();

                string SQL = string.Format("SELECT * FROM Organization_Type WHERE Name = '{0}'", name);
                NpgsqlCommand command = new NpgsqlCommand(SQL, conn);
                NpgsqlDataReader dr = command.ExecuteReader();
                OrganizationType org = new OrganizationType();

                while (dr.Read())
                {
                    org.Name = dr["name"].ToString();
                    org.Description = dr["description"].ToString();
                    return org;
                }
                this.CloseConn();
                return org;
            }
            catch (Exception ne)
            {
                Console.WriteLine("error on query table connecting to server, Error details {0}", ne.ToString());
                return null;
            }
        }
예제 #39
0
        private void AddChapter(PageType chapterType)
        {
            var treeNode = tvItems.SelectedNode;
            var manNode = treeNode.Tag as IManifestNode;
            IManifestNode n;
            if (manNode is IItemContainer)
            {
                var newItem = ItemType.CreateNewItem(String.Format("New {0}", chapterType), Guid.NewGuid().ToString(), null, chapterType);
                n = newItem;
                (manNode as IItemContainer).SubItems.Add(newItem);
                tvItems.SelectedNode = treeNode.Nodes.Find(n.UID, true)[0];
            }
            else
            {
                var o = new OrganizationType { Title = String.Format("New {0}", chapterType) };
                n = o;
                Course.Manifest.organizations.Organizations.Add(o);
            }

            treeNode = treeNode.Nodes.Find(n.UID, true)[0];
            treeNode.BeginEdit();
        }
        public IHttpActionResult PutOrganization(string id, OrganizationType organizationType)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != organizationType.Name)
            {
                return BadRequest();
            }

            try
            {
                object obj = helper.UpdateOrganizationType(id, organizationType);
                organizationType.Name = obj.ToString();
                return CreatedAtRoute("DefaultApi", new { controller = "Organization", id = obj }, organizationType);
            }
            catch (DbUpdateConcurrencyException)
            {
                //if (!CustomerExists(id))
                //{
                //    return NotFound();
                //}
                //else
                //{
                //    throw;
                //}
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
예제 #41
0
 static int OrganizationType()
 {
     OrganizationType e = new OrganizationType()
       {
           OrganizationTypeName = "OrganizationTypeName"
       };
     commonUow.OrganizationTypes.Add<OrganizationType, int>(e);
     commonUow.OrganizationTypes.Commit();
     return e.ID;
 }