Ejemplo n.º 1
0
        private static void ShowNotifications(IList notificationInfos, RibbonForm form)
        {
            DynamicDataServiceContext dbcontext = new DynamicDataServiceContext();
            AlertControl alertControl           = new AlertControl();

            alertControl.AutoHeight = true;

            alertControl.AlertClick += (sender, e) =>
            {
                NotificationData data = (NotificationData)e.Info.Tag;
                var notificationUser  = dbcontext.GetOrNew("NotificationRecipient", data.NotificationRecipientId);
                notificationUser.AsDyanmic().NotificationStatus = "Readed";
                notificationUser.AsDyanmic().ReadedOn           = DateTime.Now;
                dbcontext.SaveChanges();
                e.AlertForm.Hide();
            };

            AlertManage manager = new AlertManage(alertControl, form);

            foreach (var notificationInfo in notificationInfos)
            {
                var notificationUser = dbcontext.GetOrNew("NotificationRecipient", notificationInfo.AsDyanmic().NotificationRecipientId);
                notificationUser.NotificationStatus = "Opened";
                manager.ShowAlert(notificationInfo);
            }
            dbcontext.SaveChanges();
        }
        void View_OnSendSysMessage(object sender, EventArgs e)
        {
            DynamicDataServiceContext context = new DynamicDataServiceContext();
            var  notification        = context.GetOrNew("Notification", Guid.Empty, "NotificationRecipients");
            var  notificationDyanmic = notification.AsDyanmic();
            Guid notificationId      = notificationDyanmic.NotificationId;

            notificationDyanmic.ObjectType = "sysMsg";
            notificationDyanmic.Subject    = _sysMessageData.Subject;
            notificationDyanmic.Body       = _sysMessageData.Body;
            IList recipients    = notificationDyanmic.NotificationRecipients as IList;
            Type  recipientType = DynamicTypeBuilder.Instance.GetDynamicType("NotificationRecipient");

            foreach (Guid receiverId in View.GetReceiverList())
            {
                if (receiverId == AuthorizationManager.CurrentUserId)
                {
                    continue;
                }
                var recipient        = Activator.CreateInstance(recipientType);
                var recipientDynamic = recipient.AsDyanmic();
                recipientDynamic.NotificationRecipientId = Guid.NewGuid();
                recipientDynamic.NotificationId          = notificationId;
                recipientDynamic.RecipientId             = receiverId;
                recipientDynamic.NotificationStatus      = "NotSend";
                recipients.Add(recipient);
            }
            context.SaveChanges();
            View.CloseView();
        }
