Click here to Skip to main content
16,014,662 members
Home / Discussions / C#
   

C#

 
QuestionHow to draw rounded rectangle? Pin
god4k5-Dec-06 21:09
god4k5-Dec-06 21:09 
AnswerRe: How to draw rounded rectangle? Pin
Christian Graus5-Dec-06 21:56
protectorChristian Graus5-Dec-06 21:56 
AnswerRe: How to draw rounded rectangle? Pin
Mandaar Kulkarni5-Dec-06 22:37
Mandaar Kulkarni5-Dec-06 22:37 
Questionmultiple dropdowns in propertygrid Pin
Tanuja1235-Dec-06 21:07
Tanuja1235-Dec-06 21:07 
QuestionAdd a user to a group Pin
quiteSmart5-Dec-06 20:09
quiteSmart5-Dec-06 20:09 
AnswerRe: Add a user to a group Pin
stancrm6-Dec-06 2:02
stancrm6-Dec-06 2:02 
QuestionWindows Service Pin
nidheeshkayal5-Dec-06 17:44
nidheeshkayal5-Dec-06 17:44 
QuestionSelecting a datagrid row for updation Pin
Deepasubramanian5-Dec-06 16:29
Deepasubramanian5-Dec-06 16:29 
Hi,
I'm in need of populating the selected datagrid row in the respective fields in the form for updating the values.I have 3 levels in datagrid interlinked with parent - child relationships.As of now,I level is populating fine.But II level can have n number of records.When I'm selecting the II level,I couldn't be able to populate(I'm not getting any exception,But the Form is retaining the I level values.)

I'm herewith giving the mwthods that I'm using!
Please,let me know How should I approach!
I'm stuck up here!
private void DisplayDataList(string vstrProductCode)
{
StringBuilder stbSQLStatement0 = new StringBuilder();
stbSQLStatement0.Append("SELECT B.[ProductCode] ");
stbSQLStatement0.Append(" ,B.[ProductDesc] ");
stbSQLStatement0.Append(" ,SUM(A.QtyIn) As [In] ");
stbSQLStatement0.Append(" ,SUM(A.QtyOut) As [Out] ");
stbSQLStatement0.Append(" ,SUM(A.QtyIn) - SUM(A.QtyOut) As [BalBillQty] ");
stbSQLStatement0.Append(" ,(SUM(A.QtyIn) - SUM(A.QtyOut)) * Avg(B.ConvFactor) As [BalReportQty] ");

stbSQLStatement0.Append("FROM [MARTblInventory] As A WITH (NOLOCK) ");
stbSQLStatement0.Append(" INNER JOIN [MARTblProduct] As B WITH (NOLOCK) ");
stbSQLStatement0.Append(" ON A.ProductCode = B.ProductCode ");
stbSQLStatement0.Append(" and A.MarketSegID = B.MarketSegmtID ");
stbSQLStatement0.Append(" and A.SourceID = B.SourceID ");


if (! vstrProductCode.Equals(""))
{
stbSQLStatement0.Append("WHERE B.[ProductCode] LIKE '" + vstrProductCode + "%' ");
}

stbSQLStatement0.Append("GROUP BY B.[ProductCode] ");
stbSQLStatement0.Append(" ,B.[ProductDesc] ");


DataSet dtsResult0 = new DataSet();
dtsResult0 = QueryData(stbSQLStatement0.ToString());

StringBuilder stbSQLStatement1 = new StringBuilder();
stbSQLStatement1.Append("SELECT A.InvRefID ");
stbSQLStatement1.Append(" ,A.EntryDate ");
stbSQLStatement1.Append(" ,B.[ProductCode] ");
stbSQLStatement1.Append(" ,B.[ProductDesc] ");
stbSQLStatement1.Append(" ,A.[ReferenceNo] ");
stbSQLStatement1.Append(" ,A.QtyIn As [In] ");
stbSQLStatement1.Append(" ,A.QtyOut As [Out] ");

stbSQLStatement1.Append(" FROM [MARTblInventory] As A WITH (NOLOCK) ");
stbSQLStatement1.Append(" INNER JOIN [MARTblProduct] As B WITH (NOLOCK) ");
stbSQLStatement1.Append(" ON A.ProductCode = B.ProductCode ");
stbSQLStatement1.Append(" and A.MarketSegID = B.MarketSegmtID ");
stbSQLStatement1.Append(" and A.SourceID = B.SourceID ");


if (! vstrProductCode.Equals(""))
{
stbSQLStatement1.Append("WHERE B.[ProductCode] LIKE '" + vstrProductCode + "%' ");
}

DataSet dtsResult1 = new DataSet();
dtsResult1 = QueryData(stbSQLStatement1.ToString());


StringBuilder stbSQLStatement2 = new StringBuilder();
stbSQLStatement2.Append("SELECT A.InvRefID ");
stbSQLStatement2.Append(" ,B.PackageNo ");
stbSQLStatement2.Append(" ,B.Length ");
stbSQLStatement2.Append(" ,B.Area ");
stbSQLStatement2.Append(" ,B.ReferenceNo ");

stbSQLStatement2.Append("FROM [MARTblInventory] As A WITH (NOLOCK) ");
stbSQLStatement2.Append(" INNER JOIN [MARTblInventoryPkgDetail] As B WITH (NOLOCK) ");
stbSQLStatement2.Append(" ON A.InvRefID = B.InvRefID ");

if (! vstrProductCode.Equals(""))
{
stbSQLStatement2.Append("WHERE A.[ProductCode] LIKE '" + vstrProductCode + "%' ");
}

DataSet dtsResult2 = new DataSet();
dtsResult2 = QueryData(stbSQLStatement2.ToString());



DataSet dtsCombine = new DataSet();
dtsCombine.Tables.Add(dtsResult0.Tables[0].Copy());
dtsCombine.Tables[0].TableName = "Product";


if (dtsResult1.Tables[0].Rows.Count > 0)
//foreach(DataRow dr in dtsResult1.Tables[0].Rows)
{
dtsCombine.Tables.Add(dtsResult1.Tables[0].Copy());
dtsCombine.Tables[1].TableName = "ProductDetail";

dtsCombine.Relations.Add("ProductDetail",
dtsCombine.Tables["Product"].Columns["ProductCode"],
dtsCombine.Tables["ProductDetail"].Columns["ProductCode"]);




if (dtsResult2.Tables[0].Rows.Count > 0)
{

dtsCombine.Tables.Add(dtsResult2.Tables[0].Copy());
dtsCombine.Tables[2].TableName = "PackageDetail";

dtsCombine.Relations.Add("PackageDetail",
dtsCombine.Tables["ProductDetail"].Columns["InvRefID"],
dtsCombine.Tables["PackageDetail"].Columns["InvRefID"]);
}
ugdDataList.Text = mstrGridName;
ugdDataList.DataSource = dtsCombine;
ugdDataList.DataBind();

if (ucbProductCode.Text != "")
SeekTheSelectedRowInGrid(ucbProductCode.Text);

}

SetControlForMaintenance(CWinMaintainCln.MaintenanceMode.enmBlank);
pnlDataHeader.Visible = false;
}




private void DisplayDataDetail(string vstrDataKeyName)
{

StringBuilder stbSQLStatement0 = new StringBuilder();
stbSQLStatement0.Append("SELECT A.InvRefID ");
stbSQLStatement0.Append(" ,B.[ProductCode] ");
stbSQLStatement0.Append(" ,B.[ProductDesc] ");
stbSQLStatement0.Append(" ,A.ReferenceNo ");
stbSQLStatement0.Append(" ,A.Remarks ");
stbSQLStatement0.Append(" ,A.TransTypeID ");
stbSQLStatement0.Append(" ,A.QtyIn ");
stbSQLStatement0.Append(" ,A.QtyOut ");
stbSQLStatement0.Append(" ,A.EntryDate ");
stbSQLStatement0.Append("FROM [MARTblInventory] As A WITH (NOLOCK) ");
stbSQLStatement0.Append(" INNER JOIN [MARTblProduct] As B WITH (NOLOCK) ");
stbSQLStatement0.Append(" ON A.ProductCode = B.ProductCode ");
stbSQLStatement0.Append(" and A.MarketSegID = B.MarketSegmtID " );
stbSQLStatement0.Append(" and A.SourceID = B.SourceID ");

stbSQLStatement0.Append("WHERE A.ProductCode = '" + vstrDataKeyName + "' ");
//stbSQLStatement0.Append("Where A.InvRefID = '" + vstrDataKeyName + "' ");

DataSet dtsResult = new DataSet();
dtsResult = QueryData(stbSQLStatement0.ToString());
UltraGridRow activeRow = this.ugdDataList.ActiveRow;


lblInvRefID.Text = dtsResult.Tables[0].Rows[0]["InvRefID"].ToString();
ucbProductCode.Text = dtsResult.Tables[0].Rows[0]["ProductCode"].ToString();
lblProductDescDisplay.Text = dtsResult.Tables[0].Rows[0]["ProductDesc"].ToString();
txtReferenceNo.Text = dtsResult.Tables[0].Rows[0]["ReferenceNo"].ToString();
ucbTransactionType.Value = dtsResult.Tables[0].Rows[0]["TransTypeID"].ToString();
txtRemarks.Text = dtsResult.Tables[0].Rows[0]["Remarks"].ToString();

uneQuantityInDisplay.Value = double.Parse(dtsResult.Tables[0].Rows[0]["QtyIn"].ToString());

DateTime dtmEntryDate = new DateTime();
dtmEntryDate = Convert.ToDateTime(dtsResult.Tables[0].Rows[0]["EntryDate"].ToString());

if (dtmEntryDate.Year == 1900)
{
dtpDate.Checked = false;
}
else
{
dtpDate.Checked = true;
dtpDate.Value = dtmEntryDate;
}

StringBuilder stbSQLStatement1 = new StringBuilder();
stbSQLStatement1.Append("SELECT A.InvRefID ");
stbSQLStatement1.Append(" ,B.PackageNo ");
stbSQLStatement1.Append(" ,B.Length ");
stbSQLStatement1.Append(" ,B.Area ");
stbSQLStatement1.Append(" ,B.ReferenceNo ");

stbSQLStatement1.Append("FROM [MARTblInventory] As A WITH (NOLOCK) ");
stbSQLStatement1.Append(" INNER JOIN [MARTblInventoryPkgDetail] As B WITH (NOLOCK) ");
stbSQLStatement1.Append(" ON A.InvRefID = B.InvRefID ");

stbSQLStatement1.Append("WHERE A.InvRefID = " + lblInvRefID.Text + " ");

DataSet dtsResult1 = new DataSet();
dtsResult1 = QueryData(stbSQLStatement1.ToString());
dtsResult1.Tables[0].TableName = "Add new Package Detail";
ugdPackageDetail.DataSource = dtsResult1.Tables[0];
ugdPackageDetail.DataBind();

if (mblnIsRowSelected)
SetControlForMaintenance(CWinMaintainCln.MaintenanceMode.enmReady);
}



