Exemplo n.º 1
0
 public string QueryUserById(MailGroupMapQuery query)
 {
     try
     {
         List<MailGroupMapQuery> store = _IMailGroupDao.QueryUserById(query);
         StringBuilder stb = new StringBuilder();
         foreach (var item in store)
         {
             stb.Append(string.Format("{0}", item.user_id));
             stb.Append(",");
         }
         return stb.ToString().Length > 0 ? stb.ToString().Substring(0, stb.ToString().Length - 1) : "";
     }
     catch (Exception ex)
     {
         throw new Exception("MailGroupMgr-->QueryUserById-->" + ex.Message, ex);
     }
 }
Exemplo n.º 2
0
        //add by wwei0216w 2015/4/9
        public HttpResponseBase GetMemberInfo()
        {
            string json = "";
            MailGroupMapQuery query = new MailGroupMapQuery();
            try
            {

                if (!string.IsNullOrEmpty(Request.Form["rowId"]))
                {
                    query.group_id = Convert.ToInt32(Request.Form["rowId"]);
                    query.status = 1;
                    _IMailGroupMgr = new MailGroupMgr(mySqlConnectionString);
                    var list = _IMailGroupMgr.QueryUserInfo(query);
                    //StringBuilder sb = new StringBuilder("[");
                    //sb.Append("{rowId:" + query.group_id + ",groupName:\"" + list[0].group_name + "\",item:[");
                    //foreach(MailGroupMapQuery mm in list)
                    //{
                    //    sb.Append("{user_name:\"" + mm.user_mail + "\",row_id:" + mm.row_id + "}");
                    //}
                    //sb.Append("]}");
                    //sb.Append("]");
                    //json = sb.ToString().Replace("}{", "},{");

                    json = "{items:" + JsonConvert.SerializeObject(list) + "}";
                }
            }
            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);
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Exemplo n.º 3
0
        public HttpResponseBase AddCallid()
        {
            List<MailGroupMapQuery> list = new List<MailGroupMapQuery>();
            MailGroupMapQuery query = new MailGroupMapQuery();
            string json = string.Empty;
            _IMailGroupMgr = new MailGroupMgr(mySqlConnectionString);
            try
            {
                if (!string.IsNullOrEmpty(Request.Form["groupId"]))
                {
                    query.group_id = Int32.Parse(Request.Form["groupId"]);
                }
                if (!string.IsNullOrEmpty(Request.Form["callid"]))
                {
                    string[] callid = Request.Form["callid"].IndexOf(",") != -1 ? Request.Form["callid"].Split(',') : new string[] { Request.Form["callid"] };

                    _IMailGroupMgr.DeleteMailMap(query.group_id);
                    for (int i = 0; i < callid.Length; i++)
                    {
                        query = new MailGroupMapQuery();
                        query.group_id = Int32.Parse(Request.Form["groupId"]);
                        query.user_id = Convert.ToInt32(callid[i]);
                        query.create_time = DateTime.Now;
                        query.update_time = query.create_time;
                        query.create_user = (Session["caller"] as Caller).user_id;
                        query.update_user = (Session["caller"] as Caller).user_id;
                        query.status = _IMailGroupMgr.GetStatus(query.user_id);
                        list.Add(query);
                    }
                    if (_IMailGroupMgr.SaveMailMap(list))
                    {
                        json = "{success:true,msg:\"新增成功\"}";
                    }
                    else
                    {
                        json = "{success:true,msg:\"新增失败\"}";
                    }
                }
                else
                {

                    if (_IMailGroupMgr.DeleteMailMap(query.group_id) > 0)
                    {
                        json = "{success:true,msg:\"人员已清空\"}";
                    }
                    else
                    {
                        json = "{success:true,msg:\"人员已清空\"}";
                    }
                }
            }
            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:true,msg:\"新增失败\"}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Exemplo n.º 4
0
 public string QueryUserById()
 {
     string json = string.Empty;
     MailGroupMapQuery query = new MailGroupMapQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Form["groupId"]))
         {
             query.group_id = Convert.ToInt32(Request.Form["groupId"]);
         }
         query.status = 1;
         _IMailGroupMgr = new MailGroupMgr(mySqlConnectionString);
         json = _IMailGroupMgr.QueryUserById(query);
     }
     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 = "[]";
     }
     return json;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 選擇已選的人插入羣組中
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public string SaveMailMap(MailGroupMapQuery query)
 {
     StringBuilder sql = new StringBuilder();
     sql.Append("insert into mail_group_map (`group_id`,`user_id`,`status`,`create_time`,`create_user`,`update_time`,`update_user`)");
     sql.AppendFormat("values({0},{1},{2},'{3}',{4},'{5}',{6})",query.group_id,query.user_id,query.status,CommonFunction.DateTimeToString(query.create_time),query.create_user,CommonFunction.DateTimeToString(query.update_time),query.update_user);
     return sql.ToString();
 }
Exemplo n.º 6
0
        public List<MailGroupMapQuery> QueryUserById(MailGroupMapQuery query)
        {
            StringBuilder sql = new StringBuilder();
            try
            {

                sql.AppendFormat(@"SELECT mu.user_mail,mu.user_name,mgm.row_id,mgm.user_id,mg.group_name
                        FROM mail_group_map mgm 
                            LEFT join mail_user mu on mgm.user_id=mu.row_id
                        LEFT JOIN mail_group mg ON mg.row_id = mgm.group_id
                        WHERE mgm.group_id={0} AND mgm.`status`={1};", query.group_id, query.status); //add by wwei0216w 2015/4/9 添加 mu.user_mail 查詢
                return _access.getDataTableForObj<MailGroupMapQuery>(sql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("MapGroupDao-->QueryUserById-->"+sql.ToString()+ex.Message,ex);
            }
        }
Exemplo n.º 7
0
 public List<MailGroupMapQuery> QueryUserInfo(MailGroupMapQuery query)
 {
     try
     {
         List<MailGroupMapQuery> store = _IMailGroupDao.QueryUserById(query);
         return store;
     }
     catch (Exception ex)
     {
         throw new Exception("MailGroupMgr-->QueryUserInfo-->" + ex.Message, ex);
     }
 }