Click here to Skip to main content
15,908,013 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
Scott Barbour27-Dec-07 13:16
Scott Barbour27-Dec-07 13:16 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
Matt Sollars1-Jan-08 5:46
Matt Sollars1-Jan-08 5:46 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
GuyThiebaut3-Jan-08 3:29
professionalGuyThiebaut3-Jan-08 3:29 
GeneralRe: What If (Re: VBA GoTo Hell) Pin
Matt Sollars3-Jan-08 6:28
Matt Sollars3-Jan-08 6:28 
GeneralRe: VBA GoTo Hell Pin
Paul Conrad31-Dec-07 7:41
professionalPaul Conrad31-Dec-07 7:41 
GeneralRe: VBA GoTo Hell Pin
jgrogan3-Jan-08 3:25
jgrogan3-Jan-08 3:25 
GeneralRe: VBA GoTo Hell Pin
GuyThiebaut3-Jan-08 3:28
professionalGuyThiebaut3-Jan-08 3:28 
GeneralWorderful object names PinPopular
minsik072520-Dec-07 17:13
minsik072520-Dec-07 17:13 
My company has a well organized naming rule.
It's a standard which has been developed for a few years.
Look:

Table names like: TB200010
View names like: VI600230
Procedure names like: USP980010_07R
Web services names like: WS210080.asmx
Web form page names like: UI400740.aspx
Reporting service page names like: RPT1731.aspx

There are thousands of objects like the aboves.

Here the example (real one):

// ????

public class UI200020

{



// ??? ??? ??

string TabPageUrl01 = ...;

string TabPageUrl02 = ...;

string TabPageUrl03 = ...;

string TabPageUrl04 = ...;

string TabPageUrl05 = ...;



// ??? ??

private WS980010.XD980010 xd980010UserInfo;



// ??? ????

WS200010 wsProxy = ...;

WS100010 wsProxy2 = ...;



// ? ???

protected System.Web.UI.WebControls.DataGrid dgListSub01;

protected System.Web.UI.WebControls.DataGrid dgListSub02;

protected System.Web.UI.WebControls.DataGrid dgListSub03;

protected System.Web.UI.WebControls.DataGrid dgListSub04;

protected System.Web.UI.WebControls.DataGrid dgListSub05;

protected System.Web.UI.WebControls.DataGrid dgListSub06;

protected System.Web.UI.WebControls.DataGrid dgListSub07;

protected System.Web.UI.WebControls.DataGrid dgListSub09;

protected System.Web.UI.WebControls.DataGrid dgListSub10;

protected System.Web.UI.WebControls.DataGrid dgListSub11;

protected System.Web.UI.WebControls.DataGrid dgListSub12;



// ???? ?? ?? ??

protected System.Web.UI.WebControls.ImageButton ibtnTabMore01;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore02;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore03;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore04;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore05;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore06;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore09;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore10;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore11;

protected System.Web.UI.WebControls.ImageButton ibtnTabMore12;



// ? ?? ??

protected System.Web.UI.WebControls.Label lblSUBTITLE01;

protected System.Web.UI.WebControls.Label lblSUBTITLE02;

protected System.Web.UI.WebControls.Label lblSUBTITLE03;

protected System.Web.UI.WebControls.Label lblSUBTITLE04;

protected System.Web.UI.WebControls.Label lblSUBTITLE05;

protected System.Web.UI.WebControls.Label lblSUBTITLE11;

protected System.Web.UI.WebControls.Label lblTABTITLE06;

protected System.Web.UI.WebControls.Label lblTABTITLE10;

protected System.Web.UI.WebControls.Label lblTABTITLE11;



// ??? ??

protected System.Web.UI.WebControls.Panel PN0;

protected System.Web.UI.WebControls.Panel PN1;

protected System.Web.UI.WebControls.Panel PN10;

protected System.Web.UI.WebControls.Panel PN11;

protected System.Web.UI.WebControls.Panel PN2;

protected System.Web.UI.WebControls.Panel PN3;

protected System.Web.UI.WebControls.Panel PN4;

protected System.Web.UI.WebControls.Panel PN5;

protected System.Web.UI.WebControls.Panel PN6;

protected System.Web.UI.WebControls.Panel PN9;



#region ? More ?? ??



private void ibtnTabMore01_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub01);

this.GetData(this.Key);

}



private void ibtnTabMore02_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub02);

this.GetData(this.Key);

}



private void ibtnTabMore04_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub04);

this.GetData(this.Key);

}



private void ibtnTabMore05_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub05);

this.GetData(this.Key);

}



private void ibtnTabMore03_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub03);

this.GetData(this.Key);

}



private void ibtnTabMore06_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub06);

this.GetData(this.Key);

}



private void ibtnTabMore10_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub10);

this.GetData(this.Key);

}



private void ibtnTabMore09_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub09);

this.GetData(this.Key);

}



private void ibtnTabMore11_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub11);

this.GetData(this.Key);

}

private void ibtnTabMore12_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

// ?? DataGrid? ???? ? ???? ??

this.MorePageSize(this.dgListSub12);

this.GetData(this.Key);

}



#endregion









// ? ??? ???? ???

if (xd200010Set.XD280010S != null &&

xd200010Set.XD280010S.Length > 0)

{

this.dgListSub01.DataSource = CreateDataSource(xd200010Set.XD280010S) ;

this.dgListSub01.DataBind();

}



//???? ?

if (xd200010Set.XD110010S != null &&

xd200010Set.XD110010S.Length > 0)

{

this.dgListSub12.DataSource = CreateDataSource(xd200010Set.XD110010S) ;

this.dgListSub12.DataBind();



// ???? ?? & Tooltip ??.

foreach(DataGridItem item in dgListSub12.Items)

{

string rawStr = ((Label)item.Cells[4].FindControl("lblCTTDESC")).Text;



if(rawStr.Length > 200)

{

item.Cells[4].ToolTip = rawStr.Substring(0, 200) ;

}

else

{

item.Cells[4].ToolTip = rawStr ;

}



if( rawStr.Length > 34)

item.Cells[4].Text = rawStr.Substring(0,34)+" ...";

}

}



if (xd200010Set.XD210010S != null &&

xd200010Set.XD210010S.Length > 0)

{

this.dgListSub02.DataSource = CreateDataSource(xd200010Set.XD210010S) ;

this.dgListSub02.DataBind();



// ????, ??? ???? ?? & Tooltip ??.

foreach(DataGridItem item in dgListSub02.Items)

{

Label tlblSALENAME = ((Label)item.FindControl("lblSALENAME"));

Label tlblPRDID_ = ((Label)item.FindControl("lblPRDID_"));



string rawSALENAME = tlblSALENAME.Text;

string rawPRDID_ = tlblPRDID_.Text;



tlblSALENAME.ToolTip = rawSALENAME;

tlblPRDID_.ToolTip = rawPRDID_;



if( rawSALENAME.Length > 20)

tlblSALENAME.Text = rawSALENAME.Substring(0,20)+" ...";



if( rawPRDID_.Length > 20)

tlblPRDID_.Text = rawPRDID_.Substring(0,20)+" ...";

}

}



if (xd200010Set.XD220020S != null &&

xd200010Set.XD220020S.Length > 0)

{

this.dgListSub05.DataSource = CreateDataSource(xd200010Set.XD220020S) ;

this.dgListSub05.DataBind();



xd220020AMT = wsPurBill.ReadAMT(Key, QUERYUSER);

xd220020NAMT = wsPurBill.ReadNAMT(Key, QUERYUSER);



this.lblCNT2.Text = xd220020AMT.RCOUNT ;

this.lblAMT2.Text = xd220020AMT.TOTAMT ;

this.lblNCNT2.Text = xd220020NAMT.NRCOUNT;

this.lblNAMT2.Text = xd220020NAMT.NTOTAMT;

}



if (xd200010Set.XD220010S != null &&

xd200010Set.XD220010S.Length > 0)

{

this.dgListSub04.DataSource = CreateDataSource(xd200010Set.XD220010S) ;

this.dgListSub04.DataBind();



xd220010AMT = wsSaleBill.ReadAMT(Key, QUERYUSER);

xd220010NAMT = wsSaleBill.ReadNAMT(Key, QUERYUSER);



this.lblCNT1.Text = xd220010AMT.RCOUNT ;

this.lblAMT1.Text = xd220010AMT.TOTAMT ;

this.lblNCNT1.Text = xd220010NAMT.NRCOUNT ;

this.lblNAMT1.Text = xd220010NAMT.NTOTAMT ;

}



if (xd200010Set.XD230030S != null &&

xd200010Set.XD230030S.Length > 0)

{

this.dgListSub06.DataSource = CreateDataSource(xd200010Set.XD230030S) ;

this.dgListSub06.DataBind();



xd230030AMT = wsOrder.ReadAMT(Key, QUERYUSER, "CLIENT");



this.lblCNT4.Text = xd230030AMT.RCOUNT ;

this.lblAMT4.Text = xd230030AMT.TOTAMT ;

this.lblPOINT4.Text = xd230030AMT.TOTALPOINT ;

}



if (xd200010Set.XD230010S != null &&

xd200010Set.XD230010S.Length > 0)

{

this.dgListSub10.DataSource = CreateDataSource(xd200010Set.XD230010S) ;

this.dgListSub10.DataBind();



xd230010AMT = wsEst.ReadAMT(Key, QUERYUSER, "CLIENT");



this.lblCNT3.Text = xd230010AMT.RCOUNT ;

this.lblAMT3.Text = xd230010AMT.TOTAMT ;



}



if (xd200010Set.FILES != null &&

xd200010Set.FILES.Length > 0)

{

this.dgListSub03.DataSource= CreateDataSource(xd200010Set.FILES) ;

this.dgListSub03.DataBind();

}



if (xd200010Set.XD300010S != null &&

xd200010Set.XD300010S.Length > 0)

{

this.dgListSub09.DataSource = CreateDataSource(xd200010Set.XD300010S) ;

this.dgListSub09.DataBind();

}



//???? ?

if (this.xd200010Set.XD930010S != null)

{

this.dgListSub11.DataSource = CreateDataSource(this.xd200010Set.XD930010S);

this.dgListSub11.DataBind();

}



//??? ?? ?? ??

if (xd200010Set.XD990010S != null &&

xd200010Set.XD990010S.Length > 0)

{

this.hlADDLINK.Visible = false;



this.dlLINK.DataSource = CreateDataSource(xd200010Set.XD990010S);

this.dlLINK.DataBind();

}

else

{

WS950010.XD950010 xd950010 = null;

xd950010 = wsTableID.GetTableID("TB200010", this.QUERYUSER);



this.hlADDLINK.Text = "??? ?? ?? ??";

this.hlADDLINK.NavigateUrl = "../UI900/UI990070.aspx?TABLEID="+ xd950010.TABLE_ID ;

}



I should work with tons of code like THAT. Fantastic, isn't it?
GeneralRe: Worderful object names Pin
PIEBALDconsult20-Dec-07 17:39
mvePIEBALDconsult20-Dec-07 17:39 
GeneralRe: Worderful object names Pin
Yitzchok Dev20-Dec-07 18:25
Yitzchok Dev20-Dec-07 18:25 
JokeRe: Worderful object names PinPopular
Steve Echols20-Dec-07 20:22
Steve Echols20-Dec-07 20:22 
GeneralRe: Worderful object names Pin
Paul Conrad22-Dec-07 12:18
professionalPaul Conrad22-Dec-07 12:18 
GeneralRe: Worderful object names Pin
darkelv20-Dec-07 22:07
darkelv20-Dec-07 22:07 
GeneralRe: Worderful object names Pin
Xpnctoc22-Dec-07 19:02
Xpnctoc22-Dec-07 19:02 
JokeRe: Worderful object names Pin
Paddy Boyd20-Dec-07 22:43
Paddy Boyd20-Dec-07 22:43 
GeneralRe: Worderful object names Pin
tosch21-Dec-07 1:27
tosch21-Dec-07 1:27 
GeneralRe: Worderful object names Pin
Alaric_21-Dec-07 5:25
professionalAlaric_21-Dec-07 5:25 
GeneralRe: Worderful object names Pin
RGSeeds21-Dec-07 6:59
RGSeeds21-Dec-07 6:59 
GeneralRe: Worderful object names Pin
Hesbon Ongira21-Dec-07 7:46
Hesbon Ongira21-Dec-07 7:46 
GeneralRe: Worderful object names Pin
esplosion21-Dec-07 11:58
esplosion21-Dec-07 11:58 
GeneralRe: Worderful object names Pin
Paul Conrad22-Dec-07 12:17
professionalPaul Conrad22-Dec-07 12:17 
JokeRe: Worderful object names Pin
Gandalf_TheWhite23-Dec-07 19:45
professionalGandalf_TheWhite23-Dec-07 19:45 
GeneralRe: Worderful object names Pin
Pete O'Hanlon23-Dec-07 23:07
mvePete O'Hanlon23-Dec-07 23:07 
GeneralRe: Worderful object names Pin
CurtD24-Dec-07 7:47
CurtD24-Dec-07 7:47 
GeneralRe: Worderful object names Pin
Tim Carmichael28-Dec-07 10:29
Tim Carmichael28-Dec-07 10:29 

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.