Thank you,
Deepa

Be the Change You Want to See!
QuestionTricky C# questions... Pin
swjam5-Dec-06 14:57
swjam5-Dec-06 14:57 
AnswerRe: Tricky C# questions... Pin
Not Active5-Dec-06 15:13
mentorNot Active5-Dec-06 15:13 
AnswerRe: Tricky C# questions... Pin
V.5-Dec-06 22:09
professionalV.5-Dec-06 22:09 
QuestionBinding DataGridView to a DataTable - skipping binding some of the columns in the DataTable Pin
Athadu5-Dec-06 14:38
Athadu5-Dec-06 14:38 
QuestionActionscript & C# Pin
Revant Jain5-Dec-06 13:34
Revant Jain5-Dec-06 13:34 
AnswerRe: Actionscript & C# Pin
Vasudevan Deepak Kumar6-Dec-06 0:56
Vasudevan Deepak Kumar6-Dec-06 0:56 
QuestionInserting ListItem controls inside DropDownList controls contained in a Datalist control Pin
tedhill135-Dec-06 12:43
tedhill135-Dec-06 12:43 
Questionsql server 2005 ConnectionString. Pin
hdv2125-Dec-06 11:30
hdv2125-Dec-06 11:30 
AnswerRe: sql server 2005 ConnectionString. Pin
Guffa5-Dec-06 13:31
Guffa5-Dec-06 13:31 
AnswerRe: sql server 2005 ConnectionString. Pin
ednrgc6-Dec-06 7:06
ednrgc6-Dec-06 7:06 
QuestionRichEditBox, IRichEditOle, IOleObject - Inserting, Saving and Loading embedded Ole objects in a RichTextBox Pin
Anthony Queen5-Dec-06 11:23
Anthony Queen5-Dec-06 11:23 
GeneralRe: RichEditBox, IRichEditOle, IOleObject - Inserting, Saving and Loading embedded Ole objects in a RichTextBox Pin
Anthony Queen6-Dec-06 5:48
Anthony Queen6-Dec-06 5:48 
GeneralRe: RichEditBox, IRichEditOle, IOleObject - Inserting, Saving and Loading embedded Ole objects in a RichTextBox Pin
ednrgc6-Dec-06 7:13
ednrgc6-Dec-06 7:13 
GeneralRe: RichEditBox, IRichEditOle, IOleObject - Inserting, Saving and Loading embedded Ole objects in a RichTextBox Pin
Anthony Queen7-Dec-06 4:07
Anthony Queen7-Dec-06 4:07 
QuestionListview owner draw question Pin
BudWhite5-Dec-06 9:44
BudWhite5-Dec-06 9:44 
Questionimage drag and drop problem Pin
Kim06185-Dec-06 7:53
Kim06185-Dec-06 7:53 
AnswerRe: image drag and drop problem Pin
Eric Dahlvang5-Dec-06 9:19
Eric Dahlvang5-Dec-06 9:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.