/// <summary> /// update relationons in internalbookmark /// </summary> /// <param name="selectedTables"></param> private void UpdateRelationOns(string key) { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); TemplateInfo templateInfo = Wkl.MainCtrl.CommonCtrl.GetTemplateInfo(srvPro.FullDocName); foreach (string domainName in templateInfo.DomainNames) { DomainInfo domainInfo = Wkl.MainCtrl.CommonCtrl.GetDomainInfo(domainName); List <RelationOn> relationOns = new List <RelationOn>(); List <string> selectedTables = srvPro.Ibm.GetInternalBookmarkDomain(domainName).GetAllSelectedTables(); foreach (DSOnClause onClause in domainInfo.DSDomainData.OnClauses.Items) { foreach (string alias in selectedTables) { if (onClause.Alias == alias) { relationOns.Add(new RelationOn() { UniqueName = onClause.UniqueName, OnClause = onClause.ExClause }); } } } templateInfo.InternalBookmark.GetInternalBookmarkDomain(domainName).RelationOns = relationOns; } }
public string GetInternalBookmarkString() { try { string srvKey = string.Empty; ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out srvKey); GetInternalBookmark(srvKey); InternalBookmark internalBm = srvPro.Ibm; Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(srvKey); return(ObjectSerializeHelper.SerializeToString <InternalBookmark>(internalBm)); } catch (BaseException srvExp) { Services.ServiceException newSrvExp = new Services.ServiceException(ErrorCode.ipe_LoadInternalBookmarkError); newSrvExp.Errors.Add(srvExp); throw newSrvExp; } catch (Exception ex) { ServiceException srvExp = new ServiceException(ErrorCode.ipe_LoadInternalBookmarkError, MessageUtils.Expand(Properties.Resources.ipe_LoadInternalBookmarkError, ex.Message), ex.StackTrace); throw srvExp; } }
private void GenXslForPdh(string key) { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); // create new docx file path string folderPath = Path.GetDirectoryName(srvPro.FullDocName); string fileName = System.Guid.NewGuid().ToString(); string newDocxPath = string.Format(PathFormat, folderPath, fileName, FileExtension.Docx); // copy docx file File.Copy(srvPro.FullDocName, newDocxPath, true); // save as word xml document (xml 2007) string firstDomainName = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo.FirstDomain; Core.InternalBookmarkDomain firstDomain = srvPro.Ibm.GetInternalBookmarkDomain(firstDomainName); string xmlFilePath = SaveAsMhtForPdh(newDocxPath, firstDomain); try { srvPro.IsXsl2007Format = true; Mht.XslGenerator xslGenerator = new Mht.XslGenerator(xmlFilePath); srvPro.XsltString = xslGenerator.GenXsl(key); } catch (System.Exception ex) { Core.LogUtils.Log("GenXsl", ex); } finally { // remove temp file System.IO.File.Delete(xmlFilePath); System.IO.File.Delete(newDocxPath); } }
public void AddControl(string key) { ServicesProfile profile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); PdmServiceProfile pdmProfile = profile.PdmProfile; profile.ContentService.MarkProntDoc = true; Word.Range rangeToInsert = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentSelection.Range; rangeToInsert.Collapse(Word.WdCollapseDirection.wdCollapseEnd); try { ControlBase control = Add(pdmProfile.ControlType, rangeToInsert); pdmProfile.Control = control; ControlEventBinding(key); MarkProntoDoc(key); } catch (Exception ex) { profile.Error = ex; profile.Message = ex.Message; } }
/// <summary> /// HACK:FORM CONTROLS - GenXslForPdm /// </summary> /// <param name="key"></param> private void GenXslForPdm(string key) { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); string firstDomainName = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo.FirstDomain; Core.InternalBookmarkDomain firstDomain = srvPro.Ibm.GetInternalBookmarkDomain(firstDomainName); string htmlFileName = SaveAsHtmlForPdm(srvPro.FullDocName, firstDomain); try { srvPro.IsXsl2007Format = true; Pdm.XslGenerator generator = new Pdm.XslGenerator(srvPro.Ibm, htmlFileName); srvPro.XsltString = generator.GenXsl(); } catch (System.Exception ex) { //TODO:FORM CONTROLS - EXCEPTION Core.LogUtils.Log("GenXsl", ex); throw ex; } finally { File.Delete(htmlFileName); } }
/// <summary> /// gen xsl from docx with [Word Xml Document] format /// </summary> /// <param name="key"></param> public void GenXsl2007(string key) { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); switch (srvPro.TemplateType) { case TemplateType.Pdw: GenXslForPdw(key); break; case TemplateType.Pdh: GenXslForPdh(key); break; case TemplateType.Pdz: GenXslForPdx(key); break; case TemplateType.Pdm: GenXslForPdm(key); break; default: break; } }
private ControlBase AddControl(FormControlType type) { string key; ControlBase control = null; ServicesProfile profile = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out key); profile.PdmProfile.ControlType = type; profile.PdmProfile.IsAdding = true; MainManager manager = new MainManager(); try { manager.MainService.PdmService.AddControl(key); control = profile.PdmProfile.Control; } catch (Exception e) { throw e; } Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(key); return(control); }
private void GenXslForPdx(string key) { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); // create new docx file path string folderPath = Path.GetDirectoryName(srvPro.FullDocName); string fileName = System.Guid.NewGuid().ToString(); string newDocxPath = string.Format(PathFormat, folderPath, fileName, FileExtension.Docx); // copy docx file File.Copy(srvPro.FullDocName, newDocxPath, true); // save as word xml document (xml 2007) string content = SaveAsTextForPdx(newDocxPath); try { srvPro.IsXsl2007Format = true; Pdx.XslGenerator xslGenerator = new Pdx.XslGenerator(content); srvPro.XsltString = xslGenerator.GenXsl(key); } catch (System.Exception ex) { Core.LogUtils.Log("GenXsl", ex); } finally { System.IO.File.Delete(newDocxPath); } }
public void HighlightWordBookmark(string key) { try { ContentServiceProfile contentProfile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key).ContentService; string keyService; ServicesProfile serviceProfile = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out keyService); if (!string.IsNullOrEmpty(contentProfile.HighlightBookmark_IBMName)) { HighlightBookmark(keyService); } } catch (BaseException srvExp) { Services.ServiceException newSrvExp = new Services.ServiceException(ErrorCode.ipe_HighlightBookmarkError); newSrvExp.Errors.Add(srvExp); throw newSrvExp; } catch (Exception ex) { ServiceException srvExp = new ServiceException(ErrorCode.ipe_HighlightBookmarkError, MessageUtils.Expand(Properties.Resources.ipe_HighlightBookmarkError, ex.Message, ex.StackTrace), ex.StackTrace); throw srvExp; } }
/// <summary> /// Add bookmark into word document (word object and internal bookmark) /// </summary> /// <param name="item"></param> private void AddForeachBookmark(InternalBookmarkItem item) { MainManager _mainManager = new MainManager(); _mainManager.RegisterEvents(); string key; ServicesProfile serviceProfile = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out key); // validate position of data tag with foreach tags serviceProfile.ContentService.DomainName = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo.SelectedDomainName; _mainManager.MainService.BookmarkService.ValidateDataTagPosition(key); if (!serviceProfile.ContentService.IsValid) { MessageBox.Show(serviceProfile.Message.ToString()); Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(key); return; } // add into internal bookmark serviceProfile.IntegrationService.AddInternalBM_IBookmark = item; _mainManager.MainService.PropertyService.AddInternalBookmark(key); // add into work bookmark serviceProfile.ContentService.AddBookmark_IBookmark = item; _mainManager.MainService.BookmarkService.AddBookmark(key); Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(key); }
/// <summary> /// Add select bookmark /// </summary> /// <param name="name">Name of bookmark</param> /// <param name="value">Value of bookmark</param> private void AddSingleBookmark(InternalBookmarkItem bm) { string key; ServicesProfile servicePro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out key); //Add a space before text. servicePro.ContentService.AddToSelection_Text = " "; servicePro.ContentService.AddToSelection_IsSelected = false; AddTextToCurrentSelection(key); // add select text servicePro.ContentService.AddToSelection_Text = MarkupUtilities.GenTextXslTag(bm.BizName, bm.Type, true); servicePro.ContentService.AddToSelection_IsSelected = true; AddTextToCurrentSelection(key); // add select bookmark servicePro.ContentService.AddBookmark_Name = MarkupUtilities.GenKeyForXslTag(bm.Key, bm.Type, true); AddBookmarkInCurrentSelection(key); // set cursor after bookmark servicePro.ContentService.MoveChars_Count = 1; servicePro.ContentService.MoveChars_IsLeft = false; MoveChars(key); Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(key); }
/// <summary> /// Delete Pair of bookmark (Foreach, If) /// </summary> /// <param name="name"></param> /// <returns></returns> private bool DeleteBookmarkWithPair(Bookmark bookmark) { string name = bookmark.Name; string key; ServicesProfile servicePro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out key); servicePro.ContentService.DeletedBookmarkName = bookmark.Name; servicePro.ContentService.DeleteWholeBookmark = true; DeleteBookmark(key); //Delete internal bookmark Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo.InternalBookmark.RemoveInternalBookmarkItem(name); if (name.Contains(ProntoMarkup.KeyStartForeach) || name.Contains(ProntoMarkup.KeyStartIf)) { name = name.Replace(ProntoMarkup.KeyStartIf, ProntoMarkup.KeyEndIf); name = name.Replace(ProntoMarkup.KeyStartForeach, ProntoMarkup.KeyEndForeach); servicePro.ContentService.DeleteWholeBookmark = true; servicePro.ContentService.DeletedBookmarkName = name; DeleteBookmark(key); Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo.InternalBookmark.RemoveInternalBookmarkItem(name); } return(false); }
/// <summary> /// Get Previous from the cursor. /// </summary> /// <param name="item"></param> /// <returns></returns> private Bookmark GetPreviousBookmark(BookmarkItem item) { string srvKey = string.Empty; ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out srvKey); GetCurrentSelection(srvKey); Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(srvKey); int cursorPosition = srvPro.ContentService.WSelection.Start; int max = -1; int index = -1; for (int i = 0; i < item.Items.Count; i++) { if (item.Items[i].Start <cursorPosition && item.Items[i].Start> max) { max = item.Items[i].Start; index = i; } } if (index > -1) { return(item.Items[index]); } else { return(null); } }
/// <summary> /// Get Next Bookmark from the cursor. /// </summary> /// <param name="item"></param> /// <returns></returns> private Bookmark GetNextBookmark(BookmarkItem item) { string srvKey = string.Empty; ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out srvKey); GetCurrentSelection(srvKey); Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(srvKey); int cursorPosition = srvPro.ContentService.WSelection.Start; int min = int.MaxValue; int index = 0; if ((cursorPosition >= GetLastBookmark(item).Start)) { return(GetFirstBookmark(item)); } for (int i = 0; i < item.Items.Count; i++) { if (item.Items[i].Start > cursorPosition) { if (item.Items[i].Start < min) { min = item.Items[i].Start; index = i; } } } return(item.Items[index]); }
public string GenXsl(string key) { try { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ValidateBookmarks(); // prepare data _ibm = srvPro.Ibm; // replace bookmarks by xslt tags ReplaceBookmarkTag(); // add multi-section AddMultiSection(); // build xsl string (put header, body, footer) return(GetXslString()); } catch (Pdw.Core.BaseException srvExp) { Services.ServiceException newSrvExp = new Services.ServiceException(Pdw.Core.ErrorCode.ipe_GetXslContentError); newSrvExp.Errors.Add(srvExp); throw newSrvExp; } catch (Exception ex) { ServiceException srvExp = new ServiceException(Pdw.Core.ErrorCode.ipe_GetXslContentError, Pdw.Core.MessageUtils.Expand(Properties.Resources.ipe_GetXslContentError, ex.Message), ex.StackTrace); throw srvExp; } }
public ServicesProfile CreateProfile(out string key) { ServicesProfile srvPro = new ServicesProfile(); key = AddDataObject(srvPro); return(srvPro); }
private void PdmService_AddInternalBookmarkItem(string key) { ServicesProfile profile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); profile.IntegrationService.AddInternalBM_IBookmark = profile.PdmProfile.BindingBookmark; PropertyService.AddInternalBookmark(key); }
/// <summary> /// update usc item collection /// key: service key /// value: ServiceProfile.UscItems /// </summary> /// <param name="items"></param> public void UpdateUscItemCollection(List <USCItem> items) { string srvKey = string.Empty; ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out srvKey); srvPro.UscItems = items; UpdateUscItems(srvKey); Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(srvKey); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ServicesProfile.Configure(services); // Add framework services. services.AddMvc() .AddJsonOptions(options => { options.SerializerSettings.ContractResolver = new MyContractResolver(); }); }
private void proService_SavePdwInfo(string key) { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key); mgrPro.PdwInfo = srvPro.PdwInfo; mgrPro.ServiceType = ServiceType.IntegrationService; mgrPro.EventType = EventType.SavePdwInfo; MainEvent(key); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key); }
private void proService_RemoveInternalBookmarkItem(string key) { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key); mgrPro.ServiceType = ServiceType.IntegrationService; mgrPro.EventType = EventType.RemoveInternalBookmarkItem; mgrPro.WbmKey = srvPro.WbmKey; MainEvent(key); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key); }
/// <summary> /// Delete internal bookmark that not exist in word bookmark /// </summary> public void ValidateInternalBookmarkCollection(string key) { // 1. Get internal bookmark object // 2. Get all key of internal bookmark item that not exist in word bookmark collection // 3. Remove all internal bookmark item has key in key collection above try { IntegrationServiceProfile integrationProfile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key).IntegrationService; List <string> removed = new List <string>(); InternalBookmark iBms = null; List <string> removeKeys = new List <string>(); string srvKey = string.Empty; ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out srvKey); GetInternalBookmark(srvKey); iBms = srvPro.Ibm; Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(srvKey); foreach (InternalBookmarkDomain ibmDomain in iBms.InternalBookmarkDomains) { ValidateInternalBookmarkDomain(ibmDomain, integrationProfile.ValidateInternalBM_IListBM, ref removed, ref removeKeys); } if (integrationProfile.ValidateInternalBM_IIsUpdate) { srvKey = string.Empty; srvPro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out srvKey); foreach (string bmKey in removeKeys) { srvPro.WbmKey = bmKey; RemoveInternalBookmark(srvKey); } Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(srvKey); } integrationProfile.ValidateInternalBM_OListError = removed; } catch (BaseException srvExp) { Services.ServiceException newSrvExp = new Services.ServiceException(ErrorCode.ipe_ValidateIbmsError); newSrvExp.Errors.Add(srvExp); throw newSrvExp; } catch (Exception ex) { ServiceException srvExp = new ServiceException(ErrorCode.ipe_ValidateIbmsError, MessageUtils.Expand(Properties.Resources.ipe_ValidateIbmsError, ex.Message), ex.StackTrace); throw srvExp; } }
private void proService_UpdateUscItems(string key) { string mgrKey = string.Empty; ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(out mgrKey); mgrPro.UscItems = srvPro.UscItems; mgrPro.ServiceType = ServiceType.IntegrationService; mgrPro.EventType = EventType.UpdateUscItems; MainEvent(mgrKey); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(mgrKey); }
private void bmService_GetCurrentSelection(string key) { ServicesProfile servicePro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key); mgrPro.ServiceType = ServiceType.ContentService; mgrPro.EventType = EventType.GetCurrentSelection; MainEvent(key); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key); servicePro.ContentService.WSelection = mgrPro.WSelection; }
private void bmService_HighlightBookmark(string key) { ServicesProfile servicePro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key); mgrPro.ServiceType = ServiceType.ContentService; mgrPro.EventType = EventType.HighlightBookmark; mgrPro.HighlightBookmarkName = servicePro.ContentService.HighlightBookmarkName; MainEvent(key); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key); }
private void bmService_MarkProntoDoc(string key) { ServicesProfile servicePro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key); mgrPro.ServiceType = ServiceType.ContentService; mgrPro.EventType = EventType.MarkProntoDoc; mgrPro.MarkProntDoc = servicePro.ContentService.MarkProntDoc; MainEvent(key); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key); }
public ChecksumInfo GetChecksum() { try { string srvKey = string.Empty; ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out srvKey); GetPdwInformation(srvKey); Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(srvKey); List <XmlObject> customXmls = srvPro.XmlObjects; ChecksumInfo checksum = null; string osql = string.Empty; foreach (XmlObject xmlObject in customXmls) { if (xmlObject == null) { continue; } if (xmlObject.ContentType == ContentType.Checksum) { checksum = ObjectSerializeHelper.Deserialize <ChecksumInfo>(xmlObject.Content); checksum.InternalBookmark = GetInternalBookmarkString(); checksum.Osql = osql; } else if (xmlObject.ContentType == ContentType.Osql) { osql = xmlObject.Content; if (checksum != null) { checksum.Osql = osql; } } } return(checksum != null ? checksum : new ChecksumInfo()); } catch (BaseException srvExp) { Services.ServiceException newSrvExp = new Services.ServiceException(ErrorCode.ipe_GetChecksumError); newSrvExp.Errors.Add(srvExp); throw newSrvExp; } catch (Exception ex) { ServiceException srvExp = new ServiceException(ErrorCode.ipe_GetChecksumError, MessageUtils.Expand(Properties.Resources.ipe_GetChecksumError, ex.Message), ex.StackTrace); throw srvExp; } }
private void proService_GetInternalBookmark(string key) { ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key); mgrPro.ServiceType = ServiceType.IntegrationService; mgrPro.EventType = EventType.GetInternalBookmark; MainEvent(key); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key); srvPro.Ibm = mgrPro.Ibm; srvPro.PdeContent = mgrPro.PdeContent; }
private void bmService_SetFontForCurrentSelection(string key) { ServicesProfile servicePro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key); mgrPro.ServiceType = ServiceType.ContentService; mgrPro.EventType = EventType.SetFontForCurrentSelection; mgrPro.WdColorIndex = servicePro.ContentService.WdColorIndex; MainEvent(key); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key); }
private void bmService_GetForeachTagsBoundCurrentPosEvent(string key) { ServicesProfile servicePro = Wkl.MainCtrl.ServiceCtrl.GetProfile(key); ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(key); mgrPro.ServiceType = ServiceType.ContentService; mgrPro.EventType = EventType.GetForeachTagsBoundCurrentPos; MainEvent(key); Wkl.MainCtrl.ManagerCtrl.RemoveDataObject(key); servicePro.ContentService.DicBookmarks = mgrPro.DicBookmarks; }