/// <summary>
        /// 输出xml
        /// </summary>
        /// <param name="stting"></param>
        /// <returns></returns>
        private string ConvertToXml(PecketBookWebSetting model)
        {
            //TODO:转换成xml结构的算法
            //创建一个xml对象
            XmlDocument xmlDoc = new XmlDocument();
            //创建开头
            XmlDeclaration dec = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);

            xmlDoc.AppendChild(dec);
            //创建根节点
            XmlElement root = xmlDoc.CreateElement("Root");

            root.SetAttribute("UseBookComfirm", ConfigConvert.ConvertToString(model.UseBookComfirm));
            root.SetAttribute("UseBookNextDaySeat", ConfigConvert.ConvertToString(model.UseBookNextDaySeat));
            root.SetAttribute("UseBookNowDaySeat", ConfigConvert.ConvertToString(model.UseBookNowDaySeat));
            root.SetAttribute("UseBookSeat", ConfigConvert.ConvertToString(model.UseBookSeat));
            root.SetAttribute("UseCancelBook", ConfigConvert.ConvertToString(model.UseCancelBook));
            root.SetAttribute("UseCancelWait", ConfigConvert.ConvertToString(model.UseCancelWait));
            root.SetAttribute("UseCanLeave", ConfigConvert.ConvertToString(model.UseCanLeave));
            root.SetAttribute("UseComeBack", ConfigConvert.ConvertToString(model.UseComeBack));
            root.SetAttribute("UseContinue", ConfigConvert.ConvertToString(model.UseContinue));
            root.SetAttribute("UseShortLeave", ConfigConvert.ConvertToString(model.UseShortLeave));
            root.SetAttribute("UseWaitSeat", ConfigConvert.ConvertToString(model.UseWaitSeat));
            root.SetAttribute("UseSelectSeat", ConfigConvert.ConvertToString(model.UseSelectSeat));
            root.SetAttribute("UseChangeSeat", ConfigConvert.ConvertToString(model.UseChangeSeat));
            //添加根节点
            xmlDoc.AppendChild(root);
            return(xmlDoc.OuterXml);
        }
Esempio n. 2
0
        /// <summary>
        /// 输出xml
        /// </summary>
        /// <param name="stting"></param>
        /// <returns></returns>
        private string ConvertToXml(MoveWebAppSetting model)
        {
            //TODO:转换成xml结构的算法
            //创建一个xml对象
            XmlDocument xmlDoc = new XmlDocument();
            //创建开头
            XmlDeclaration dec = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);

            xmlDoc.AppendChild(dec);
            //创建根节点
            XmlElement root = xmlDoc.CreateElement("Root");

            root.SetAttribute("IsCanDcodeCheckTime", ConfigConvert.ConvertToString(model.IsCanDcodeCheckTime));
            root.SetAttribute("IsCanDcodeComeBack", ConfigConvert.ConvertToString(model.IsCanDcodeComeBack));
            root.SetAttribute("IsCanDcodeContinueTime", ConfigConvert.ConvertToString(model.IsCanDcodeContinueTime));
            root.SetAttribute("IsCanDcodeLeave", ConfigConvert.ConvertToString(model.IsCanDcodeLeave));
            root.SetAttribute("IsCanDcodeReselectSeat", ConfigConvert.ConvertToString(model.IsCanDcodeReselectSeat));
            root.SetAttribute("IsCanDcodeSelectSeat", ConfigConvert.ConvertToString(model.IsCanDcodeSelectSeat));
            root.SetAttribute("IsCanDcodeShortLeave", ConfigConvert.ConvertToString(model.IsCanDcodeShortLeave));
            root.SetAttribute("IsCanDcodeWaitSeat", ConfigConvert.ConvertToString(model.IsCanDcodeWaitSeat));
            root.SetAttribute("IsCanLeave", ConfigConvert.ConvertToString(model.IsCanLeave));
            root.SetAttribute("IsCanShortLeave", ConfigConvert.ConvertToString(model.IsCanShortLeave));
            root.SetAttribute("IsUseBespeak", ConfigConvert.ConvertToString(model.IsUseBespeak));
            root.SetAttribute("IsUseNextDayBespeak", ConfigConvert.ConvertToString(model.IsUseNextDayBespeak));
            root.SetAttribute("IsUseNowDayBespeak", ConfigConvert.ConvertToString(model.IsUseNowDayBespeak));
            root.SetAttribute("IsUseDcode", ConfigConvert.ConvertToString(model.IsUseDcode));
            //添加根节点
            xmlDoc.AppendChild(root);
            return(xmlDoc.OuterXml);
        }
Esempio n. 3
0
        public static XmlElement ToXmlNode(OftenSeat oftenSeat)
        {
            XmlDocument doc     = new XmlDocument();
            XmlElement  secNode = doc.CreateElement("OftenSeat");

            secNode.InnerText = ConfigConvert.ConvertToString(oftenSeat.Used);
            secNode.SetAttribute("LengthTime", oftenSeat.LengthDays.ToString());
            secNode.SetAttribute("SeatCount", oftenSeat.SeatCount.ToString());
            return(secNode);
        }
Esempio n. 4
0
        public static XmlElement ToXmlNode(POSRestrict set, XmlDocument doc)
        {
            XmlElement secNode = doc.CreateElement("POSRestrict");

            if (set == null)
            {
                set = new POSRestrict()
                {
                    Minutes = 10, Times = 3, IsUsed = true
                };
            }
            secNode.SetAttribute("IsUsed", ConfigConvert.ConvertToString(set.IsUsed));
            secNode.SetAttribute("Minutes", set.Minutes.ToString());
            secNode.SetAttribute("Times", set.Times.ToString());
            return(secNode);
        }
        private static XmlElement ConvertBlacklistSet(BlacklistSetting blacklist)
        {
            XmlElement element = doc.CreateElement("blacklist");

            element.SetAttribute("used", ConfigConvert.ConvertToString(blacklist.Used));
            element.SetAttribute("violateTimes", blacklist.ViolateTimes.ToString());
            element.SetAttribute("limitDays", blacklist.LimitDays.ToString());
            element.SetAttribute("leaveBlacklist", ((int)blacklist.LeaveBlacklist).ToString());
            element.SetAttribute("ViolateFailDays", blacklist.ViolateFailDays.ToString());
            foreach (ViolationRecordsType violateType in blacklist.ViolateRoule.Keys)
            {
                XmlElement child = doc.CreateElement("violateType");
                child.SetAttribute("used", ConfigConvert.ConvertToString(blacklist.ViolateRoule[violateType]));
                child.SetAttribute("typeValue", ((int)violateType).ToString());
                element.AppendChild(child);
            }
            return(element);
        }
