String was not recognized as a valid Boolean.
how to solve this problem
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Zakir AhamedPosted Sep 12, 2017, 2:57 AM
Midhun TpPosted Sep 12, 2017, 2:55 AM
Syeada Sanjida JahanPosted Sep 12, 2017, 2:45 AM
{
DataTable dtUserRight = new DataTable();
string strConnectionString = ConfigurationManager.ConnectionStrings["EchoITEMS"].ConnectionString;
SqlConnection Conn = new SqlConnection(strConnectionString);
Conn.Open();
SqlCommand cmd = new SqlCommand("GET_USER_RIGHTS_MENU_SP", Conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@USER_ID", SqlDbType.BigInt).Value = Convert.ToInt32(ddlUser.SelectedItem.Value.ToString()); ;
cmd.CommandTimeout = 50;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dtUserRight);
Conn.Close();
if (dtUserRight.Rows.Count > 0)
{
var _userRightList = from DataRow myRow in dtUserRight.Rows select myRow;
foreach (DataRow userRight in _userRightList)
{
if (Convert.ToInt32(e.NodeKey) == Convert.ToInt32(userRight["wbMenuId"].ToString()))
{
tvMenu.FindNodeByKeyValue(e.NodeKey).Selected = true;
(tvMenu.FindDataCellTemplateControl(e.NodeKey, tvMenu.Columns["wbCanView"] as TreeListDataColumn, "chkView") as CheckBox).Checked = Convert.ToBoolean(userRight["wbCanView"].ToString());
(tvMenu.FindDataCellTemplateControl(e.NodeKey, tvMenu.Columns["wbCanEdit"] as TreeListDataColumn, "chkEdit") as CheckBox).Checked = Convert.ToBoolean(userRight["wbCanEdit"].ToString());
(tvMenu.FindDataCellTemplateControl(e.NodeKey, tvMenu.Columns["wbCanDelete"] as TreeListDataColumn, "chkDelete") as CheckBox).Checked = Convert.ToBoolean(userRight["wbCanDelete"].ToString());
}
}
}
}
protected void btnAssaign_Click(object sender, EventArgs e)
{
if (ddlUser.SelectedIndex > -1)
{
int _userID = Convert.ToInt32(ddlUser.SelectedItem.Value.ToString());
string _userName = ddlUser.SelectedItem.Text.Trim();
lblMessage.Text = "";
try
{
foreach (TreeListNode node in tvMenu.GetAllNodes())
{
CheckBox chkView = tvMenu.FindDataCellTemplateControl(node.Key.ToString(), tvMenu.Columns["wbCanView"] as TreeListDataColumn, "chkView") as CheckBox;
CheckBox chkEdit = tvMenu.FindDataCellTemplateControl(node.Key.ToString(), tvMenu.Columns["wbCanEdit"] as TreeListDataColumn, "chkEdit") as CheckBox;
CheckBox chkDelete = tvMenu.FindDataCellTemplateControl(node.Key.ToString(), tvMenu.Columns["wbCanDelete"] as TreeListDataColumn, "chkDelete") as CheckBox;
String ConnString = ConfigurationManager.ConnectionStrings["EchoITEMS"].ConnectionString;
SqlConnection con = new SqlConnection(ConnString);
SqlCommand cmd = new SqlCommand("USER_RIGHTS_INSERT_UPDATE_SP", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@USER_ID", SqlDbType.BigInt).Value = _userID;
cmd.Parameters.Add("@MENU_ID", SqlDbType.BigInt).Value = Convert.ToInt32(node.Key);
cmd.Parameters.Add("@CAN_EDIT", SqlDbType.Bit).Value = chkEdit.Checked;
cmd.Parameters.Add("@CAN_DELETE", SqlDbType.Bit).Value = chkDelete.Checked;
cmd.Parameters.Add("@CAN_VIEW", SqlDbType.Bit).Value = chkView.Checked;
if (String.IsNullOrEmpty(node.ParentNode.Key))
{
cmd.Parameters.Add("@PARENT_ID", SqlDbType.BigInt).Value = Convert.ToInt32(node.Key);
}
else
{
cmd.Parameters.Add("@PARENT_ID", SqlDbType.BigInt).Value = Convert.ToInt32(node.ParentNode.Key);
}
try
{
con.Open();
cmd.ExecuteNonQuery();
lblMessage.Text = String.Format("Menu Permission has Inserted successfully to Assign User : {0}", _userName);
}
catch (Exception ex)
{
}
}
}
catch (Exception ex)
{
lblMessage.Text = String.Format("Menu Permission hasn't Complete..RollBack!! of User : {0} ", _userName);
}
}
}
Zakir AhamedPosted Sep 12, 2017, 1:43 AM