public override bool SelectFieldValue(FieldDefinition field, TrimMainObject trimObject, string previousValue) { m_errorMsg.Remove(0, m_errorMsg.Length); writeToLog("Display user interface for selecting a value for the field {0} on {1} (previous value: {2}).", field.NameString, trimObject.NameString, previousValue); return(false); }
public override bool PreSave(TrimMainObject modifiedObject) { m_errorMsg.Remove(0, m_errorMsg.Length); writeToLog("{0} will be saved. (To prevent saving certain objects, insert your code here and return false, else true.)", modifiedObject.NameString); return(true); }
public override void Setup(TrimMainObject newObject) { Record record = newObject as Record; if (record != null && string.IsNullOrEmpty(record.Title)) { string key = $"{record.RecordType.Name}_CustomTitleConfig"; if (!titleTemplates.ContainsKey(key)) { using (Database db = record.Database) { FieldDefinition fieldDef = db.FindTrimObjectByName(BaseObjectTypes.FieldDefinition, key) as FieldDefinition; if (fieldDef == null) { fieldDef = db.FindTrimObjectByName(BaseObjectTypes.FieldDefinition, "CustomTitleConfig") as FieldDefinition; } if (fieldDef != null) { titleTemplates[key] = fieldDef.DefaultValue.AsString(); } else { titleTemplates[key] = titleTemplate; } } } record.Title = titleTemplates[key].TrimEnd(); } }
public override void PostDelete(TrimMainObject deletedObject) { m_errorMsg.Remove(0, m_errorMsg.Length); TrimMenuLink[] links = new TrimMenuLink[] { new SampleMenuLink(), new SampleMenuLinkTagged() }; writeToLog("{0} was deleted (Code here is executed after an object was saved).", deletedObject.NameString); }
public RMRecord(TrimMainObject obj) { InitializeComponent(); // this.obj = obj; if (obj != null) { this.TrimDb = obj.Database; } Record rec = obj.Database.FindTrimObjectByUri(BaseObjectTypes.Record, obj.Uri) as Record; intUri = obj.Uri; strRecNumber = rec.Number; strRecTitle = rec.Title; strWebServer = obj.WebURL; toolTip1.SetToolTip(textBox1, "Change the link text to whatever you want."); textBox1.Text = strRecNumber; if(!rec.IsContainer&&rec.IsElectronic) { radioButton3.Visible = true; } //strWebAddress = "https://eddie.c1.sccl.qld.gov.au/HPRMServiceAPI/Record/" + intUri + "/file/document"; strWebAddress = "https://eddie.c1.sccl.qld.gov.au/hprmwebclient/?uri=" + intUri; //MessageBox.Show("Link Created to clipboard.", "", MessageBoxButtons.OK); }
public override bool IsMenuItemEnabled(int cmdId, TrimMainObject forObject) { var menuItem = links.FirstOrDefault(x => x.MenuID == cmdId); if (menuItem != null && menuItem is IMenuLinkEnabled) { return(((IMenuLinkEnabled)menuItem).IsEnabled(forObject)); } return(false); }
public override void Setup(TrimMainObject newObject) { Record rec = (Record)newObject; string rType = rec.RecordType.Uri.ToString(); string rCon = GetContainer(rType); if (rCon != "") { rec.Container = (Record)rec.Database.FindTrimObjectByUri(BaseObjectTypes.Record, Convert.ToInt64(rCon)); } }
public override void PostSave(TrimMainObject savedObject, bool itemWasJustCreated) { m_errorMsg.Remove(0, m_errorMsg.Length); if (itemWasJustCreated) { writeToLog("{0} was just created and saved", savedObject.NameString); } else { writeToLog("{0} was saved", savedObject.NameString); } }
private string writeObjectDetails(BaseObjectTypes trimType, long uri, Database db) { ObjectDef objDef = new ObjectDef(trimType, db); TrimMainObject obj = db.FindTrimObjectByUri(trimType, uri); if (obj != null) { return(string.Format("Event object {0} ({1}) of type {2}.", obj.NameString, obj.NameStringExtra, objDef.Caption)); } else { return(string.Format("Missing object for Uri: {0} of type {1}.", uri, objDef.Caption)); } }
public override bool IsMenuItemEnabled(int cmdId, TrimMainObject forObject) { switch (cmdId) { case MenuLinks.UpdateOcrRendition.LINK_ID: return(forObject.TrimType == BaseObjectTypes.Record && ((HP.HPTRIM.SDK.Record)forObject).IsElectronic); case MenuLinks.RemoveOcrRendition.LINK_ID: return(forObject.TrimType == BaseObjectTypes.Record && ((Record)forObject).HasOcrRendition()); default: return(false); } }
// this inherits from the base ServiceAPI service class so participates in all the authenticate and Database access. // This means we do not need to construct a database we just use the Database instance on the base class. public object Get(MakeReference request) { if (!string.IsNullOrWhiteSpace(request.Name)) { TrimMainObject trimObject = Database.FindTrimObjectByName((BaseObjectTypes)request.TrimType, request.Name); if (trimObject != null) { // replace / with _ so that windows will not get confused by the path seperator in a file name string fileLocation = trimObject.MakeReference(string.Format("c:\\temp\\{0}.tr5", request.Name.Replace('/', '_'))); return(new HttpResult(new TempDownloadableFile(fileLocation), true)); } } throw new HttpError(HttpStatusCode.NotFound, "404", "File not found"); }
public override bool VerifyFieldValue(FieldDefinition field, TrimMainObject trimObject, string newValue) { m_errorMsg.Remove(0, m_errorMsg.Length); // simple test for non-blank bool isValid = (newValue != ""); if (!isValid) { m_errorMsg.Append("SampleField cannot be blank"); } writeToLog("VerifyFieldValue: {0}({1}):{2}. Value = {3}, {4}", trimObject.TrimType, trimObject.Uri, trimObject.NameString, newValue, isValid); return(isValid); }
public override void ExecuteLink(int cmdId, TrimMainObject forObject, ref bool itemWasChanged) { HP.HPTRIM.SDK.Record record = forObject as HP.HPTRIM.SDK.Record; if ((HP.HPTRIM.SDK.Record)record != null && links[0].MenuID == cmdId) { FolderBrowserDialog directorySelector = new FolderBrowserDialog() { Description = "Select a directory to place the electronic documents", ShowNewFolderButton = true }; if (directorySelector.ShowDialog() == DialogResult.OK) { string outputPath = Path.Combine(directorySelector.SelectedPath, $"{record.Number}.{record.Extension}"); record.GetDocument(outputPath, false, string.Empty, string.Empty); } } }
public static IList <MyCommandDef> getCommandDefs(TrimMainObject fromRecord) { if (supportedCommandIds == null) { supportedCommandIds = new Dictionary <BaseObjectTypes, CommandIds[]>(); supportedCommandIds[BaseObjectTypes.Record] = new CommandIds[] { CommandIds.Properties, CommandIds.RecCheckIn, CommandIds.RecDocFinal, CommandIds.AddToFavorites, CommandIds.RemoveFromFavorites }; supportedCommandIds[BaseObjectTypes.CheckinPlace] = new CommandIds[] { CommandIds.New, CommandIds.Remove }; } var commandDefs = new List <MyCommandDef>(); foreach (var commandId in supportedCommandIds[fromRecord.TrimType]) { commandDefs.Add(makeCommand(commandId, fromRecord)); } return(commandDefs); }
public RMRecord(TrimMainObject obj) { InitializeComponent(); // this.obj = obj; if (obj != null) { this.TrimDb = obj.Database; } Record rec = obj.Database.FindTrimObjectByUri(BaseObjectTypes.Record, obj.Uri) as Record; intUri = obj.Uri; strRecNumber = rec.Number; textBox1.Text = strRecNumber; //MessageBox.Show("Link Created to clipboard.", "", MessageBoxButtons.OK); }
public override void ExecuteLink(int cmdId, TrimMainObject forObject, ref bool itemWasChanged) { HP.HPTRIM.SDK.Record record = forObject as HP.HPTRIM.SDK.Record; if ((HP.HPTRIM.SDK.Record)record != null) { switch (cmdId) { case MenuLinks.UpdateOcrRendition.LINK_ID: RecordController.UpdateOcrRendition(record); break; case MenuLinks.RemoveOcrRendition.LINK_ID: RecordController.RemoveOcrRendition(record); break; default: break; } } }
public override bool PreSave(TrimMainObject modifiedObject) { Record record = modifiedObject as Record; if (record != null) { if (record.Title == titleTemplates[$"{record.RecordType.Name}_CustomTitleConfig"]) { m_errorMsg.Clear(); m_errorMsg.Append("Please set Title before saving."); return(false); } else { lastPos = 0; record.Title = Regex.Replace(record.Title, "\\s?<(.*?)>\\s?", new MatchEvaluator(match => replacePlaceHolder(record, match))); } } return(true); }
private static MyCommandDef makeCommand(CommandIds commandId, TrimMainObject fromRecord) { CommandDef commandDef = new CommandDef(commandId, fromRecord.Database); var myCommandDef = new MyCommandDef(); myCommandDef.CommandId = (HP.HPTRIM.ServiceModel.CommandIds)commandId; myCommandDef.MenuEntryString = commandDef.GetMenuEntryString(fromRecord.TrimType); myCommandDef.Tooltip = commandDef.GetTooltip(fromRecord.TrimType); myCommandDef.StatusBarMessage = commandDef.GetStatusBarMessage(fromRecord.TrimType); if (fromRecord is CheckinPlace) { myCommandDef.IsEnabled = commandDef.IsEnabled((fromRecord as CheckinPlace).CheckinAs); } else { myCommandDef.IsEnabled = commandDef.IsEnabled(fromRecord); } myCommandDef.IsListCommand = commandDef.IsListCommand; myCommandDef.NeedsAnObject = commandDef.NeedsAnObject; return(myCommandDef); }
public override bool IsMenuItemEnabled(int cmdId, TrimMainObject forObject) { return(links[0].MenuID == cmdId && forObject.TrimType == BaseObjectTypes.Record && ((HP.HPTRIM.SDK.Record)forObject).IsElectronic); }
public override bool VerifyFieldValue(FieldDefinition field, TrimMainObject trimObject, string newValue) { return(true); }
public override void Setup(TrimMainObject newObject) { m_errorMsg.Remove(0, m_errorMsg.Length); writeToLog("New object of type {0} was just constructed (Code here is executed after an object's constructor was called, but before properties have been set).", newObject.TrimType); }
public override bool SelectFieldValue(FieldDefinition field, TrimMainObject trimObject, string previousValue) { return(false); }
public override bool PreDelete(TrimMainObject modifiedObject) { //throw new NotImplementedException(); return true; }
public override bool IsMenuItemEnabled(int cmdId, TrimMainObject forObject) { //throw new NotImplementedException(); return true; }
public override void PostSave(TrimMainObject savedObject, bool itemWasJustCreated) { //throw new NotImplementedException(); //Loggitt("Record Uri: "+savedObject.Uri, "Record Lifecycle test: PostSave"); }
public override void PostDelete(TrimMainObject deletedObject) { }
public override bool PreDelete(TrimMainObject modifiedObject) { return(true); }
public override bool IsMenuItemEnabled(int cmdId, TrimMainObject forObject) { m_errorMsg.Remove(0, m_errorMsg.Length); return(true); }
public override void ExecuteLink(int cmdId, TrimMainObject forObject, ref bool itemWasChanged) { ////MessageBox.Show("itemWasChanged: " + forObject.Uri.ToString()); //string strallrecs = null; ////throw new NotImplementedException(); //System.Windows.Forms.Clipboard //Loggitt("Record Uri: " + forObject.Uri.ToString(), "Record Lifecycle test: ExecuteLink(int cmdId, TrimMainObject forObject, ref bool itemWasChanged)"); //using(TrimMainObjectSearch obj = new TrimMainObjectSearch(forObject.Database, BaseObjectTypes.Record)) //{ // obj.SetSearchString("allrelated:" + forObject.Uri); // foreach(Record r in obj) // { // strallrecs += r.Number+Environment.NewLine; // } //} //MessageBox.Show("All related: " + Environment.NewLine + strallrecs); //MessageBox.Show("itemWasChanged: " + forObject.Uri.ToString() + " - " + forObject.WebURL); //Clipboard.SetText(forObject.WebURL, TextDataFormat.Html); //Clipboard.SetText("http://www.news.com.au", TextDataFormat.Html); // // //Record rec = forObject.Database.FindTrimObjectByUri(BaseObjectTypes.Record, forObject.Uri) as Record; //intUri = forObject.Uri; //strRecNumber = rec.Number; //Thread clipboardThread = new Thread(somethingToRunInThread); //clipboardThread.SetApartmentState(ApartmentState.STA); //clipboardThread.IsBackground = false; //clipboardThread.Start(); //MessageBox.Show("Link Created to clipboard.", "", MessageBoxButtons.OK); if(forObject!=null) { using(RMRecord form = new RMRecord(forObject)) { form.ShowDialog(); } } //try //{ // if (forTaggedObjects.FastCount > 0) // { // using (Database db = forTaggedObjects.Database) // { // // process of multiple objects was not supported. Only process the first one // foreach (TrimMainObject obj in forTaggedObjects) // { // using (RMRecord form = new RMRecord(obj)) // { // form.ShowDialog(); // } // // To do....Processing // obj.Dispose(); // } // } // } //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message); //} }
public override bool VerifyFieldValue(FieldDefinition field, TrimMainObject trimObject, string newValue) { //throw new NotImplementedException(); bool isValid = (newValue != ""); return isValid; }
public override void Setup(TrimMainObject newObject) { //Loggitt(newObject.Name, "Record Lifecycle test: Setup"); }
public override bool IsMenuItemEnabled(int cmdId, TrimMainObject forObject) { return(false); }
public override void Setup(TrimMainObject newObject) { }
public override void ExecuteLink(int cmdId, TrimMainObject forObject, ref bool itemWasChanged) { }
public override void PostDelete(TrimMainObject deletedObject) { throw new NotImplementedException(); }
public override void PostSave(TrimMainObject savedObject, bool itemWasJustCreated) { }
public override bool PreSave(TrimMainObject modifiedObject) { //Loggitt("Record Uri: " + modifiedObject.Uri, "Record Lifecycle test: PreSave"); return true; }
public override bool SelectFieldValue(FieldDefinition field, TrimMainObject trimObject, string previousValue) { //throw new NotImplementedException(); return false; }
public override void ExecuteLink(int cmdId, TrimMainObject forObject, ref bool itemWasChanged) { m_errorMsg.Remove(0, m_errorMsg.Length); writeToLog("Executed sample menu link for {0} (command id {1}).", forObject.NameString, cmdId); }