Esempio n. 6
0
        public static string Convert(ClientConfig config)
        {
            XmlDocument    doc = new XmlDocument();
            XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);

            doc.AppendChild(dec);
            XmlElement root     = doc.CreateElement("RootNote");
            XmlElement secNode1 = doc.CreateElement("ClientNo");

            secNode1.InnerText = config.ClientNo;
            root.AppendChild(secNode1);
            XmlElement secNode2 = doc.CreateElement("ChooseSeatMothed");

            secNode2.InnerText = ((int)config.SelectMethod).ToString();
            root.AppendChild(secNode2);
            XmlElement secNode3 = doc.CreateElement("Nokeyboard");

            secNode3.InnerText = ConfigConvert.ConvertToString(config.UsingEnterNoForSeat);
            root.AppendChild(secNode3);

            XmlElement secNode4 = doc.CreateElement("OftenSeat");

            secNode4.InnerText = ConfigConvert.ConvertToString(config.UsingOftenUsedSeat.Used);
            secNode4.SetAttribute("LengthTime", config.UsingOftenUsedSeat.LengthDays.ToString());
            secNode4.SetAttribute("SeatCount", config.UsingOftenUsedSeat.SeatCount.ToString());
            root.AppendChild(secNode4);
            XmlElement secNode5 = doc.CreateElement("isPrint");

            secNode5.InnerText = ConfigConvert.ConvertToString(config.UsingPrintSlip);
            root.AppendChild(secNode5);
            XmlElement nodeShowClosedRoom = doc.CreateElement("IsShowClosedRoom");

            nodeShowClosedRoom.InnerText = ConfigConvert.ConvertToString(config.IsShowClosedRoom);
            root.AppendChild(nodeShowClosedRoom);
            XmlElement secNode6 = doc.CreateElement("Activation");

            secNode6.InnerText = ConfigConvert.ConvertToString(config.UsingActiveBespeakSeat);
            root.AppendChild(secNode6);

            XmlElement secNode11 = doc.CreateElement("IsShowInitPOS");

            secNode11.InnerText = ConfigConvert.ConvertToString(config.IsShowInitPOS);
            root.AppendChild(secNode11);

            XmlElement secNode7 = doc.CreateElement("POSRestrict");

            secNode7.SetAttribute("Minutes", config.PosTimes.Minutes.ToString());
            secNode7.SetAttribute("Times", config.PosTimes.Times.ToString());
            secNode7.SetAttribute("IsUsed", ConfigConvert.ConvertToString(config.PosTimes.IsUsed));
            root.AppendChild(secNode7);
            XmlElement secNode8 = doc.CreateElement("AddReadingRoom");

            foreach (string roomNo in config.Rooms)
            {
                XmlElement thirdNode = doc.CreateElement("ReadRoomID");
                thirdNode.InnerText = roomNo;
                secNode8.AppendChild(thirdNode);
            }
            root.AppendChild(secNode8);

            XmlElement secNode9 = doc.CreateElement("img");

            foreach (string elementName in config.BackImgage.Keys)
            {
                XmlElement thirdNode = doc.CreateElement("backgroundimg");
                thirdNode.InnerText = config.BackImgage[elementName];
                thirdNode.SetAttribute("id", elementName);
                secNode9.AppendChild(thirdNode);
            }
            root.AppendChild(secNode9);

            XmlElement secNode10   = doc.CreateElement("Resolution");
            XmlElement thirdNode1  = doc.CreateElement("FormSet");
            XmlElement fourthNode1 = doc.CreateElement("size");

            fourthNode1.SetAttribute("x", config.SystemResoultion.WindowSize.Size.X.ToString());
            fourthNode1.SetAttribute("y", config.SystemResoultion.WindowSize.Size.Y.ToString());
            thirdNode1.AppendChild(fourthNode1);
            XmlElement fourthNode2 = doc.CreateElement("location");

            fourthNode2.SetAttribute("x", config.SystemResoultion.WindowSize.Location.X.ToString());
            fourthNode2.SetAttribute("y", config.SystemResoultion.WindowSize.Location.Y.ToString());
            thirdNode1.AppendChild(fourthNode2);

            secNode10.AppendChild(thirdNode1);
            XmlElement thirdNode2  = doc.CreateElement("TooltipSet");
            XmlElement fourthNode3 = doc.CreateElement("size");

            fourthNode3.SetAttribute("x", config.SystemResoultion.TooltipSize.Size.X.ToString());
            fourthNode3.SetAttribute("y", config.SystemResoultion.TooltipSize.Size.Y.ToString());
            thirdNode2.AppendChild(fourthNode3);
            XmlElement fourthNode4 = doc.CreateElement("location");

            fourthNode4.SetAttribute("x", config.SystemResoultion.TooltipSize.Location.X.ToString());
            fourthNode4.SetAttribute("y", config.SystemResoultion.TooltipSize.Location.Y.ToString());
            thirdNode2.AppendChild(fourthNode4);
            secNode10.AppendChild(thirdNode2);
            root.AppendChild(secNode10);
            doc.AppendChild(root);
            return(doc.OuterXml);
        }
        /// <summary>
        /// 通过座位布局创建Xml
        /// </summary>
        /// <returns></returns>
        public static string CreadSeatXml(SeatLayout seatLayout)
        {
            XmlDocument doc = new XmlDocument();

            try
            {
                //创建开头
                XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
                doc.AppendChild(dec);
                XmlElement Rootelement = doc.CreateElement("seatroot");//最后添加到Doc

                XmlElement SecNode1 = doc.CreateElement("seatinfo");
                //行
                XmlElement ThirdNode1 = doc.CreateElement("rowscount");
                ThirdNode1.InnerText = seatLayout.SeatRow.ToString();
                //列
                XmlElement ThirdNode2 = doc.CreateElement("columscount");
                ThirdNode2.InnerText = seatLayout.SeatCol.ToString();

                //方位
                XmlElement ThirdNode3 = doc.CreateElement("position");
                ThirdNode3.InnerText = seatLayout.Position.ToString();

                XmlElement ThirdNode4 = doc.CreateElement("IsUpdate");
                ThirdNode4.InnerText = seatLayout.IsUpdate.ToString();

                SecNode1.AppendChild(ThirdNode1);
                SecNode1.AppendChild(ThirdNode2);
                SecNode1.AppendChild(ThirdNode3);
                SecNode1.AppendChild(ThirdNode4);

                Rootelement.AppendChild(SecNode1);
                //创建座位节点
                XmlElement SecNode2 = doc.CreateElement("seatdetail");
                foreach (string seatNo in seatLayout.Seats.Keys)
                {
                    XmlElement seatNode = doc.CreateElement("objseat");
                    //   seatNode.SetAttribute("seatno", seatLayout.RoomNo + seatLayout.Seats[seatNo].ShortSeatNo);
                    seatNode.SetAttribute("seatno", seatLayout.Seats[seatNo].SeatNo);
                    seatNode.SetAttribute("haspower", ConfigConvert.ConvertToString(seatLayout.Seats[seatNo].HavePower));
                    seatNode.SetAttribute("isstop", ConfigConvert.ConvertToString(seatLayout.Seats[seatNo].IsSuspended));
                    seatNode.SetAttribute("rownum", seatLayout.Seats[seatNo].PositionY.ToString());
                    seatNode.SetAttribute("colnum", seatLayout.Seats[seatNo].PositionX.ToString());
                    seatNode.SetAttribute("booktype", Convert.ToInt32(seatLayout.Seats[seatNo].CanBeBespeak).ToString());
                    seatNode.SetAttribute("centerx", seatLayout.Seats[seatNo].RotationCenterX.ToString());
                    seatNode.SetAttribute("centery", seatLayout.Seats[seatNo].RotationCenterY.ToString());
                    seatNode.SetAttribute("angle", seatLayout.Seats[seatNo].RotationAngle.ToString());
                    SecNode2.AppendChild(seatNode);
                }
                Rootelement.AppendChild(SecNode2);
                //创建备注节点。。
                XmlElement seatNotes = doc.CreateElement("seatnotes");
                for (int i = 0; i < seatLayout.Notes.Count; i++)
                {
                    XmlElement node = doc.CreateElement("seatnote");
                    node.SetAttribute("strnote", seatLayout.Notes[i].Remark);
                    node.SetAttribute("rownum", seatLayout.Notes[i].PositionY.ToString());
                    node.SetAttribute("colnum", seatLayout.Notes[i].PositionX.ToString());
                    node.SetAttribute("centerx", seatLayout.Notes[i].RotationCenterX.ToString());
                    node.SetAttribute("centery", seatLayout.Notes[i].RotationCenterY.ToString());
                    node.SetAttribute("angle", seatLayout.Notes[i].RotationAngle.ToString());
                    node.SetAttribute("type", ((int)seatLayout.Notes[i].Type).ToString());
                    node.SetAttribute("baseHeight", seatLayout.Notes[i].BaseHeight.ToString());
                    node.SetAttribute("baseWidth", seatLayout.Notes[i].BaseWidth.ToString());
                    seatNotes.AppendChild(node);
                    // throw new Exception("老的构造方法");
                }
                Rootelement.AppendChild(seatNotes);
                doc.AppendChild(Rootelement);
                return(doc.OuterXml);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }