protected void btnGenerateKey_Click(object sender, EventArgs e)
 {
     UserKeyInfo keyInfo = new UserKeyInfo();
     keyInfo.Amount = Convert.ToDecimal(txtAmount.Text);
     keyInfo.CreatedDate = DateTime.Now;
     keyInfo.Status = Convert.ToInt32(EnumHelper.RegistrationKeyStatus.User_Not_Created);
     keyInfo.UserPaymetType = Convert.ToInt32(ddlPaymetType.SelectedValue.ToString());
     keyInfo.UserKey = Guid.NewGuid();
     keyInfo.KeyTaker = txtName.Text;
     keyInfo.KeyTakerPhone = txtPhoneNo.Text;
     using (TheFacade facade = new TheFacade())
     {
         facade.Insert<UserKeyInfo>(keyInfo);
     }
     if (keyInfo.IID > 0)
     {
         lblGenerateKey.Text = keyInfo.UserKey.ToString();
     }
 }
Beispiel #2
0
        public UserKeyInfo GetValidUserKeyInfoByUserKey(string userKey)
        {
            UserKeyInfo userKeyInfo = new UserKeyInfo();
            try
            {
                Guid Temp = new Guid(userKey);
                userKeyInfo = Database.UserKeyInfos.Single(u => u.UserKey == Temp && u.Status == (int)EnumHelper.UserKeyInfoStatus.NotUse);
            }
            catch (Exception ex)
            {
            }

            return userKeyInfo;
        }