예제 #1
0
        public static Organizations GetOrganization(OrganizationModel model)
        {
            if (model == null)
            {
                return(new Organizations());
            }

            return(new Organizations {
                Id = model.Id, Name = model.Name, Address = model.Address, City = model.City, State = model.State, Zip = model.Zip, Users = UserFactory.GetUser(model.Users)
            });
        }
예제 #2
0
        public ActionResult Index(int id, int?peopleid = null)
        {
            var db = DbUtil.Db;

            db.CurrentOrg = new CurrentOrg {
                Id = id, GroupSelect = GroupSelectCode.Member
            };

            var m = new OrganizationModel(id);

            if (peopleid.HasValue)
            {
                m.NameFilter = peopleid.ToString();
            }

            if (m.Org == null)
            {
                return(Content("organization not found"));
            }

            if (Util2.OrgLeadersOnly)
            {
                var oids = DbUtil.Db.GetLeaderOrgIds(Util.UserPeopleId);
                if (!oids.Contains(m.Org.OrganizationId))
                {
                    return(NotAllowed("You must be a leader of this organization", m.Org.OrganizationName));
                }
                var sgleader = DbUtil.Db.SmallGroupLeader(id, Util.UserPeopleId);
                if (sgleader.HasValue())
                {
                    db.CurrentOrg.SgFilter = sgleader;
                    m.SgFilter             = sgleader;
                }
            }
            if (m.Org.LimitToRole.HasValue())
            {
                if (!User.IsInRole(m.Org.LimitToRole))
                {
                    return(NotAllowed("no privilege to view ", m.Org.OrganizationName));
                }
            }

            DbUtil.LogOrgActivity($"Viewing Org({m.Org.OrganizationName})", id, m.Org.OrganizationName);

            ViewBag.OrganizationContext = true;
            ViewBag.orgname             = m.Org.FullName;
            ViewBag.model      = m;
            ViewBag.selectmode = 0;
            InitExportToolbar(id);
            m.GroupSelect = "10";
            Session["ActiveOrganization"] = m.Org.OrganizationName;
            return(View(m));
        }
예제 #3
0
        public static OrganizationModel UpdateFormData(
            Dictionary <string, object> dataModel,
            OrganizationModel model
            )
        {
            foreach (var item in dataModel)
            {
                model.Write(item.Key, item.Value);
            }

            return(model);
        }
        public OrganizationModel Save(OrganizationModel school)
        {
            var entity = school.MapAs <Organization>();

            entity.IsActive     = "Y";
            entity.CreatedDate  = DateTime.Now;
            entity.ModifiedDate = DateTime.Now;
            this._context.Organizations.Add(entity);
            this._context.SaveChanges();

            return(entity.MapAs <Organization, OrganizationModel>());
        }
예제 #5
0
 public static BasicOrganizationViewModel ToBasic(this OrganizationModel model)
 {
     return(new BasicOrganizationViewModel()
     {
         id = model.Id,
         lat = model.Address.Latitude,
         lng = model.Address.Longitude,
         label = model.Name,
         Categories = model.Categories,
         PhoneNumber = model.PhoneNumber
     });
 }
예제 #6
0
        public async Task UpdateOrganization(OrganizationModel model)
        {
            var organization = await _context.Organizations.FindAsync(model.Id);

            organization.Name    = model.Name;
            organization.Address = model.Address;
            organization.City    = model.City;
            organization.State   = model.State;
            organization.Zip     = model.Zip;

            await _context.SaveChangesAsync();
        }
        public static Organization FromModel(OrganizationModel model)
        {
            var srv  = CompositionRoot.Resolve <IOrganizationService>();
            var type = srv.GetTypeById(model.TypeId);

            return(new Organization {
                Id = model.Id,
                Caption = model.Caption,
                FullCaption = model.FullCaption,
                Type = type
            });
        }
예제 #8
0
 public bool UpdateOrganization(OrganizationModel model)
 {
     if (model.OrganizationId == -1)
     {
         model.OrganizationId = null;
         return(_serviceFactory.Organization.Create(model));
     }
     else
     {
         return(_serviceFactory.Organization.Update(model));
     }
 }
예제 #9
0
        public ActionResult RenameDiv(int id, int divid, string name)
        {
            var d = DbUtil.Db.Divisions.Single(dd => dd.Id == divid);

            d.Name = name;
            DbUtil.Db.SubmitChanges();
            var m = new OrganizationModel {
                ProgramId = id
            };

            return(View("DivisionIds", m));
        }
        public async Task <ActionResult> Edit(int id)
        {
            var el = await _mediator.Send(new GetOrganizationByIdQuery(id));

            var model = new OrganizationModel()
            {
                Name       = el.Name,
                Id         = el.Id,
                IsInactive = el.IsInactive
            };

            return(View(model));
        }
예제 #11
0
        public ActionResult Delete(Organization organization)
        {
            var organizationModel   = new OrganizationModel();
            var deletedOrganization = organizationModel.SetOrganizationIsDeleted(organization.Organization_Id, true);

            if (deletedOrganization == null)
            {
                ViewBag.Message = "An Error Occured, Contact support";
                return(View(organization));
            }

            return(RedirectToAction("Index", "Organization"));
        }
예제 #12
0
        public async Task <IActionResult> Create([Bind("Id,Name,ContactEmail,PhoneNumber,Address,WebsiteLink,MissionStatement,FullDescription,CauseId,ImageFile")] OrganizationModel organizationModel)
        {
            if (ModelState.IsValid)
            {
                Organization organization = organizationModel.GetOrganization(_context, _imageManager);

                _context.Add(organization);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(organizationModel));
        }
예제 #13
0
        public ActionResult SettingsMeetingsUpdate(int id)
        {
            var m = new OrganizationModel(id);

            m.schedules.Clear();

            UpdateModel(m);
            m.UpdateSchedules();
            DbUtil.Db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, m.org.OrgSchedules);
            DbUtil.LogActivity("Update SettingsMeetings {0}".Fmt(m.org.OrganizationName));
            return(View("SettingsMeetings", m));
            //return View("SettingsMeetingsEdit", m);
        }
예제 #14
0
        public async Task <int> CreateOrganization(OrganizationModel model)
        {
            var request = GetRequest(CREATEORGANIZATION_URL, Method.POST, model);

            var response = await _client.ExecuteTaskAsync(request);

            if (response.IsSuccessful)
            {
                return(JsonConvert.DeserializeObject <int>(response.Content));
            }

            return(0);
        }
예제 #15
0
        private OrganizationModel CreateOrgModel(Organization o)
        {
            var model = new OrganizationModel();

            model.ID        = o.ID;
            model.Name      = o.Name;
            model.Path      = o.Path;
            model.PathName  = o.PathName;
            model.ParentID  = o.ParentID == null ? "" : o.ParentID;
            model.IsChecked = false;

            return(model);
        }
예제 #16
0
        public ActionResult Index(int id, int?peopleid = null)
        {
            if (id == 0)
            {
                var recent = Util2.MostRecentOrgs;
                id = recent.Any() ? recent[0].Id : 1;
                return(Redirect($"/Org/{id}"));
            }
            var m = new OrganizationModel(id);

            if (peopleid.HasValue)
            {
                m.NameFilter = peopleid.ToString();
            }

            if (m.Org == null)
            {
                return(Content("organization not found"));
            }

            if (Util2.OrgLeadersOnly)
            {
                var oids = DbUtil.Db.GetLeaderOrgIds(Util.UserPeopleId);
                if (!oids.Contains(m.Org.OrganizationId))
                {
                    return(NotAllowed("You must be a leader of this organization", m.Org.OrganizationName));
                }
                var sgleader = DbUtil.Db.SmallGroupLeader(id, Util.UserPeopleId);
                if (sgleader.HasValue())
                {
                    m.SgFilter = sgleader;
                }
            }
            if (m.Org.LimitToRole.HasValue())
            {
                if (!User.IsInRole(m.Org.LimitToRole))
                {
                    return(NotAllowed("no privilege to view ", m.Org.OrganizationName));
                }
            }

            DbUtil.LogOrgActivity($"Viewing Org({m.Org.OrganizationName})", id, m.Org.OrganizationName);

            ViewBag.OrganizationContext = true;
            ViewBag.orgname             = m.Org.FullName;
            ViewBag.model      = m;
            ViewBag.selectmode = 0;
            InitExportToolbar(m);
            Session["ActiveOrganization"] = m.Org.OrganizationName;
            return(View(m));
        }
예제 #17
0
        public void DeleteProject(ProjectModel model, Guid organizationId)
        {
            OrganizationModel org = LoadRecordById <OrganizationModel>(_organizationCollection, organizationId);

            if (model.ParentIdTreePath.Count > 0)
            {
                org.GetProjectByIdTree(model.ParentIdTreePath).SubProjects.Remove(model);
            }
            else
            {
                org.Projects.Remove(model);
            }
            UpsertRecord(_organizationCollection, organizationId, org);
        }
