using
System;
using
System.Collections;
using
System.Web.Services;
using
EXDb97;
// ###3
namespace
EPol
{
/// <summary>
/// Summary description for WebService1.
/// </summary>
[WebService(Namespace="http://localhost/epolws/",
Description="This is Epol WebService.")]
public class
EPolWebService: WebService
{
public EPolWebService()
{
m_oProfileTable=
new CProfileTable( PROD_DATABASE);
m_oMemeView =
null;
m_dSubIndex = m_dProfileIndex = CDbEPBase.NOT_USED;
}
[WebMethod]
public bool
bCheckLogin(string sLogin)
{
return m_oProfileTable.bIsUserExist(sLogin);
}
[WebMethod]
public bool
bCheckPassword(string sLogin, string sPassword, int dLanguage)
{
m_dProfileIndex = m_oProfileTable.dGetProfileIndex( sLogin, sPassword,
out m_dSubIndex);
if ( CDbEPBase.IsUsed(m_dProfileIndex) )
{
m_oMemeView =
new CMemeView(sLogin, sPassword, PROD_DATABASE, (CDbEPBase.ENLanguage)dLanguage);
}
return CDbEPBase.IsUsed(m_dProfileIndex);
}
[WebMethod]
public bool
bSetPassword(string sLogin, string sPassword1, string sPassword2, int dLanguage)
{
if ( sPassword1 == sPassword2)
{
m_dProfileIndex = m_oProfileTable.dAddProfile(sLogin, sPassword1, dLanguage);
}
return CDbEPBase.IsUsed(m_dProfileIndex);
}
[WebMethod(EnableSession=
true)]
public bool
bIsLocked(string sLoginID)
{
if (Session["nLoginTried"] == null)
{
Session["nLoginTried"] = 1;
}
else
{
Session["nLoginTried"] = ((
int) Session["nLoginTried"]) + 1;
}
if ( (int)Session["nLoginTried"]
>=5 )
{
return true;
}
return false;
}
[WebMethod]
public bool
bSetAttribute(string sAttributeName, object sAttributeValue)
{
return m_oProfileTable.bAddAttribute(m_dProfileIndex, m_dSubIndex,
sAttributeName, sAttributeValue);
}
[WebMethod]
public void
AddAvatar(string sUsedId, int nDefaultLanguage)
{
m_oProfileTable.bAddAvatar(sUsedId, m_dProfileIndex, m_dSubIndex, nDefaultLanguage);
}
protected CProfileTable m_oProfileTable;
protected CMemeView m_oMemeView;
protected int
m_dProfileIndex, m_dSubIndex;
public const
string PROD_DATABASE = "PROD_DATABASE";
public class
CCommandName
{
public CCommandName()
{
bAutoCommit =
false;
}
public string
sName;
public char
cShortName;
public bool
bAutoCommit;
}
[WebMethod(CacheDuration = 600,
Description="Returns the array of supported command name")]
public CCommandName[] GetCommandNameArray()
{
ArrayList oCommandArray =
new ArrayList();
CCommandName oCommandName =
new CCommandName();
oCommandName.sName = "create";
oCommandName.cShortName = 'c';
oCommandArray.Add(oCommandName);
oCommandName.sName = "list";
oCommandName.cShortName = 'l';
oCommandName.bAutoCommit =
true;
oCommandArray.Add(oCommandName);
oCommandName.sName = "move";
oCommandName.cShortName = 'c';
oCommandName.bAutoCommit =
true;
oCommandArray.Add(oCommandName);
oCommandName.sName = "order";
oCommandName.cShortName = 'o';
oCommandArray.Add(oCommandName);
oCommandName.sName = "commit";
oCommandName.cShortName = 'y';
oCommandName.bAutoCommit =
true;
oCommandArray.Add(oCommandName);
oCommandName.sName = "rollback";
oCommandName.cShortName = 'n';
oCommandName.bAutoCommit =
true;
oCommandArray.Add(oCommandName);
oCommandName.sName = "open";
oCommandName.cShortName = 'o';
oCommandName.bAutoCommit =
true;
oCommandArray.Add(oCommandName);
oCommandName.sName = "delete";
oCommandName.cShortName = 'd';
oCommandArray.Add(oCommandName);
oCommandName.sName = "help";
oCommandName.cShortName = 'h';
oCommandName.bAutoCommit =
true;
oCommandArray.Add(oCommandName);
return ( CCommandName[])oCommandArray.ToArray(typeof(CCommandName));
}
/*
[WebMethod(CacheDuration = 600,
Description="Returns the array of supported properties")]
public int[] GetAgglomeration()
{
ArrayList oAgglomerationArray = new ArrayList();
int dAgglomeration = new int();
dAgglomeration = N.CONSTITUTIONAL_RULES;
oAgglomerationArray.Add(Agglomeration);
return ( int[])oAgglomerationArray.ToArray(typeof(int));
}
*/
public struct
N
{
public const
char STRING_TYPE = 's';
public const
char CLASS_TYPE = 'c';
public const
char INSTANCE_TYPE = 'i';
public const
char META_CLASS_TYPE = 'm';
public const
int NONE = 0;
public const
int AGENT = 1;
public const
int ORGANISATION = 2;
public const
int AVATAR = 3;
public const
int PROFILE = 4;
public const
int NON_PHYSIC_AVATAR = 5;
public const
int GODS = 6;
public const
int PAGAN_IDOLE = 7;
public const
int JEHOVAT = 8;
public const
int HISTORIC_PERSON = 9;
public const
int PUBLIC_PERSON = 10;
public const
int BIBLIC_PROPHET = 11;
public const
int CATEGORY = 12;
public const
int TRACTATION = 13;
public const
int OBJECTIVE = 14;
public const
int RULE = 15;
public const
int PHYSICAL_RULE = 16;
public const
int SELF_ETHIC = 17;
public const
int CONSTRAINT = 18;
public const
int ACTION = 19;
public const
int MARKETING = 20;
public const
int INDIVIDUAL_POSITION = 21;
public const
int RESSOURCE = 22;
public const
int ASSET_LIQUID_SELLABLE = 23;
public const
int PERSONAL_AVAILABLE_TIME = 24;
public const
int DIRECT_TAXATION = 25;
public const
int INDIRECT_TAXATION = 26;
public const
int CIVIL_SERVANT_TIME = 27;
public const
int TIME_PERIOD = 28;
public const
int CURRENT_YEAR = 29;
public const
int FUTURE_YEAR = 30;
public const
int PAST_YEAR = 31;
public const
int LOCATION = 32;
public const
int WORLD = 33;
public const
int COUNTRY = 34;
public const
int REGION = 35;
public const
int CITY = 36;
public const
int DISTRICT = 37;
public const
int PROSPECT = 38;
public const
int FACT = 39;
public const
int OPPOSITION_FACT = 40;
public const
int MANAGEMENT_TEAM = 41;
public const
int MANAGEMENT_PRIVATE_COMPANY = 42;
public const
int GOVERMENT_STATE = 43;
public const
int ORGANIC_RULE = 44;
public const
int ASSIGMENT = 45;
public const
int RIGHT_TO_REACT = 46;
};
public class
CEntityName
{
public CEntityName()
{
dEntityParent = N.NONE;
cType=N.CLASS_TYPE;
sPropertiesList = "";
sAnwersList = "";
}
public int
dName;
public int
dEntityParent;
public string
sHelp;
public char
cType;
public string
sHasList;
public string
sHasSetOfList;
public string
sPropertiesList;
public string
sAnwersList;
}
public CEntityName[] GetEntityNameArray()
{
ArrayList oEntityNameArray =
new ArrayList();
CEntityName oEntityName =
new CEntityName();
//////////// HUMAN BEING
oEntityName.dName = N.AGENT;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.AVATAR;
oEntityName.dEntityParent = N.AGENT;
oEntityName.cType = N.CLASS_TYPE;
oEntityName.sHelp = "An avatar has restricted access to the information of your profile.\nThe avatar can have a restricted
display right of his father avatar. A normal avatar is created by the user.";
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.PROFILE;
oEntityName.dEntityParent = N.AVATAR;
oEntityName.cType = N.CLASS_TYPE;
oEntityName.sHelp = "The profile is the root avatar and it has all accesses. The connection to a profile should be done
with a password.";
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.PROSPECT;
oEntityName.dEntityParent = N.AVATAR;
oEntityName.sHelp = "A prospect is a non register avatar. A prospect is created by a friend in order to join a cause.";
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.NON_PHYSIC_AVATAR;
oEntityName.dEntityParent = N.AVATAR;
oEntityName.sHelp = "An idole is a non existing avatar with an autority.";
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.GODS;
oEntityName.dEntityParent = N.NON_PHYSIC_AVATAR;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.PAGAN_IDOLE;
oEntityName.dEntityParent = N.GODS;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.JEHOVAT;
oEntityName.dEntityParent = N.GODS;
oEntityName.cType = N.INSTANCE_TYPE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.HISTORIC_PERSON;
oEntityName.dEntityParent = N.NON_PHYSIC_AVATAR;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.PUBLIC_PERSON;
oEntityName.dEntityParent = N.AVATAR;
oEntityName.sHelp = "A public person is an individual who has a mediatic access for politic purpose.";
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.BIBLIC_PROPHET;
oEntityName.dEntityParent = N.NON_PHYSIC_AVATAR;
oEntityNameArray.Add(oEntityName);
//////////// ORGANISATION
oEntityName.dName = N.MANAGEMENT_TEAM;
oEntityName.dEntityParent = N.ORGANISATION;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.GOVERMENT_STATE;
oEntityName.dEntityParent = N.MANAGEMENT_TEAM;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.ORGANISATION;
oEntityName.sHasSetOfList = N.INDIVIDUAL_POSITION + " " + N.ORGANIC_RULE;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
//////////// CATEGORY
oEntityName.dName = N.CATEGORY;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
//////////// TRACTATION
oEntityName.dName = N.TRACTATION;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
//////////// OBJECTIVE
oEntityName.dName = N.OBJECTIVE;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
//////////// RULE
oEntityName.dName = N.RULE;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.PHYSICAL_RULE;
oEntityName.dEntityParent = N.RULE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.SELF_ETHIC;
oEntityName.dEntityParent = N.RULE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.CONSTRAINT;
oEntityName.dEntityParent = N.SELF_ETHIC;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.ORGANIC_RULE;
oEntityName.dEntityParent = N.RULE;
oEntityNameArray.Add(oEntityName);
//////////// ACTION
oEntityName.dName = N.ACTION;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
//////////// MARKETING
oEntityName.dName = N.MARKETING;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
//////////// RESPONSABILITY
oEntityName.dName = N.INDIVIDUAL_POSITION;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityName.sHasSetOfList = N.ASSIGMENT + " " + N.RIGHT_TO_REACT;
oEntityNameArray.Add(oEntityName);
//////////// RESSOURCE
oEntityName.dName = N.RESSOURCE;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.ASSET_LIQUID_SELLABLE;
oEntityName.dEntityParent = N.RESSOURCE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.PERSONAL_AVAILABLE_TIME;
oEntityName.dEntityParent = N.RESSOURCE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.DIRECT_TAXATION;
oEntityName.dEntityParent = N.RESSOURCE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.INDIRECT_TAXATION;
oEntityName.dEntityParent = N.RESSOURCE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.CIVIL_SERVANT_TIME;
oEntityName.dEntityParent = N.RESSOURCE;
oEntityNameArray.Add(oEntityName);
//////////// TIME
oEntityName.dName = N.TIME_PERIOD;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.CURRENT_YEAR;
oEntityName.dEntityParent = N.TIME_PERIOD;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.FUTURE_YEAR;
oEntityName.dEntityParent = N.TIME_PERIOD;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.PAST_YEAR;
oEntityName.dEntityParent = N.TIME_PERIOD;
oEntityNameArray.Add(oEntityName);
//////////// LOCATION
oEntityName.dName = N.LOCATION;
oEntityName.cType = N.META_CLASS_TYPE;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.WORLD;
oEntityName.dEntityParent = N.LOCATION;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.COUNTRY;
oEntityName.dEntityParent = N.WORLD;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.REGION;
oEntityName.dEntityParent = N.COUNTRY;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.CITY;
oEntityName.dEntityParent = N.REGION;
oEntityNameArray.Add(oEntityName);
oEntityName.dName = N.DISTRICT;
oEntityName.dEntityParent = N.CITY;
oEntityNameArray.Add(oEntityName);
////////////////////////////////////////////////////////////////////////////////////////////////
return ( CEntityName[])oEntityNameArray.ToArray(typeof(CEntityName));
}
public class
CCommand
{
public CCommand() {
dTargetEntity= N.NONE;
sHelp = "";
}
public char
cCommand;
public int
dEntity;
public int
dTargetEntity;
public string
sHelp;
}
[WebMethod(CacheDuration = 600,
Description="Returns the array of supported command")]
public CCommand[] GetCommandArray()
{
ArrayList oCommandArray =
new ArrayList();
CCommand oCommand =
new CCommand();
////////////// AVATAR
oCommand.cCommand = 'c';
oCommand.dEntity = N.AVATAR;
oCommand.sHelp = "Create a user id with a resicted access to the information of your profile.\nThe avatar can have a restricted
display right of his father avatar.";
oCommandArray.Add(oCommand);
oCommand.cCommand = 'm';
oCommand.dEntity = N.AVATAR;
oCommandArray.Add(oCommand);
return ( CCommand[])oCommandArray.ToArray(typeof(CCommand));
}
}
}