You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
4.2 KiB
Plaintext

11 months ago
using System;
using System.Data;
using BP.DA;
using BP.En;
using BP.Port;
namespace BP.CN
{
/// <summary>
/// <20><><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
/// </summary>
public class AreaAttr : EntityNoNameAttr
{
#region <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public const string FK_PQ = "FK_PQ";
public const string FK_SF = "FK_SF";
public const string Grade = "Grade";
public const string Names = "Names";
#endregion
}
/// <summary>
/// <20><><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
/// </summary>
public class Area :EntityNoName
{
#region <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public string Names
{
get
{
return this.GetValStrByKey(CityAttr.Names);
}
}
public string FK_PQ
{
get
{
return this.GetValStrByKey(AreaAttr.FK_PQ);
}
}
public string FK_SF
{
get
{
return this.GetValStrByKey(AreaAttr.FK_SF);
}
}
#endregion
#region <20><><EFBFBD><EFBFBD><ECBAAF>
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
uac.OpenForSysAdmin();
return uac;
}
}
/// <summary>
/// <20><><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
/// </summary>
public Area(){}
public Area(string no):base(no)
{
}
/// <summary>
/// Map
/// </summary>
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map();
#region <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
map.PhysicsTable = "CN_Area";
map.DepositaryOfMap = Depositary.Application;
map.DepositaryOfEntity = Depositary.None;
map.EnDesc = "<22><><EFBFBD>б<EFBFBD><D0B1><EFBFBD>";
map.EnType = EnType.App;
map.CodeStruct = "4";
#endregion
#region <20>ֶ<EFBFBD>
map.AddTBStringPK(AreaAttr.No, null, "<22><><EFBFBD><EFBFBD>", true, false, 0, 50, 50);
map.AddTBString(AreaAttr.Name, null, "<22><><EFBFBD><EFBFBD>", true, false, 0, 50, 200);
map.AddTBString(AreaAttr.Names, null, "С<><D0A1>", true, false, 0, 50, 200);
map.AddTBInt(AreaAttr.Grade, 0, "Grade", false, false);
map.AddDDLEntities(AreaAttr.FK_SF, null, "ʡ<><CAA1>", new SFs(), true);
map.AddDDLEntities(AreaAttr.FK_PQ, null, "Ƭ<><C6AC>", new PQs(), true);
map.AddSearchAttr(AreaAttr.FK_SF);
#endregion
this._enMap = map;
return this._enMap;
}
}
#endregion
public static string GenerAreaNoByName(string name1, string name2, string oldcity)
{
string fk_city1 = BP.CN.Area.GenerAreaNoByName(name1 , "");
string fk_city2 = BP.CN.Area.GenerAreaNoByName(name2 , "");
string fk_city = null;
if (fk_city1.Length >= 4)
{
fk_city = fk_city1;
}
if (fk_city1.Length == 2)
{
if (fk_city2.Contains(fk_city1))
fk_city = fk_city2;
else
fk_city = fk_city1;
}
return fk_city;
}
public static string GenerAreaNoByName(string name, string oldcity)
{
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ء<EFBFBD>
string sql = "SELECT NO FROM CN_Area WHERE indexof('" + name + "', names ) >0 ORDER BY GRADE DESC ";
string val = DBAccess.RunSQLReturnString(sql);
if (val != null)
return val;
else
return oldcity;
}
}
/// <summary>
/// <20><><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
/// </summary>
public class Areas : EntitiesNoName
{
#region <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD> Entity
/// <summary>
/// <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD> Entity
/// </summary>
public override Entity GetNewEntity
{
get
{
return new Area();
}
}
#endregion
#region <20><><EFBFBD><EFBFBD><ECB7BD>
/// <summary>
/// <20><><EFBFBD>б<EFBFBD><D0B1><EFBFBD>s
/// </summary>
public Areas() { }
/// <summary>
/// <20><><EFBFBD>б<EFBFBD><D0B1><EFBFBD>s
/// </summary>
/// <param name="sf">ʡ<><CAA1></param>
public Areas(string sf)
{
this.Retrieve(AreaAttr.FK_SF, sf);
}
#endregion
}
}