Example #1
0
        /// <summary>
        /// загрузка из файла старого формата
        /// </summary>
        /// <param name="curnode"></param>
        /// <param name="par"></param>
        /// <param name="curVer"></param>
        /// <returns></returns>
        private static DataRecept LoadFromXmlVer0(XmlNode curnode, DataBase par, ReceptVersion curVer)
        {
            DataRecept curRec = new DataRecept(par);

            curRec.BeginUpdate();
            XmlNode rootNode = curnode.SelectSingleNode("recept");

            foreach (XmlNode props in rootNode.ChildNodes)
            {
                switch (props.Name)
                {
                case "name": curRec.Name = props.InnerText; break;

                case "number": curRec.Id = int.Parse(props.InnerText, CultureInfo.CurrentCulture); break;

                case "water": curRec._water = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture); break;

                case "deflect": { curRec._waterPlus  = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture);
                                  curRec._waterMinus = curRec._waterPlus; break; }

                case "description": curRec._design = props.InnerText; break;

                case "poteri": curRec._totalLoss = DataTotalLoss.LoadFromXml(props, curRec, curVer); break;

                case "component": curRec.Components.Add(DataRaw.LoadOneFromXml(props, curRec, curVer)); break;
                }
            }
            curRec.IsChanged = false;
            curRec.EndUpdate(false);
            return(curRec);
        }
Example #2
0
        /// <summary>
        /// загрузка файла версии программы "2"
        /// </summary>
        /// <param name="curnode">узел дерева XML</param>
        /// <param name="par">родительский объект</param>
        /// <returns>структуру данных рецептуры</returns>
        private static DataRecept LoadFromXmlVer1(XmlNode curnode, DataBase par, ReceptVersion curVer)
        {
            DataRecept curRec = new DataRecept(par);

            curRec.BeginUpdate();
            curRec.Id = int.Parse(curnode.Attributes["id"].Value, CultureInfo.CurrentCulture);
            foreach (XmlNode props in curnode.ChildNodes)
            {
                switch (props.Name)
                {
                case "color": curRec._color = props.InnerText; break;

                case "components": curRec.Components.AddRange(DataRaw.LoadManyFromXml(props, curRec, curVer)); break;

                case "consistence": curRec._consistence = props.InnerText; break;

                case "delivery": curRec._delivery = props.InnerText; break;

                case "design": curRec._design = props.InnerText; break;

                case "extView": curRec._extView = props.InnerText; break;

                case "totalLoss": curRec._totalLoss = DataTotalLoss.LoadFromXml(props, curRec, curVer); break;

                case "process": curRec._process = props.InnerText; break;

                case "sale": curRec._sale = props.InnerText; break;

                case "storage": curRec._storage = props.InnerText; break;

                case "taste": curRec._taste = props.InnerText; break;

                case "water": curRec._water = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture); break;

                case "waterPlus": curRec._waterPlus = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture); break;

                case "waterMinus": curRec._waterMinus = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture); break;

                case "acidity": curRec.myAcidity = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture); break;

                case "name": curRec.Name = props.InnerText; break;

                case "source": curRec._source = props.InnerText; break;

                case "normativDoc": curRec._normativDoc = props.InnerText; break;

                case "preview": curRec._preview = props.InnerText; break;

                case "quantity": curRec.Quantity = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture); break;

                case "totalExit": curRec.myTotalExit = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture); break;

                case "countExit": curRec.myCountExit = Convert.ToDecimal(props.InnerText, CultureInfo.CurrentCulture); break;

                case "microbiology": curRec.myMicroBiology = DataMicroBiology.LoadFromXml(props, curRec, curVer); break;

                case "isCalcExit": curRec.myIsCalcExit = Convert.ToBoolean(props.InnerText, CultureInfo.CurrentCulture); break;

                case "isCalcWater": curRec.myIsCalcWater = Convert.ToBoolean(props.InnerText, CultureInfo.CurrentCulture); break;

                case "isSetWater": curRec.myIsSetWater = Convert.ToBoolean(props.InnerText, CultureInfo.CurrentCulture); break;
                }
            }
            curRec.IsChanged = false;
            curRec.EndUpdate(false);
            return(curRec);
        }