Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            LanguageMgr.Setup(ConfigurationManager.AppSettings["ReqPath"]);
            bool     value   = false;
            string   message = LanguageMgr.GetTranslation("Tank.Request.ConsortiaCheck.Exist");
            XElement result  = new XElement("Result");

            try
            {
                string ConsortiaName = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["NickName"]));
                if (System.Text.Encoding.Default.GetByteCount(ConsortiaName) <= 14)
                {
                    if (!string.IsNullOrEmpty(ConsortiaName))
                    {
                        using (ConsortiaBussiness db = new ConsortiaBussiness())
                        {
                            if (db.GetConsortiaSingleByName(ConsortiaName) == null)
                            {
                                value   = true;
                                message = LanguageMgr.GetTranslation("Tank.Request.ConsortiaCheck.Right");
                            }
                        }
                    }
                }
                else
                {
                    message = LanguageMgr.GetTranslation("Tank.Request.ConsortiaCheck.Long");
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaCheck", ex);
                value = false;
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }