private void HandleLinkRequest(object sender, EventArgs e) { if (_state.Value == string.Empty) { return; } var jso = new Dictionary <string, object>(); JsonConvert.PopulateObject(_state.Value, jso); string request = GetValue(jso, "request"); string kind = GetValue(jso, "kind"); string type = GetValue(jso, "type"); string id = GetValue(jso, "id"); string selectionInfoKey = GetValue(jso, "selectionInfoKey"); string recurDate = String.Empty; DateTime dateTime; Dictionary <string, string> args = GetArgs(jso); switch (request) { case "EntityDetail": if (kind == "ACTIVITY") { Link.EditActivity(id); } else if (kind == "HISTORY") { Link.EditHistory(id); } else { Link.EntityDetail(id, kind); } break; case "Schedule": if (type == "PhoneCall") { Link.SchedulePhoneCall(); } else if (type == "Meeting") { Link.ScheduleMeeting(); } else if (type == "ToDo") { Link.ScheduleToDo(); } else if (type == "PersonalActivity") { Link.SchedulePersonalActivity(); } else if (type == "CompleteActivity") { Link.ScheduleCompleteActivity(); } break; case "New": if (type == "Note") { Link.NewNote(); } break; case "EditActivity": Link.EditActivity(id); break; case "EditActivityOccurrence": recurDate = GetValue(jso, "recurDate"); dateTime = Convert.ToDateTime(recurDate); Link.EditActivityOccurrencePrompt(id, dateTime); break; case "EditHistory": Link.EditHistory(id, args); break; case "CompleteActivity": Link.CompleteActivity(id); break; case "CompleteActivityOccurrence": recurDate = GetValue(jso, "recurDate"); dateTime = Convert.ToDateTime(recurDate); Link.CompleteActivityOccurrencePrompt(id, dateTime); break; case "DeleteActivity": Link.DeleteActivity(id); break; case "DeleteActivityOccurrence": recurDate = GetValue(jso, "recurDate"); dateTime = Convert.ToDateTime(recurDate); Link.DeleteActivityOccurrencePrompt(id, dateTime); break; case "ScheduleActivity": Link.ScheduleActivity(args); break; case "ConfirmActivity": string toUserId = GetValue(jso, "toUserId"); Link.ConfirmActivity(id, toUserId); break; case "DeleteConfirmation": string notifyId = GetValue(jso, "notifyId"); Link.DeleteConfirmation(id, notifyId); break; case "RemoveDeletedConfirmation": Link.RemoveDeletedConfirmation(id); break; case "MergeRecords": Link.MergeRecords(selectionInfoKey); break; case "ShowDialog": //dialog properties String smartPart = GetValue(jso, "smartPart"); String entityId = GetValue(jso, "entityId"); String title = GetValue(jso, "dialogTitle"); bool isCentered = Convert.ToBoolean(GetValue(jso, "isCentered")); int top = Convert.ToInt16(GetValue(jso, "dialogTop")); int left = Convert.ToInt16(GetValue(jso, "dialogLeft")); int height = Convert.ToInt16(GetValue(jso, "dialogHeight")); int width = Convert.ToInt16(GetValue(jso, "dialogWidth")); Link.ShowDialog(type, smartPart, entityId, title, isCentered, top, left, height, width); break; case "Administration": if (type == "AddUsers") { Link.NewUsers(); } else if (type == "CopyUser") { Link.CopyUser(GetSelectedIds(selectionInfoKey)); } else if (type == "CopyUserProfile") { Link.CopyUserProfile(GetSelectedIds(selectionInfoKey)); } else if (type == "DeleteUsers") { Link.DeleteUsers(GetSelectedIds(selectionInfoKey)); } else if (type == "AddToTeam") { Link.AddToTeam(GetSelectedIds(selectionInfoKey)); } else if (type == "RemoveFromTeam") { //Link.RemoveUsersFromTeam(GetSelectedIds(selectionInfoKey)); } else if (type == "AssignRole") { Link.AssignRoleToUsers(GetSelectedIds(selectionInfoKey)); } else if (type == "RemoveFromAllTeams") { Link.RemoveFromAllTeams(GetSelectedIds(selectionInfoKey)); } else if (type == "ReplaceTeamMember") { Link.ReplaceTeamMember(GetSelectedIds(selectionInfoKey)); } else if (type == "RedirectToUser") { Sage.Entity.Interfaces.IOwner owner = Sage.Platform.EntityFactory.GetById <Sage.Entity.Interfaces.IOwner>(id); Response.Redirect(string.Format("User.aspx?entityId={0}", owner.User.Id.ToString()), true); } else if (type == "EditSecurityProfile") { Link.ShowEditSecurityProfileDialog(selectionInfoKey); } else if (type == "DeleteTeam") { Link.DeleteTeam(GetSelectedIds(selectionInfoKey)); } else if (type == "DeleteDepartment") { Link.DeleteDepartment(GetSelectedIds(selectionInfoKey)); } else if (type == "CopyTeam") { Link.CopyTeam(GetSelectedIds(selectionInfoKey)); } else if (type == "CopyDepartment") { Link.CopyDepartment(GetSelectedIds(selectionInfoKey)); } else if (type == "SetUsersToStandardRole") { Link.SetUsersToStandardRole(); } break; } }
private void HandleLinkRequest(object sender, EventArgs e) { if (_state.Value == string.Empty) { return; } var jso = new Dictionary <string, object>(); JsonConvert.PopulateObject(_state.Value, jso); string request = GetValue(jso, "request"); string kind = GetValue(jso, "kind"); string type = GetValue(jso, "type"); string id = GetValue(jso, "id"); string selectionInfoKey = GetValue(jso, "selectionInfoKey"); string recurDate = String.Empty; Dictionary <string, string> args = GetArgs(jso); switch (request) { case "Schedule": if (type == "CompleteActivity") { Link.ScheduleCompleteActivity(); } break; case "EntityDetail": Link.EntityDetail(id, kind); break; case "MergeRecords": Link.MergeRecords(selectionInfoKey); break; case "ShowDialog": //dialog properties String smartPart = GetValue(jso, "smartPart"); String entityId = GetValue(jso, "entityId"); String title = GetValue(jso, "dialogTitle"); bool isCentered = Convert.ToBoolean(GetValue(jso, "isCentered")); int top = Convert.ToInt16(GetValue(jso, "dialogTop")); int left = Convert.ToInt16(GetValue(jso, "dialogLeft")); int height = Convert.ToInt16(GetValue(jso, "dialogHeight")); int width = Convert.ToInt16(GetValue(jso, "dialogWidth")); Link.ShowDialog(type, smartPart, entityId, title, isCentered, top, left, height, width); break; case "Administration": if (type == "AddUsers") { Link.NewUsers(); } else if (type == "CopyUser") { Link.CopyUser(GetSelectedIds(selectionInfoKey)); } else if (type == "CopyUserProfile") { Link.CopyUserProfile(GetSelectedIds(selectionInfoKey)); } else if (type == "DeleteUsers") { Link.DeleteUsers(GetSelectedIds(selectionInfoKey)); } else if (type == "AddToTeam") { Link.AddToTeam(GetSelectedIds(selectionInfoKey)); } else if (type == "RemoveFromTeam") { //Link.RemoveUsersFromTeam(GetSelectedIds(selectionInfoKey)); } else if (type == "AssignRole") { Link.AssignRoleToUsers(GetSelectedIds(selectionInfoKey)); } else if (type == "RemoveFromAllTeams") { Link.RemoveFromAllTeams(GetSelectedIds(selectionInfoKey)); } else if (type == "ReplaceTeamMember") { Link.ReplaceTeamMember(GetSelectedIds(selectionInfoKey)); } else if (type == "RedirectToUser") { Sage.Entity.Interfaces.IOwner owner = Sage.Platform.EntityFactory.GetById <Sage.Entity.Interfaces.IOwner>(id); Response.Redirect(string.Format("User.aspx?entityId={0}", owner.User.Id.ToString()), true); } else if (type == "EditSecurityProfile") { Link.ShowEditSecurityProfileDialog(selectionInfoKey); } else if (type == "DeleteTeam") { Link.DeleteTeam(GetSelectedIds(selectionInfoKey)); } else if (type == "DeleteDepartment") { Link.DeleteDepartment(GetSelectedIds(selectionInfoKey)); } else if (type == "CopyTeam") { Link.CopyTeam(GetSelectedIds(selectionInfoKey)); } else if (type == "CopyDepartment") { Link.CopyDepartment(GetSelectedIds(selectionInfoKey)); } else if (type == "SetUsersToStandardRole") { Link.SetUsersToStandardRole(); } break; } // Clear the state, otherwise performing the same action again won't work // (but remove the state changed event first, otherwise clearing the state will // trigger another postback with the same data -- if a dialog is closed, // it would open immediately after being closed, for example) _state.ValueChanged -= HandleLinkRequest; _state.Value = string.Empty; }