コード例 #1
0
        public IParamBuilder GetListSql(ListDataRightEventArgs e)
        {
            if (e.User.MainOrgId == null)
            {
                return(SqlParamBuilder.NoResult);
            }

            string layer = CompanyUserDataRight.GetLayer(e);
            string sql   = string.Format(ObjectUtil.SysCulture, RETURN_SQL, fField.FieldName, layer);

            return(ParamBuilder.CreateSql(sql));
        }
コード例 #2
0
        public void Check(DataRightEventArgs e)
        {
            if (e.User.MainOrgId == null)
            {
                throw new NoDataRightException(ErrorMessage);
            }

            string orgId = e.Row[fField.NickName].ToString();

            if (orgId != e.User.MainOrgId.ToString())
            {
                string layer = CompanyUserDataRight.GetLayer(e);
                string sql   = string.Format(ObjectUtil.SysCulture, SINGLE_ORG_SQL, e.User.MainOrgId, layer);
                int    count = DbUtil.ExecuteScalar(sql, e.Context).Value <int>();
                if (count != 1)
                {
                    throw new NoDataRightException(ErrorMessage);
                }
            }
        }