function Person(oInit) {
this.Clear();
if (typeof oInit === "object") { this.Init(oInit); }
this.Init(oInit)
}
Person.sId = "Party";
Person.sColor = "#00f";
Person.sIcon = "../img/user_suit.png";
Person.prototype.Clear = function () {
this.nkPer = 0;
this.rvPer = 0;
this.sPerLNm = "";
this.sPerEml = "";
};
Person.prototype.Init = function (oInit) {
if (typeof oInit === "undefined") oInit = { nkPer: 0, sPerLNm: "" };
this.Ini = function (sFld) { if (typeof oInit[sFld] !== "undefined") this[sFld] = oInit[sFld]; };
this.Ini("nkPer");
this.Ini("sPerLNm");
this.Ini("sPerEml");
};
Person.prototype.SerializeAll = function () {
return oS.FR +
oS.Ser.Int(this.nkPer) + oS.DELIM +
oS.Ser.Ser(this.sPerLNm) + oS.DELIM +
oS.Ser.Ser(this.sPerEml) +
oS.TO;
};
Person.prototype.DeserializeAll = function (sSer) {
var Vals = oS.Split(sSer);
var nFld = 0;
this.nkPer = oS.Des.Int(Vals[nFld++]);
this.sPerLNm = oS.De.Str(Vals[nFld++]);
this.sPerEml = oS.De.Str(Vals[nFld++]);
return this;
};
Person.prototype.Serialize = function () {
return oS.FR +
oS.Ser.Int(this.nkPer) + oS.DELIM +
oS.Ser.Str(this.sPerLNm) + oS.DELIM +
oS.Ser.Str(this.sPerEml) +
oS.TO;
};
Person.prototype.Deserialize = function (sSer) {
var Vals = oS.Split(sSer);
var nFld = 0;
this.nkPer = oS.Des.Int(Vals[nFld++]);
this.sPerLNm = oS.De.Str(Vals[nFld++]);
this.sPerEml = oS.De.Str(Vals[nFld++]);
return this;
};
Person.prototype.Clone = function () {
var o = new this.constructor();
o.Copy(this);
return o;
};
Person.prototype.Copy = function (o) {
this.nkPer = o.nkPer;
this.sPerLNm = o.sPerLNm;
this.sPerEml = o.sPerEml;
return this;
};
Party.prototype.CopyTo = function (o) {
o.Copy(this);
return this;
};
Party.prototype.IsEqual = function (o) {
return (
this.sPerLNm === o.sPerLNm
&& this.sPerEml===osPerEml
);
};
Person.prototype.Check = function () {
var oEr = { bOK: true, nkPer: [], sPerLNm: [], sPerEml:[] };
if (this.sPerLNm < 0)
oEr.sPerLNm.push(ins.Msg("Enter Person's name"));
oEr.bOK = (
oEr.nkPer.length === 0 &&
oEr.sPerLNm.length === 0 &&
oEr.sPerEml.length === 0);
return oEr;
};
ins.Msgs.push(
{ "Surname": ["Επώνυμο"] },
{ "Name": ["Ονομα"] },
{ "Phone": ["Τηλέφωνο"] },
{ "Mobile": ["Κινητό"] },
{ "email": ["Ηλ.Ταχυδρομείο"] },
{ "tel": ["τηλ"] },
{ "mob": ["κιν"] }
);
Javascript Class Template
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment