日期:2014-05-18  浏览次数:20837 次

C#简单的问题
namespace 企业管理.进销存
{
/// <summary>
/// UserControl1 的摘要说明。
/// </summary>

[StoreUnit(StoreUnitType.Db|StoreUnitType.Define)]
[gridvisual(new string[]{"员工编码","姓名","部门名称","住址","性别","家庭电话","借款余额"},new int[]{100,90,90,40,60,100,100},"企业管理.进销存.员工编辑")]
[版本控制("1.00")]
[单据前缀(true,false,true)]
[分类管理("企业管理.部门","部门名称")]
[查找("姓名")]
public class 员工
{


[Field(StoreFieldType.Key)]
[Valid(ValidType.Pattern,"pattern=id-4")]
public string 员工存储编码;
[Field]
public string 员工编码;
[Field]
public string 姓名;
[Field]
public 性别 性别;
[Field]
public string 职员类别;
[Field]
public string 部门名称;
[Field]
public DateTime 出生年月=DateTime.Now;
[Field]
public string 身份证号码;
[Field]
public string 职务;

[Field]
public string 邮编;
[Field]
public string 住址;
[Field]
public string 学历;
[Field]
public string 家庭电话;
[Field]
public string 手机;
[Field]
public string 电子邮件;
[Field]
public string 籍贯;
[Field]
public string 银行账号;
[Field]
public int 年龄;
[Field]
public double 借款余额;


}





}

-------------------
  [Field(StoreFieldType.Key)]
[Valid(ValidType.Pattern,"pattern=id-4")]
public string 员工存储编码;
第一,是用什么方式把这"员工存储编码"变成id0001,id0002



------解决方案--------------------
添加set和get访问器
------解决方案--------------------
public class AccountEntity
{
#region 变量定义
///<summary>
///用户ID
///</summary>
private int userID ;

///<summary>
///性别
///</summary>
private string userSex;
///<summary>
///邮箱
///</summary>
private string userEmail;
/// <summary>
/// 地址
/// </summary>
private AddressEntity address;

///<summary>
///用户职位
///</summary>
private string userJob;


///<summary>
///MSN
///</summary>
private string userMSN;
///<summary>
///UserQQ
///</summary>
private string userQQ;
///<summary>
///其他联系信息
///</summary>
private string userOther;
///<summary>
///用户状态
///</summary>
private int userState;
///<summary>
///登陆次数
///</summary>
private int loginCount;
///<summary>
///创建时间
///</summary>
private DateTime createTime;
///<summary>
///最后活跃时间
///</summary>
private DateTime lastActivityDate;
private System.Collections.Specialized.NameValueCollection otherinfo;
#endregion

#region 构造函数
///<summary>
///
///</summary>
public AccountEntity()
{
otherinfo = new System.Collections.Specialized.NameValueCollection();
string userName = String.Empty;
string userSex = String.Empty;
string userEmail = String.Empty;
AddressEntity address;
string userJob = String.Empty;
string userMSN = String.Empty;
string userQQ = String.Empty;
string userOther = String.Empty;
int userState=0