当前位置: 首页>>代码示例>>C#>>正文


C# Manager.getStatus方法代码示例

本文整理汇总了C#中Manager.getStatus方法的典型用法代码示例。如果您正苦于以下问题:C# Manager.getStatus方法的具体用法?C# Manager.getStatus怎么用?C# Manager.getStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Manager的用法示例。


在下文中一共展示了Manager.getStatus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: firstAdd

        /// <summary>
        /// Creates the file "Experts.xml" and inserts the first Expert to it.
        /// </summary>
        /// <param name="expert">The object holding the data.</param>
        /// <returns></returns>
        public static bool firstAdd(Manager.ExpertManager.Expert expert)
        {
            try
            {
                XmlWriterSettings wSettings = new XmlWriterSettings();
                wSettings.Indent = true;
                MemoryStream ms = new MemoryStream();
                XmlWriter xw = XmlWriter.Create(ms, wSettings);// Write Declaration
                xw.WriteStartDocument();

                // Write the root node
                xw.WriteStartElement("Experts");

                // Write the expert and the expert elements
                xw.WriteStartElement("Expert");

                xw.WriteStartAttribute("id");
                xw.WriteString("0");
                xw.WriteEndAttribute();

                xw.WriteStartAttribute("login");
                xw.WriteString(expert.getLogin());
                xw.WriteEndAttribute();

                xw.WriteStartAttribute("password");
                xw.WriteString(expert.getPassword());
                xw.WriteEndAttribute();
                //----------------
                xw.WriteStartElement("firstName");
                xw.WriteString(expert.getFirstName());
                xw.WriteEndElement();
                //-----------------
                xw.WriteStartElement("lastName");
                xw.WriteString(expert.getLastName());
                xw.WriteEndElement();
                //-----------------
                xw.WriteStartElement("email");
                xw.WriteString(expert.getEmail());
                xw.WriteEndElement();
                //-----------------
                xw.WriteStartElement("phoneNumber");
                xw.WriteString(expert.getPhoneNumber());
                xw.WriteEndElement();
                //-----------------
                xw.WriteStartElement("address");
                xw.WriteString(expert.getAddress());
                xw.WriteEndElement();
                //-----------------
                xw.WriteStartElement("role");
                xw.WriteString(expert.getRole());
                xw.WriteEndElement();
                //-----------------
                xw.WriteStartElement("specialty");
                xw.WriteString(expert.getSpecialty());
                xw.WriteEndElement();
                //-----------------
                xw.WriteStartElement("status");
                xw.WriteString(expert.getStatus().ToString());
                xw.WriteEndElement();
                //-----------------

                xw.WriteEndElement();

                xw.WriteStartElement("MaxID");
                xw.WriteString("0");
                xw.WriteEndElement();

                // Close the document
                xw.WriteEndDocument();

                // Flush the write
                xw.Flush();

                Byte[] buffer = new Byte[ms.Length];
                buffer = ms.ToArray();
                string xmlOutput = System.Text.Encoding.UTF8.GetString(buffer);

                //File.WriteAllText(path+"Experts.xml", xmlOutput);
                Helper.service.CreateXmlFile("Experts.xml", xmlOutput);
            }
            catch (Exception x) { return false; }
            return true;
        }
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:88,代码来源:XMLExpert.cs

示例2: insert

        /// <summary>
        /// inserts an Expert to "Experts.xml".
        /// </summary>
        /// <param name="expert">The object holding the data</param>
        /// <returns></returns>
        public static bool insert(Manager.ExpertManager.Expert expert)
        {
            try
            {
                XmlDocument XmlDoc = new XmlDocument();
                XPathNavigator Navigator;
                XPathNodeIterator Nodes;
                Int32 ID; /* Variable utilisée pour savoir quel est l'ID qu'il faut affecter au nouveau
                       * noeud créé */
                string rslt = Helper.service.LoadFile("Experts.xml").ToString();

                StreamWriter sw = new StreamWriter(System.Windows.Forms.Application.StartupPath + "\\temp.xml");
                sw.Write(rslt);
                sw.Close();

                XmlDoc.Load(System.Windows.Forms.Application.StartupPath + "\\temp.xml");

                Navigator = XmlDoc.CreateNavigator();
                /* Recherche du noeud MaxID pour déterminer quelle sera l'ID du nouveau
                 * expert. */
                string ExpXPath = "//MaxID";
                Nodes = Navigator.Select(Navigator.Compile(ExpXPath));
                Nodes.MoveNext();
                /* On place l'ID le plus élevé du document dans la variable ID */
                ID = Nodes.Current.ValueAsInt;
                /* On incrémente la valeur du noeud MaxID car une fois notre nouveau noeud
                 * créé, l'ID le plus élevé du document sera aussi incrémenté */
                Nodes.Current.SetValue((ID + 1).ToString());
                /* On se place sur le noeud ayant l'ID le plus élevé */
                ExpXPath = "//Expert[@id='" + ID.ToString() + "']";
                Nodes = Navigator.Select(Navigator.Compile(ExpXPath));
                if (Nodes.Count != 0)
                {
                    Nodes.MoveNext();
                    /* On crée le noeud principal (Client). */
                    Nodes.Current.InsertElementAfter("", "Expert", "", "");
                    /* On se place sur le noeud ainsi créé. */
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    ID++; /* On incrémente ID pour que sa valeur soit identique à celle se
                       * trouvant dans le noeud MaxID. */
                    /* Encodage des données */
                    Nodes.Current.CreateAttribute("", "id", "", ID.ToString());
                    Nodes.Current.CreateAttribute("", "login", "", expert.getLogin());
                    Nodes.Current.CreateAttribute("", "password", "", expert.getPassword());
                    Nodes.Current.AppendChildElement("", "firstName", "", expert.getFirstName());
                    Nodes.Current.AppendChildElement("", "lastName", "", expert.getLastName());
                    Nodes.Current.AppendChildElement("", "email", "", expert.getEmail());
                    Nodes.Current.AppendChildElement("", "phoneNumber", "", expert.getPhoneNumber());
                    Nodes.Current.AppendChildElement("", "address", "", expert.getAddress());
                    Nodes.Current.AppendChildElement("", "role", "", expert.getRole());
                    Nodes.Current.AppendChildElement("", "specialty", "", expert.getSpecialty());
                    Nodes.Current.AppendChildElement("", "status", "", expert.getStatus().ToString());

                    //XmlDoc.Save(path+"Experts.xml");
                    Helper.service.SaveXmlFile("Experts.xml",XmlDoc);
                }
                else
                {
                    return false;
                }
            }
            catch (Exception x) { return false; }
            return true;
        }
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:69,代码来源:XMLExpert.cs

