//................................. public void ArchiveErrorMailBoxEntry(XmlDocument inErrorMailBox, LogErrorLevel inErrorLevel) { OpenErrorMailBox(inErrorMailBox); //:::::::::::::::::::::::::::::::: CopyErrorMailBoxEntry(inErrorMailBox, inErrorLevel); //:::::::::::::::::::::::::::::::::::::: XmlNode entry = GetEntry(inErrorLevel); XmlNodeList errorList = XMLDocManager.GetNodeList(entry, @"Error"); foreach (XmlNode error in errorList) { entry.RemoveChild(error); XMLDocManager.SetAttribute(entry, @"locked", @"false"); } try { SaveErrorEmailBox(inErrorMailBox, _errorMailBoxPath); } catch (Exception e) { LogWarning(string.Format(@"ArchiveErrorMailBoxEntry: Summa failed to saved error mailbox Message: {0} StackTrace: {1}", e.Message, e.StackTrace)); } //:::::::::::::::::::::::::::::::: CloseErrorMailBox(inErrorMailBox); }
/// <summary> /// /// </summary> /// <param name="inServingCourseNode"></param> /// <param name="index"></param> private void showServingCourse(XmlNode inServingCourseNode, int index) { // Serving Course's items are shown first XmlNodeList itemList = getItemList(inServingCourseNode); showItems(itemList); //:::::::::::::::::::::::::::::::::::::::::::::::::::::: string name = @""; string value = XMLDocManager.GetAttribute(inServingCourseNode, @"name", @"none"); Color nameColor = Color.White; Color nameBckColor = Color.FromArgb(0xBB - index, 0xBB - index, 0xDD - index); Font nameFont = new Font(@"Tahoma", 12.0f, FontStyle.Bold); Color valueColor = Color.White; Color valueBckColor = Color.FromArgb(0xBB - index, 0xBB - index, 0xDD - index); Font valueFont = new Font(@"Tahoma", 12.0f, FontStyle.Bold); if (!string.IsNullOrWhiteSpace(_currencySymbol)) // MM-2827 { value += " (" + _currencySymbol + ")"; } insertDisplayItemWithName(name, nameFont, nameColor, nameBckColor, value, valueFont, valueColor, valueBckColor); }
//................................. private XmlNode AddMailBoxError(XmlNode inEntry, LogErrorLevelFile inErrorLevelFile, string inErrorStr, string inErrorStrDetail, bool inSent) { string timeStr = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); XmlNode error = XMLDocManager.AddNode(_errorMailBox, inEntry, @"Error"); XMLDocManager.AddAttribute(_errorMailBox, error, @"id", Convert.ToString((int)inErrorLevelFile)); XMLDocManager.AddAttribute(_errorMailBox, error, @"file", GetLogErrorLevelFileStr(inErrorLevelFile)); XMLDocManager.AddAttribute(_errorMailBox, error, @"time", timeStr); XMLDocManager.AddAttribute(_errorMailBox, error, @"sent", inSent ? @"true" : @"false"); XMLDocManager.AddAttribute(_errorMailBox, error, @"name", inErrorStr); XMLDocManager.AddAttribute(_errorMailBox, error, @"detail", inErrorStrDetail); //::::::::::::::::::::::::::::::: if (onErrorFunc != null) { LogErrorLevel errorLevel = (LogErrorLevel)Convert.ToInt32(inEntry.Attributes[@"id"].Value); onErrorFunc(errorLevel, timeStr, inErrorLevelFile, inErrorStr, inErrorStrDetail, inSent); } //::::::::::::::::::::::::::::::: return(error); }
/// <summary> /// /// </summary> /// <param name="inItemsSectionNode"></param> /// <param name="outOrderHeaderAccount"></param> void readWebOrderItemsComplete( XmlNode inItemsSectionNode, DTO_WebOrderAccount outOrderHeaderAccount) { XmlNodeList itemNodeList = XMLDocManager.GetNodeList(inItemsSectionNode, @"Item"); List <DTO_WebOrderItem> itemList = new List <DTO_WebOrderItem>(); foreach (XmlNode itemNode in itemNodeList) { DTO_WebOrderItem item = new DTO_WebOrderItem(); item.UID = getXMLOrderAttribute(itemNode, @"uid", @""); item.BasePrice = Convert.ToDecimal(getXMLOrderAttribute(itemNode, @"basePrice", @"0.00")); item.Qty = Convert.ToSingle(getXMLOrderAttribute(itemNode, @"quantity", @"0.0")); item.DiscountID = Convert.ToUInt32(getXMLOrderAttribute(itemNode, @"discountID", @"0")); item.Note = getXMLOrderAttribute(itemNode, @"note", @""); item.ItemOptions = readWebOrderItemOptionsComplete(itemNode.FirstChild); // Options node item.ItemSides = readWebOrderItemSidesComplete(itemNode.FirstChild.NextSibling); // Sides node itemList.Add(item); } outOrderHeaderAccount.OrderItems = itemList.ToArray(); }
/// <summary> /// /// </summary> public void SaveSettings() { if (file_uri != @"") // XML config was created already { // Databases XmlNode uniqueDBServerNode = getUniqueDBServerNode(); XmlNode dbServersNode = getDBServersNode(); XmlNode webmateDBServerNode = dbServersNode.FirstChild; XmlNode chefmateDBServerNode = dbServersNode.FirstChild.NextSibling; XMLDocManager.SetAttribute(uniqueDBServerNode, @"checked", Convert.ToString(unique_db_server)); XMLDocManager.SetAttribute(uniqueDBServerNode, @"name", unique_db_server_name); XMLDocManager.SetAttribute(uniqueDBServerNode, @"folder", unique_db_server_folder); XMLDocManager.SetAttribute(dbServersNode, @"checked", Convert.ToString(database_servers)); XMLDocManager.SetAttribute(webmateDBServerNode, @"name", db_server_webmate_name); XMLDocManager.SetAttribute(webmateDBServerNode, @"folder", db_server_webmate_folder); XMLDocManager.SetAttribute(chefmateDBServerNode, @"name", db_server_chefmate_name); XMLDocManager.SetAttribute(chefmateDBServerNode, @"folder", db_server_chefmate_folder); //:::::::::::::::::::::::::::::: config_file_doc.Save(file_uri); modified = false; } }
/// <summary> /// /// </summary> /// <param name="inOptionNode"></param> /// <param name="inOrderControl"></param> private void showSide(XmlNode inSideNode) { string sideName = XMLDocManager.GetAttribute(inSideNode, @"name", @"Option"); string sideInfo = string.Format(" {0}", sideName); string sidePrice = XMLDocManager.GetAttribute(inSideNode, @"price", @""); showOrderItemSide(sideInfo, OrderItemType.Side, sidePrice); }
/// <summary> /// /// </summary> /// <param name="inOptionNode"></param> /// <param name="inOrderControl"></param> private void showOption(XmlNode inOptionNode) { bool added = XMLDocManager.GetAttribute(inOptionNode, @"added", @"true").ToUpper() == @"TRUE"; string optionModifier = added ? @"+" : @"-"; string optionName = XMLDocManager.GetAttribute(inOptionNode, @"name", @"Option"); string optionInfo = string.Format(" {0} {1}", optionModifier, optionName); showOrderItemOption(optionInfo, OrderItemType.Option, @""); }
//................................. private XmlNode AddEntry(XmlDocument inErrorMailBox, XmlNode inEntries, string inEntryName, LogErrorLevel inErrorLevel) { XmlNode entry = XMLDocManager.AddNode(inErrorMailBox, inEntries, @"Entry"); XMLDocManager.AddAttribute(inErrorMailBox, entry, @"name", inEntryName); XMLDocManager.AddAttribute(inErrorMailBox, entry, @"id", Convert.ToString((int)inErrorLevel)); XMLDocManager.AddAttribute(inErrorMailBox, entry, @"locked", @"false"); return(entry); }
private void setTextFontSize(XmlNode textFontSize) { try { SetTextFontSize = Convert.ToDouble(XMLDocManager.GetAttribute(textFontSize, @"fontsize", @"")); } catch (Exception) { SetTextFontSize = 0; } }
/// <summary> /// /// </summary> protected void loadXMLErrorMessage(XmlDocument outXmlOrder, string inOrderHandle, string inErrorMsg) { XmlNode root = XMLDocManager.CreateRoot(outXmlOrder, @"POSOrder"); XMLDocManager.AddAttribute(outXmlOrder, root, @"handle", inOrderHandle); XmlNode scs = XMLDocManager.AddNodeChild(outXmlOrder, root, @"ServingCourses"); XmlNode sc = XMLDocManager.AddNodeChild(outXmlOrder, scs, @"ServingCourse"); XMLDocManager.AddAttribute(outXmlOrder, sc, @"name", @""); XmlNode its = XMLDocManager.AddNodeChild(outXmlOrder, sc, @"Items"); XmlNode it = XMLDocManager.AddNodeChild(outXmlOrder, its, @"Item"); XMLDocManager.AddAttribute(outXmlOrder, it, @"displayName", @"Customer Display Error"); XMLDocManager.AddAttribute(outXmlOrder, it, @"value", @""); it = XMLDocManager.AddNodeChild(outXmlOrder, its, @"Item"); XMLDocManager.AddAttribute(outXmlOrder, it, @"displayName", inErrorMsg); XMLDocManager.AddAttribute(outXmlOrder, it, @"value", @""); //......................................................................... XmlNode totals = XMLDocManager.AddNodeChild(outXmlOrder, root, @"Totals"); XmlNode tdc = XMLDocManager.AddNodeChild(outXmlOrder, totals, @"TotalDiscount"); XMLDocManager.AddAttribute(outXmlOrder, tdc, @"name", @"Total"); XMLDocManager.AddAttribute(outXmlOrder, tdc, @"value", @""); XmlNode total = XMLDocManager.AddNodeChild(outXmlOrder, totals, @"Total"); XMLDocManager.AddAttribute(outXmlOrder, total, @"name", @"Total"); XMLDocManager.AddAttribute(outXmlOrder, total, @"value", @""); XmlNode change = XMLDocManager.AddNodeChild(outXmlOrder, totals, @"Change"); XMLDocManager.AddAttribute(outXmlOrder, change, @"name", @"Change"); XMLDocManager.AddAttribute(outXmlOrder, change, @"value", @""); XmlNode tsch = XMLDocManager.AddNodeChild(outXmlOrder, totals, @"TotalServiceCharge"); XMLDocManager.AddAttribute(outXmlOrder, tsch, @"name", @"Total Service Charge"); XMLDocManager.AddAttribute(outXmlOrder, tsch, @"value", @""); XMLDocManager.AddAttribute(outXmlOrder, tsch, @"visible", @"false"); XmlNode ttx = XMLDocManager.AddNodeChild(outXmlOrder, totals, @"TotalTax"); XMLDocManager.AddAttribute(outXmlOrder, ttx, @"name", @"Total Tax"); XMLDocManager.AddAttribute(outXmlOrder, ttx, @"value", @""); XMLDocManager.AddAttribute(outXmlOrder, ttx, @"visible", @"false"); }
getTrineoCredentialsFromXmlNode( XmlNode xmlNode) { Credentials t_crd = new Credentials(); if (xmlNode != null) { t_crd.Client_ID = XMLDocManager.GetAttribute(xmlNode, "client_id", null); t_crd.Client_secret = XMLDocManager.GetAttribute(xmlNode, "client_secret", null); } return(t_crd); }
//................................. private XmlNode GetEntry(LogErrorLevel inErrorLevel) { XmlNodeList entries = XMLDocManager.GetNodeList(_errorMailBox, @"Entries/Entry"); foreach (XmlNode entry in entries) { if (Convert.ToInt32(entry.Attributes[@"id"].Value) == (int)inErrorLevel) { return(entry); } } return(null); }
//................................. public void CopyErrorMailBoxEntry(XmlDocument inErrorMailBox, LogErrorLevel inErrorLevel) { //:::::::::::::::::::::::::::::: XmlDocument errorMailBoxEntryArchive = new XmlDocument(); // Create the XML Declaration, and append it to XML document XMLDocManager.CreateXmlDeclaration(errorMailBoxEntryArchive, @"1.0", null, null); //:::::::::::::::::::::::::::::: string entryName = LogErrorLevelToName(inErrorLevel); string timeStr = DateTime.Now.ToString("yyyyMMddHHmmss"); // Create the root element XMLDocManager.CreateRoot(errorMailBoxEntryArchive, string.Format(@"{0}{1}", timeStr, entryName)); //:::::::::::::::::::::::::::::: XmlNode archiveEntry = AddEntry(errorMailBoxEntryArchive, errorMailBoxEntryArchive.DocumentElement, entryName, inErrorLevel); //.............................. XmlNode entry = GetEntry(inErrorLevel); XmlNodeList errorList = XMLDocManager.GetNodeList(entry, @"Error"); foreach (XmlNode error in errorList) { ArchiveMailBoxError(errorMailBoxEntryArchive, archiveEntry, error.Attributes[@"id"].Value, error.Attributes[@"file"].Value, error.Attributes[@"time"].Value, error.Attributes[@"name"].Value, error.Attributes[@"detail"].Value, error.Attributes[@"sent"].Value); } //:::::::::::::::::::::::::::::::::::::: try { SaveErrorEmailBox(errorMailBoxEntryArchive, string.Format(@"{0}{1}.xml", _archiveMailBoxFolder, errorMailBoxEntryArchive.DocumentElement.Name)); LogWarning(string.Format(@"An error mailbox entry has been archived: {0}", errorMailBoxEntryArchive.DocumentElement.Name)); } catch (Exception e) { LogWarning(string.Format(@"CopyErrorMailBoxEntry: Summa failed to saved error mailbox Message: {0} StackTrace: {1}", e.Message, e.StackTrace)); } }
getSalesforceCredentialsFromXmlNode( XmlNode xmlNode) { SalesforceCredentials crd = new SalesforceCredentials(); if (xmlNode != null) { crd.UserName = XMLDocManager.GetAttribute(xmlNode, "username", null); crd.Password = XMLDocManager.GetAttribute(xmlNode, "password", null); crd.SecurityToken = XMLDocManager.GetAttribute(xmlNode, "token", null); } return(crd); }
private bool ReadUniqueDatabaseServer() { bool result = true; try { XmlNode uniqueDatabaseServerNode = GetUniqueDatabaseServerNode(); result = Convert.ToBoolean(XMLDocManager.GetAttribute(uniqueDatabaseServerNode, @"checked", @"true")); } catch { result = true; } return(result); }
private string LoadAttribute(XmlDocument xmlDocument, string attribute) { try { XmlNode salesforceNode = XMLDocManager.GetNode(xmlDocument, @"salesforce"); return(XMLDocManager.GetAttribute(salesforceNode, attribute, @"")); } catch (Exception exception) { throw new Exception("There was an error retrieving query from sales force.") { Source = exception.Source }; } }
/// <summary> /// /// </summary> /// <param name="inCommentsSectionNode"></param> /// <param name="outOrderHeaderAccount"></param> void readWebOrderCommentsComplete( XmlNode inCommentsSectionNode, DTO_WebOrderAccount outOrderHeaderAccount) { XmlNodeList commentNodeList = XMLDocManager.GetNodeList(inCommentsSectionNode, @"Comment"); List <string> commentList = new List <string>(); foreach (XmlNode commentNode in commentNodeList) { commentList.Add(commentNode.InnerText); } outOrderHeaderAccount.Comments = commentList.ToArray(); }
private string ReadUniqueDatabaseServerFolder() { string result = DefaultDatabaseFolder; try { XmlNode uniqueDatabaseServerNode = GetUniqueDatabaseServerNode(); result = XMLDocManager.GetAttribute(uniqueDatabaseServerNode, @"folder", DefaultDatabaseFolder); } catch { result = DefaultDatabaseFolder; } return(result); }
private string ReadClippIpAddress() { string result = DefaultClippIpAddress; try { XmlNode clippIpAddressNode = GetClippIpAddressNode(); result = XMLDocManager.GetAttribute(clippIpAddressNode, @"value", DefaultClippIpAddress); } catch { result = DefaultClippIpAddress; } return(result); }
private string ReadUniqueDatabaseServerName() { string result = DefaultDatabaseServerName; try { XmlNode uniqueDatabaseServerNode = GetUniqueDatabaseServerNode(); result = XMLDocManager.GetAttribute(uniqueDatabaseServerNode, @"name", DefaultDatabaseServerName); } catch { result = DefaultDatabaseServerName; } return(result); }
private bool ReadDatabaseServers() { bool result = false; try { XmlNode dbServersNode = GetDatabaseServerNode(); result = Convert.ToBoolean(XMLDocManager.GetAttribute(dbServersNode, @"checked", @"false")); } catch { result = false; } return(result); }
/// <summary> /// /// </summary> /// <param name="inNode"></param> /// <param name="inAttrName"></param> /// <param name="inDefaultValue"></param> /// <returns></returns> string getXMLOrderAttribute ( XmlNode inNode, string inAttrName, string inDefaultValue) { string returnValue = inDefaultValue; try { returnValue = XMLDocManager.GetAttribute(inNode, inAttrName, inDefaultValue); } catch (Exception ex) { } return(returnValue); }
//................................. private XmlNode ArchiveMailBoxError(XmlDocument inErrorMailArchive, XmlNode inEntry, string inId, string inFile, string inTimeStr, string inErrorStr, string inErrorStrDetail, string inSent) { string timeStr = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); XmlNode error = XMLDocManager.AddNode(inErrorMailArchive, inEntry, @"Error"); XMLDocManager.AddAttribute(inErrorMailArchive, error, @"id", inId); XMLDocManager.AddAttribute(inErrorMailArchive, error, @"file", inFile); XMLDocManager.AddAttribute(inErrorMailArchive, error, @"time", inTimeStr); XMLDocManager.AddAttribute(inErrorMailArchive, error, @"sent", inSent); XMLDocManager.AddAttribute(inErrorMailArchive, error, @"name", inErrorStr); XMLDocManager.AddAttribute(inErrorMailArchive, error, @"detail", inErrorStrDetail); //::::::::::::::::::::::::::::::: return(error); }
/// <summary> /// /// </summary> /// <param name="inTotalsNode"></param> private void showTotalsNode(XmlNode inTotalsNode) { XmlNode totalNode = inTotalsNode.FirstChild.NextSibling; XmlNode changeNode = totalNode.NextSibling; XmlNode serviceChargeNode = changeNode.NextSibling; XmlNode taxNode = serviceChargeNode.NextSibling; bool showSC = XMLDocManager.GetAttribute(serviceChargeNode, @"visible", @"false").ToUpper() == @"TRUE"; bool showTax = XMLDocManager.GetAttribute(taxNode, @"visible", @"false").ToUpper() == @"TRUE"; gbOrderItems.Height = _orderPanelHeight - TOTALS_PANEL_HEIGHT; int tmp = 0; if (showTax) { gbOrderItems.Height = spDisplay.Panel2.Height - TOTALS_PANEL_HEIGHT + tmp; showOrderTotal(XMLDocManager.GetAttribute(taxNode, @"name", @"Tax"), XMLDocManager.GetAttribute(taxNode, @"value", @"")); } else { tmp += ITEM_HEIGHT; } if (showSC) { gbOrderItems.Height = spDisplay.Panel2.Height - TOTALS_PANEL_HEIGHT + tmp; showOrderTotal(XMLDocManager.GetAttribute(serviceChargeNode, @"name", @"Service Charge"), XMLDocManager.GetAttribute(serviceChargeNode, @"value", @"")); } else { tmp += ITEM_HEIGHT; } showOrderTotal(XMLDocManager.GetAttribute(changeNode, @"name", @"Change"), XMLDocManager.GetAttribute(changeNode, @"value", @"")); string totalCaption = XMLDocManager.GetAttribute(totalNode, @"name", @"Total"); if (!string.IsNullOrWhiteSpace(_currencySymbol)) { totalCaption += " (" + _currencySymbol + ")"; } showOrderTotalToPay(totalCaption, XMLDocManager.GetAttribute(totalNode, @"value", @"")); gbOrderItems.Height = _orderPanelHeight - Convert.ToInt32(TOTALS_PANEL_HEIGHT * _ratio) + tmp; }
private void InitErrorMailBox(XmlDocument inErrorMailBox) { //:::::::::::::::::::::::::::::: // Create the XML Declaration, and append it to XML document XMLDocManager.CreateXmlDeclaration(inErrorMailBox, @"1.0", null, null); //:::::::::::::::::::::::::::::: // Create the root element XMLDocManager.CreateRoot(inErrorMailBox, @"ErrorMailBox"); //:::::::::::::::::::::::::::::: AddEntries(inErrorMailBox); //_errorMailBoxEntries.Add(XMLDocManager.AddNode(inErrorMailBox, root, @"ServerStartListeningFailed")); }
private XmlDocument BuildResponse(string inOrderNo, bool inSuccess, string inMsg) { XmlDocument result = new XmlDocument(); //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: XMLDocManager.CreateXmlDeclaration(result, @"1.0", @"", @""); XmlElement orderResponse = XMLDocManager.CreateRoot(result, @"Order"); XMLDocManager.AddAttribute(result, orderResponse, @"action", @"orderResponse"); XMLDocManager.AddAttribute(result, orderResponse, @"orderNumber", @"0"); XMLDocManager.AddAttribute(result, orderResponse, @"result", inSuccess ? "OK" : "FAILED"); XMLDocManager.AddAttribute(result, orderResponse, @"message", inMsg); //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: return(result); }
private string ReadChefmateDatabaseServerFolder() { string result = DefaultDatabaseFolder; try { XmlNode databaseServerNode = GetDatabaseServerNode(); XmlNode chefmateDatabaseServerNode = databaseServerNode.FirstChild.NextSibling; result = XMLDocManager.GetAttribute(chefmateDatabaseServerNode, @"folder", DefaultDatabaseFolder); } catch { result = DefaultDatabaseFolder; } return(result); }
private string ReadWebmateDatabaseServerName() { string result = DefaultDatabaseServerName; try { XmlNode databaseServerNode = GetDatabaseServerNode(); XmlNode webmateDatabaseServerNode = databaseServerNode.FirstChild; result = XMLDocManager.GetAttribute(webmateDatabaseServerNode, @"name", DefaultDatabaseServerName); } catch { result = DefaultDatabaseServerName; } return(result); }
getCredentialsFromXML() { XmlDocument doc = getCredentialsFile(); if (doc == null) { return; } SalesforceCredentials temp_sf_crd = getSalesforceCredentialsFromXmlNode(XMLDocManager.GetNode(doc, "salesforce")); Credentials temp_tr_crd = getTrineoCredentialsFromXmlNode(XMLDocManager.GetNode(doc, "trineo")); this.sfCredentials.UserName = temp_sf_crd.UserName; this.sfCredentials.Password = temp_sf_crd.Password; this.sfCredentials.SecurityToken = temp_sf_crd.SecurityToken; this.trineoCredentials.Client_ID = temp_tr_crd.Client_ID; this.trineoCredentials.Client_secret = temp_tr_crd.Client_secret; }
/// <summary> /// /// </summary> /// <param name="inTotalDiscountNode"></param> private void showTotalDiscount(XmlNode inTotalDiscountNode) { string value = XMLDocManager.GetAttribute(inTotalDiscountNode, @"value", @"0.00"); if (Convert.ToDecimal(value) != 0.0m) { string name = XMLDocManager.GetAttribute(inTotalDiscountNode, @"name", @"none"); Color nameColor = Color.White; Color nameBckColor = Color.Teal; Font nameFont = new Font(@"Tahoma", 12.0f, FontStyle.Regular); Color valueColor = Color.White; Color valueBckColor = Color.Teal; Font valueFont = new Font(@"Tahoma", 12.0f, FontStyle.Regular); insertDisplayItemWithName(name, nameFont, nameColor, nameBckColor, value, valueFont, valueColor, valueBckColor); } }