Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        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);
            }
        }