/// <summary> /// /// </summary> /// <param name="ids"></param> /// <param name="nodes"></param> /// <returns></returns> public int MoveTo(string[] ids, string[] nodes) { if (ids.Length == 0) { throw new Exception("被移动的文章未选择!"); } if (nodes.Length == 0) { throw new Exception("要移动到的栏目未选择!"); } int r = 0; try { for (int i = 0; i < nodes.Length; i++) { cmsNewsCatalog nc = NewsCatalogService.GetInstance().Get(nodes[i]); string sql = @"update cmsNews set nodecode='{0}',langId={1} where 1=1 and Id in ('{2}')"; sql = string.Format(sql, nodes[i], nc.LangId, string.Join("','", ids).Replace("'0',", "")); r = DBSession.CurrentSession.FromSql(sql).ExecuteNonQuery(); } } catch (Exception ex) { throw ex; } return(r); }
/// <summary> /// /// </summary> /// <param name="ids"></param> /// <param name="nodes"></param> /// <returns></returns> public int CopyTo(string[] ids, string[] nodes) { if (ids.Length == 0) { throw new Exception("被复制的文章未选择!"); } if (nodes.Length == 0) { throw new Exception("要复制到的栏目未选择!"); } int r = 0; try { for (int i = 0; i < nodes.Length; i++) { cmsNewsCatalog nc = NewsCatalogService.GetInstance().Get(nodes[i]); for (int j = 0; j < ids.Length; j++) { string sql = @"insert into cmsNews(RGuid,NodeCode,Title,Content,Summary,Tags,Author,Source,SmallPic,Pics,Hits,AddTime,AddUser,EditTime,EditUser,OrderNo,IsIndex,IsTop,IsAudit,AuditTime,AuditUser,AuditComment,ProductNo,ProductModel,Parameter1,Parameter2,Parameter3,Parameter4,Parameter5,langId) select '{0}','{1}',Title,Content,Summary,Tags,Author,Source,SmallPic,Pics,Hits,AddTime,AddUser,EditTime,EditUser,OrderNo,IsIndex,IsTop,IsAudit,AuditTime,AuditUser,AuditComment,ProductNo,ProductModel,Parameter1,Parameter2,Parameter3,Parameter4,Parameter5,{2} from cmsNews where 1=1 and Id='{3}'"; sql = string.Format(sql, Guid.NewGuid().ToString(), nodes[i], nc.LangId, ids[j]); r = DBSession.CurrentSession.FromSql(sql).ExecuteNonQuery(); } } } catch (Exception ex) { throw ex; } return(r); }