Esempio n. 1
0
 public HttpResponseBase GetPersonList()
 {
     string json = string.Empty;
     EdmEmailQuery query = new EdmEmailQuery();
     DataTable store = new DataTable();
     int totalCount = 0;
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["gname"]))
         {
             query.group_name = Request.Params["gname"].ToString().Replace("\\", "\\\\");
         }
         if (!string.IsNullOrEmpty(Request.Params["gid"]))
         {
             query.group_id = Convert.ToInt16(Request.Params["gid"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["email_id"]))
         {
             query.email_id = Convert.ToUInt32(Request.Params["email_id"]);
         }
         query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
         query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
         _edmEmailMgr = new EdmEmailMgr(mySqlConnectionString);
         store = _edmEmailMgr.GetPersonList(query, out totalCount);
         for (int i = 0; i < store.Rows.Count; i++)
         {
             DataRow dr = store.Rows[i];
             if (!string.IsNullOrEmpty(dr["email_name"].ToString()))
             {
                 dr["email_name"] = dr["email_name"].ToString().Substring(0, 1) + "**";
             }
             dr["email_address"] = dr["email_address"].ToString().Split('@')[0] + "@***";
         }
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store) + "}";
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:false,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Esempio n. 2
0
        public HttpResponseBase GetEmailByID()
        {
            string json = string.Empty;
            uint eid = 0;
            string email_name = string.Empty;
            string email_address = string.Empty;
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["eid"]))
                {
                    eid = Convert.ToUInt32(Request.Params["eid"].ToString());
                }
                _edmEmailMgr = new EdmEmailMgr(mySqlConnectionString);
                _edmEmailMgr.GetEmailByID(eid, out email_name, out email_address);
                //json = "{success:true}";
                json = "{success:true,email_name:'" + email_name + "',email_address:'" + email_address + "'}";
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;

        }