E
Esraa Saeed
Guest
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace files_4
{
public class Coulmns
{
public int index_forign { set; get; }
dynamic DataType;
List<dynamic> Values = new List<dynamic>();
[XmlAttribute("DataType")]
public string dataTypeName { set; get; }
[XmlAttribute("Constrain")]
public string constrain { set; get; }
[XmlElement]
public string nameColm { set; get; }
[XmlIgnore]
public int numOfConstrain { set; get; }
[XmlIgnore]
public bool HadConstrain{set;get;}
[XmlIgnore]
public string CharOfConstrain { set; get; }
[XmlIgnore]
public bool allow { set; get; }
public void set_dataType(string dataType)
{
this.dataTypeName = dataType;
switch (dataType)
{
case "int":
{ this.DataType = 8; }
break;
case "string":
{ this.DataType = ""; }
break;
case "float":
{ this.DataType = 5.5; }
break;
case "double":
{ this.DataType = 5.5; }
break;
default:
this.DataType = "";
break;
}
}
public void convert_add_Value(string texttag) //if not achieve the constrain will add null as String
{
if (HadConstrain == true)
{
int Intvalue = Convert.ToInt32(texttag);
if (achieve_Constrain(Intvalue))
{
Values.Add(Intvalue);
}
else { Values.Add("Null"); }
}
else
{
switch (this.dataTypeName)
{
case "int":
{ Values.Add(Convert.ToInt32(texttag)); }
break;
case "string":
{ Values.Add(texttag); }
break;
case "float":
{ Values.Add(Convert.ToDouble(texttag)); }
break;
case "double":
{ Values.Add(Convert.ToDouble(texttag)); }
break;
default:
Values.Add(texttag);
break;
}
}
}
public void setConstrain(string numberTxt, string charConstrain)
{
this.HadConstrain = true;
this.numOfConstrain = Convert.ToInt32(numberTxt);
this.CharOfConstrain = charConstrain;
constrain = numberTxt + charConstrain;
}
private bool achieve_Constrain(int num) //used in addvalue function
{
if (HadConstrain == true)
{
switch (CharOfConstrain)
{
case ">":
{ if (num > numOfConstrain) { return true; } else { return false; } }
break;
case ">=":
{ if (num >= numOfConstrain) { return true; } else { return false; } }
break;
case "<":
{ if (num < numOfConstrain) { return true; } else { return false; } }
break;
case "<=":
{ if (num <= numOfConstrain) { return true; } else { return false; } }
break;
case "=": { if (num == numOfConstrain) { return true; } else { return false; } }
default:
return false;
break;
}
}
else { return false; }
}
}
public class TableC
{
public string index_prim { set; get; }
public string name_table { get; set; }
public Dictionary<string, Coulmns> coluoms { get; set; }
public TableC()
{
coluoms = new Dictionary<string, Coulmns>(); }
public void set_name(string name)
{
this.name_table = name;
}
}
class Data_base
{
public string Data_base_Name { set; get; }
public Dictionary<string, TableC> tables { set; get; }
public Data_base(string name_dataBase)
{
this.Data_base_Name = name_dataBase;
tables = new Dictionary<string, TableC>();
}
}
}
Continue reading...
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace files_4
{
public class Coulmns
{
public int index_forign { set; get; }
dynamic DataType;
List<dynamic> Values = new List<dynamic>();
[XmlAttribute("DataType")]
public string dataTypeName { set; get; }
[XmlAttribute("Constrain")]
public string constrain { set; get; }
[XmlElement]
public string nameColm { set; get; }
[XmlIgnore]
public int numOfConstrain { set; get; }
[XmlIgnore]
public bool HadConstrain{set;get;}
[XmlIgnore]
public string CharOfConstrain { set; get; }
[XmlIgnore]
public bool allow { set; get; }
public void set_dataType(string dataType)
{
this.dataTypeName = dataType;
switch (dataType)
{
case "int":
{ this.DataType = 8; }
break;
case "string":
{ this.DataType = ""; }
break;
case "float":
{ this.DataType = 5.5; }
break;
case "double":
{ this.DataType = 5.5; }
break;
default:
this.DataType = "";
break;
}
}
public void convert_add_Value(string texttag) //if not achieve the constrain will add null as String
{
if (HadConstrain == true)
{
int Intvalue = Convert.ToInt32(texttag);
if (achieve_Constrain(Intvalue))
{
Values.Add(Intvalue);
}
else { Values.Add("Null"); }
}
else
{
switch (this.dataTypeName)
{
case "int":
{ Values.Add(Convert.ToInt32(texttag)); }
break;
case "string":
{ Values.Add(texttag); }
break;
case "float":
{ Values.Add(Convert.ToDouble(texttag)); }
break;
case "double":
{ Values.Add(Convert.ToDouble(texttag)); }
break;
default:
Values.Add(texttag);
break;
}
}
}
public void setConstrain(string numberTxt, string charConstrain)
{
this.HadConstrain = true;
this.numOfConstrain = Convert.ToInt32(numberTxt);
this.CharOfConstrain = charConstrain;
constrain = numberTxt + charConstrain;
}
private bool achieve_Constrain(int num) //used in addvalue function
{
if (HadConstrain == true)
{
switch (CharOfConstrain)
{
case ">":
{ if (num > numOfConstrain) { return true; } else { return false; } }
break;
case ">=":
{ if (num >= numOfConstrain) { return true; } else { return false; } }
break;
case "<":
{ if (num < numOfConstrain) { return true; } else { return false; } }
break;
case "<=":
{ if (num <= numOfConstrain) { return true; } else { return false; } }
break;
case "=": { if (num == numOfConstrain) { return true; } else { return false; } }
default:
return false;
break;
}
}
else { return false; }
}
}
public class TableC
{
public string index_prim { set; get; }
public string name_table { get; set; }
public Dictionary<string, Coulmns> coluoms { get; set; }
public TableC()
{
coluoms = new Dictionary<string, Coulmns>(); }
public void set_name(string name)
{
this.name_table = name;
}
}
class Data_base
{
public string Data_base_Name { set; get; }
public Dictionary<string, TableC> tables { set; get; }
public Data_base(string name_dataBase)
{
this.Data_base_Name = name_dataBase;
tables = new Dictionary<string, TableC>();
}
}
}
Continue reading...