当前位置: 首页>>代码示例>>C#>>正文


C# IEntityBase.FieldIsNull方法代码示例

本文整理汇总了C#中IEntityBase.FieldIsNull方法的典型用法代码示例。如果您正苦于以下问题:C# IEntityBase.FieldIsNull方法的具体用法?C# IEntityBase.FieldIsNull怎么用?C# IEntityBase.FieldIsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEntityBase的用法示例。


在下文中一共展示了IEntityBase.FieldIsNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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")));

        }
开发者ID:JodenSoft,项目名称:JodenSoft,代码行数:34,代码来源:Session.cs

示例2: 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;
        }
开发者ID:JodenSoft,项目名称:JodenSoft,代码行数:64,代码来源:BillRight.cs


注:本文中的IEntityBase.FieldIsNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。