Beispiel #1
0
        public static string QueryFristNews()
        {
            string              r    = "";
            NB_NewsBll          sicb = new NB_NewsBll();
            SessionUserValidate iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                string dw = "";
                if (iv.u.dcode.Trim() != "")
                {
                    dw = " and dcode = '" + iv.u.dcode.Substring(0, 8) + "'";
                }
                else
                {
                }
                List <NB_News> lnb = sicb.QueryList(" and cdate>'" + iv.u.ecdate + "' and ((nvrange='all' " + dw + " ) or (nvrange='seldep' and id in(select nid from NB_DepNews where dcode='" + iv.u.dcode + "') ))and id not in(select nid from NB_NewsReader where ename='" + iv.u.ename + "') order by id desc");
                if (lnb != null)
                {
                    r = js.Serialize(lnb[0]);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Beispiel #2
0
        public static string InitNews(string id)
        {
            string              r   = "";
            NB_NewsBll          nnb = new NB_NewsBll();
            NB_News             n   = new NB_News();
            SessionUserValidate iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                NB_News sn = nnb.Query(" and id=" + id + "");
                if (sn != null)
                {
                    r = js.Serialize(sn);
                }
                else
                {
                    n.id     = 0;
                    n.nstate = true;
                    r        = js.Serialize(n);
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Beispiel #3
0
        public static ArrayList CustQueryRoleList(string curpage, string pagesize)
        {
            ArrayList          r    = new ArrayList();
            BusiEventButtonBll bebb = new BusiEventButtonBll();
            NB_NewsBll         sub  = new NB_NewsBll();
            List <NB_News>     lsr  = new List <NB_News>();

            StringBuilder where = new StringBuilder();
            SessionUserValidate iv = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r.Add(iv.badstr);
                int rcount = 0;
                int pcount = 0;
                if (iv.u.rcode != "xtgl")
                {
                    where.AppendFormat(" and ( id in(select nid from NB_DepNews where dcode='{0}') or rtype='a' )   ", iv.u.dcode);
                }
                lsr = sub.QueryList(Convert.ToInt32(curpage), Convert.ToInt32(pagesize), where.ToString(), "id desc", ref rcount, ref pcount);
                if (lsr != null)
                {
                    r.Add(pcount);
                    foreach (NB_News s in lsr)
                    {
                        ArrayList al = new ArrayList();
                        al.Add(s.id);
                        al.Add(s.ntitle);
                        al.Add(s.ntype);
                        al.Add(s.nstate == true ? "显示" : "关闭");
                        al.Add(s.maker);
                        al.Add(s.cdate);
                        al.Add(bebb.QueryBtnListItems("0175", iv.u.rcode, "LX", s.id.ToString()));
                        r.Add(al);
                    }
                }
            }
            else
            {
                r.Add(iv.badstr);
            }
            return(r);
        }
Beispiel #4
0
        public static ArrayList CustQueryListAll(string curpage, string pagesize)
        {
            ArrayList           r    = new ArrayList();
            BusiEventButtonBll  bebb = new BusiEventButtonBll();
            NB_NewsBll          sub  = new NB_NewsBll();
            List <NB_News>      lsr  = new List <NB_News>();
            SessionUserValidate iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r.Add(iv.badstr);
                int rcount = 0;
                int pcount = 0;

                lsr = sub.QueryList(Convert.ToInt32(curpage), Convert.ToInt32(pagesize), " ", "id desc", ref rcount, ref pcount);
                if (lsr != null)
                {
                    r.Add(pcount);
                    foreach (NB_News s in lsr)
                    {
                        ArrayList al = new ArrayList();
                        al.Add(s.id);
                        al.Add(s.ntitle);
                        al.Add(s.ntype);
                        al.Add(s.nstate == true ? "显示" : "关闭");
                        al.Add(s.maker);
                        al.Add(s.cdate);
                        al.Add(bebb.QueryBtnListItems("0176", iv.u.rcode, "LX", s.id.ToString()));
                        r.Add(al);
                    }
                }
            }
            else
            {
                r.Add(iv.badstr);
            }
            return(r);
        }
Beispiel #5
0
        public static string DelNews(string id)
        {
            string              r   = "";
            NB_NewsBll          sdb = new NB_NewsBll();
            SessionUserValidate iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                if (sdb.Delete(" and id=" + id + ""))
                {
                    r = "S";
                }
                else
                {
                    r = "F";
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Beispiel #6
0
        public static string SaveNews(string ndate, string nfbr, string nid, string nshow, string nreader, string ntext, string ntype, string sdep, string tname)
        {
            string              r    = "";
            NB_NewsBll          sicb = new NB_NewsBll();
            NB_News             sic  = new NB_News();
            ArrayList           sbn  = new ArrayList();
            SessionUserValidate iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                if (nreader == "seldep")
                {
                    string[] darr = sdep.Split(';');
                    foreach (string dstr in darr)
                    {
                        List <Sys_Depment> lsd = sdb.QueryList(" and dcode like '" + dstr + "%' and disend='true'");
                        if (lsd != null)
                        {
                            foreach (Sys_Depment sd in lsd)
                            {
                                sbn.Add(sd.dcode);
                            }
                        }
                    }
                }
                else
                {
                    nreader = "all";
                    sbn     = null;
                }
                sic.ntitle   = tname;
                sic.ncontent = ntext;
                sic.nreadnum = 0;
                sic.nstate   = nshow == "a"?true:false;
                sic.maker    = iv.u.ename;
                sic.cdate    = DateTime.Now.ToString();
                sic.nvrange  = nreader;
                sic.ntype    = ntype;
                sic.nsid     = CommonBll.GetSid();
                sic.dcode    = "";
                sic.rtype    = "a";
                sic.sdcode   = sdep;
                if (nid == "0")
                {
                    if (sicb.Add(sic) > 0)
                    {
                        r = "S";
                        NB_News sicc = sicb.Query(" and nsid='" + sic.nsid + "'");
                        if (sicc != null)
                        {
                            nid = sicc.id.ToString();
                            ndnb.Add(nid, sbn);
                        }
                    }
                    else
                    {
                        r = "F";
                    }
                }
                else
                {
                    sic.id = Convert.ToInt32(nid);
                    if (sicb.Update(sic))
                    {
                        r = "S";
                        ndnb.Delete(" and nid=" + nid + "");
                        ndnb.Add(nid, sbn);
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }