using System;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Data.Sql;
using BP.DA;
using BP.En;
using BP.Sys;
using BP.Port;
namespace BP.Cloud
{
///
/// 组织 属性
///
public class OrgAttr : BP.En.EntityNoNameAttr
{
///
/// 注册的IP
///
public const string RegIP = "RegIP";
///
/// 状态
///
public const string OrgSta = "OrgSta";
#region 基本属性
///
/// 微信分配的永久的qiye ID.
///
public const string CorpID = "CorpID";
///
/// 部门
///
public const string FK_HY = "FK_HY";
///
/// 密码
///
public const string Pass = "Pass";
///
/// Addr
///
public const string Addr = "Addr";
///
/// 简称
///
public const string NameFull = "NameFull";
///
/// 邮箱
///
public const string Adminer = "Adminer";
///
/// 管理员名称
///
public const string AdminerName = "AdminerName";
///
/// 注册来源
///
public const string UrlFrom = "UrlFrom";
public const string DB = "DB";
///
/// 序号
///
public const string Idx = "Idx";
///
/// 拼音
///
public const string PinYin = "PinYin";
///
/// JSONOfTongJi
///
public const string JSONOfTongJi = "JSONOfTongJi";
///
/// QQ号
///
public const string QQ = "QQ";
///
/// GUID
///
public const string GUID = "GUID";
///
/// 注册来源
///
public const string RegFrom = "RegFrom";
///
/// 使用状态
///
public const string UseSta = "UseSta";
///
/// 停用日期
///
public const string DTEnd = "DTEnd";
///
/// 启用日期
///
public const string DTReg = "DTReg";
///
///
///
public const string RDT = "RDT";
///
/// 授权方(企业)access_token,最长为512字节
///
public const string AccessToken = "AccessToken";
///
/// 授权方(企业)access_token过期时间,有效期2小时
///
public const string AccessTokenExpiresIn = "AccessTokenExpiresIn";
///
/// 企业微信永久授权码
///
public const string PermanentCode = "PermanentCode";
///
/// 授权方企业方形头像
///
public const string CorpSquareLogoUrl = "CorpSquareLogoUrl";
///
/// 授权方企业圆形头像
///
public const string CorpRoundLogoUrl = "CorpRoundLogoUrl";
/// 授权方企业用户规模
///
public const string CorpUserMax = "CorpUserMax";
///
/// 授权方企业应用数上限
///
public const string CorpAgentMax = "CorpAgentMax";
///
/// 授权方企业的主体名称
///
public const string CorpFullName = "CorpFullName";
///
/// 企业类型,1. 企业; 2. 政府以及事业单位; 3. 其他组织, 4.团队号
///
public const string SubjectType = "SubjectType";
///
/// 认证到期时间
///
public const string VerifiedEndTime = "VerifiedEndTime";
///
/// 企业规模。当企业未设置该属性时,值为空
///
public const string CorpScale = "CorpScale";
///
/// 企业所属行业。当企业未设置该属性时,值为空
///
public const string CorpIndustry = "CorpIndustry";
///
/// 企业所属子行业。当企业未设置该属性时,值为空
///
public const string CorpSubIndustry = "CorpSubIndustry";
///
/// 企业所在地信息, 为空时表示未知
///
public const string Location = "Location";
///
/// 授权方应用方形头像
///
public const string SquareLogoUrl = "SquareLogoUrl";
///
/// 授权方应用圆形头像
///
public const string RoundLogoUl = "RoundLogoUl";
///
/// 授权方应用id
///
public const string AgentId = "AgentId";
///
/// 授权方应用名字
///
public const string AgentName = "AgentName";
///
/// 微信应用状态
///
public const string WXUseSta = "WXUseSta";
///
/// PrivateKey
///
public const string PrivateKey = "PrivateKey";
#endregion
}
///
/// 组织 的摘要说明。
///
public class Org : EntityNoName
{
#region 扩展属性
///
/// 该人员是否被禁用.
///
public bool IsEnable
{
get
{
if (this.No == "admin")
return true;
string sql = "SELECT COUNT(FK_Org) FROM Port_DeptOrgStation WHERE FK_Org='" + this.No + "'";
if (DBAccess.RunSQLReturnValInt(sql, 0) == 0)
return false;
sql = "SELECT COUNT(FK_Org) FROM Port_DeptOrg WHERE FK_Org='" + this.No + "'";
if (DBAccess.RunSQLReturnValInt(sql, 0) == 0)
return false;
return true;
}
}
public string DB
{
get
{
return this.GetValStringByKey(OrgAttr.DB);
}
set
{
this.SetValByKey(OrgAttr.DB, value);
}
}
///
/// 网站来源
///
public string UrlFrom
{
get
{
return this.GetValStringByKey(OrgAttr.UrlFrom);
}
set
{
this.SetValByKey(OrgAttr.UrlFrom, value);
}
}
///
/// 注册来源 0=网站, 1=微信, 2=钉钉.
///
public int RegFrom
{
get
{
return this.GetValIntByKey(OrgAttr.RegFrom);
}
set
{
this.SetValByKey(OrgAttr.RegFrom, value);
}
}
///
/// 注册的IP
///
public string RegIP
{
get
{
return this.GetValStrByKey(OrgAttr.RegIP);
}
set
{
this.SetValByKey(OrgAttr.RegIP, value);
}
}
public string DTReg
{
get
{
return this.GetValStrByKey(OrgAttr.DTReg);
}
set
{
this.SetValByKey(OrgAttr.DTReg, value);
}
}
public string DTEnd
{
get
{
return this.GetValStrByKey(OrgAttr.DTEnd);
}
set
{
this.SetValByKey(OrgAttr.DTEnd, value);
}
}
public string Addr
{
get
{
return this.GetValStrByKey(OrgAttr.Addr);
}
set
{
this.SetValByKey(OrgAttr.Addr, value);
}
}
public string GUID
{
get
{
return this.GetValStrByKey(OrgAttr.GUID);
}
}
///
/// 拼音
///
public string Adminer
{
get
{
return this.GetValStrByKey(OrgAttr.Adminer);
}
set
{
this.SetValByKey(OrgAttr.Adminer, value);
}
}
public string AdminerName
{
get
{
return this.GetValStrByKey(OrgAttr.AdminerName);
}
set
{
this.SetValByKey(OrgAttr.AdminerName, value);
}
}
///
/// 全名
///
public string NameFull
{
get
{
return this.GetValStrByKey(OrgAttr.NameFull);
}
set
{
this.SetValByKey(OrgAttr.NameFull, value);
}
}
///
/// 统计用的JSON
///
public string JSONOfTongJi
{
get
{
return this.GetValStrByKey(OrgAttr.JSONOfTongJi);
}
set
{
this.SetValByKey(OrgAttr.JSONOfTongJi, value);
}
}
///
/// 注册年月
///
public string FK_HY
{
get
{
return this.GetValStrByKey(OrgAttr.FK_HY);
}
set
{
this.SetValByKey(OrgAttr.FK_HY, value);
}
}
///
/// 拼音
///
public string PinYin
{
get
{
return this.GetValStrByKey(EmpAttr.PinYin);
}
set
{
this.SetValByKey(EmpAttr.PinYin, value);
}
}
///
/// 使用状态0=未安装,1=使用中,2=卸载
///
public int WXUseSta
{
get
{
return this.GetValIntByKey(OrgAttr.WXUseSta);
}
set
{
this.SetValByKey(OrgAttr.WXUseSta, value);
}
}
///
/// 企业ID
///
public string CorpID
{
get
{
return this.GetValStrByKey(OrgAttr.CorpID);
}
set
{
this.SetValByKey(OrgAttr.CorpID, value);
}
}
public string RDT
{
get
{
return this.GetValStrByKey(OrgAttr.RDT);
}
set
{
this.SetValByKey(OrgAttr.RDT, value);
}
}
///
///
///
public string AccessToken
{
get
{
return this.GetValStrByKey(OrgAttr.AccessToken);
}
set
{
this.SetValByKey(OrgAttr.AccessToken, value);
}
}
public string AccessTokenExpiresIn
{
get
{
return this.GetValStrByKey(OrgAttr.AccessTokenExpiresIn);
}
set
{
this.SetValByKey(OrgAttr.AccessTokenExpiresIn, value);
}
}
public string PermanentCode
{
get
{
return this.GetValStrByKey(OrgAttr.PermanentCode);
}
set
{
this.SetValByKey(OrgAttr.PermanentCode, value);
}
}
public string AgentId
{
get
{
return this.GetValStrByKey(OrgAttr.AgentId);
}
set
{
this.SetValByKey(OrgAttr.AgentId, value);
}
}
public string AgentName
{
get
{
return this.GetValStrByKey(OrgAttr.AgentName);
}
set
{
this.SetValByKey(OrgAttr.AgentName, value);
}
}
public string CorpSquareLogoUrl
{
get
{
return this.GetValStrByKey(OrgAttr.CorpSquareLogoUrl);
}
set
{
this.SetValByKey(OrgAttr.CorpSquareLogoUrl, value);
}
}
public string CorpRoundLogoUrl
{
get
{
return this.GetValStrByKey(OrgAttr.CorpRoundLogoUrl);
}
set
{
this.SetValByKey(OrgAttr.CorpRoundLogoUrl, value);
}
}
public string CorpUserMax
{
get
{
return this.GetValStrByKey(OrgAttr.CorpUserMax);
}
set
{
this.SetValByKey(OrgAttr.CorpUserMax, value);
}
}
public string CorpAgentMax
{
get
{
return this.GetValStrByKey(OrgAttr.CorpAgentMax);
}
set
{
this.SetValByKey(OrgAttr.CorpAgentMax, value);
}
}
public string CorpFullName
{
get
{
return this.GetValStrByKey(OrgAttr.CorpFullName);
}
set
{
this.SetValByKey(OrgAttr.CorpFullName, value);
}
}
public string SubjectType
{
get
{
return this.GetValStrByKey(OrgAttr.SubjectType);
}
set
{
this.SetValByKey(OrgAttr.SubjectType, value);
}
}
public string VerifiedEndTime
{
get
{
return this.GetValStrByKey(OrgAttr.VerifiedEndTime);
}
set
{
this.SetValByKey(OrgAttr.VerifiedEndTime, value);
}
}
public string CorpScale
{
get
{
return this.GetValStrByKey(OrgAttr.CorpScale);
}
set
{
this.SetValByKey(OrgAttr.CorpScale, value);
}
}
public string CorpIndustry
{
get
{
return this.GetValStrByKey(OrgAttr.CorpIndustry);
}
set
{
this.SetValByKey(OrgAttr.CorpIndustry, value);
}
}
public string CorpSubIndustry
{
get
{
return this.GetValStrByKey(OrgAttr.CorpSubIndustry);
}
set
{
this.SetValByKey(OrgAttr.CorpSubIndustry, value);
}
}
public string Location
{
get
{
return this.GetValStrByKey(OrgAttr.Location);
}
set
{
this.SetValByKey(OrgAttr.Location, value);
}
}
public string SquareLogoUrl
{
get
{
return this.GetValStrByKey(OrgAttr.SquareLogoUrl);
}
set
{
this.SetValByKey(OrgAttr.SquareLogoUrl, value);
}
}
public string RoundLogoUl
{
get
{
return this.GetValStrByKey(OrgAttr.RoundLogoUl);
}
set
{
this.SetValByKey(OrgAttr.RoundLogoUl, value);
}
}
#endregion
#region 公共方法
///
/// 检查密码(可以重写此方法)
///
/// 密码
/// 是否匹配成功
public bool CheckPass(string pass)
{
//if (this.Pass == pass)
// return true;
return false;
}
#endregion 公共方法
#region 构造函数
///
/// 组织
///
public Org()
{
}
public Org(string no)
{
this.No = no;
this.Retrieve();
}
///
/// 权限
///
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
uac.OpenForAppAdmin();
return uac;
}
}
///
/// 重写基类方法
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("Port_Org", "组织");
map.setEnType(EnType.App);
map.IndexField = OrgAttr.FK_HY;
#region 字段
/*关于字段属性的增加 */
map.AddTBStringPK(OrgAttr.No, null, "账号OrgNo", true, false, 1, 50, 90);
map.AddTBString(OrgAttr.CorpID, null, "CorpID", true, false, 1, 50, 90);
map.AddTBString(OrgAttr.Name, null, "简称", true, false, 0, 200, 130);
map.AddTBString(OrgAttr.NameFull, null, "全称", true, false, 0, 300, 400);
map.AddTBString(OrgAttr.Adminer, null, "管理员帐号", true, true, 0, 300, 400);
map.AddTBString(OrgAttr.AdminerName, null, "管理员", true, true, 0, 300, 400);
map.AddTBString(OrgAttr.Addr, null, "地址", true, false, 0, 300, 36);
map.AddTBString(OrgAttr.GUID, null, "GUID", true, false, 0, 32, 36);
map.AddTBDateTime(OrgAttr.DTReg, null, "起始日期", true, false);
map.AddTBDateTime(OrgAttr.DTEnd, null, "停用日期", true, false);
map.AddTBString(OrgAttr.RegIP, null, "注册的IP", true, false, 0, 30, 20);
map.AddTBDateTime(OrgAttr.RDT, null, "注册日期", true, false);
//@0=网站注册@1=企业微信@2=钉钉@3=微信小程序
map.AddTBInt(OrgAttr.RegFrom, 0, "注册来源", true, false);
map.AddTBInt(OrgAttr.WXUseSta, 0, "状态@0=未安装1=使用中@2=卸载.", true, false);
map.AddTBString(OrgAttr.UrlFrom, null, "网站来源", true, true, 0, 30, 20);
map.AddTBString(OrgAttr.DB, null, "DB", true, false, 0, 32, 36);
//map.AddTBInt(OrgAttr.WXUseSta, 0, "状态", true, false);
#endregion 字段
#region 微信信息
map.AddTBString(OrgAttr.CorpID, null, "授权方企业微信id", true, false, 0, 200, 36);
map.AddTBString(OrgAttr.AgentName, null, "授权方企业名称,即企业简称", true, false, 0, 200, 36);
map.AddTBString(OrgAttr.AgentId, null, "授权方应用id", true, false, 0, 200, 36);
map.AddTBString(OrgAttr.PermanentCode, null, "企业微信永久授权码", true, false, 0, 200, 36);
map.AddTBString(OrgAttr.AccessToken, null, "授权方(企业)access_token", true, false, 0, 200, 36);
map.AddTBDateTime(OrgAttr.AccessTokenExpiresIn, null, "授权方(企业)access_token失效时间", true, false);
//map.AddTBString(OrgAttr.CorpSquareLogoUrl, null, "授权方企业方形头像", true, false, 0, 4000, 36);
//map.AddTBString(OrgAttr.CorpRoundLogoUrl, null, "授权方企业圆形头像", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.CorpUserMax, null, "授权方企业用户规模", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.CorpAgentMax, null, "授权方企业应用数上限", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.CorpFullName, null, "授权方企业的主体名称", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.SubjectType, null, "企业类型,1. 企业; 2. 政府以及事业单位; 3. 其他组织, 4.团队号", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.VerifiedEndTime, null, "认证到期时间", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.CorpScale, null, "企业规模。当企业未设置该属性时,值为空", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.CorpIndustry, null, "企业所属行业。当企业未设置该属性时,值为空", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.CorpSubIndustry, null, "企业所属子行业。当企业未设置该属性时,值为空", true, false, 0, 4000, 36);
map.AddTBString(OrgAttr.Location, null, "企业所在地信息, 为空时表示未知", true, false, 0, 4000, 36);
// map.AddTBString(OrgAttr.SquareLogoUrl, null, "授权方应用方形头像", true, false, 0, 4000, 36);
//map.AddTBString(OrgAttr.RoundLogoUl, null, "授权方应用圆形头像", true, false, 0, 4000, 36);
#endregion 微信信息
this._enMap = map;
return this._enMap;
}
}
public string DoICON()
{
return "../../../GPM/OrgDepts.htm?FK_Org=" + this.No;
}
protected override bool beforeUpdateInsertAction()
{
//增加拼音,以方便查找.
if (DataType.IsNullOrEmpty(this.Name) == true)
throw new Exception("err@名称不能为空.");
string pinyinQP = BP.DA.DataType.ParseStringToPinyin(this.Name).ToLower();
string pinyinJX = BP.DA.DataType.ParseStringToPinyinJianXie(this.Name).ToLower();
this.PinYin = "," + pinyinQP + "," + pinyinJX + ",";
return base.beforeUpdateInsertAction();
}
///
/// 获取集合
///
public override Entities GetNewEntities
{
get { return new Orgs(); }
}
#endregion 构造函数
public int RunSQL(string sql)
{
string dns = "Password=STARCOSH;Persist Security Info=True;User ID=STARCO;Initial Catalog=" + this.DB + ";Data Source=citydo.com.cn;Timeout=999;MultipleActiveResultSets=true";
SqlConnection conn = new SqlConnection(dns);
return DBAccess.RunSQL(sql, conn, dns);
}
///
/// 初始化数据.
///
public void Init_OrgDatas()
{
#region 初始化 - 流程树.
BP.Cloud.Template.FlowSort fs = new BP.Cloud.Template.FlowSort();
fs.No = this.No; //公司编号
fs.Name = "流程树";
fs.OrgNo = this.No;
fs.ParentNo = "100"; //这里固定死了,必须是100.
fs.DirectInsert();
fs.No = DBAccess.GenerGUID(5, "Port_Dept", "No");
fs.ParentNo = this.No; //帐号信息.
fs.Name = "日常办公";
fs.OrgNo = this.No;
fs.DirectInsert();
fs.No = DBAccess.GenerGUID();
fs.ParentNo = this.No; //帐号信息.
fs.Name = "财务类";
fs.OrgNo = this.No;
fs.DirectInsert();
fs.No = DBAccess.GenerGUID();
fs.ParentNo = this.No;
fs.Name = "人力资源类";
fs.OrgNo = this.No;
fs.DirectInsert();
#endregion 开始流程树.
#region 加载流程模版.
//类别.
BP.Cloud.Template.FlowSorts fss = new BP.Cloud.Template.FlowSorts();
fss.Retrieve("OrgNo", this.No);
fs = fss[0] as BP.Cloud.Template.FlowSort;
#endregion
#region 表单树.
BP.Cloud.Template.FrmTree ft = new BP.Cloud.Template.FrmTree();
ft.No = this.No; //公司编号
ft.Name = "表单树";
ft.OrgNo = this.No;
ft.ParentNo = "100"; //这里固定死了必须是100.
ft.DirectInsert();
ft.No = DBAccess.GenerGUID();
ft.ParentNo = this.No; //帐号信息.
ft.Name = "日常办公";
ft.OrgNo = this.No;
ft.DirectInsert();
ft.No = DBAccess.GenerGUID();
ft.ParentNo = this.No; //帐号信息.
ft.Name = "财务类";
ft.OrgNo = this.No;
ft.DirectInsert();
ft.No = DBAccess.GenerGUID();
ft.ParentNo = this.No;
ft.Name = "人力资源类";
ft.OrgNo = this.No;
ft.DirectInsert();
#endregion 表单树.
//如果是web注册 =0,就去掉.
if (this.RegFrom != 0)
return;
#region 初始化部门.
//根目录.
Dept dept = new Dept();
dept.No = this.No;
dept.ParentNo = "100";
dept.Name = this.Name;
dept.OrgNo = this.No;
dept.Adminer = this.Adminer;
dept.DirectInsert();
Emp ep = new Emp(this.No + "_" + this.Adminer);
ep.FK_Dept = this.No;
ep.OrgNo = this.No; //所在公司.
ep.Update();
//写入Port_OrgAdminer表中,供查询是否是管理员.
BP.WF.Port.Admin2Group.OrgAdminer orgAdminer = new BP.WF.Port.Admin2Group.OrgAdminer();
orgAdminer.FK_Emp = ep.No;
orgAdminer.OrgNo = this.No;
orgAdminer.DirectInsert();
//管理员.
this.Adminer = ep.UserID;
this.AdminerName = ep.Name;
//把这个人员放入到根目录下.
DeptEmp de = new DeptEmp();
de.OrgNo = ep.OrgNo;
de.FK_Dept = this.No;
de.FK_Emp = ep.UserID;
de.setMyPK(de.FK_Dept + "_" + de.FK_Emp);
de.DirectInsert();
#region 开始创建下级部门.
dept.No = DBAccess.GenerGUID(); // (deptNoLen, "Port_Dept", "No");
dept.ParentNo = this.No; //帐号信息.
dept.Name = "总经理部";
dept.OrgNo = this.No;
dept.Adminer = null;
dept.DirectInsert();
dept.No = DBAccess.GenerGUID(); // (deptNoLen, "Port_Dept", "No");
dept.ParentNo = this.No; //帐号信息.
dept.Name = "信息部";
dept.OrgNo = this.No;
dept.Adminer = null;
dept.DirectInsert();
//把当前的人员放入到信息部里面去.
DeptEmp myde = new DeptEmp();
//设置主键.
myde.setMyPK(dept.No + "_" + this.Adminer);
myde.FK_Dept = dept.No;
myde.FK_Emp = this.Adminer;
// myde.EmpNo = this.No + "_" + this.Adminer;
myde.OrgNo = this.No;
myde.Insert();
dept.No = DBAccess.GenerGUID(); // (deptNoLen, "Port_Dept", "No");
dept.ParentNo = this.No; //帐号信息.
dept.Name = "财务部";
dept.OrgNo = this.No;
dept.Adminer = null;
dept.DirectInsert();
dept.No = DBAccess.GenerGUID(); // (deptNoLen, "Port_Dept", "No");
dept.ParentNo = this.No;
dept.Name = "人力资源部";
dept.Adminer = null;
dept.OrgNo = this.No;
dept.DirectInsert();
#endregion 开始创建下级部门.
#endregion 初始化部门.
#region Init 角色类别.
#region 高层角色.
StationType st = new StationType();
st.No = DBAccess.GenerGUID();
st.Name = "高层";
st.OrgNo = this.No;
st.DirectInsert();
Station sta = new Station();
sta.No = DBAccess.GenerGUID();
sta.Name = "总经理岗";
sta.OrgNo = this.No;
sta.FK_StationType = st.No;
sta.DirectInsert();
sta = new Station();
sta.No = DBAccess.GenerGUID();
sta.Name = "副总经理岗";
sta.OrgNo = this.No;
sta.FK_StationType = st.No;
sta.DirectInsert();
#endregion 高层角色.
#region 中层角色
st = new StationType();
st.No = DBAccess.GenerGUID();
st.Name = "中层";
st.OrgNo = this.No;
st.DirectInsert();
sta = new Station();
sta.No = DBAccess.GenerGUID();
sta.Name = "信息部部长";
sta.OrgNo = this.No;
sta.FK_StationType = st.No;
sta.DirectInsert();
//把当前的人员放入到信息部里面去.
DeptEmpStation des = new DeptEmpStation();
des.FK_Dept = myde.FK_Dept;
des.FK_Emp = this.Adminer;
des.FK_Station = sta.No; //信息部部长.
des.OrgNo = this.No;
des.DirectInsert();
sta = new Station();
sta.No = DBAccess.GenerGUID();
sta.Name = "财务部经理岗";
sta.OrgNo = this.No;
sta.FK_StationType = st.No;
sta.DirectInsert();
sta = new Station();
sta.No = DBAccess.GenerGUID();
sta.Name = "人力资源部经理岗";
sta.OrgNo = this.No;
sta.FK_StationType = st.No;
sta.DirectInsert();
#endregion 中层角色
#region 基层
st = new StationType();
st.No = DBAccess.GenerGUID();
st.Name = "基层";
st.OrgNo = this.No;
st.DirectInsert();
sta = new Station();
sta.No = DBAccess.GenerGUID();
sta.Name = "程序员岗";
sta.OrgNo = this.No;
sta.FK_StationType = st.No;
sta.DirectInsert();
sta = new Station();
sta.No = DBAccess.GenerGUID();
sta.Name = "出纳岗";
sta.OrgNo = this.No;
sta.FK_StationType = st.No;
sta.DirectInsert();
sta = new Station();
sta.No = DBAccess.GenerGUID();
sta.Name = "人力资源助理岗";
sta.OrgNo = this.No;
sta.FK_StationType = st.No;
sta.DirectInsert();
#endregion 基层
#endregion Init 角色类别.
//return "url@/Admin/Portal/Default.htm?Token=" + ep.SID + "&UserNo=" + ep.No;
}
///
/// 生成一个唯一的GUID》
///
///
public static string GenerNewOrgNo()
{
while (true)
{
string chars = System.Guid.NewGuid().ToString().Substring(0, 4);
string str = chars.Substring(0, 1);
if (DataType.IsNumStr(str) == true)
continue;
string sql = "SELECT count(No) as Num FROM Port_Org WHERE No='" + chars + "'";
if (DBAccess.RunSQLReturnValInt(sql) >= 1)
continue;
return chars;
}
}
///
/// 执行删除.
///
///
protected override bool beforeDelete()
{
throw new Exception("不允许删除.");
}
public void DoDelete()
{
//删除流程,删除数据.
BP.WF.Flows fls = new BP.WF.Flows();
fls.Retrieve(BP.WF.Template.FlowAttr.OrgNo, this.No);
foreach (BP.WF.Flow item in fls)
{
item.DoDelData();
item.DoDelete();
}
//删除组织数据.
DBAccess.RunSQL("DELETE FROM Port_Emp WHERE OrgNo='" + this.No + "'");
DBAccess.RunSQL("DELETE FROM Port_Dept WHERE OrgNo='" + this.No + "'");
DBAccess.RunSQL("DELETE FROM Port_DeptEmp WHERE OrgNo='" + this.No + "'");
DBAccess.RunSQL("DELETE FROM Port_DeptEmpStation WHERE OrgNo='" + this.No + "'");
//删除管理员.
DBAccess.RunSQL("DELETE FROM Port_OrgAdminer WHERE OrgNo='" + this.No + "'");
//删除类别.
DBAccess.RunSQL("DELETE FROM WF_FlowSort WHERE OrgNo='" + this.No + "'");
DBAccess.RunSQL("DELETE FROM Sys_FormTree WHERE OrgNo='" + this.No + "'");
this.DirectDelete();
}
public void DoDeletePassPort()
{
//删除组织数据.
DBAccess.RunSQL("DELETE FROM Port_Emp WHERE OrgNo='" + this.No + "'");
DBAccess.RunSQL("DELETE FROM Port_Dept WHERE OrgNo='" + this.No + "'");
DBAccess.RunSQL("DELETE FROM Port_DeptEmp WHERE OrgNo='" + this.No + "'");
//删除管理员.
DBAccess.RunSQL("DELETE FROM Port_OrgAdminer WHERE OrgNo='" + this.No + "'");
this.DirectDelete();
}
}
///
/// 组织s
//
public class Orgs : EntitiesNoName
{
#region 构造方法
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new Org();
}
}
///
/// 组织s
///
public Orgs()
{
}
#endregion 构造方法
#region 为了适应自动翻译成java的需要,把实体转换成List.
///
/// 转化成 java list,C#不能调用.
///
/// List
public System.Collections.Generic.IList ToJavaList()
{
return (System.Collections.Generic.IList)this;
}
///
/// 转化成list
///
/// List
public System.Collections.Generic.List Tolist()
{
System.Collections.Generic.List list = new System.Collections.Generic.List();
for (int i = 0; i < this.Count; i++)
{
list.Add((Org)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}