本文整理汇总了C#中Manager.getEmail方法的典型用法代码示例。如果您正苦于以下问题:C# Manager.getEmail方法的具体用法?C# Manager.getEmail怎么用?C# Manager.getEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager.getEmail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Modify
/// <summary>
/// The object that holds the new data.
/// </summary>
/// <param name="admin">The object that holds the data.</param>
/// <returns></returns>
public static bool Modify(Manager.Administrator admin)
{
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+"Administrator.xml");
Navigator = XmlDoc.CreateNavigator();
string ExpXPath = "//Admin";
Nodes = Navigator.Select(Navigator.Compile(ExpXPath));
if (Nodes.Count != 0)
{
/* Encodage des nouvelles données */
Nodes.MoveNext();
Nodes.Current.MoveToFirstAttribute();
//Nodes.Current.MoveToNextAttribute();
//System.Windows.Forms.MessageBox.Show("Current: " + Nodes.Current.Name + " value: " + admin.getLogin());
Nodes.Current.SetValue(admin.getLogin());
Nodes.Current.MoveToNextAttribute();
Nodes.Current.SetValue(admin.getPassword());
Nodes.Current.MoveToParent();
Nodes.Current.MoveToFirstChild();
Nodes.Current.SetValue(admin.getFirstName());
Nodes.Current.MoveToNext(XPathNodeType.Element);
Nodes.Current.SetValue(admin.getLastName());
Nodes.Current.MoveToNext(XPathNodeType.Element);
Nodes.Current.SetValue(admin.getEmail());
Nodes.Current.MoveToNext(XPathNodeType.Element);
Nodes.Current.SetValue(admin.getPhoneNumber());
Nodes.Current.MoveToNext(XPathNodeType.Element);
Nodes.Current.SetValue(admin.getAddress());
Nodes.Current.MoveToNext(XPathNodeType.Element);
Nodes.Current.SetValue(admin.getRole());
Nodes.Current.MoveToNext(XPathNodeType.Element);
Nodes.Current.SetValue(admin.getSpecialty());
//XmlDoc.Save(path+"Administrator.xml");
Program.service.SaveXmlFile("Administrator.xml", XmlDoc);
}
else
{
return false;
}
}
catch (Exception x)
{ return false; }
return true;
}
示例2: Add
/// <summary>
/// Adds an Adminstrator to the Data Base (Administrator.xml).
/// </summary>
/// <param name="admin">Data to insert.</param>
/// <returns></returns>
public static bool Add(Manager.Administrator admin)
{
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("Administrator");
// Write the administrator and the administrator elements
xw.WriteStartElement("Admin");
xw.WriteStartAttribute("login");
xw.WriteString(admin.getLogin());
xw.WriteEndAttribute();
xw.WriteStartAttribute("password");
xw.WriteString(admin.getPassword());
xw.WriteEndAttribute();
//----------------
xw.WriteStartElement("firstName");
xw.WriteString(admin.getFirstName());
xw.WriteEndElement();
//-----------------
xw.WriteStartElement("lastName");
xw.WriteString(admin.getLastName());
xw.WriteEndElement();
//-----------------
xw.WriteStartElement("email");
xw.WriteString(admin.getEmail());
xw.WriteEndElement();
//-----------------
xw.WriteStartElement("phoneNumber");
xw.WriteString(admin.getPhoneNumber());
xw.WriteEndElement();
//-----------------
xw.WriteStartElement("address");
xw.WriteString(admin.getAddress());
xw.WriteEndElement();
//-----------------
xw.WriteStartElement("role");
xw.WriteString(admin.getRole());
xw.WriteEndElement();
//-----------------
xw.WriteStartElement("specialty");
xw.WriteString(admin.getSpecialty());
xw.WriteEndElement();
//-----------------
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 + "Administrator.xml", xmlOutput);
Program.service.CreateXmlFile("Administrator.xml", xmlOutput);
}
catch (Exception x) { return false; }
return true;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}