Ejemplo n.º 3
0
        private bool UpdateTask(TaskTimeHistory task)
        {
            var entityOjbect = DynamicDataServiceContext.GetOrNew("ProjectTask", task.TaskId);
            var entity       = entityOjbect.AsDyanmic();

            entity.ActualInput = Convert.ToDouble(entity.ActualInput ?? 0) + task.ActualInput;
            entity.Effort      = Convert.ToDouble(entity.Effort ?? 0) + task.Effort;
            entity.Overtime    = Convert.ToDouble(entity.Overtime ?? 0) + task.Overtime;
            if (task.TaskTimeHistoryId == Guid.Empty)
            {
                entity.Description = entity.Description ?? " " + task.Description;
            }
            if (entity.ActualWorkHours - entity.Effort <= 0)
            {
                entity.StatusCode = 3;
            }
            else if (entity.StatusCode == 1 || entity.ActualWorkHours - entity.Effort > 0)
            {
                entity.StatusCode = 2;
            }
            if (entity.Effort > entity.ActualWorkHours)
            {
                View.ValidateResult = false;
                XtraMessageBox.Show(Properties.Resources.OverEffortMessage,
                                    Properties.Resources.Katrin,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                return(false);
            }
            return(true);
        }
 protected override void OnSaving()
 {
     if (WorkingMode == EntityDetailWorkingMode.Add)
     {
         int itemCount = 0;
         foreach (Guid recordPersonId in View.GetRecordPersonList())
         {
             if (DynamicEntity.RecordOn == null)
             {
                 DynamicEntity.RecordOn = DateTime.Today;
             }
             if (itemCount == 0)
             {
                 DynamicEntity.RecordPersonId = recordPersonId;
             }
             else
             {
                 var recordPersonEntity = DynamicDataServiceContext.GetOrNew("Attendance", Guid.Empty);
                 recordPersonEntity.AsDyanmic().RecordOn           = DynamicEntity.RecordOn;
                 recordPersonEntity.AsDyanmic().AttendanceTypeCode = DynamicEntity.AttendanceTypeCode;
                 recordPersonEntity.AsDyanmic().AttendanceLength   = DynamicEntity.AttendanceLength;
                 recordPersonEntity.AsDyanmic().AttendanceUnitCode = DynamicEntity.AttendanceUnitCode;
                 recordPersonEntity.AsDyanmic().CreatedOn          = DynamicEntity.CreatedOn;
                 recordPersonEntity.AsDyanmic().Description        = DynamicEntity.Description;
                 recordPersonEntity.AsDyanmic().CreatedById        = DynamicEntity.CreatedById;
                 recordPersonEntity.AsDyanmic().ModifiedOn         = DynamicEntity.ModifiedOn;
                 recordPersonEntity.AsDyanmic().ModifiedById       = DynamicEntity.ModifiedById;
                 recordPersonEntity.AsDyanmic().RecordPersonId     = recordPersonId;
             }
             itemCount++;
         }
     }
     base.OnSaving();
 }
Ejemplo n.º 5
0
        private void ShowRelatedEntityDetail(string entityName, Guid entityId, EntityDetailWorkingMode workMode)
        {
            var  detailViewType = FindLoadedType(entityName + "DetailView");
            Type controlType    = typeof(EnityDetailController <>).MakeGenericType(detailViewType);
            var  addNewMethod   =
                RootWorkItem.Items.GetType().GetMethod("AddNew", new[] { typeof(string) }).MakeGenericMethod(controlType);
            var getMethod = RootWorkItem.Items.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public)
                            .First(m => m.IsGenericMethod && m.Name == "Get").MakeGenericMethod(controlType);

            string key = entityId + entityName + ":DetailWorkItem";
            var    detailWorkObject = getMethod.Invoke(RootWorkItem.Items, new object[] { key });
            var    detailWorkItem   = detailWorkObject as WorkItem;

            if (detailWorkItem == null)
            {
                detailWorkObject = addNewMethod.Invoke(RootWorkItem.Items, new object[] { key });
                detailWorkItem   = detailWorkObject as WorkItem;
                var initializeMethod =
                    detailWorkItem.GetType().GetMethod("Initialize");

                PropertyInfo entityProperty = detailWorkItem.GetType().GetProperty("EntityName");
                entityProperty.SetValue(detailWorkItem, entityName, null);
                initializeMethod.Invoke(detailWorkItem, new object[] { });
            }
            if (workMode == EntityDetailWorkingMode.Convert)
            {
                var _dynamicDataServiceContext = new DynamicDataServiceContext();
                detailWorkItem.State["ConvertEntiy"] = _dynamicDataServiceContext.GetOrNew(EntityName, (Guid)State["EntityId"]);
                detailWorkItem.State["ConvertName"]  = EntityName;
            }
            detailWorkItem.State["EntityId"]    = entityId;
            detailWorkItem.State["WorkingMode"] = workMode;
            detailWorkItem.Run();
        }
Ejemplo n.º 6
0
        protected virtual object GetEntity()
        {
            var entity = DynamicDataServiceContext.GetOrNew(EntityName, EntityId, "CreatedBy,ModifiedBy");

            ConvertEntity(entity);
            return(entity);
        }
        private void OnStatusCodeChange(object sender, EventArgs <object, int, int> e)
        {
            var fromStatus = e.Data2;
            var newStatus  = e.Data3;

            var isTaskCompleted    = fromStatus == 3 || fromStatus == 4;
            var attemptingComplete = newStatus == 3 || fromStatus == 4;
            var hasRemaininWorks   = e.Data1.AsDyanmic().ActualWorkHours > e.Data1.AsDyanmic().Effort;

            if (!isTaskCompleted && attemptingComplete && hasRemaininWorks)
            {
                Cursor.Current = Cursors.WaitCursor;
                EditTask <TaskEffortDetailView>(e.Data1, "ProjectTaskEffort");
                Cursor.Current = Cursors.Default;
            }
            BackgroundWorker bgWorker = new BackgroundWorker();

            bgWorker.WorkerSupportsCancellation = true;
            bgWorker.DoWork += (ws, we) =>
            {
                var entity = DynamicDataServiceContext.GetOrNew(EntityName, e.Data1.AsDyanmic().TaskId);
                entity.StatusCode = newStatus;
                DynamicDataServiceContext.SaveChanges();
            };
            bgWorker.RunWorkerAsync();
        }
 private void DeleteTaskHistory()
 {
     foreach (var task in _deleteTaskList)
     {
         var taskTimeHistory = DynamicDataServiceContext.GetOrNew("TaskTimeHistory", task.TaskTimeHistoryId).AsDyanmic();
         taskTimeHistory.IsDeleted = true;
     }
 }
Ejemplo n.º 9
0
        public void DeleteProjectTask(object sender, EventArgs <Guid> e)
        {
            var timeTracking = DynamicDataServiceContext.GetOrNew("ProjectTask", e.Data);

            DynamicDataServiceContext.DeleteObject("ProjectTask", timeTracking);
            DynamicDataServiceContext.SaveChanges();
            OnShowProjectTask(sender, e);
        }
Ejemplo n.º 10
0
        public void DeleteTimeTracking(object sender, EventArgs <Guid> e)
        {
            var timeTracking = DynamicDataServiceContext.GetOrNew("TimeTracking", e.Data);

            DynamicDataServiceContext.DeleteObject("TimeTracking", timeTracking);
            DynamicDataServiceContext.SaveChanges();

            ShowTimeTrackingListView();
        }
Ejemplo n.º 11
0
        protected override void OnSaved()
        {
            base.OnSaved();
            if (DynamicEntity.OriginatingLeadId == null)
            {
                return;
            }
            var leadEntity = DynamicDataServiceContext.GetOrNew("Lead", DynamicEntity.OriginatingLeadId);

            leadEntity.StatusCode = 4;
            DynamicDataServiceContext.SaveChanges();
        }
Ejemplo n.º 12
0
        protected override object GetEntity()
        {
            var entity = DynamicDataServiceContext.GetOrNew(EntityName, EntityId, "InvoiceContracts,CreatedBy,ModifiedBy");

            if (WorkingMode == EntityDetailWorkingMode.Add)
            {
                entity.AsDyanmic().StatusCode            = 1;
                entity.AsDyanmic().TransactionCurrencyId = Guid.Parse("992a4ff1-856d-421f-a928-654357e4b70b");
            }
            ConvertEntity(entity);
            return(entity);
        }
        private void SetHistory(TaskTimeHistory task)
        {
            var taskTimeHistory = DynamicDataServiceContext.GetOrNew("TaskTimeHistory", task.TaskTimeHistoryId).AsDyanmic();

            task.TaskTimeHistoryId      = taskTimeHistory.TaskTimeHistoryId;
            taskTimeHistory.TaskId      = task.TaskId;
            taskTimeHistory.ActualInput = task.ActualInput;
            taskTimeHistory.Effort      = task.Effort;
            taskTimeHistory.Overtime    = task.Overtime;
            taskTimeHistory.Description = task.Description;
            taskTimeHistory.RecordOn    = task.RecordOn;
        }
