|
i need help for converting c# code to c++.
Is there any kind of coverter for this please send it to me.
please do help me .
MISHAQ
|
|
|
|
|
No, there is not. To convert C# to C++/CLI is trivial, and you can buy converters. To convert it to straight C++ is not really possible via an automated process.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
ok thanx for replying
but sir you can tell me how function ToInt16()or ToInt32()will be converted.
MIshaq
|
|
|
|
|
That depends. You may use a cast, or you may have to use atoi
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sir,
I Want to fill tree view from a self joined SqlServer Table. The data in this table is filled up by the user at the run-time. So I want code which can fill tree view at the run-time.
Regards.
Prashant Mathur
Viva Creations
|
|
|
|
|
below code should be written in code behind i.e .ascx.cs
----------------------------------------------------------------------------
public partial class PresentationTier_Controls_MenuCreationControl : System.Web.UI.UserControl
{
//Creating Object for Class
MenuCreationBLL obj = new MenuCreationBLL();
UserCreationBLL uc = new UserCreationBLL();
//Variable Declarions
int childid = 1;
string Who; //CreatedBy
int ClientId;
string f1;
string f2;
string i1;
string i2;
string ids = "";
string RoleName = "";
static string s = "";
public int Count1;
public int Count2;
public static int pqr;
public static string flag2;
public static int c1;
public static int cout = 0;
public static int cout1 = 0;
public static string abc = "";
public static int count = 0;
public static int child;
public static int menuid;
public static int reply;
public static int aaa;
public static int val;
public static int val1;
public static int bbb;
public static int flg3;
public static int pid;
public static int threaddown;
public static int replyup;
public static int replydown;
public static int meid;
public static DataTable dt = new DataTable();
public static DataTable dt1 = new DataTable();
public DataTable myDataTable = new DataTable();
public static DataTable MyDtab = new DataTable();
public static DataTable MyDset = new DataTable();
public static DataView threads = new DataView();
DataTable dt2 = new DataTable();
DataView dv = new DataView();
string tempnme;
public static DataTable dt3 = new DataTable();
public static DataTable dsrole = new DataTable();
//*****************************PageLoad****************************************************//
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (Session.Count > 0)
{
tempnme = "";
Who = Session["SAName"].ToString();
ClientId = Convert.ToInt32(Session["SClientId"].ToString());
btnSubmit.Attributes.Add("onclick", "return validation();");
Edit.Attributes.Add("onclick", "return Message();");
AddSibling.Attributes.Add("onclick", "return Message();");
AddChild.Attributes.Add("onclick", "return Message();");
MoveUp.Attributes.Add("onclick", "return Message();");
MoveDown.Attributes.Add("onclick", "return Message();");
Delete.Attributes.Add("onclick", "return Message();");
if (!IsPostBack)
{
meid = 0;
pqr = 0;
threaddown = 0;
aaa = 0;
bbb = 0;
PopulateNodes();
s = "";
TreeView1.ExpandDepth = 0;
GetStatus();
GetTemplate();
DisplayErr();
table2.Attributes.Add("style", "Display:block");
}
}
else
{
Response.Redirect("~/AdminLogin.aspx");
}
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
if (ddlMenuStatus.SelectedItem.Text == "Drafts")
{
QLink.Attributes.Add("style", "Display:none");
chkQuickLinks.Checked = false;
}
if (ddlMenuStatus.SelectedItem.Text == "Backoffice" || ddlMenuStatus.SelectedItem.Text == "Active")
{
QLink.Attributes.Add("style", "Display:block");
QLink.Focus();
}
if (ddlMenuStatus.SelectedItem.Text == "--Choose--")
{
chkQuickLinks.Checked = false;
}
}
//*****************************************************************************************//
// For TreeView Display
//*****************************************************************************************//
public void PopulateNodes()
{
try
{
TreeView1.Nodes.Clear();
DataTable MName = obj.GetAllMenus(1, ClientId,tempnme);
threads = GetThreads(MName);
menuid = Convert.ToInt32(threads.Table.Rows[0]["MenuId"].ToString());
foreach (DataRowView row in threads)
{
TreeNode threadNode = new TreeNode();
threadNode.Text = row["MenuName"].ToString();
threadNode.Value = row["MenuId"].ToString();
threaddown++;
val = Convert.ToInt32(threadNode.Value);
if (threaddown == 2)
{
menuid = Convert.ToInt32(threadNode.Value);
}
if (threaddown == row.DataView.Count)
{
threaddown = Convert.ToInt32(threadNode.Value);
}
if (row.DataView.Count == 1)
{
threaddown = Convert.ToInt32(threadNode.Value);
menuid = Convert.ToInt32(threadNode.Value);
}
if (Convert.ToInt32(threadNode.Value) == pqr)
{
threadNode.Expand();
cout = 1;
abc += Convert.ToString(threadNode.Value) + ",";
count = 1;
}
TreeView1.Nodes.Add(threadNode);
reply = 0;
AddReplies(MName, threadNode);
if (val1 == Convert.ToInt32(threadNode.Value))
{
threadNode.Expand();
}
}
if (count == 1)
{
Hidegrid.Attributes.Add("style", "Display:block");
}
if (pqr != 0)
{
displayGrid();
}
table2.Attributes.Add("style", "Display:none");
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
}
//************************
//********************************************************//
//Get Threads in TreeView
//********************************************************************************//
public DataView GetThreads(DataTable discuss)
{
DataView view = new DataView(discuss);
view.RowFilter = "ParentId=0";
int w = view.Table.Rows.Count;
return view;
}
//********************************************************************************//
// Add Replies in TreeView *//
//********************************************************************************//
public void AddReplies(DataTable messages, TreeNode node)
{
try
{
DataView replies = GetReplies(messages, node.Value);
foreach (DataRowView row in replies)
{
aaa = Convert.ToInt32(obj.GetMaxCount(Convert.ToInt32(node.Value), 1));
bbb = Convert.ToInt32(obj.GetMaxCount(Convert.ToInt32(node.Value), 2));
TreeNode replyNode = new TreeNode();
replyNode.Text = row["MenuName"].ToString();
replyNode.Value = row["MenuId"].ToString();
reply++;
if (replyup == 0)
{
if (bbb == flg3)
{
replyup = Convert.ToInt32(replyNode.Value);
}
}
if ((aaa == flg3))
{
if (i1 == null)
{
replydown = Convert.ToInt32(replyNode.Value);
}
}
if ((aaa == pqr) && (bbb == pqr))
{
replyup = Convert.ToInt32(replyNode.Value);
replydown = Convert.ToInt32(replyNode.Value);
}
if (Convert.ToInt32(replyNode.Value) == pqr)
{
if (cout1 == 1)
{
replyNode.Collapse();
cout1 = 0;
}
else
{
replyNode.Expand();
cout1 = 1;
}
if (cout == 1)
{
node.Expand();
}
abc += Convert.ToString(replyNode.Value) + ",";
node.Expand();
count = 1;
val1 = val;
displayGrid();
}
node.ChildNodes.Add(replyNode);
AddReplies(messages, replyNode);
}
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
}
//********************************************************************************//
// Get Replies in TreeView *//
//********************************************************************************//
public DataView GetReplies(DataTable messages, string messageID)
{
DataView view = new DataView(messages);
view.RowFilter = "ParentId=" + messageID;
return view;
}
//*****************************************************************************************//
//For DisplayGrid
//*****************************************************************************************//
public void displayGrid()
{
try
{
DataColumn myDataColumn;
DataRow myDataRow;
//create the first column
//myDataTable.Columns.Clear();
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.Int32");
myDataColumn.ColumnName = "MenuId";
myDataColumn.ReadOnly = true;
myDataColumn.Unique = true;
//myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
//Create and add the second column
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "MenuName";
myDataColumn.ReadOnly = false;
////myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
//Create and add the second column
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "TemplateName";
myDataColumn.ReadOnly = false;
////myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
//Create and add the Third column
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "Description";
myDataColumn.ReadOnly = false;
//myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
//Create and add the second column
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "MetaTags";
myDataColumn.ReadOnly = false;
//myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
// Create and add the second column
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "MetaKeyWords";
myDataColumn.ReadOnly = false;
//myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
//Create and add the second column
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "MenuStatus";
myDataColumn.ReadOnly = false;
////myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
//Create and add the second column
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.String");
myDataColumn.ColumnName = "ParentId";
myDataColumn.ReadOnly = false;
//myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
//Create and add the second column
myDataColumn = new DataColumn();
myDataColumn.DataType = System.Type.GetType("System.Int32");
myDataColumn.ColumnName = "Flag1";
myDataColumn.ReadOnly = false;
////myDataTable.Columns.Add(myDataColumn);
if (meid == 0)
{
myDataTable.Columns.Add(myDataColumn);
}
//meid++;
dt = obj.GetMenu(pqr, ClientId);
string[] x = abc.Split(',');
int asd = abc.Length;
count = 1;
for (int a = 0; a < count; a++)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
if (x[a] == Convert.ToString(dt.Rows[i]["MenuId"]))
{
int Mi = Convert.ToInt32(dt.Rows[i]["MenuId"]);
string Mt = Convert.ToString(dt.Rows[i]["MenuName"]);
string temp = Convert.ToString(dt.Rows[i]["TemplateName"]);
string desc = Convert.ToString(dt.Rows[i]["Description"]);
string mtag = Convert.ToString(dt.Rows[i]["MetaTags"]);
string mkey = Convert.ToString(dt.Rows[i]["MetaKeyWords"]);
string status = Convert.ToString(dt.Rows[i]["MenuStatus"]);
int cid = Convert.ToInt32(dt.Rows[i]["ParentId"]);
int flg1 = Convert.ToInt32(dt.Rows[i]["Flag1"]);
flg3 = flg1;
myDataRow = myDataTable.NewRow();
myDataRow["MenuId"] = Mi;
myDataRow["MenuName"] = Mt;
myDataRow["TemplateName"] = temp;
myDataRow["Description"] = desc;
myDataRow["MetaTags"] = mtag;
myDataRow["MetaKeyWords"] = mkey;
myDataRow["MenuStatus"] = status;
myDataRow["ParentId"] = cid;
myDataTable.Rows.Add(myDataRow);
}
}
}
dgMenu.DataSource = myDataTable;
dgMenu.DataBind();
count = 0;
abc = "";
}
catch (Exception ex)
{
//lblErrorMessage.Text = ex.Message;
}
}
//*****************************************************************************************//
//Retriving values from lookup table to dropdownlist of Status
//*****************************************************************************************//
public void GetStatus()
{
try
{
string s = "Status";
ddlMenuStatus.DataSource = obj.GetStatus(s, ClientId);
ddlMenuStatus.DataTextField = "LookUpText";
ddlMenuStatus.DataBind();
ddlMenuStatus.Items.Insert(0, new ListItem("--Choose--"));
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
}
//*****************************************************************************************//
//Retriving values from lookup table to dropdownlist of Templates
//*****************************************************************************************//
public void GetTemplate()
{
try
{
ddlAddTemplate.DataSource = obj.GetTemplates(ClientId);
ddlAddTemplate.DataTextField = "TemplateName";
ddlAddTemplate.DataBind();
ddlAddTemplate.Items.Insert(0, new ListItem("--Choose--"));
}
catch (Exception ex)
{
lblErrorMessage.Text=ex.Message;
}
}
//*****************************************************************************************//
//(Event Submit)Code for Submit or Save the records
//*****************************************************************************************//
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
string jv1;
string menname = "";
string status = "";
string menid = "";
int qid;
int QL;
DataTable dt4 = obj.GetLinkCount(ClientId);
QL = Convert.ToInt32(dt4.Rows[0]["QuickLinkId"]);
if (chkQuickLinks.Checked == true)
{
//int QL;
//DataTable dt4 = obj.GetLinkCount(ClientId);
//QL = Convert.ToInt32(dt4.Rows[0]["QuickLinkId"]);
//if (QL > 7)
//{
// jv1 = "alert('QuickLink Limit Completed');";
// this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
//}
//else
//{
qid = 1;
//}
}
else
{
qid = 0;
}
string MenuName = txtMenuTitle.Text.ToString();
if (menuid == 0)
{
MyDtab = obj.ChkMenuNames(txtMenuTitle.Text.Trim());
foreach (DataRow r in MyDtab.Rows)
{
menid = Convert.ToString(MyDtab.Rows[0]["MenuId"]);
menname = Convert.ToString(MyDtab.Rows[0]["MenuName"]);
status = Convert.ToString(MyDtab.Rows[0]["DStatus"]);
}
if (menname == "" && status == "" && txtMenuId.Text == "")
{
if (btnSubmit.Text == "Submit")
{
if ((chkQuickLinks.Checked == true) && (QL > 7))
{
jv1 = "alert('QuickLink Limit Completed');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
qid = 0;
chkQuickLinks.Focus();
}
else
{
menid = "0";
menname = txtMenuTitle.Text.Trim();
obj.GetSave(ClientId, menuid, qid, txtMenuTitle.Text.Trim(), c1, ddlAddTemplate.Text.Trim(), txtDescription.Text.Trim(), txtAddMetaTag.Text.Trim(), txtAddMetaKeyWord.Text.Trim(), ddlMenuStatus.Text.Trim(), Who, Convert.ToString(menuid));
Clear();
table2.Attributes.Add("style", "display:none");
jv1 = "alert('Record Saved Successfully');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
table1.Attributes.Add("style", "display:none");
MyDtab = obj.GetAllMenus(1, ClientId, tempnme);
dv = MyDtab.DefaultView;
}
}
}
}
else if (menuid != 0)
{
MyDtab = obj.ChkMenuNames(txtMenuTitle.Text.Trim());
foreach (DataRow r in MyDtab.Rows)
{
menid = Convert.ToString(MyDtab.Rows[0]["MenuId"]);
menname = Convert.ToString(MyDtab.Rows[0]["MenuName"]);
status = Convert.ToString(MyDtab.Rows[0]["DStatus"]);
}
string nameupper1 = txtMenuTitle.Text.ToUpper();
string nameupper2 = menname.ToUpper();
if ((menid != txtMenuId.Text.ToString()) && (nameupper1 != nameupper2) && (status != "1"))
{
MyDtab = obj.GetAllMenus(1, ClientId,tempnme);
dv = MyDtab.DefaultView;
if (btnSubmit.Text == "Submit")
{
if ((chkQuickLinks.Checked == true)&&(QL > 7))
{
jv1 = "alert('QuickLink Limit Completed');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
qid = 0;
chkQuickLinks.Focus();
}
else
{
obj.GetSave(ClientId, Convert.ToInt32(txtMenuId.Text.Trim()), qid, txtMenuTitle.Text.Trim(), c1, ddlAddTemplate.SelectedItem.Text, txtDescription.Text.Trim(), txtAddMetaTag.Text.Trim(), txtAddMetaKeyWord.Text.Trim(), ddlMenuStatus.SelectedItem.Text, Who, Convert.ToString(flg3));
jv1 = "alert('Record Updated Successfully');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
Clear();
}
}
else if (btnSubmit.Text == "Add Sibling")
{
if ((chkQuickLinks.Checked == true) && (QL > 7))
{
jv1 = "alert('QuickLink Limit Completed');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
qid = 0;
chkQuickLinks.Focus();
}
else
{
menuid = 0;
obj.GetSave(ClientId, menuid, qid, txtMenuTitle.Text.Trim(), pid, ddlAddTemplate.SelectedItem.Text, txtDescription.Text, txtAddMetaTag.Text, txtAddMetaKeyWord.Text, ddlMenuStatus.SelectedItem.Text, Who, Convert.ToString(menuid));
jv1 = "alert('Record Saved Successfully');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
btnSubmit.Text = "Submit";
Clear();
table2.Attributes.Add("style", "display:none");
table1.Attributes.Add("style", "display:none");
replyup = 0; replydown = 0;
threaddown = 0; menuid = 0;
int mm = Convert.ToInt32(dt.Rows[0]["MenuId"]);//retreiving menuid
int pp = Convert.ToInt32(dt.Rows[0]["ParentId"]);//retreiving parentid
if (pp.ToString() == "0")//1st level(TreeView)
{
replydown = pqr + 1;
threaddown = pqr + 1;
}
else
{
mm = pp;
DataTable dt3 = obj.NodeLevel(mm, ClientId);
mm = 0; pp = 0;
int kk = 0;
kk = Convert.ToInt32(dt3.Rows[0]["ParentId"]);
if (kk.ToString() == "0")
{
replydown = pqr - 1;
threaddown = pqr - 1;
}
else
{
replydown = pqr + 1;
threaddown = pqr + 1;
}
}
}
}
else if (btnSubmit.Text == "Add Child")
{
if ((chkQuickLinks.Checked == true) && (QL > 7))
{
jv1 = "alert('QuickLink Limit Completed');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
qid = 0;
chkQuickLinks.Focus();
}
else
{
menuid = 0;
obj.GetSave(ClientId, menuid, qid, txtMenuTitle.Text.Trim(), pqr, ddlAddTemplate.SelectedItem.Text, txtDescription.Text, txtAddMetaTag.Text, txtAddMetaKeyWord.Text, ddlMenuStatus.SelectedItem.Text, Who, Convert.ToString(menuid));
jv1 = "alert('Record Saved Successfully');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
btnSubmit.Text = "Submit";
Clear();
table2.Attributes.Add("style", "display:none");
table1.Attributes.Add("style", "display:none");
}
}
}
else if ((menid == txtMenuId.Text.ToString()) && (nameupper1 == nameupper2) && (status == "0"))
{
MyDtab = obj.GetAllMenus(1, ClientId,tempnme);
dv = MyDtab.DefaultView;
if (btnSubmit.Text == "Submit")
{
if ((chkQuickLinks.Checked == true) && (QL > 7))
{
jv1 = "alert('QuickLink Limit Completed');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
qid = 0;
//jv1 = "document.getelementById(ctl00_ContentPlaceHolder1_MenuCreationControl1_chkQuickLinks).select();";
//this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
chkQuickLinks.Focus();
}
else
{
obj.GetSave(ClientId, Convert.ToInt32(txtMenuId.Text.Trim()), qid, txtMenuTitle.Text.Trim(), c1, ddlAddTemplate.SelectedItem.Text, txtDescription.Text.Trim(), txtAddMetaTag.Text.Trim(), txtAddMetaKeyWord.Text.Trim(), ddlMenuStatus.SelectedItem.Text, Who, Convert.ToString(flg3));
Clear();
jv1 = "alert('Record Updated Successfully');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
table2.Attributes.Add("style", "display:none");
table1.Attributes.Add("style", "display:none");
}
}
else if (btnSubmit.Text == "Add Sibling")
{
if (menid == txtMenuId.Text.ToString())
{
jv1 = "alert('Menu Name already exists');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
}
else
{
if ((chkQuickLinks.Checked == true) && (QL > 7))
{
jv1 = "alert('QuickLink Limit Completed');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
qid = 0;
chkQuickLinks.Focus();
}
else
{
obj.GetSave(ClientId, menuid, qid, txtMenuTitle.Text.Trim(), c1, ddlAddTemplate.SelectedItem.Text, txtDescription.Text, txtAddMetaTag.Text, txtAddMetaKeyWord.Text, ddlMenuStatus.SelectedItem.Text, Who, Convert.ToString(menuid));
jv1 = "alert('Record Saved Successfully');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
btnSubmit.Text = "Submit";
Clear();
table2.Attributes.Add("style", "display:none");
table1.Attributes.Add("style", "display:none");
}
}
}
else if (btnSubmit.Text == "Add Child")
{
if (menid == txtMenuId.Text.ToString())
{
jv1 = "alert('Menu Name already exists');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
}
else
{
if ((chkQuickLinks.Checked == true) && (QL > 7))
{
jv1 = "alert('QuickLink Limit Completed');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
qid = 0;
//jv1 = "document.getelementById(ctl00_ContentPlaceHolder1_MenuCreationControl1_chkQuickLinks).select();" ;
//this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
chkQuickLinks.Focus();
}
else
{
obj.GetSave(ClientId, menuid, qid, txtMenuTitle.Text.Trim(), pqr, ddlAddTemplate.SelectedItem.Text, txtDescription.Text, txtAddMetaTag.Text, txtAddMetaKeyWord.Text, ddlMenuStatus.SelectedItem.Text, Who, Convert.ToString(menuid));
jv1 = "alert('Record Saved Successfully');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
btnSubmit.Text = "Submit";
Clear();
table2.Attributes.Add("style", "display:none");
table1.Attributes.Add("style", "display:none");
}
}
}
if ((Count1 == 1) && (Count2 != 1))
{
btnSubmit.Enabled = false;
}
}
else
{
if (status == "0" && menid != txtMenuId.Text.ToString())
{
jv1 = "alert('Menu Name already exist');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
}
else if (status == "1" && menid != txtMenuId.Text.ToString())
{
jv1 = "alert('Menu Name already exists but moved to Recyclebin');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
}
else if (status == "0")
{
jv1 = "alert('Menu Name already exists');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
}
else if (status == "1")
{
jv1 = "alert('Menu Name already exists but moved to Recyclebin');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
}
}
}
if (status == "0" && menid != "")
{
jv1 = "alert('Menu Name already exists');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
}
if (status == "1" && menid != "")
{
jv1 = "alert('Menu Name already exists but moved to Recyclebin');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
}
menuid = 0;
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
PopulateNodes();
}
//*****************************************************************************************//
//For Clear All TextBoxes
//*****************************************************************************************//
public void Clear()
{
try
{
txtMenuTitle.Text = "";
txtDescription.Text = "";
ddlAddTemplate.SelectedItem.Text = "";
GetTemplate();
txtAddMetaTag.Text = "";
txtAddMetaKeyWord.Text = "";
ddlMenuStatus.SelectedItem.Text = "";
GetStatus();
chkQuickLinks.Checked = false;
txtMenuTitle.Enabled = true;
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
}
//*****************************************************************************************//
// * indicate For Mandatory Fields purpose
//*****************************************************************************************//
public void DisplayErr()
{
try
{
lblMenuStatusErr.Text = "*";
lblAddTemplateErr.Text = "*";
lblMenuTitleErr.Text = "*";
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
}
//*****************************************************************************************//
//(TreeView Event)To Get MenuTitle In TreeView
//*****************************************************************************************//
protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
selectNode();
}
void selectNode()
{
try
{
pqr = 0;
flg3 = 0;
aaa = 0;
bbb = 0;
val = 0;
val1 = 0;
pid = 0;
menuid = 0;
threaddown = 0;
replyup = 0;
replydown = 0;
s = TreeView1.SelectedNode.Text;
pqr = Convert.ToInt32(obj.GetMenuTitle(s, ClientId));
dt = obj.GetMenu(pqr, ClientId);
pid = Convert.ToInt32(dt.Rows[0]["ParentId"]);
flg3 = Convert.ToInt32(dt.Rows[0]["Flag1"]);
PopulateNodes();
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
table1.Attributes.Add("style", "Display:none");
table2.Attributes.Add("style", "display:none");
Hidegrid.Attributes.Add("style", "Display:block");
}
//*****************************************************************************************//
//(Edit Event)Getting Values From Grid To TextBoxes
//*****************************************************************************************//
protected void dgMenu_EditCommand(object source, DataGridCommandEventArgs e)
{
try
{
string mi = dgMenu.Items[e.Item.ItemIndex].Cells[1].Text;
if (mi == "About Us" || mi == "Disclaimer" || mi == "Credit" || mi == "Contact Us" || mi == "Terms & Conditions")
{
txtMenuTitle.Enabled = false;
txtDescription.Focus();
}
else
{
txtMenuTitle.Enabled = true;
txtMenuTitle.Focus();
}
menuid = Convert.ToInt32(txtMenuId.Text);
lblErrorMessage.Text = "";
txtMenuTitle.Text = dgMenu.Items[e.Item.ItemIndex].Cells[1].Text;
int temp = Convert.ToInt32(dgMenu.Items[e.Item.ItemIndex].Cells[2].Text);
string tmp = obj.EditTemplate(temp);
GetTemplate();
ddlAddTemplate.SelectedValue = Convert.ToString(tmp);
txtDescription.Text = dgMenu.Items[e.Item.ItemIndex].Cells[3].Text;
txtAddMetaTag.Text = dgMenu.Items[e.Item.ItemIndex].Cells[4].Text;
txtAddMetaKeyWord.Text = dgMenu.Items[e.Item.ItemIndex].Cells[5].Text;
GetStatus();
ddlMenuStatus.SelectedValue = dgMenu.Items[e.Item.ItemIndex].Cells[6].Text;
ddlMenuStatus.SelectedItem.Text = dgMenu.Items[e.Item.ItemIndex].Cells[6].Text;
child = Convert.ToInt32(dgMenu.Items[e.Item.ItemIndex].Cells[7].Text);
flag2 = Convert.ToString(dgMenu.Items[e.Item.ItemIndex].Cells[8].Text);
childid = Convert.ToInt32(child);
c1 = child;
btnSubmit.Text = "Submit";
if (txtDescription.Text == " ")
{
txtDescription.Text = "";
}
if (txtAddMetaKeyWord.Text == " ")
{
txtAddMetaKeyWord.Text = "";
}
if (txtAddMetaTag.Text == " ")
{
txtAddMetaTag.Text = "";
}
table1.Attributes.Add("style", "Display:block");
table2.Attributes.Add("style", "display:none");
if ((Count1 == 1) && (Count2 != 1))
{
btnSubmit.Enabled = true;
}
if (ddlMenuStatus.SelectedItem.Text == "Drafts")
{
QLink.Attributes.Add("style", "Display:none");
}
if (ddlMenuStatus.SelectedItem.Text == "Backoffice" || ddlMenuStatus.SelectedItem.Text == "Active")
{
MyDtab = obj.GetAllMenus(1, ClientId,tempnme);
int QLid = Convert.ToInt32(dt.Rows[0]["QuickLinkId"]);
if (QLid == 1)
{
chkQuickLinks.Checked = true;
}
else
{
chkQuickLinks.Checked = false;
}
QLink.Attributes.Add("style", "Display:block");
}
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
}
//*****************************************************************************************//
//(Delete Event)Delete Records fromMenu
//*****************************************************************************************//
protected void dgMenu_DeleteCommand(object source, DataGridCommandEventArgs e)
{
try
{
Clear();
string jv1;
int temp = Convert.ToInt32(dgMenu.Items[e.Item.ItemIndex].Cells[0].Text);
int count = Convert.ToInt32(obj.GetDeleteOrder(temp));
if (count == 0)
{
string mi = dgMenu.Items[e.Item.ItemIndex].Cells[1].Text;
if (mi == "About Us" || mi == "Disclaimer" || mi == "Credit" || mi == "Contact Us" || mi == "Terms & Conditions")
{
jv1 = "alert('This Menu cannot be Deleted because It is in Footer');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
PopulateNodes();
Hidegrid.Attributes.Add("style", "display:block");
table1.Attributes.Add("style", "display:none");
table2.Attributes.Add("style", "display:none");
}
else
{
obj.GetDelete(temp);
jv1 = "alert('Record Deleted Successfully');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
PopulateNodes();
table1.Attributes.Add("style", "display:none");
table2.Attributes.Add("style", "display:block");
Hidegrid.Attributes.Add("style", "display:none");
}
}
else
{
jv1 = "alert('Cannot delete parent item without deleting child items');";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jv1, true);
PopulateNodes();
Hidegrid.Attributes.Add("style", "display:block");
table1.Attributes.Add("style", "display:none");
table2.Attributes.Add("style", "display:none");
}
}
catch (Exception ex)
{
lblErrorMessage.Text = ex.Message;
}
}
//*****************************************************************************************//
//(Grid Event)To Display Grid Order by Treeview Selection
//*****************************************************************************************//
protected void dgMenu_ItemCommand(object source, DataGridCommandEventArgs e)
{
try
{
int mid, cid, flag;
txtMenuId.Text = dgMenu.Items[e.Item.ItemIndex].Cells[0].Text;
int flg = Convert.ToInt32(txtMenuId.Text);
dt = obj.GetMenu(flg,ClientId);
string flg1 = Convert.ToString(dt.Rows[0]["Flag1"]);
string child = dgMenu.Items[e.Item.ItemIndex].Cells[7].Text;
int c1 = Convert.ToInt32(child);
// To Add Sibling
if (e.CommandName == "Add Sibling")
{
Clear();
txtMenuTitle.Focus();
btnSubmit.Text = "Add Sibling";
table1.Attributes.Add("style", "Display:block");
table2.Attributes.Add("style", "display:none");
}
else
//To Add Child
if (e.CommandName == "Add Child")
{
Clear();
int mm = Convert.ToInt32(dt.Rows[0]["MenuId"]);//retreiving menuid
int pp = Convert.ToInt32(dt.Rows[0]["ParentId"]);//retreiving parentid
if (pp.ToString() == "0")//1st level(TreeView)
{
btnSubmit.Text = "Add Child";
table1.Attributes.Add("style", "Display:block");
table2.Attributes.Add("style", "display:none");
txtMenuTitle.Focus();
}
else
{
mm = pp;
DataTable dt3 = obj.NodeLevel(mm, ClientId);
mm = 0;
pp = 0;
int kk = 0;
kk = Convert.ToInt32(dt3.Rows[0]["ParentId"]);
if (kk.ToString() == "0")//2nd level(TreeView)
{
btnSubmit.Text = "Add Child";
table1.Attributes.Add("style", "Display:block");
table2.Attributes.Add("style", "display:none");
txtMenuTitle.Focus();
}
else
{
//mm = kk;
//DataTable dt4 = obj.NodeLevel(mm, ClientId);
//int ff = Convert.ToInt32(dt4.Rows[0]["ParentId"]);
//if (ff.ToString() == "0")//3rd level(TreeView)
//{
// btnSubmit.Text = "Add Child";
// table1.Attributes.Add("style", "Display:block");
// table2.Attributes.Add("style", "display:none");
// txtMenuTitle.Focus();
//}
//else
//{
string jj = "alert('Maximum 3 Levels Allowed');";//3rd level of TreeView
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", jj, true);
//}
}
}
}
//For Move Down
else if (e.CommandName == "Move Down")
{
table1.Attributes.Add("style", "Display:none");
table2.Attributes.Add("style", "display:none");
dt2 = obj.MoveUp(c1, ClientId);
int count1 = 0;
string abc1 = "";
string abc2 = "";
DataView dv;
dv = dt2.DefaultView;
int i;
for (i = 0; i < dt2.Rows.Count; i++)
{
mid = Convert.ToInt32(dt2.Rows[i]["MenuId"]);
cid = Convert.ToInt32(dt2.Rows[i]["ParentId"]);
flag = Convert.ToInt32(dt2.Rows[i]["Flag1"]);
count1++;
abc1 += Convert.ToString(flag) + ",";
abc2 += Convert.ToString(mid) + ",";
}
string[] x1 = abc1.Split(',');
string[] x2 = abc2.Split(',');
for (int a = 0; a < count1; a++)
{
if (x1[a] == flg1)
{
f1 = x1[a + 1];
f2 = x1[a];
i1 = x2[a + 1];
i2 = x2[a];
}
}
obj.GetUpdate(Convert.ToInt32(child), f2, Convert.ToInt32(i1), ClientId);
obj.GetUpdate(Convert.ToInt32(child), f1, Convert.ToInt32(i2), ClientId);
replyup = 0;
replydown = 0;
replydown = int.Parse(x2[count1 - 2].ToString());
threaddown = 0;
menuid = 0;
threaddown = int.Parse(x2[count1 - 2].ToString());
PopulateNodes();
f1 = "";
f2 = "";
i1 = "";
i2 = "";
}
//For Move Up
else if (e.CommandName == "Move Up")
{
table1.Attributes.Add("style", "Display:none");
table2.Attributes.Add("style", "display:none");
dt2 = obj.MoveUp(c1, ClientId);
int count1 = 0;
string abc1 = "";
string abc2 = "";
DataView dv;
dv = dt2.DefaultView;
for (int i = 0; i < dt2.Rows.Count; i++)
{
mid = Convert.ToInt32(dt2.Rows[i]["MenuId"]);
cid = Convert.ToInt32(dt2.Rows[i]["ParentId"]);
flag = Convert.ToInt32(dt2.Rows[i]["Flag1"]);
count1++;
abc1 += Convert.ToString(flag) + ",";
abc2 += Convert.ToString(mid) + ",";
}
string[] x1 = abc1.Split(',');
string[] x2 = abc2.Split(',');
for (int a = 0; a < count1; a++)
{
if (x1[a] == flg1)
{
f1 = x1[a - 1];
f2 = x1[a];
i1 = x2[a - 1];
i2 = x2[a];
}
}
string c2 = x1[count1 - 1];
obj.GetUpdate(Convert.ToInt32(child), f2, Convert.ToInt32(i1), ClientId);
obj.GetUpdate(Convert.ToInt32(child), f1, Convert.ToInt32(i2), ClientId);
replyup = 0;
replydown = 0;
replyup = int.Parse(x2[1].ToString());
threaddown = 0;
menuid = 0;
menuid = int.Parse(x2[1].ToString());
f1 = "";
f2 = "";
i1 = "";
i2 = "";
PopulateNodes();
}
flg = 0;
flg1 = "";
}
catch (Exception ex)
{
string s = ex.Message;
}
}
//*********************************************************************************************//
// For Edit, AddSibling,AddChild...
//*********************************************************************************************//
protected void dgMenu_ItemCreated(object sender, DataGridItemEventArgs e)
{
try
{
table1.Focus();
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if (pqr == 1 || pqr == 71 || pqr == 72 || pqr == 73 || pqr == 74 || pqr == 75)
{
}
else
{
Button _myButton = (Button)e.Item.FindControl("btnDelete");
_myButton.Attributes.Add("onclick", "return confirm_delete();");
}
}
if (e.Item.ItemType == ListItemType.Item)
{
e.Item.Cells[9].ToolTip = "To Edit";
e.Item.Cells[10].ToolTip = "To add Sibling";
e.Item.Cells[11].ToolTip = "To add Child ";
e.Item.Cells[12].ToolTip = "To Move Up";
e.Item.Cells[13].ToolTip = "To Move Down";
e.Item.Cells[14].ToolTip = "To Delete";
}
if (pqr == menuid || pqr==1 )
{
Button b = (Button)e.Item.FindControl("btn1");
if (b != null)
b.Enabled = false;
}
if (pqr == threaddown || pqr==1)
{
Button b = (Button)e.Item.FindControl("btnMoveDown");
if (b != null)
b.Enabled = false;
}
if (pqr == replyup )
{
Button b = (Button)e.Item.FindControl("btn1");
if (b != null)
b.Enabled = false;
}
if (pqr == replydown)
{
Button b = (Button)e.Item.FindControl("btnMoveDown");
if (b != null)
b.Enabled = false;
}
RoleName = Convert.ToString(Session["RN"]);
dsrole = uc.GetOptions(RoleName);
if (dsrole.Rows.Count == 0)
{
ids = "10" + "," + "11" + "," + "12" + "," + "13";
}
else
{
string s = dsrole.Rows[0]["RoleDescription"].ToString();
string[] names = s.Split(',');
for (int i = 0; i < names.Length; i++)
{
dt3 = uc.TopMenu_LookupId(names[i].ToString());
ids = ids + dt3.Rows[0]["lookupid"].ToString() + ",";
}
if (dt.Rows.Count != 0)
{
ids = ids.Substring(0, ids.Length - 1);
}
}
Array id = ids.Split(',');
for (int i = 0; i < id.Length; i++)
{
if (id.GetValue(i).ToString() == "10")
{
if (pqr == 1)
{
Button b = (Button)e.Item.FindControl("btnEdit");
b.Enabled = false;
}
else
{
Button b = (Button)e.Item.FindControl("btnEdit");
if (b != null)
b.Enabled = true;
}
Count1 = 1;
}
if (id.GetValue(i).ToString() == "12")
{
btnSubmit.Enabled = true;
Button b = (Button)e.Item.FindControl("btnAddSibling");
if (b != null)
b.Enabled = true;
Button b3 = (Button)e.Item.FindControl("btnAddChild");
if (b3 != null)
b3.Enabled = true;
Count2 = 2;
}
if (id.GetValue(i).ToString() == "11")
{
if (pqr == 1)
{
Button b = (Button)e.Item.FindControl("btnDelete");
b.Enabled = false;
}
else
{
Button b = (Button)e.Item.FindControl("btnDelete");
if (b != null)
b.Enabled = true;
}
}
}
}
catch (Exception ex)
{
string s = ex.Message;
}
}
protected void Edit_Click(object sender, EventArgs e)
{
}
protected void AddSibling_Click(object sender, EventArgs e)
{
}
protected void AddChild_Click(object sender, EventArgs e)
{
}
protected void MoveUp_Click(object sender, EventArgs e)
{
}
protected void MoveDown_Click(object sender, EventArgs e)
{
}
protected void Delete_Click(object sender, EventArgs e)
{
}
}
=============================================================================
data base should be developed your self
hi
|
|
|
|
|
a very comprehensive answer:->
|
|
|
|
|
Hi
Im calling batch file from C# application as like below
Process.Start (@"c:\\test.bat", "param1 param2");
and my Batch file recongnizes that it has two paramter, if param1 has some space it will consider that as one more parameter, how can have space in the paramters?
Thanks.
|
|
|
|
|
Put them in quotes, the same as if you were typing them in.
use \" to do quotes in a string.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Still i have a hic cup., am doing as like below please tell me whats wrong
Process.start (@"c:\\test.bat", `Now is the time %forvar` all good );
still it says
Arg0 - Now
Arg1 - is
Whats the correct one?
|
|
|
|
|
What on earth is that ? The ` is not a quote. That is your problem.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Christian,
over here we call ' a single quote and " a double quote (and '' would be two sinqle quotes).
So asking for a quote may be ambiguous.
|
|
|
|
|
No, ' is an apostophe, " is a quote.
|
|
|
|
|
Hi, the following excerpt from http://www.bbsinc.com/iso8859.html[^]
illustrates the possible confusion.
Special Characters and Numbers
Description Char Hex Character Entity
Reference Name
(Dec)
space 20 --> &sp; --> &sp;
exclamation mark ! 21 ! --> ! ! --> !
(double) quotation mark " 22 " --> " " --> "
number sign # 23 # --> # # --> #
dollar sign $ 24 $ --> $ $ --> $
percent sign % 25 % --> % % --> %
ampersand & 26 & --> & & --> &
apostrophe, ' 27 ' --> ' ' --> '
single quote mark
Now does "quote" sound more like "(double) quotation mark" or "single quote mark" ?
|
|
|
|
|
|
|
hi,
iam seetha,i need your suggestions for displaying video files using asp.net.My question is how to retrevie an video file from sql database and play the video file using windows media player using asp.net2.0
i hope i get the best suggestions from experts.....
i will be thankfull for every one who supports me...
Seetha......
hi
|
|
|
|
|
ASP.NET really has nothing to do with it, b/c it offers no video player control or framework. YOu need to render the HTML to embed Windows Media Player in your page. I'm not sure if it's possible to stream the video, or if you need to store it in a location you can point IE to.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want your help in my project(Hanoi Tower2)....
Towers of Hanoi
The ancient folklore behind the “Towers of Hanoi” puzzle is quite well known. A more recent legend tells us that once the Brahmin monks discovered how long it would take to finish transferring the 64 discs from the needle which they were on to one of the other needles, they decided to find a faster strategy and be done with it.
One of the priests at the temple informed his colleagues that they could achieve the transfer in single afternoon at a one disc-per-second rhythm by using an additional needle. He proposed the following strategy:
• First move the topmost discs (say the top k discs) to one of the spare needles.
• Then use the standard three needles strategy to move the remaining n − k discs (for a general case with n discs) to their destination.
• Finally, move the top k discs into their final destination using the four needles.
He calculated the value of k which minimized the number of movements and found that 18,433 transfers would suffice. Thus they could spend just 5 hours, 7 minutes, and 13 seconds with this scheme versus over 500, 000 million years without the additional needle!
Try to follow the clever priest’s strategy and calculate the number of transfers using four needles, where the priest can move only one disc at a time and must place each disc on a needle such that there is no smaller disc below it. Calculate the k that minimizes the number of transfers under this strategy.
Input
The input file contains several lines of input. Each line contains a single integer 0 ≤ N ≤ 10, 000 giving the number of disks to be transferred. Input is terminated by end of file.
Output
For each line of input produce one line of output which indicates the number of movements required to transfer the N disks to the final needle.
Sample Input
1
2
28
64
Sample Output
1
3
769
18433
can u help me....
|
|
|
|
|
Gee - here's a piece of homework we've never seen posted before.
You've posted the description of hte towers of hanoi. You seem not to be asking for help, but a solution. You need to do your own homework. When you have code that doesn't quite work, feel free to post it and ask specific questions. Until then, the best help we can give you, is encourage you that the purpose of your homework is for you to learn, not for you to get the answer from the web.
But, I'd be happy to write it for you, for $200 an hour. That's the sort of contracting rate you will never attract in your life, if you don't do your own homework.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Gee - here's a piece of homework we've never seen posted before
Christian Graus wrote: write it for you, for $200 an hour
Is that all? I charge $500/hr and include a complimentary email to the teacher :->
|
|
|
|
|
Paul Conrad wrote: Is that all?
He's a student, that's my student discount :P
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: that's my student discount;P
Wow, I guess I'm not that lenient :->
|
|
|
|
|
The dude's profile:
Messages Posted 1 - Poster
Articles Submitted 0 - Browser
Dont you guys think it's about time to put an end to these homework posters??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
iam sorry i understand the rules now.
iam very sorry.
|
|
|
|
|