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); }
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); }