示例3: Modify

        /// <summary>
        /// Modifies the Expert Data.
        /// </summary>
        /// <param name="login">The login of the target Expert object.</param>
        /// <param name="admin">The object that holds the new data.</param>
        /// <returns></returns>
        public static bool Modify(string login, Manager.ExpertManager.Expert expert)
        {
            //System.Windows.Forms.MessageBox.Show(expert.getFirstName(),"XMLExpert");
            try
            {
                /* On utilise un XmlDocument et non un XPathDocument car ce dernier ne permet
            * pas l'édition des données XML. */
                XmlDocument XmlDoc = new XmlDocument();
                XPathNavigator Navigator;
                XPathNodeIterator Nodes;
                string rslt = Helper.service.LoadFile("Experts.xml").ToString();

                StreamWriter sw = new StreamWriter(System.Windows.Forms.Application.StartupPath + "\\temp.xml");
                sw.Write(rslt);
                sw.Close();

                XmlDoc.Load(System.Windows.Forms.Application.StartupPath + "\\temp.xml");
                Navigator = XmlDoc.CreateNavigator();
                string ExpXPath = "//Expert[@login='" + login + "']";
                Nodes = Navigator.Select(Navigator.Compile(ExpXPath));
                if (Nodes.Count != 0)
                {
                    /* Encodage des nouvelles données */
                    Nodes.MoveNext();
                    Nodes.Current.MoveToFirstAttribute();
                    Nodes.Current.MoveToNextAttribute();
                    Nodes.Current.SetValue(expert.getLogin());
                    Nodes.Current.MoveToNextAttribute();
                    Nodes.Current.SetValue(expert.getPassword());
                    Nodes.Current.MoveToParent();

                    Nodes.Current.MoveToFirstChild();
                    //System.Windows.Forms.MessageBox.Show(Nodes.Current.Name.ToString() + " | " + Nodes.Current.Value.ToString());
                    Nodes.Current.SetValue(expert.getFirstName());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(expert.getLastName());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(expert.getEmail());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(expert.getPhoneNumber());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(expert.getAddress());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(expert.getRole());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(expert.getSpecialty());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(expert.getStatus().ToString());
                    //XmlDoc.Save(path+"Experts.xml");
                    Helper.service.SaveXmlFile("Experts.xml", XmlDoc);
                }
                else
                {
                    return false;
                }
            }
            catch (Exception x)
            { return false; }
            return true;
        }
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:66,代码来源:XMLExpert.cs

示例4: Modify

        /// <summary>
        /// Modifies the technician Data.
        /// </summary>
        /// <param name="login">The login of the target technician object.</param>
        /// <param name="admin">The object that holds the new data.</param>
        /// <returns></returns>
        public static bool Modify(string login, Manager.Technician technician)
        {
            try
            {
                /* On utilise un XmlDocument et non un XPathDocument car ce dernier ne permet
            * pas l'édition des données XML. */
                XmlDocument XmlDoc = new XmlDocument();
                XPathNavigator Navigator;
                XPathNodeIterator Nodes;
                XmlDoc.Load(path+"Technicians.xml");
                Navigator = XmlDoc.CreateNavigator();
                string ExpXPath = "//Technician[@login='" + login + "']";
                Nodes = Navigator.Select(Navigator.Compile(ExpXPath));
                if (Nodes.Count != 0)
                {
                    /* Encodage des nouvelles données */
                    Nodes.MoveNext();
                    Nodes.Current.MoveToFirstAttribute();
                    Nodes.Current.MoveToNextAttribute();
                    Nodes.Current.SetValue(technician.getLogin());
                    Nodes.Current.MoveToNextAttribute();
                    Nodes.Current.SetValue(technician.getPassword());
                    Nodes.Current.MoveToParent();

                    Nodes.Current.MoveToFirstChild();
                    Nodes.Current.SetValue(technician.getFirstName());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(technician.getLastName());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(technician.getEmail());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(technician.getPhoneNumber());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(technician.getAddress());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(technician.getRole());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(technician.getSpecialty());
                    Nodes.Current.MoveToNext(XPathNodeType.Element);
                    Nodes.Current.SetValue(technician.getStatus().ToString());
                    //XmlDoc.Save(path+"Technicians.xml");
                    Program.service.SaveXmlFile("Technicians.xml", XmlDoc);
                }
                else
                {
                    return false;
                }
            }
            catch (Exception x)
            { return false; }
            return true;
        }
开发者ID:walidBelfadel,项目名称:MARS_project,代码行数:58,代码来源:XMLTechnician.cs


注:本文中的Manager.getStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。