Example #1
0
        public HttpResponseBase EdmGroupEmailEdit()
        {
            string json = string.Empty;
            _IEdmGroupEmailMgr = new EdmGroupEmailMgr(mySqlConnectionString);
            EdmGroupEmailQuery groupEmailQuery = new EdmGroupEmailQuery();
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["group_id"]))
                {
                    groupEmailQuery.group_id = Convert.ToUInt32(Request.Params["group_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["email_id"]))
                {
                    groupEmailQuery.email_id = Convert.ToUInt32(Request.Params["email_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["email_address"]))
                {
                    groupEmailQuery.email_address = Request.Params["email_address"].ToString().Trim();
                }
                if (!string.IsNullOrEmpty(Request.Params["email_name"]))
                {
                    groupEmailQuery.email_name = Request.Params["email_name"].ToString().Trim();
                }
                if (!string.IsNullOrEmpty(Request.Params["email_status"]))
                {
                    groupEmailQuery.email_status = Convert.ToUInt32(Request.Params["email_status"]);
                }
                json = _IEdmGroupEmailMgr.EdmGroupEmailEdit(groupEmailQuery);
            }
            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,msg:0}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;

        }
Example #2
0
 public HttpResponseBase Load()
 {
     string json = string.Empty;
     _IEdmGroupEmailMgr = new EdmGroupEmailMgr(mySqlConnectionString);
     EdmGroupQuery store = new EdmGroupQuery();
     EdmGroupQuery query = new EdmGroupQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["group_id"]))
         {
             query.group_id = Convert.ToUInt32(Request.Params["group_id"]);
         }
         store = _IEdmGroupEmailMgr.Load(query);
         if (store != null)
         {
             json = "{success:true,group_id:" + store.group_id + ",group_name:'" + store.group_name + "',group_count:'" + store.group_total_email + "'}";
         }
         else
         {
             json = "{success:false,msg:1}";
         }
     }
     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,msg:0}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Example #3
0
 public HttpResponseBase DelEdmGroupEmail()
 {
     string json = string.Empty;
     _IEdmGroupEmailMgr = new EdmGroupEmailMgr(mySqlConnectionString);
     EdmGroupEmailQuery query = new EdmGroupEmailQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["group_id"]))
         {
             query.group_id = Convert.ToUInt32(Request.Params["group_id"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["email_ids"]))
         {
             query.email_ids = Request.Params["email_ids"].ToString();
         }
         query.email_ids = query.email_ids.Substring(0, query.email_ids.Length - 1);
         int res = _IEdmGroupEmailMgr.DeleteEdmGroupEmail(query);
         if (res > 0)
         {
             json = "{success:true,msg:1}";
             int num = _IEdmGroupEmailMgr.UpdateCount(Convert.ToInt32(query.group_id));
             if (num <= 0)
             {
                 json = "{success:true,msg:0}";
             }
         }
         else
         {
             json = "{success:true,msg:0}";
         }
     }
     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}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Example #4
0
        public HttpResponseBase GetEdmGroupEmailList()
        {
            string json = string.Empty;
            _IEdmGroupEmailMgr = new EdmGroupEmailMgr(mySqlConnectionString);
            List<EdmGroupEmailQuery> store = new List<EdmGroupEmailQuery>();
            EdmGroupEmailQuery query = new EdmGroupEmailQuery();

            try
            {
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
                if (!string.IsNullOrEmpty(Request.Params["selectType"]))
                {
                    query.selectType = Request.Params["selectType"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["search_con"]))
                {
                    query.search_con = Request.Params["search_con"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["email_status"]))
                {
                    query.email_status = Convert.ToUInt32(Request.Params["email_status"].ToString());
                }
                if (!string.IsNullOrEmpty(Request.Params["group_id"]))
                {
                    query.group_id = Convert.ToUInt32(Request.Params["group_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["email_id"]))
                {
                    query.email_id = Convert.ToUInt32(Request.Params["email_id"]);
                }
                int totalCount = 0;
                store = _IEdmGroupEmailMgr.GetEdmGroupEmailList(query, out totalCount);
                foreach (EdmGroupEmailQuery egeq in store)
                {
                    if (Convert.ToBoolean(Request.Params["isSecret"]))
                    {
                        if (!string.IsNullOrEmpty(egeq.email_name))
                        {
                            egeq.email_name = egeq.email_name.Substring(0, 1) + "**";
                        }
                        if (!string.IsNullOrEmpty(egeq.email_address))
                        {
                            egeq.email_address = egeq.email_address.Split('@')[0] + "@***";
                        }
                    }
                    egeq.email_createdate_tostring = CommonFunction.GetNetTime(egeq.email_createdate);
                    egeq.email_updatedate_tostring = CommonFunction.GetNetTime(egeq.email_updatedate);
                }
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";
            }
            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,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }