コード例 #1
0
        private void BindUserPanel()
        {
            DateTime fromDate = SchedulerManager.GetScheduleFromDate(WebScheduleInfo1);
            DateTime toDate   = SchedulerManager.GetScheduleEndDate(WebDayView1);

            // bind user names to schedule
            bindResources();


            bindTasks(fromDate, toDate);

            List <LeadTask> appointments = null;

            // active resouce
            int userID = Convert.ToInt32(ActiveResourceKey);

            // get taks and show in scheduler as appointment
            Expression <Func <CRM.Data.Entities.Task, bool> > predicate = PredicateBuilder.True <CRM.Data.Entities.Task>();

            // load events only
            predicate = predicate.And(LeadTask => LeadTask.TaskType == 2);

            predicate    = predicate.And(LeadTask => LeadTask.start_date >= fromDate && LeadTask.end_date <= toDate);
            predicate    = predicate.And(LeadTask => LeadTask.owner_id == userID);
            appointments = TasksManager.GetLeadTask(predicate, fromDate, toDate);

            SchedulerManager.BindAppointment(WebScheduleInfo1, appointments);
        }
コード例 #2
0
        public void bindEvents()
        {
            int      clientID    = SessionHelper.getClientId();
            int      DaysinMonth = 0;
            DateTime fromDate    = DateTime.Now;
            DateTime toDate      = DateTime.Now;

            CRM.Data.Entities.SecUser user = null;

            int userID = SessionHelper.getUserId();

            user = SecUserManager.GetById(userID);

            if (user != null)
            {
                if (WebDayView1.Visible)
                {
                    fromDate = SchedulerManager.GetScheduleFromDate(WebScheduleInfo1);
                    toDate   = SchedulerManager.GetScheduleEndDate(WebDayView1);
                }
                else if (WebMonthView1.Visible)
                {
                    fromDate    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                    DaysinMonth = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
                    toDate      = fromDate.AddMonths(1).AddTicks(-1);
                }

                List <LeadTask> appointments = null;

                // get events from all users and show on scheduler
                Expression <Func <Task, bool> > predicate = PredicateBuilder.True <CRM.Data.Entities.Task>();
                predicate = predicate.And(LeadTask => LeadTask.creator_id == clientID);
                predicate = predicate.And(LeadTask => LeadTask.TaskType == 2);
                predicate = predicate.And(LeadTask => LeadTask.owner_id == userID);

                predicate = predicate.And(LeadTask => LeadTask.start_date >= fromDate && LeadTask.start_date <= toDate);


                appointments = TasksManager.GetEvents(predicate);


                Resource resource = new Resource();

                resource.DataKey = userID.ToString();

                resource.Name = user.FirstName + " " + user.LastName;

                WebScheduleInfo1.Activities.Clear();
                WebScheduleInfo1.VisibleResources.Clear();

                WebScheduleInfo1.VisibleResources.Add(resource);

                SchedulerManager.BindAppointment(WebScheduleInfo1, appointments);
            }
        }
コード例 #3
0
        private void bindTasksForUser()
        {
            DateTime fromDate = SchedulerManager.GetScheduleFromDate(WebScheduleInfo1);
            DateTime toDate   = SchedulerManager.GetScheduleEndDate(WebDayView1);

            List <LeadTask> appointments = null;

            // get taks and show in scheduler as appointment
            Expression <Func <Task, bool> > predicate = PredicateBuilder.True <CRM.Data.Entities.Task>();

            predicate    = predicate.And(LeadTask => LeadTask.start_date >= fromDate && LeadTask.end_date <= toDate);
            predicate    = predicate.And(LeadTask => LeadTask.owner_id == userID);
            appointments = TasksManager.GetLeadTask(predicate, fromDate, toDate);

            SchedulerManager.BindAppointment(WebScheduleInfo1, appointments);
        }
コード例 #4
0
        private void bindTasksForClient()
        {
            DateTime fromDate = SchedulerManager.GetScheduleFromDate(WebScheduleInfo1);
            DateTime toDate   = SchedulerManager.GetScheduleEndDate(WebDayView1);

            List <LeadTask> appointments = null;

            // active resouce
            int userID = Convert.ToInt32(ActiveResourceKey);

            // get taks and show in scheduler as appointment
            Expression <Func <Task, bool> > predicate = PredicateBuilder.True <CRM.Data.Entities.Task>();

            predicate    = predicate.And(LeadTask => LeadTask.start_date >= fromDate && LeadTask.end_date <= toDate);
            predicate    = predicate.And(LeadTask => LeadTask.creator_id == clientID);
            appointments = TasksManager.GetLeadTask(predicate, fromDate, toDate);

            SchedulerManager.BindAppointment(WebScheduleInfo1, appointments);
        }
コード例 #5
0
        // client/admin changed to another user tab
        protected void WebScheduleInfo1_ActiveResourceChanged(object sender, ActiveResourceChangedEventArgs e)
        {
            List <LeadTask> tasks = null;

            DateTime fromDate = SchedulerManager.GetScheduleFromDate(WebScheduleInfo1);
            DateTime toDate   = SchedulerManager.GetScheduleEndDate(WebDayView1);
            int      userID   = Convert.ToInt32(e.ResourceDataKey);

            // save it in viewstate
            ActiveResourceKey = e.ResourceDataKey;

            Expression <Func <Task, bool> > predicate = PredicateBuilder.True <CRM.Data.Entities.Task>();

            predicate = predicate.And(LeadTask => LeadTask.start_date >= fromDate && LeadTask.end_date <= toDate);
            predicate = predicate.And(LeadTask => LeadTask.owner_id == userID);
            tasks     = TasksManager.GetLeadTask(predicate, fromDate, toDate);

            SchedulerManager.BindAppointment(WebScheduleInfo1, tasks);
            //SchedulerManager.BindUserAppointments(WebScheduleInfo1, userID, fromDate, toDate);
        }
コード例 #6
0
        private void bindTasksForLead()
        {
            int      leadID   = SessionHelper.getLeadId();
            Resource resource = null;

            if (leadID > 0)
            {
                resource         = new Resource();
                resource.DataKey = leadID.ToString();
                resource.Name    = SessionHelper.getClaimantName();
                WebScheduleInfo1.VisibleResources.Add(resource);

                WebScheduleInfo1.ActiveResourceName = WebScheduleInfo1.VisibleResources[1].Name;

                ActiveResourceKey = WebScheduleInfo1.VisibleResources[1].DataKey.ToString();

                DateTime fromDate = SchedulerManager.GetScheduleFromDate(WebScheduleInfo1);
                DateTime toDate   = SchedulerManager.GetScheduleEndDate(WebDayView1);

                List <LeadTask> appointments = null;

                // get tasks and show them in scheduler as appointments
                Expression <Func <Task, bool> > predicate = PredicateBuilder.True <CRM.Data.Entities.Task>();
                predicate    = predicate.And(LeadTask => LeadTask.start_date >= fromDate && LeadTask.end_date <= toDate);
                predicate    = predicate.And(LeadTask => LeadTask.lead_id == leadID);
                appointments = TasksManager.GetLeadTask(predicate, fromDate, toDate);

                // set resourcekey to lead id
                if (appointments != null && appointments.Count > 0)
                {
                    appointments.ForEach(x => x.resourceKey = leadID);
                }

                SchedulerManager.BindAppointment(WebScheduleInfo1, appointments);
            }
        }