Exemple #1
0
        /// <summary>
        /// 删除遗忘提醒
        /// </summary>
        /// <param name="context"></param>
        public void update_remind_isdelete(HttpContext context)
        {
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;
            string       id       = request["id"];
            string       guid     = request["guid"];

            try
            {
                if (id != "0")
                {
                    if (dic_Self.ContainsKey(guid))
                    {
                        //获取当前用户的所有联系人
                        List <remind> list1 = (from t in dic_Self[guid]
                                               where t.id == Convert.ToInt64(id)
                                               select t).ToList <remind>();
                        //删除指定ID的联系人
                        if (list1.Count > 0)
                        {
                            dic_Self[guid].Remove(list1[0]);
                            jsonModel = new JsonModel()
                            {
                                errNum  = 0,
                                errMsg  = "success",
                                retData = list1.Count
                            };
                            //开启线程操作数据库
                            new Thread(() =>
                            {
                                try
                                {
                                    remind remind       = Constant.remind_S.GetEntityById(Convert.ToInt32(id)).retData as remind;
                                    remind.rem_isdelete = request["rem_isdelete"];
                                    if (remind != null)
                                    {
                                        jsonModel = Constant.remind_S.Update(remind);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    LogHelper.Error(ex);
                                }
                            })
                            {
                            }.Start();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Exemple #2
0
        /// <summary>
        /// 打开或关闭遗忘提醒
        /// </summary>
        /// <param name="context"></param>
        public void update_remind_isopen(HttpContext context)
        {
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;
            string       id       = request["id"];
            string       guid     = request["guid"];

            try
            {
                if (id != "0")
                {
                    if (dic_Self.ContainsKey(guid))
                    {
                        List <remind> dic2 = dic_Self[guid].Where(item => item.id == Convert.ToInt64(id)).ToList <remind>();
                        if (dic2.Count > 0)
                        {
                            dic2[0].rem_isopen = request["rem_isopen"];
                            //成功提示
                            jsonModel = new JsonModel()
                            {
                                errNum  = 0,
                                errMsg  = "success",
                                retData = dic2.Count
                            };
                            //开启线程操作数据库
                            new Thread(() =>
                            {
                                remind remind     = Constant.remind_S.GetEntityById(Convert.ToInt32(id)).retData as remind;
                                remind.rem_isopen = request["rem_isopen"];
                                if (remind != null)
                                {
                                    jsonModel = Constant.remind_S.Update(remind);
                                }
                            })
                            {
                            }.Start();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Exemple #3
0
        /// <summary>
        /// 新增遗忘提醒
        /// </summary>
        /// <param name="context"></param>
        public void edit_remain(HttpContext context)
        {
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;
            string       id       = request["id"];
            string       guid     = request["guid"];

            try
            {
                remind remind = new remind();
                remind.id           = Convert.ToInt32(id);
                remind.rem_date     = DateTime.Parse(request["rem_date"].ToString());
                remind.rem_content  = request["rem_content"];
                remind.rem_status   = request["rem_status"];
                remind.rem_isopen   = request["rem_isopen"];
                remind.rem_isdelete = "0";
                //修改《暂时修改功能》
                if (id != "0")
                {
                    if (dic_Self.ContainsKey(guid))
                    {
                        List <remind> dic2 = dic_Self[guid].Where(item => item.id == Convert.ToInt64(id)).ToList <remind>();
                        if (dic2.Count > 0)
                        {
                            dic2[0] = remind;
                            //成功提示
                            jsonModel = new JsonModel()
                            {
                                errNum  = 0,
                                errMsg  = "success",
                                retData = dic2.Count
                            };
                            //开启线程操作数据库
                            new Thread(() =>
                            {
                                remind advert = Constant.remind_S.GetEntityById(Convert.ToInt32(id)).retData as remind;
                                if (advert != null)
                                {
                                    jsonModel = Constant.remind_S.Update(remind);
                                }
                            })
                            {
                            }.Start();
                        }
                    }
                }
                else
                {
                    remind.rem_userid = request["rem_userid"];
                    if (dic_Self.ContainsKey(guid))
                    {
                        //缓存添加客户
                        dic_Self[guid].Add(remind);
                        //当前添加客户
                        list_All.Add(remind);

                        jsonModel = new JsonModel()
                        {
                            errNum  = 0,
                            errMsg  = "success",
                            retData = 1
                        };
                        new Thread(() =>
                        {
                            jsonModel = Constant.remind_S.Add(remind);
                        })
                        {
                        }.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }