Exemplo n.º 1
0
        public string SalonInfo([FromBody] SUID model)
        {
            string value = CodeHelp.GetResults(0, "失败", "");

            try
            {
                if (string.IsNullOrEmpty(model.suid.ToString()))
                {
                    value = CodeHelp.GetResults(0, "失败", "沙龙ID不能为空");
                }
                else
                {
                    SalonSimple     salon = new SalonSimple();
                    List <AllSalon> list  = new List <AllSalon>();
                    SalonService    sa    = new SalonService();
                    INoticeService  nots  = new INoticeService();
                    //取沙龙的基本信息和环境图
                    list = sa.GetSalonInfo(model.suid, 3);
                    if (list != null && list.Count > 0)
                    {
                        if (list[0].Status != 4)
                        {
                            value = CodeHelp.GetResults(0, "无法找到页面,该沙龙暂时不提供此服务。", "沙龙未开通");
                        }
                        else
                        {
                            if (list[0].Opendate < DateTime.Now)
                            {
                                value = CodeHelp.GetResults(0, "无法找到页面,该沙龙暂时不提供此服务。", "沙龙未开通");
                            }
                            else
                            {
                                list.First().Address = list.First().Address.Replace("|", "");
                                Tnotice noice        = new Tnotice();
                                noice = nots.GetNotice(model.suid);
                                if (noice != null)
                                {
                                    list.First().noticecontent = noice.content;
                                }
                                else
                                {
                                    list.First().noticecontent = "暂无公告";
                                }
                                value = CodeHelp.GetResults(1, "成功", list).ToLower();
                            }
                        }
                    }
                    else
                    {
                        value = CodeHelp.GetResults(0, "失败", "未取到数据");
                    }
                }
            }
            catch (Exception ex)
            {
                value = CodeHelp.GetResults(0, "失败", ex.Message);
            }
            return(value);
        }
Exemplo n.º 2
0
        public Tnotice GetNotice(Guid suid)
        {
            var info = new Tnotice();

            try
            {
                info = _db.t_notice
                       .Where(a => a.tn_s_uid == suid && a.tn_status == 1)
                       .OrderByDescending(a => a.tn_date)
                       .Select(a => new Tnotice
                {
                    id      = a.tn_id,
                    content = a.tn_content,
                    date    = a.tn_date,
                    status  = a.tn_status,
                    suid    = a.tn_s_uid
                })
                       .FirstOrDefault();
            }
            catch
            { }
            return(info);
        }