// GET: Targets
 public ActionResult Index()
 {
     var officeManager = new DataAccess.OfficeMananer();
     ViewData["Offices"] = officeManager.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     BundleConfig.AddScript("~/Scripts/Offices", "targets.js", ControllerName);
     return View();
 }
 public ActionResult AddByOffice()
 {
     var officeMananer = new DataAccess.OfficeMananer();
     var offices = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId, 4);
     ViewData["Offices"] = offices;
     ViewData["UserID"] = UserDetail.UserId;
     return PartialView();
 }
 public ActionResult Add()
 {
     if (!IsAdmin) { return RedirectToAction("AddByOffice"); }
     var officeMananer = new DataAccess.OfficeMananer();
     var offices = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     ViewData["Offices"] = offices.ToList();
     return PartialView();
 }
 public PartialViewResult Edit(int id)
 {
     var officeManager = new DataAccess.OfficeMananer();
     ViewData["Offices"] = officeManager.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     var targetManager = new DataAccess.TargetManager();
     var target = targetManager.GetTarget(id);
     return PartialView(target);
 }
 public ActionResult Edit(int id)
 {
     var officeMananer = new DataAccess.OfficeMananer();
     var taskManager = new DataAccess.TaskManager();
     var task = taskManager.GetTask(id);
     var offices = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     ViewData["Offices"] = offices.Where(model => model.IsDeleted == false).ToList();
     return PartialView(task);
 }
 public PartialViewResult Add()
 {
     var customRoleProvider = new CustomAuthentication.CustomRoleProvider();
     var officeMananer = new DataAccess.OfficeMananer();
     // Remove Admin from User Role
     var roles = IsAdmin ? customRoleProvider.GetAllRoles() : customRoleProvider.GetAllRoles().Where(model => model.RoleId != 1 && model.RoleId != 2).ToList();
     ViewData["Offices"] = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     return PartialView(roles);
 }
 public PartialViewResult Edit(int id)
 {
     var customRoleProvider = new CustomAuthentication.CustomRoleProvider();
     var userManager = new DataAccess.UserManager();
     var user = userManager.GetUserDetail(id);
     var roles = IsAdmin ? customRoleProvider.GetAllRoles() : customRoleProvider.GetAllRoles().Where(model => model.RoleId != 1 && model.RoleId != 2).ToList();
     ViewData["UserRoles"] = roles;
     var officeMananer = new DataAccess.OfficeMananer();
     ViewData["Offices"] = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     return PartialView(user);
 }
 public PartialViewResult Edit(int id)
 {
     var userDetailManager = new DataAccess.UserManager();
     var officeMananer = new DataAccess.OfficeMananer();
     var user = userDetailManager.GetUserDetail(UserDetail.UserId);
     var offices = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     ViewData["Offices"] = offices;
     var conventionManager = new DataAccess.ConventionManager();
     var conventions = conventionManager.GetConventions();
     ViewData["Conventions"] = conventions;
     var eventManager = new DataAccess.EventManager();
     var eventDetail = eventManager.GetEventDetail(id);
     return PartialView(eventDetail);
 }
 public PartialViewResult Add()
 {
     var visitTypeManager = new DataAccess.VisitTypeManager();
     ViewData["VisitTypes"] = visitTypeManager.GetVisitTypes();
     var officeManager = new DataAccess.OfficeMananer();
     var offices = officeManager.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     ViewData["Offices"] = offices;
     var eventManager = new DataAccess.EventManager();
     ViewData["Events"] = eventManager.GetActiveEvents(offices.Select(model => model.OfficeId).ToList());
     var userManager = new DataAccess.FSMDetailManager();
     ViewData["FSMUsers"] = userManager.FSMDetails();
     var conventionManager = new DataAccess.ConventionManager();
     ViewData["Convention"] = conventionManager.GetActiveConventions();
     var serviceManager = new DataAccess.ServiceManager();
     ViewData["Services"] = serviceManager.GetServices();
     return PartialView();
 }
 public ActionResult Add()
 {
     var userDetailManager = new DataAccess.UserManager();
     var officeMananer = new DataAccess.OfficeMananer();
     var user = userDetailManager.GetUserDetail(UserDetail.UserId);
     var offices = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     ViewData["Offices"] = offices;
     var conventionManager = new DataAccess.ConventionManager();
     var conventions = conventionManager.GetConventions();
     ViewData["Conventions"] = conventions;
     if (IsAdmin)
     {
         var customRoleProvider = new CustomAuthentication.CustomRoleProvider();
         var customMembershipProvider = new CustomAuthentication.CustomMembershipProvider();
         ViewData["Employee"] = customMembershipProvider.GetUsers(4);
     }
     return PartialView();
 }
 public ActionResult Index()
 {
     BundleConfig.AddScript("~/Scripts/Audiences", "audiences.js", ControllerName);
     var officeManager = new DataAccess.OfficeMananer();
     var offices = officeManager.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     ViewData["Offices"] = offices;
     var eventManager = new DataAccess.EventManager();
     ViewData["Events"] = eventManager.GetActiveEvents(offices.Select(model => model.OfficeId).ToList());
     var userManager = new DataAccess.FSMDetailManager();
     ViewData["FSMUsers"] = userManager.FSMDetails();
     var conventionManager = new DataAccess.ConventionManager();
     ViewData["Convention"] = conventionManager.GetActiveConventions();
     var serviceManager = new DataAccess.ServiceManager();
     ViewData["Services"] = serviceManager.GetServices();
     StartupScript = "audiences.DoPageSetting();";
     return View();
 }
예제 #12
0
        public UserDetail GetUserDetail(int id)
        {
            try
            {
                DataSet dataSet;
                using (var command = database.GetStoredProcCommand("[dbo].[sproc_SimplePlatForm_GetUserByID]"))
                {
                    database.AddInParameter(command, "@ID", DbType.Int32, id);
                    dataSet = database.ExecuteDataSet(command);
                }

                if (dataSet == null || dataSet.Tables.Count <= 0) return null;
                var officeManager = new DataAccess.OfficeMananer();
                var dataTable = dataSet.Tables[0];
                var userDetail = (from dataRow in dataTable.AsEnumerable()
                                  select new DataModel.Modal.UserDetail
                                  {
                                      UserId = dataRow.Field<int>("UserId"),
                                      User = new User
                                      {
                                          UserId = dataRow.Field<int>("UserId"),
                                          UserName = dataRow.Field<string>("UserName"),
                                          FirstName = dataRow.Field<string>("FirstName"),
                                          LastName = dataRow.Field<string>("LastName"),
                                          Email = dataRow.Field<string>("Email"),
                                          Roles = new List<Role> {
                                            new Role {
                                                RoleId = dataRow.Field<int>("RoleId"),
                                                RoleName = dataRow.Field<string>("RoleName")
                                            }
                                        }
                                      },
                                      Offices = officeManager.GetOffices(dataRow.Field<int>("UserId")),
                                      FileResource = dataRow.Field<int?>("FileResourceID").GetValueOrDefault(0) == 0 ? null : new FileResource
                                      {
                                          Id = dataRow.Field<int>("FileResourceID"),
                                          name = dataRow.Field<string>("FileResourceName"),
                                          path = dataRow.Field<string>("FileResourcePath")
                                      }
                                  }).FirstOrDefault();
                return userDetail;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        public ActionResult Index()
        {
            var officeMananer = new DataAccess.OfficeMananer();
            var offices = officeMananer.GetOffices(UserDetail.UserId);
            var totalOffices = offices.Count();
            var office = offices.FirstOrDefault();
            if (totalOffices == 1) { return RedirectToAction("Detail", new { id = office.OfficeId }); }

            BundleConfig.AddStyle("/Offices", "Offices.css", ControllerName);
            BundleConfig.AddScript("~/Scripts/Offices", "Offices.js", ControllerName);
            Script = string.Format("office.options.isEditDeleteEnable = {0};", IsAdmin.ToString().ToLower());
            return View();
        }
 public JsonResult GetOffices(int pageNo, int pageSize, string startDate, string endDate)
 {
     try
     {
         var officesManager = new DataAccess.OfficeMananer();
         var offices = officesManager.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
         var totalRecord = offices.Count();
         var startDateTime = Convert.ToDateTime(startDate);
         var endDateTime = Convert.ToDateTime(endDate);
         var filteredOffices = offices
             .Where(model => model.IsDeleted == false)
             .OrderBy(model => model.Name)
             .Select(modal => new
             {
                 ID = modal.OfficeId,
                 Name = modal.Name,
                 Fundraising = GetFundRaisingTargets(modal.OfficeId, startDateTime, endDateTime),
                 Task = GetTaskTargets(modal.OfficeId, startDateTime, endDateTime),
                 Arrival = GetArrivalTargets(modal.OfficeId, startDateTime, endDateTime),
                 BookingInProcess = GetBookingTargets(modal.OfficeId, startDateTime, endDateTime),
                 Events = GetEventsTarget(modal.OfficeId, startDateTime, endDateTime),
                 ProfilePic = modal.FileResource == null ? Url.Content("~/Content/Images/Common/office_convention_avatar.png") : Url.Content(modal.FileResource.path)
             }).OrderBy(modal => modal.ID).Skip((pageNo - 1) * pageSize).Take(pageSize).ToList();
         return Json(new
         {
             totalRecord = totalRecord,
             currentPage = pageNo,
             pageSize = pageSize,
             offices = filteredOffices
         });
     }
     catch (Exception ex)
     {
         return null;
     }
 }