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(); }
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(); }
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(); }
public void DeleteProjectTask(object sender, EventArgs <Guid> e) { var timeTracking = DynamicDataServiceContext.GetOrNew("ProjectTask", e.Data); DynamicDataServiceContext.DeleteObject("ProjectTask", timeTracking); DynamicDataServiceContext.SaveChanges(); OnShowProjectTask(sender, e); }
public void DeleteTimeTracking(object sender, EventArgs <Guid> e) { var timeTracking = DynamicDataServiceContext.GetOrNew("TimeTracking", e.Data); DynamicDataServiceContext.DeleteObject("TimeTracking", timeTracking); DynamicDataServiceContext.SaveChanges(); ShowTimeTrackingListView(); }
public void OnSetOpportunityResurrection(object sender, EventArgs e) { DynamicEntity.ClosedTime = (DateTime?)null; DynamicEntity.StatusCode = (int)OpportunityStatus.InProgress; DynamicEntity.SalesStageCode = DynamicEntity.StatusCode + SaleStageCodeOffSet; DynamicDataServiceContext.SaveChanges(); OnEntitySaved(new EventArgs <bool>(false)); WorkItem.Commands["Refresh"].Execute(); }
protected override void OnSaved() { base.OnSaved(); if (DynamicEntity.OriginatingLeadId == null) { return; } var leadEntity = DynamicDataServiceContext.GetOrNew("Lead", DynamicEntity.OriginatingLeadId); leadEntity.StatusCode = 4; DynamicDataServiceContext.SaveChanges(); }
void View_DeteleNotification(object sender, EventArgs <object> e) { if (e.Data == null) { return; } DynamicDataServiceContext context = new DynamicDataServiceContext(); context.DeleteObject(_entityName, e.Data); context.SaveChanges(); View.Bind(_entityName); }
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()); } }
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); }
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()); } }
private bool SaveEntity() { View.PostEditors(); OnSaving(); if (!View.ValidateData()) { return(false); } DynamicDataServiceContext.SaveChanges(); NewEntityId = Guid.Empty; OnSaved(); if (WorkingMode == EntityDetailWorkingMode.Add) { WorkingMode = EntityDetailWorkingMode.Edit; } OnEntitySaved(new EventArgs <bool>(false)); WorkItem.Commands["Refresh"].Execute(); return(true); }
public void OnSetOpportunityFail(object sender, EventArgs e) { OpportunityLossReason resonForm = new OpportunityLossReason(); DialogResult result = resonForm.ShowDialog(); if (result == DialogResult.OK) { string lossReason = resonForm.LossReasion(); DynamicEntity.ClosedTime = DateTime.Now; DynamicEntity.StatusCode = (int)OpportunityStatus.Lost; DynamicEntity.SalesStageCode = DynamicEntity.StatusCode + SaleStageCodeOffSet; if (!string.IsNullOrEmpty(lossReason)) { DynamicEntity.Description += "\r\n" + lossReason; } DynamicDataServiceContext.SaveChanges(); OnEntitySaved(new EventArgs <bool>(false)); WorkItem.Commands["Refresh"].Execute(); } }
protected override void OnSaved() { UpdateTask(); DynamicDataServiceContext.SaveChanges(); }