this.txt_Menu_ParentID_number.Text = strValue[2];
txtType.Text = "edit";
this.winMenuAdd.Title = "菜单修改";
this.winMenuAdd.Show();
}
break;
case "menuDelete":
if (strValue.Length <= 1)
{
Notification.Show(new NotificationConfig
{
Title = "客户来源管理",
Icon = Icon.Information,
Html = "未选择记录"
});
}
else
{
this.Delete();
}
break;
}
}
[DirectMethod]
public void ClickCurrentNode(string name)
{
txtValue.Text = name;
}
///
/// 保存
///
///
[DirectMethod]
public string Save()
{
string name = this.txt_Menu_Name_varchar2.Text;
string pid = this.txt_Menu_ParentID_number.Text;
MenuInfo menu = new MenuInfo();
menu.Name = name;
menu.Pid = pid;
bool bl = false;
string sql = "";
if (txtType.Text == "add")
{
sql = "insert into [CustomerSource] (Name,ParentId) values ('" + menu.Name + "'," + menu.Pid + ")";
int res = DbHelperSQL.ExecuteSql(sql, null);
if (res > 0)
bl = true;
}
else
{
string[] strValue = txtValue.Text.Split('|');
menu.Id = strValue[0];
sql = "update CustomerSource set Name='" + menu.Name + "' " + " where Id=" + menu.Id + " ";
int res = DbHelperSQL.ExecuteSql(sql, null);
if (res > 0)
bl = true;
}
if (bl)
{
txt_Menu_Name_varchar2.Text = "";
Notification.Show(new NotificationConfig
{
Title = "客户来源管理",
Icon = Icon.Information,
Html = "保存成功"
});
winMenuAdd.Hide();
string rtn = RefreshMenu();
return rtn;
}
else
{
Notification.Show(new NotificationConfig
{
Title = "客户来源管理",
Icon = Icon.Information,
Html = "保存失败"
});
return this.TreeGrid1.Root.ToJson();
}
this.txtValue.Text = "";
}
///
/// 删除
///
///
[DirectMethod]
public string Delete()
{
string[] strValue = txtValue.Text.Split('|');
string id = strValue[0];
string ssql = "select Id from [CustomerSource] where ParentId=" + id + "";
DataTable dt = DbHelperSQL.ExecuteDT(ssql, null);
if (dt.Rows.Count > 0)
{
Notification.Show(new NotificationConfig
{
Title = "客户来源管理",
Icon = Icon.I