コード例 #1
0
ファイル: Add.aspx.cs プロジェクト: fangliu520/Beeant
 /// <summary>
 /// 填充用户
 /// </summary>
 /// <param name="info"></param>
 protected virtual void FillRoleAccounts(UserEntity info)
 {
     info.RoleAccounts = new List <RoleAccountEntity>();
     foreach (GridViewRow gvr in gvRole.Rows)
     {
         if (gvr.RowType != DataControlRowType.DataRow)
         {
             continue;
         }
         var ckSelect = gvr.FindControl("ckSelect") as System.Web.UI.HtmlControls.HtmlInputCheckBox;
         if (ckSelect == null || !ckSelect.Checked)
         {
             continue;
         }
         var roleAccount = new RoleAccountEntity
         {
             Role = new RoleEntity {
                 Id = ckSelect.Value.Convert <long>()
             },
             Account  = info.Account,
             SaveType = SaveType.Add,
         };
         info.RoleAccounts.Add(roleAccount);
     }
 }
コード例 #2
0
        /// <summary>
        /// 重写
        /// </summary>
        /// <typeparam name="TEntityType"></typeparam>
        /// <param name="id"></param>
        /// <param name="saveType"></param>
        /// <returns></returns>
        protected override TEntityType CreateSaveEntity <TEntityType>(long id, SaveType saveType)
        {
            var info = new RoleAccountEntity
            {
                SaveType = saveType,
                Role     = new RoleEntity {
                    Id = id
                }, Account = new AccountEntity {
                    Id = Request.QueryString["Accountid"].Convert <long>()
                }
            };

            return(info as TEntityType);
        }