예제 #18
0
 public void UpdateOrganization(OrganizationModel Organization, OrganizationModel origOrganization)
 {
     try
     {
         SaveChanges();
     }
     catch (Exception ex)
     {
         //Include catch blocks for specific exceptions first,
         //and handle or log the error as appropriate in each.
         //Include a generic catch block like this one last.
         throw ex;
     }
 }
예제 #19
0
        public int Insert(OrganizationModel model)
        {
            string sql = "INSERT INTO [Organization]([OrgID],[Organization]) VALUES(@OrgID,@Organization)";

            SqlParameter[] parameters =
            {
                new SqlParameter("@OrgID",        SqlDbType.Int),
                new SqlParameter("@Organization", SqlDbType.NVarChar),
            };
            parameters[0].Value = model.OrgID;
            parameters[1].Value = model.Organization == null ? (object)DBNull.Value : model.Organization;

            return(DbHelperSQL.ExecuteSql(sql, parameters));
        }
예제 #20
0
        public JsonResult SaveOrganization(OrganizationModel model)
        {
            Organization organizationDB = new Organization();
            var          message        = "Couldn't Added Organization Properly";
            var          obj            = db.Users.Where(x => x.UserName == User.Identity.Name).FirstOrDefault();

            if (model.Id > 0)
            {
                Organization updateDB = db.Organizations.Find(model.Id);
                if (model.Name != null)
                {
                    updateDB.Name            = model.Name;
                    updateDB.Status          = model.Status;
                    updateDB.UpdatedBy_Id    = obj.Id;
                    db.Entry(updateDB).State = EntityState.Modified;
                    db.SaveChanges();
                    message = "Organization Updated Successfully";
                }
                else
                {
                    message = "Couldn't Update Properly";
                }
            }
            else
            {
                if (model.Name != null)
                {
                    try
                    {
                        if (obj != null)
                        {
                            organizationDB.Name         = model.Name;
                            organizationDB.CreatedBy_Id = obj.Id;
                            organizationDB.CreatedDate  = model.CreatedDate;
                            organizationDB.Status       = model.Status;
                            db.Organizations.Add(organizationDB);
                            db.SaveChanges();
                            message = model.Name + " Added Successfully";
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                else
                {
                }
            }
            return(Json(new { Message = message }, JsonRequestBehavior.AllowGet));
        }
예제 #21
0
        public void SearchResultViewModelTest_CopyToExcel_TextInExcelFormat()
        {
            // Arrange
            Mock <ILog> logger = new Mock <ILog>();

            Mock <IRestQuery> query = new Mock <IRestQuery>();

            string expectedResult = "LER OG HEREFOSS AS\t910570919\[email protected]\t" + Environment.NewLine +
                                    "LER OG HEREFOSS AS\t910570919\[email protected]\t98008410" + Environment.NewLine +
                                    "LER OG HEREFOSS AS\t910570919\[email protected]\t98008410" + Environment.NewLine + Environment.NewLine;

            SearchResultViewModel searchResultViewModel = new SearchResultViewModel(logger.Object, mapper, query.Object);

            OrganizationModel organizationModel = new OrganizationModel
            {
                Name               = "LER OG HEREFOSS",
                Type               = "AS",
                IsSelected         = true,
                OrganizationNumber = "910570919",
                OfficialContacts   = "https://www.altinn.no/api/serviceowner/organizations/910570919/officialcontacts"
            };

            searchResultViewModel.Model.ResultCollection.Add(organizationModel);

            ObservableCollection <OfficialContact> officialContacts = new ObservableCollection <OfficialContact>
            {
                new OfficialContact
                {
                    EmailAddress = "*****@*****.**"
                },
                new OfficialContact()
                {
                    MobileNumber = "98008410",
                    EmailAddress = "*****@*****.**"
                },
                new OfficialContact()
                {
                    MobileNumber = "98008410",
                    EmailAddress = "*****@*****.**"
                }
            };

            query.Setup(s => s.GetByLink <OfficialContact>(It.Is <string>(url => url == organizationModel.OfficialContacts))).Returns(officialContacts);

            // Act
            searchResultViewModel.CopyToClipboardExcelFormatHandler();

            // Assert
            Assert.AreEqual(expectedResult, Clipboard.GetText());
        }
        public async Task <HttpResponseMessage> Create(OrganizationModel model)
        {
            var command = _mapper.Map <CreateNewOrganization>(model);

            var organizationId = await _bus.ExecuteAsyncCommand(command);

            var response = Request.CreateResponse(HttpStatusCode.Created, model);

            var uri = _urlHelper.Action("Details", new { controller = "Organization", id = organizationId });

            response.Headers.Location = new Uri(Request.RequestUri, uri);

            return(response);
        }
        private OrganizationModel CreateOrgModel(Organization o, string[] checkedOrg)
        {
            var model = new OrganizationModel();

            model.ID          = o.ID;
            model.Name        = o.Name;
            model.ParentID    = o.ParentID == null ? "" : o.ParentID;
            model.IsChecked   = checkedOrg.Contains(model.ID);
            model.OrderNum    = o.SortNum;
            model.IsShow      = o.IsShow;
            model.Description = o.Description;

            return(model);
        }
예제 #24
0
        public ActionResult ManageUserDetail(int id)
        {
            int OrgID = int.Parse(Request.Cookies["OrgID"].Value);
            OrganizationModel orgmodel = SecurityProvider.GetDepartmentRoleGroups(id, OrgID);
            UserModel         model    = new UserFacade().GetUserDetails(id);

            model.Departments          = orgmodel.Departments;
            model.UserID               = id;
            ViewBag.CertificationsList = new List <string>()
            {
                "", "Certified IA", "Internal Training"
            };
            return(View("ManageUser", model));
        }
예제 #25
0
        public int Update(OrganizationModel model)
        {
            string sql = "UPDATE [Organization] SET [OrgID]=@OrgID,[Organization]=@Organization WHERE OrgID=@OrgID";

            SqlParameter[] parameters =
            {
                new SqlParameter("@OrgID",        SqlDbType.Int),
                new SqlParameter("@Organization", SqlDbType.NVarChar),
            };
            parameters[0].Value = model.OrgID;
            parameters[1].Value = model.Organization == null ? (object)DBNull.Value : model.Organization;

            return(DbHelperSQL.ExecuteSql(sql, parameters));
        }
예제 #26
0
        public bool CreateOrganization(OrganizationModel model)
        {
            List <OrganizationModel> organizations = LoadRecords <OrganizationModel>(_organizationCollection);

            // Ensure that no organizations with that name already exist
            if (organizations.Where(x => x.Name == model.Name).Any())
            {
                return(false);
            }

            // No conflicts, so the record can be inserted.
            InsertRecord(_organizationCollection, model);
            return(true);
        }
 /// <summary>
 /// Append a list of credit card to current credit card
 /// </summary>
 /// <param name="customerContact"></param>
 /// <param name="organization"></param>
 /// <param name="currentListCards"></param>
 /// <param name="appendListCreditCards"></param>
 private void AddRangeCreditCard(CustomerContact customerContact, OrganizationModel organization, List <CreditCardModel> currentListCards, IEnumerable <Mediachase.Commerce.Customers.CreditCard> appendListCreditCards)
 {
     currentListCards.AddRange(appendListCreditCards.Select(x => new CreditCardModel
     {
         CreditCardNumber       = x.CreditCardNumber,
         CreditCardType         = (Mediachase.Commerce.Customers.CreditCard.eCreditCardType)x.CardType,
         CreditCardSecurityCode = x.SecurityCode,
         ExpirationMonth        = x.ExpirationMonth,
         ExpirationYear         = x.ExpirationYear,
         CreditCardId           = x.PrimaryKeyId.ToString(),
         CurrentContact         = customerContact,
         Organization           = organization
     }));
 }
예제 #28
0
        public bool UpdateOrganization(OrganizationModel model)
        {
            List <OrganizationModel> organizations = LoadRecords <OrganizationModel>(_organizationCollection);

            // Ensure that no organizations with that name already exist
            if (organizations.Where(x => x.Name == model.Name && x.Id != model.Id).Any())
            {
                return(false);
            }

            UpsertRecord(_organizationCollection, model.Id, model);

            return(true);
        }
예제 #29
0
        public Either <Error, OrganizationModel> RetrieveOrganization(int pmId)
        {
            Option <Organization> organization = _repository.FindById(pmId);

            if (organization.IsSome)
            {
                var pmModel = new OrganizationModel(organization.AsEnumerable().First(), _hostName);
                return(pmModel);
            }
            else
            {
                return(F.Error("Customer with such Id is not found: " + pmId));
            }
        }
예제 #30
0
        public bool Update(OrganizationModel model, string userId)
        {
            var organization = _context.MstOrganizations.Find(model.Cd);

            organization.Code         = model.Code.Trim();
            organization.Name         = model.Name.Trim();
            organization.NameKana     = model.NameKana.Trim();
            organization.UpdateDate   = DateTime.Now;
            organization.UpdateUserId = userId;

            Update(organization);

            return(true);
        }