protected void Button2_Click(object sender, EventArgs e)
{
string name = this.id_croDropDownList.SelectedItem.Text.Trim();
int count = this.GridView1.Rows.Count;
if (count != 0)
{
for (int i = 0; i < count; i++)
{
if ((this.GridView1.Rows[i].Cells[0].FindControl("checkbox") as CheckBox).Checked == true)
{
str += (this.GridView1.Rows[i].FindControl("lblid") as Label).Text + ",";
}
}
}
if (str == String.Empty)
{
Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('請選擇指派至!')</script>");
return;
}
strsbustring(str,name);
}
private void strsbustring(string str, string name)
{
str = str.Substring(0, str.Length - 1);
string sql = "update tbOBCustList set assign_dt=getdate(), id_cro='" + name + "'" + " where id in(" + str + ")";
int result = SqlHelper.SqlHelper.ExecuteNonQuery(BnbCRM.DAL.Connstring.ConnStr, CommandType.Text, sql);
if (result> 0)
{
Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('分配成功,系統會自動重新整理資料!')</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('分配失敗!')</script>");
}
Button1_Click(null, null);
}