一、List 转字符串
List<string> list = new List<string>();
list.Add("a");
list.Add("b");
list.Add("c");
string s = string.Join(",", list.ToArray());
MessageBox.Show(s);
a,b,c
/// <summary>
/// 删除父节点
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Btn_DelParentNode(object sender, EventArgs e)
{
int[] rows = gridview_Parent.GetSelectedRows(); //获取GridView 选中的数据行信息
if (rows.Length == 0)
{
MessageHelper.InfoMsg("请勾选一行记录。"); return;
}
else
{
List<int> selectRows;
List<int> custcode = new List<int>();
selectRows = this.gridview_Parent.GetSelectedRows().ToList();
foreach (int i in selectRows)
{
custcode.Add(int.Parse(this.gridview_Parent.GetDataRow(i)["group_num_id"].ToString()));
if (this.gridview_Parent.GetDataRow(i)["group_num_id"].ToInt() == GlobalNode.ToInt())
{
ChildNodeData.DataSource = null;
this.GlobalNode = null;
}
}
//string depaid = string.Join(",", custcode);
System.Int32[] str = custcode.ToArray();
bool result = UnitOfWork<DAL_AllocationMgt>.Resolve.ParentNodeDel(str, out string error);
if (result)
{
MessageHelper.InfoMsg("删除成功。");
ParentNodeInitData();
}
}
}
public IList<PsychTeacherResponceDTO> GetPsychTeacherInfo(Guid SchoolId, int Outside)
{
string sql = string.Format(@"select
a.YD_AdvisoryMapId Aid,
a.YD_TeacherId Tid,
b.YD_UserName TeacherName,
a.YD_TeacherIntroduce TeacherIntroduce
from [dbo].[YD_AdvisoryMapInfo] a with(nolock)
left join [dbo].[YD_UserInfo] b with(nolock)
on a.YD_TeacherId=b.YD_ID
where YD_ManageOrTeacher=2 and b.YD_IsDelete=0
and a.YD_IsDelete=0 and b.YD_Enabled=1 and b.YD_SchoolId='{0}' and a.YD_Outside='{1}'", SchoolId, Outside);
return this.SqlQuery<PsychTeacherResponceDTO>(sql.ToString());
}