public void ReadSettingsFromNode(XmlNode Node) { try { SettingsNode = Node; String Value; XMLFileUtils.GetChildNodeValue(SettingsNode, "MainFormTitle", out MainFormTitleText); if (XMLFileUtils.GetChildNodeValue(SettingsNode, "ReportRowsFromTop", out Value)) { ReportRowsFromTop = Int32.Parse(Value); } if (XMLFileUtils.GetChildNodeValue(SettingsNode, "ReportAppendRowsAtBottom", out Value)) { ReportAppendRowsAtBottom = Int32.Parse(Value); } XMLFileUtils.GetChildNodeValue(SettingsNode, "LogoFileName", out LogoFileName); if (XMLFileUtils.GetChildNodeValue(SettingsNode, "LogoImageHeight", out Value)) { LogoImageHeight = Int32.Parse(Value); } } catch (Exception ex) { CommonFunctions.ShowErrorDialog("ApplicationSettings.ReadSettingsFromNode()", ex); } }
public Boolean LoadDetailsFromNode(XmlNode ProductLineNode) { try { this.ProductLineNode = ProductLineNode; XMLFileUtils.GetAttributeValue(ProductLineNode, "Name", out Name); ObjSettings = new Settings(); XmlNode GeneralNode; XMLFileUtils.GetChildNode(ProductLineNode, "General", out GeneralNode); ObjSettings.LoadSettingsFromNode(GeneralNode); XmlNode InvoiceNode; XMLFileUtils.GetChildNode(ProductLineNode, "Invoice", out InvoiceNode); ObjSettings.LoadSettingsFromNode(InvoiceNode); XmlNode QuotationNode; XMLFileUtils.GetChildNode(ProductLineNode, "Quotation", out QuotationNode); ObjSettings.LoadSettingsFromNode(QuotationNode); XmlNode PurchaseOrderNode; XMLFileUtils.GetChildNode(ProductLineNode, "PurchaseOrder", out PurchaseOrderNode); ObjSettings.LoadSettingsFromNode(PurchaseOrderNode); return(true); } catch (Exception ex) { CommonFunctions.ShowErrorDialog("ProductLine.LoadDetailsFromNode()", ex); return(false); } }
public void ReadSettingsFromNode(XmlNode Node, ReportType Type) { try { SettingsNode = Node; this.Type = Type; String Value; XMLFileUtils.GetChildNodeValue(SettingsNode, "HeaderTitle", out HeaderTitle); XMLFileUtils.GetChildNodeValue(SettingsNode, "HeaderSubTitle", out HeaderSubTitle); XMLFileUtils.GetChildNodeValue(SettingsNode, "FooterTitle", out FooterTitle); XMLFileUtils.GetChildNodeValue(SettingsNode, "Address", out Address); XMLFileUtils.GetChildNodeValue(SettingsNode, "PhoneNumber", out PhoneNumber); XMLFileUtils.GetChildNodeValue(SettingsNode, "EMailID", out EMailID); XMLFileUtils.GetChildNodeValue(SettingsNode, "VATPercent", out VATPercent); XMLFileUtils.GetChildNodeValue(SettingsNode, "TINNumber", out TINNumber); XMLFileUtils.GetChildNodeValue(SettingsNode, "GSTINumber", out GSTINumber); if (XMLFileUtils.GetChildNodeValue(SettingsNode, "LastNumber", out Value)) { LastNumber = Int32.Parse(Value); } if (XMLFileUtils.GetChildNodeValue(SettingsNode, "HeaderTitleColor", out Value)) { HeaderTitleColor = CommonFunctions.GetColor(Value); } if (XMLFileUtils.GetChildNodeValue(SettingsNode, "HeaderSubTitleColor", out Value)) { HeaderSubTitleColor = CommonFunctions.GetColor(Value); } if (XMLFileUtils.GetChildNodeValue(SettingsNode, "FooterTitleColor", out Value)) { FooterTitleColor = CommonFunctions.GetColor(Value); } if (XMLFileUtils.GetChildNodeValue(SettingsNode, "FooterTextColor", out Value)) { FooterTextColor = CommonFunctions.GetColor(Value); } XmlNode PastSalesPeriodNode; if (XMLFileUtils.GetChildNode(SettingsNode, "PastSalesPeriod", out PastSalesPeriodNode)) { if (XMLFileUtils.GetChildNodeValue(PastSalesPeriodNode, "Value", out Value)) { PastSalePeriodValue = Int32.Parse(Value); } if (XMLFileUtils.GetChildNodeValue(PastSalesPeriodNode, "Units", out Value)) { PastSalePeriodUnits = GetTimePeriodUnits(Value); } } } catch (Exception ex) { CommonFunctions.ShowErrorDialog("ReportSettings.ReadSettingsFromNode()", ex); } }
public void UpdateSettingsToNode() { try { XMLFileUtils.SetChildNodeValue(SettingsNode, "SummaryLocation", SummaryLocation.ToString()); } catch (Exception ex) { CommonFunctions.ShowErrorDialog("GeneralSettings.UpdateSettingsToNode()", ex); } }
public void UpdateSettingsToNode() { try { XMLFileUtils.SetChildNodeValue(SettingsNode, "MainFormTitle", MainFormTitleText); XMLFileUtils.SetChildNodeValue(SettingsNode, "ReportRowsFromTop", ReportRowsFromTop.ToString()); XMLFileUtils.SetChildNodeValue(SettingsNode, "ReportAppendRowsAtBottom", ReportAppendRowsAtBottom.ToString()); XMLFileUtils.SetChildNodeValue(SettingsNode, "LogoFileName", LogoFileName); XMLFileUtils.SetChildNodeValue(SettingsNode, "LogoImageHeight", LogoImageHeight.ToString()); } catch (Exception ex) { CommonFunctions.ShowErrorDialog("ApplicationSettings.UpdateSettingsToNode()", ex); } }
public static void AddNewProductLine(String Name, Int32 UseSettingsOfProductLineIndex) { try { XmlNode ProductLineNode = ListProductLines[UseSettingsOfProductLineIndex].ProductLineNode.CloneNode(true); ProductLine ObjProductLine = new ProductLine(); XMLFileUtils.SetAttributeValue(ProductLineNode, "Name", Name); ObjProductLine.LoadDetailsFromNode(ProductLineNode); ListProductLines.Add(ObjProductLine); ProductLinesNode.AppendChild(ProductLineNode); } catch (Exception ex) { ShowErrorDialog("CommonFunctions.AddNewProductLine()", ex); } }
public void ReadSettingsFromNode(XmlNode Node) { try { SettingsNode = Node; String Value; if (XMLFileUtils.GetChildNodeValue(SettingsNode, "SummaryLocation", out Value)) { SummaryLocation = Int32.Parse(Value); } } catch (Exception ex) { CommonFunctions.ShowErrorDialog("GeneralSettings.ReadSettingsFromNode()", ex); } }
public static void LoadSettingsFile() { try { if (!File.Exists(SettingsFilePath)) { File.Copy(AppDomain.CurrentDomain.BaseDirectory + @"\Settings.xml", SettingsFilePath, false); } SettingXmlDoc = new XmlDocument(); SettingXmlDoc.Load(SettingsFilePath); XmlNode SettingsNode; XMLFileUtils.GetChildNode(SettingXmlDoc, "Settings", out SettingsNode); XmlNode ApplicationNode; XMLFileUtils.GetChildNode(SettingsNode, "Application", out ApplicationNode); ObjApplicationSettings = new ApplicationSettings(); ObjApplicationSettings.ReadSettingsFromNode(ApplicationNode); ListProductLines.Clear(); XMLFileUtils.GetChildNode(SettingsNode, "ProductLines", out ProductLinesNode); foreach (XmlNode item in ProductLinesNode.ChildNodes) { if (item.NodeType == XmlNodeType.CDATA || item.NodeType == XmlNodeType.Comment) { continue; } ProductLine ObjProductLine = new ProductLine(); if (ObjProductLine.LoadDetailsFromNode(item)) { ListProductLines.Add(ObjProductLine); } } SelectProductLine(SelectedProductLineIndex); SettingXmlDoc.NodeChanged += new XmlNodeChangedEventHandler(SettingXmlDoc_NodeChanged); } catch (Exception ex) { ShowErrorDialog("CommonFunctions.LoadSettingsFile()", ex); } }
public void UpdateSettingsToNode() { try { if (SettingsNode == null) { return; } XMLFileUtils.SetChildNodeValue(SettingsNode, "HeaderTitle", HeaderTitle); XMLFileUtils.SetChildNodeValue(SettingsNode, "HeaderSubTitle", HeaderSubTitle); XMLFileUtils.SetChildNodeValue(SettingsNode, "FooterTitle", FooterTitle); XMLFileUtils.SetChildNodeValue(SettingsNode, "Address", Address); XMLFileUtils.SetChildNodeValue(SettingsNode, "PhoneNumber", PhoneNumber); XMLFileUtils.SetChildNodeValue(SettingsNode, "EMailID", EMailID); XMLFileUtils.SetChildNodeValue(SettingsNode, "VATPercent", VATPercent); XMLFileUtils.SetChildNodeValue(SettingsNode, "TINNumber", TINNumber); XMLFileUtils.SetChildNodeValue(SettingsNode, "GSTINumber", GSTINumber); XMLFileUtils.SetChildNodeValue(SettingsNode, "LastNumber", LastNumber.ToString()); XMLFileUtils.SetChildNodeValue(SettingsNode, "HeaderTitleColor", HeaderTitleColor.ToArgb().ToString()); XMLFileUtils.SetChildNodeValue(SettingsNode, "HeaderSubTitleColor", HeaderSubTitleColor.ToArgb().ToString()); XMLFileUtils.SetChildNodeValue(SettingsNode, "FooterTitleColor", FooterTitleColor.ToArgb().ToString()); XMLFileUtils.SetChildNodeValue(SettingsNode, "FooterTextColor", FooterTextColor.ToArgb().ToString()); XmlNode PastSalesPeriodNode; if (XMLFileUtils.GetChildNode(SettingsNode, "PastSalesPeriod", out PastSalesPeriodNode)) { XMLFileUtils.SetChildNodeValue(PastSalesPeriodNode, "Value", PastSalePeriodValue.ToString()); XMLFileUtils.SetChildNodeValue(PastSalesPeriodNode, "Units", PastSalePeriodUnits.ToString()); } } catch (Exception ex) { CommonFunctions.ShowErrorDialog("ReportSettings.UpdateSettingsToNode()", ex); } }