本文整理汇总了C#中IEntityBase.GetFieldValue方法的典型用法代码示例。如果您正苦于以下问题:C# IEntityBase.GetFieldValue方法的具体用法?C# IEntityBase.GetFieldValue怎么用?C# IEntityBase.GetFieldValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityBase
的用法示例。
在下文中一共展示了IEntityBase.GetFieldValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcCurrentEntityBillDataRight
/// <summary>
/// 计算当前这一行的数据,判断是否有指定权限
/// </summary>
/// <param name="fieldName">指定权限字段</param>
/// <param name="table">权限配置数据</param>
/// <param name="destBillDataRight">目标权限</param>s
/// <param name="aEntity">数据行实体</param>
/// <returns></returns>
private static BillDataRight CalcCurrentEntityBillDataRight(string fieldName, BillRightInfo billRight, BillDataRight destBillDataRight, IEntityBase entity)
{
bool temp = false;
int CreatedBy = -1;
if (entity.FieldIsExists(BillRightInfo.CreatedByField) && !entity.FieldIsNull(BillRightInfo.CreatedByField) && entity.GetFieldValue<int>(BillRightInfo.CreatedByField) > 0)
{
CreatedBy = entity.GetFieldValue<int>(BillRightInfo.CreatedByField);
}
int OrganizationId = -1;
if (entity.FieldIsExists(BillRightInfo.OrganizationIdField) && !entity.FieldIsNull(BillRightInfo.OrganizationIdField))
{
OrganizationId = entity.GetFieldValue<int>(BillRightInfo.OrganizationIdField);
}
string OrganizationCode = "XXXXXX";
if (entity.FieldIsExists(BillRightInfo.OrganizationCodeField) && !entity.FieldIsNull(BillRightInfo.OrganizationCodeField))
{
OrganizationCode = entity.GetFieldValue<string>(BillRightInfo.OrganizationCodeField);
}
foreach (DataRow dr in billRight.DataRights.Rows)
{
//部门为空,则表示针对所有部门都是此角色
bool bAllOrganization = dr.IsNull(RES.OrganizationId);
bool bSameCreator = false;
if (!dr.IsNull(RES.CreatedBy))
{
bSameCreator = (CreatedBy == Convert.ToInt32(dr[RES.CreatedBy]));
}
bool bSameOrganizationId = false;
if (!dr.IsNull(RES.OrganizationId))
{
bSameOrganizationId = (OrganizationId == Convert.ToInt32(dr[RES.OrganizationId]));
}
bool bSameOrganizationCode = false;
if (!dr.IsNull(RES.OrganizationCode))
{
bSameOrganizationCode = OrganizationCode.StartsWith(dr[RES.OrganizationCode].ToString(), StringComparison.OrdinalIgnoreCase);
}
switch ((BillRightType)Convert.ToInt32(dr[fieldName]))
{
case BillRightType.None: continue;
case BillRightType.OnlyOwner: temp = bSameCreator && (bAllOrganization || bSameOrganizationCode || bSameOrganizationId); break;
case BillRightType.OnlyDepartment: temp = bSameCreator || bAllOrganization || bSameOrganizationId; break;
case BillRightType.DepartmentAndChild: temp = bSameCreator || bAllOrganization || bSameOrganizationCode; break;
case BillRightType.All: temp = true; break;
}
if (temp)
return destBillDataRight;
}
return BillDataRight.None;
}
示例2: Assign
public void Assign(IEntityBase entity)
{
if (entity == null)
{
this.Clear();
return;
}
if (entity.FieldIsExists("Iden"))
this.UserId = entity.GetFieldValue<int>("Iden", -1);
if (entity.FieldIsExists("UserName"))
this.UserName = entity.GetFieldValue<string>("UserName", string.Empty);
if (entity.FieldIsExists("Password"))
this.Password = entity.GetFieldValue<string>("Password", string.Empty);
if (entity.FieldIsExists("UserFullName"))
this.UserFullName = entity.GetFieldValue<string>("UserFullName", string.Empty);
if (entity.FieldIsExists("Email"))
this.Email = entity.GetFieldValue<string>("Email", string.Empty);
if (entity.FieldIsExists("TelephoneNo"))
this.TelephoneNo = entity.GetFieldValue<string>("TelephoneNo", string.Empty);
this.UserImage = null;
if (entity.FieldIsExists("UserImage") && !entity.FieldIsNull("UserImage"))
this.UserImage = new Bitmap(new MemoryStream(entity.GetFieldValue<byte[]>("UserImage")));
this.UserSignImage = null;
if (entity.FieldIsExists("UserSignImage") && !entity.FieldIsNull("UserSignImage"))
this.UserSignImage = new Bitmap(new MemoryStream(entity.GetFieldValue<byte[]>("UserSignImage")));
}
示例3: CalcBillDataRight
/// <summary>
/// 计算单据数据权限
/// </summary>
/// <param name="entity">实体</param>
/// <param name="forceCalc">是否强制重新计算</param>
/// <returns>数据权限值</returns>
public BillDataRight CalcBillDataRight(IEntityBase entity, bool forceCalc)
{
if (entity == null)
return BillDataRight.None;
if (BillRightInfo == null || BillRightInfo.BillTypeId <= 0 || !BillRightInfo.UseDataRight)
return BillDataRight.All;
object key = entity.GetFieldValue<object>(entity.PrimaryKeyName);
if (dictBillRights.ContainsKey(key))
{
if (!forceCalc)
return dictBillRights[key];
//强制重新计算
BillDataRight dr = BillRight.CalcEntityBillDataRight(entity, BillRightInfo);
dictBillRights[key] = dr;
return dr;
}
else
{
BillDataRight dr = BillRight.CalcEntityBillDataRight(entity, BillRightInfo);
dictBillRights.Add(key, dr);
return dr;
}
}