Ejemplo n.º 14
0
        protected override void OnSaved()
        {
            //base.OnSaved();
            if (DynamicEntity.OriginatingLeadId == null)
            {
                return;
            }
            var leadEntity = DynamicDataServiceContext.GetOrNew("Lead", DynamicEntity.OriginatingLeadId);

            leadEntity.StatusCode = 4;
            DynamicDataServiceContext.SaveChanges();
            MetadataProvider.Instance.CreateCommonNotification(DynamicEntity.OpportunityId, EntityName, "Lead");
        }
        public void DeleteTimeTracking(object sender, EventArgs <Guid> e)
        {
            var timeTracking = DynamicDataServiceContext.GetOrNew("TimeTracking", e.Data);

            DynamicDataServiceContext.DeleteObject("TimeTracking", timeTracking);
            DynamicDataServiceContext.SaveChanges();

            ShowTimeTrackingListView();
            if (OnReloadTiming != null)
            {
                OnReloadTiming(this, new EventArgs());
            }
        }
Ejemplo n.º 16
0
        public void DeleteProjectIteration(object sender, EventArgs <Guid> e)
        {
            var timeTracking = DynamicDataServiceContext.GetOrNew("ProjectIteration", e.Data);

            DynamicDataServiceContext.DeleteObject("ProjectIteration", timeTracking);
            DynamicDataServiceContext.SaveChanges();
            EventHandler handler = OnRefreshListProjectIteration;

            if (handler != null)
            {
                handler(sender, e);
            }
            OnShowProjectIteration(sender, e);
        }
Ejemplo n.º 17
0
        private void OnContractEditValueChanged(object sender, Katrin.Win.Infrastructure.EventArgs <Guid> e)
        {
            var  entity      = DynamicDataServiceContext.GetOrNew("Contract", e.Data, "Opportunity");
            bool isAdd       = WorkingMode == EntityDetailWorkingMode.Add;
            var  opportunity = entity.AsDyanmic().Opportunity;

            if (entity != null && opportunity != null)
            {
                DynamicEntity.ContractId      = e.Data;
                DynamicEntity.CustomerId      = isAdd ? opportunity.CustomerId : DynamicEntity.CustomerId ?? opportunity.CustomerId;
                DynamicEntity.ProjectTypeCode = isAdd ? opportunity.ProjectTypeCode : DynamicEntity.ProjectTypeCode ?? opportunity.ProjectTypeCode;
                DynamicEntity.TechnologyCode  = isAdd ? opportunity.TechnologyCode : DynamicEntity.TechnologyCode ?? opportunity.TechnologyCode;
            }
        }
        public void DeleteNote(object sender, EventArgs <Guid> e)
        {
            var noteEntity = DynamicDataServiceContext.GetOrNew("Note", e.Data);

            DynamicDataServiceContext.DeleteObject("Note", noteEntity);
            DynamicDataServiceContext.SaveChanges();

            string key          = "NoteDetailListView";
            var    noteListView = WorkItem.Items.Get <NoteListView>(key);

            noteListView.DeleteFocusedRow();
            if (OnReloadNote != null)
            {
                OnReloadNote(this, new EventArgs());
            }
        }
