Esempio n. 1
0
        public Dictionary <string, string> GetSubjectDicSPage(List <string> subjectNoList)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            if (subjectNoList != null && subjectNoList.Count() > 0)
            {
                List <SWfsSubjectTopExpand> List = DapperUtil.Query <SWfsSubjectTopExpand>("ComBeziWfs_SWfsSubjectTopExpand_GetSubjectDicSPage", new { SubjectNo = subjectNoList.ToArray() }).ToList();
                if (List != null && List.Count() > 0)
                {
                    SWfsSubjectTopExpand model = null;
                    foreach (var item in subjectNoList)
                    {
                        model = List.Where(r => r.SubjectNo.Equals(item)).FirstOrDefault();
                        if (model != null && !string.IsNullOrWhiteSpace(model.StExpand) && !dic.ContainsKey(item))
                        {
                            dic.Add(item, model.StExpand);
                        }
                        else
                        {
                            dic.Add(item, "0");
                        }
                    }
                }
            }
            return(dic);
        }
Esempio n. 2
0
        public ActionResult AjaxStickTime()
        {
            string subjectNo = Request.Params["subjectNo"];

            if (string.IsNullOrEmpty(subjectNo))
            {
                return(Json(new { result = "-1", message = "信息获取错误" }));
            }
            SWfsChannelService   service = new SWfsChannelService();
            SWfsSubjectTopExpand top     = service.SelectSubjectTopBySubjectNo(subjectNo);

            try
            {
                if (top == null)
                {
                    top               = new SWfsSubjectTopExpand();
                    top.SubjectNo     = subjectNo;
                    top.TopCreateTime = DateTime.Now;
                    top.StExpand      = string.Empty;
                    service.InsertSubjectTop(top);
                }
                else
                {
                    top.TopCreateTime = DateTime.Now;
                    service.EditSubjectTop(top);
                }
            }
            catch
            {
                return(Json(new { result = "-1", message = "置顶错误" }));
            }
            return(Json(new { result = "1", message = "该活动已经置顶" }));
        }
Esempio n. 3
0
 /// <summary>
 /// 更新置顶扩展表
 /// </summary>
 /// <param name="topExpand"></param>
 /// <returns></returns>
 public bool EditSubjectTop(SWfsSubjectTopExpand topExpand)
 {
     return(DapperUtil.Update(topExpand));
 }
Esempio n. 4
0
 /// <summary>
 /// 添加置顶
 /// </summary>
 /// <param name="topExpand"></param>
 /// <returns></returns>
 public int InsertSubjectTop(SWfsSubjectTopExpand topExpand)
 {
     return(DapperUtil.Insert(topExpand));
 }
Esempio n. 5
0
        public JsonResult AddYRPage()
        {
            string subjectNo = Request.Form["subjectNo"];
            string pageId    = Request.Form["pageId"];
            string flag      = Request.Form["flag"]; //1关联,0取消

            if (string.IsNullOrEmpty(subjectNo))
            {
                return(Json(new { rs = "0", msg = "活动编号不能为空" }));
            }
            if (flag.Equals("1") && string.IsNullOrEmpty(pageId))
            {
                return(Json(new { rs = "0", msg = "请选择关联的预热页面" }));
            }
            SWfsChannelService   service = new SWfsChannelService();
            SWfsSubjectTopExpand model   = service.SelectSubjectTopBySubjectNo(subjectNo);

            if (flag.Equals("0")) //取消
            {
                if (model == null)
                {
                    return(Json(new { rs = "1", msg = "取消成功" }));
                }
                else
                {
                    model.StExpand = "0";
                    service.EditSubjectTop(model);
                    return(Json(new { rs = "1", msg = "取消成功" }));
                }
            }
            else //关联
            {
                if (null != model) //更新
                {
                    try
                    {
                        model.StExpand = pageId;
                        service.EditSubjectTop(model);
                        return(Json(new { rs = "1", msg = "关联成功" }));
                    }
                    catch (Exception e)
                    {
                        return(Json(new { rs = "0", msg = e.Message }));
                    }
                }
                else //写入
                {
                    try
                    {
                        model = new SWfsSubjectTopExpand();
                        model.TopCreateTime = new DateTime(1900, 1, 1);//关联静态页,默认时间最小,置顶后按置顶时间先后显示
                        model.SubjectNo     = subjectNo;
                        model.StExpand      = pageId;
                        service.InsertSubjectTop(model);
                        return(Json(new { rs = "1", msg = "关联成功" }));
                    }
                    catch (Exception e)
                    {
                        return(Json(new { rs = "0", msg = e.Message }));
                    }
                }
            }
        }