Esempio n. 1
0
        public HttpResponseMessage GetActiveProfessor(string guid)
        {
            var accountId = HexadecimalEncoding.FromHexString(HttpContext.Current.Server.UrlDecode(guid));
            var professor = _professorsServices.ActivateUser(accountId);
            var response  = Request.CreateResponse(HttpStatusCode.Moved);

            response.Headers.Location = new Uri(frontEndSite);
            return(response);
        }
Esempio n. 2
0
        public VN_EN_Word getWord(string key)
        {
            VN_EN_Word w = null;

            try
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                using (SqlCommand cmd = new SqlCommand(getVnWordCommand, conn))
                {
                    cmd.Parameters.Add("@VNKey", SqlDbType.NVarChar).Value = HexadecimalEncoding.ToHexString(key + " \r");

                    SqlDataReader sdr = cmd.ExecuteReader();

                    if (sdr.Read())
                    {
                        w = new VN_EN_Word();

                        w.VNKey        = HexadecimalEncoding.FromHexString(sdr["VNKey"].ToString());
                        w.VNSuggestion = sdr["VNSuggestion"].ToString();
                        w.WordType     = sdr["WordType"].ToString();
                        w.Means        = sdr["ENMeans"].ToString();
                        w.Example      = sdr["Example"].ToString();
                    }
                    else
                    {
                        sdr.Close();
                    }

                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("@VNKey", SqlDbType.NVarChar).Value = HexadecimalEncoding.ToHexString(key + "\r");
                    sdr = cmd.ExecuteReader();

                    if (sdr.Read())
                    {
                        w = new VN_EN_Word();

                        w.VNKey        = HexadecimalEncoding.FromHexString(sdr["VNKey"].ToString());
                        w.VNSuggestion = sdr["VNSuggestion"].ToString();
                        w.WordType     = sdr["WordType"].ToString();
                        w.Means        = sdr["ENMeans"].ToString();
                        w.Example      = sdr["Example"].ToString();
                    }
                    sdr.Close();
                }
            }
            catch (Exception e)
            {
                conn.Close();
                throw e;
            }

            return(w);
        }