Ejemplo n.º 19
0
        private string InitEmailMessage(out string emailTo, DateTime thisDay, DateTime nextDay, Guid projectId, IEnumerable taskList)
        {
            string dayReportTemplate = Properties.Resources.DayReportTemplate;

            //project
            var project  = DynamicDataServiceContext.GetOrNew("Project", projectId, "Customer");
            var customer = project.AsDyanmic().Customer;

            emailTo           = customer == null ? string.Empty : customer.EMailAddress1;
            dayReportTemplate = dayReportTemplate.Replace("$CustomerName$", project.AsDyanmic().Contact);
            dayReportTemplate = dayReportTemplate.Replace("$ThisWeekTask$", GetWeekTask(thisDay, projectId));
            dayReportTemplate = dayReportTemplate.Replace("$TodayTask$", GetDayTask(taskList, projectId, false, thisDay));
            dayReportTemplate = dayReportTemplate.Replace("$NextDayTask$", GetDayTask(GetTasks(nextDay), projectId, true, nextDay));
            dayReportTemplate = dayReportTemplate.Replace("$ReportPeople$", AuthorizationManager.FullName);
            return(dayReportTemplate);
        }
 private bool CheckTaskEffort()
 {
     foreach (var taskId in _taskList.Keys)
     {
         var    taskEntity    = DynamicDataServiceContext.GetOrNew("ProjectTask", taskId);
         var    taskDyanmic   = taskEntity.AsDyanmic();
         double remainderTime = taskDyanmic.ActualWorkHours ?? 0d - taskDyanmic.Effort ?? 0d;
         if (_taskList[taskId] > remainderTime)
         {
             View.ValidateResult = false;
             XtraMessageBox.Show(Properties.Resources.OverEffortMessage,
                                 Properties.Resources.Katrin,
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Information,
                                 MessageBoxDefaultButton.Button1);
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 21
0
        protected override object GetEntity()
        {
            Dictionary <string, string> extraColumns = new Dictionary <string, string>();
            var entity = DynamicDataServiceContext.GetOrNew(EntityName, EntityId, "CreatedBy,ModifiedBy,ProjectTasks,ProjectMembers");

            _projectSummaryEntity = new ProjectSummary();
            IList projectTasks = entity.AsDyanmic().ProjectTasks;

            _projectSummaryEntity.SumQuoteWorkHours  = projectTasks.AsQueryable().Select("QuoteWorkHours").Cast <double?>().Sum();
            _projectSummaryEntity.SumActualWorkHours = projectTasks.AsQueryable().Select("ActualWorkHours").Cast <double?>().Sum();
            _projectSummaryEntity.SumActualInput     = projectTasks.AsQueryable().Select("ActualInput").Cast <double?>().Sum();
            _projectSummaryEntity.SumEffort          = projectTasks.AsQueryable().Select("Effort").Cast <double?>().Sum();
            _projectSummaryEntity.SumOvertime        = projectTasks.AsQueryable().Select("Overtime").Cast <double?>().Sum();
            _projectSummaryEntity.SumRemainderTime   = _projectSummaryEntity.SumActualWorkHours - _projectSummaryEntity.SumEffort;
            View.BindStatisticNumber(new List <ProjectSummary>()
            {
                _projectSummaryEntity
            });
            ConvertEntity(entity);
            return(entity);
        }
 private void UpdateTask()
 {
     foreach (var taskId in _taskList.Keys)
     {
         var   taskEntity  = DynamicDataServiceContext.GetOrNew("ProjectTask", taskId, "TaskTimeHistories");
         var   taskDyanmic = taskEntity.AsDyanmic();
         IList historyList = taskDyanmic.TaskTimeHistories as IList;
         historyList             = historyList.AsQueryable().Where("IsDeleted=@0", false).ToArrayList();
         taskDyanmic.ActualInput = historyList.AsQueryable().Select("ActualInput").Cast <double?>().Sum();
         taskDyanmic.Effort      = historyList.AsQueryable().Select("Effort").Cast <double?>().Sum();
         taskDyanmic.Overtime    = historyList.AsQueryable().Select("Overtime").Cast <double?>().Sum();
         if (taskDyanmic.ActualWorkHours - taskDyanmic.Effort <= 0)
         {
             taskDyanmic.StatusCode = 3;
         }
         else if (taskDyanmic.StatusCode == 1 || taskDyanmic.ActualWorkHours - taskDyanmic.Effort > 0)
         {
             taskDyanmic.StatusCode = 2;
         }
     }
 }
Ejemplo n.º 23
0
        protected override void OnSaving()
        {
            if (WorkItem.State == null)
            {
                return;
            }
            base.OnSaving();
            DynamicEntity.ObjectId   = EntityId;
            DynamicEntity.ObjectType = ObjectType;
            var parentEntity  = DynamicDataServiceContext.GetOrNew(ObjectType, EntityId);
            var dynamicEntity = new SysBits.Reflection.ReflectionProxy(parentEntity);

            dynamicEntity.TrySetProperty("ModifiedById", AuthorizationManager.CurrentUserId);
            dynamicEntity.TrySetProperty("ModifiedOn", DateTime.Now);
            if (View.AppandDescription)
            {
                object description;
                if (dynamicEntity.TryGetProperty("Description", out description))
                {
                    string appandedDescription = description != null
                                                    ? description.ToString() + DynamicEntity.NoteText
                                                    : DynamicEntity.NoteText;

                    dynamicEntity.SetProperty("Description", appandedDescription);
                    DynamicDataServiceContext.UpdateObject(parentEntity);
                }
            }
            if (View.UpdateLatestFeadback)
            {
                object latestFeedbackOn;
                if (dynamicEntity.TryGetProperty("LatestFeedbackOn", out latestFeedbackOn))
                {
                    dynamicEntity.SetProperty("LatestFeedbackOn", DateTime.Now);
                    DynamicDataServiceContext.UpdateObject(parentEntity);
                }
            }
        }
        protected override void OnSaving()
        {
            if (_editTaskTimeHistory == null)
            {
                return;
            }
            if (_editTaskTimeHistory.Overtime > _editTaskTimeHistory.Effort)
            {
                View.ValidateResult = false;
                XtraMessageBox.Show(Properties.Resources.OverTimeTip,
                                    Properties.Resources.Katrin,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                return;
            }
            if (_editTaskTimeHistory.ActualInput == 0)
            {
                View.ValidateResult = false;
                XtraMessageBox.Show(Properties.Resources.ActualInputIsZero,
                                    Properties.Resources.Katrin,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                return;
            }

            dynamic taskEntity = DynamicDataServiceContext.GetOrNew("ProjectTask", _editTaskTimeHistory.TaskId);

            if (!UpdateTask(taskEntity, _editTaskTimeHistory))
            {
                return;
            }
            SetHistory(_editTaskTimeHistory);
            View.ValidateResult = true;
        }
        private string InitEmailMessage(out string emailTo)
        {
            string weekReportTemplate = Properties.Resources.WeekReportTemplate;

            //week info
            weekReportTemplate = weekReportTemplate.Replace("$CurrentProgress$",
                                                            GetLocalizedPickListValue("ProjectWeekReport", "CurrentProgressCode", this.DynamicEntity.CurrentProgressCode));
            weekReportTemplate = weekReportTemplate.Replace("$OutlookProgress$",
                                                            GetLocalizedPickListValue("ProjectWeekReport", "OutlookProgressCode", this.DynamicEntity.OutlookProgressCode));
            weekReportTemplate = weekReportTemplate.Replace("$CurrentQuality$",
                                                            GetLocalizedPickListValue("ProjectWeekReport", "CurrentQualityCode", this.DynamicEntity.CurrentQualityCode));
            weekReportTemplate = weekReportTemplate.Replace("$OutlookQuality$",
                                                            GetLocalizedPickListValue("ProjectWeekReport", "OutlookQualityCode", this.DynamicEntity.OutlookQualityCode));
            weekReportTemplate = weekReportTemplate.Replace("$CriteriaProgress$", this.DynamicEntity.CriteriaProgress);
            weekReportTemplate = weekReportTemplate.Replace("$CriteriaQuality$", this.DynamicEntity.CriteriaQuality);
            weekReportTemplate = weekReportTemplate.Replace("$Suggestions$", this.DynamicEntity.Suggestions);
            weekReportTemplate = weekReportTemplate.Replace("$Reviews$", this.DynamicEntity.Reviews);

            // week Iteration
            var projectIteration = DynamicDataServiceContext.GetOrNew("ProjectIteration", this.DynamicEntity.ProjectIterationId, "ProjectTasks,ProjectVersion");

            weekReportTemplate = weekReportTemplate.Replace("$ShortTermGoal$", projectIteration.Objective);

            string startDate = "";

            if (projectIteration.StartDate != null)
            {
                DateTime sdt = Convert.ToDateTime(projectIteration.StartDate);
                startDate = "[" + sdt.ToShortDateString() + "]";
            }
            weekReportTemplate = weekReportTemplate.Replace("$StartDate$", startDate);
            string endDate = string.Empty;

            if (projectIteration.ProjectVersion != null)
            {
                endDate = projectIteration.ProjectVersion.VersionName;
            }
            if (projectIteration.Deadline != null)
            {
                DateTime edt = Convert.ToDateTime(projectIteration.Deadline);
                endDate = string.IsNullOrEmpty(endDate) ? "[" + edt.ToShortDateString() + "]" :
                          endDate + "[" + edt.ToShortDateString() + "]";
            }
            weekReportTemplate = weekReportTemplate.Replace("$DeadLine$", endDate);

            //week project
            var project = DynamicDataServiceContext.GetOrNew("Project", this.DynamicEntity.ProjectId, "Customer");

            if (project.Customer != null)
            {
                emailTo = project.Customer.EMailAddress1;
            }
            else
            {
                emailTo = string.Empty;
            }
            weekReportTemplate = weekReportTemplate.Replace("$CustomerName$", project.Contact);
            weekReportTemplate = weekReportTemplate.Replace("$ProjectName$", project.Name);
            weekReportTemplate = weekReportTemplate.Replace("$LongTermGoal$", project.Objective);

            //task info
            DateTime recordDate = DateTime.Today;

            if (this.DynamicEntity.RecordOn != null)
            {
                recordDate = Convert.ToDateTime(this.DynamicEntity.RecordOn);
            }
            IList projectTasks = projectIteration.ProjectTasks;

            projectTasks = projectTasks.AsQueryable().Where("IsDeleted = false").ToArrayList();
            IEnumerable taskHistoryList      = GetTaskHistory(recordDate, projectTasks.AsQueryable().Select("TaskId").Cast <Guid>().ToList());
            double?     remainingProgramming = projectTasks.AsQueryable().Select("ActualWorkHours").Cast <double?>().Sum() -
                                               (taskHistoryList == null?0d:taskHistoryList.AsQueryable().Select("Effort").Cast <double?>().Sum());
            double?availableProgramming = projectTasks.AsQueryable().Select("ActualWorkHours").Cast <double?>().Sum() -
                                          (taskHistoryList == null?0d:taskHistoryList.AsQueryable().Select("ActualInput").Cast <double?>().Sum());
            double?workAmountOfThisWeek = taskHistoryList == null?0d:taskHistoryList.AsQueryable().Select("ActualInput").Cast <double?>().Sum();

            weekReportTemplate = weekReportTemplate.Replace("$RemainingProgramming$", remainingProgramming == null ? "" : remainingProgramming.ToString());
            weekReportTemplate = weekReportTemplate.Replace("$AvailableProgramming$", availableProgramming == null ? "" : availableProgramming.ToString());
            weekReportTemplate = weekReportTemplate.Replace("$WorkAmountOfThisWeek$", workAmountOfThisWeek == null ? "" : workAmountOfThisWeek.ToString());
            weekReportTemplate = weekReportTemplate.Replace("$ThisWeekTask$", GetThisWeekTask(recordDate, projectTasks));
            weekReportTemplate = weekReportTemplate.Replace("$NextWeekTask$", GetNextWeekTask(recordDate, projectTasks));
            return(weekReportTemplate);
        }
Ejemplo n.º 26
0
        protected override object GetEntity()
        {
            var entity = DynamicDataServiceContext.GetOrNew(EntityName, EntityId, "QuoteLineItems,BillTo_Address,CreatedBy,ModifiedBy");

            return(entity);
        }
Ejemplo n.º 27
0
        protected override object GetEntity()
        {
            var entity = DynamicDataServiceContext.GetOrNew(EntityName, EntityId, "RolePrivileges");

            return(entity);
        }
Ejemplo n.º 28
0
        protected override object GetEntity()
        {
            var entity = DynamicDataServiceContext.GetOrNew(EntityName, NoteId);

            return(entity);
        }
Ejemplo n.º 29
0
        protected override object GetEntity()
        {
            var entity = DynamicDataServiceContext.GetOrNew(EntityName, EntityId, "UserRoles,CreatedBy,ModifiedBy");

            return(entity);
        }