Click here to Skip to main content
15,887,083 members
Home / Discussions / C#
   

C#

 
AnswerRe: sending/receiving sms with c# code using smartphone Pin
Dave Kreskowiak12-Jan-16 4:38
mveDave Kreskowiak12-Jan-16 4:38 
QuestionReport builder in c# Pin
Zeyad Jalil12-Jan-16 2:47
professionalZeyad Jalil12-Jan-16 2:47 
AnswerRe: Report builder in c# Pin
Pete O'Hanlon12-Jan-16 3:14
mvePete O'Hanlon12-Jan-16 3:14 
GeneralRe: Report builder in c# Pin
Zeyad Jalil12-Jan-16 6:58
professionalZeyad Jalil12-Jan-16 6:58 
GeneralRe: Report builder in c# Pin
F-ES Sitecore12-Jan-16 23:27
professionalF-ES Sitecore12-Jan-16 23:27 
AnswerRe: Report builder in c# Pin
ZurdoDev12-Jan-16 3:55
professionalZurdoDev12-Jan-16 3:55 
GeneralRe: Report builder in c# Pin
Zeyad Jalil12-Jan-16 6:58
professionalZeyad Jalil12-Jan-16 6:58 
AnswerRe: Report builder in c# Pin
rodrigogroff12-Jan-16 4:01
rodrigogroff12-Jan-16 4:01 
C#
public string SimpleReport(string title, string head, bool disp_head, int size, string csvHeader, string sizes, ref ArrayList myReport)
{
	if (myReport.Count == 0)
		return "";

	ArrayList lstHeader = new ArrayList(),
				lstContent = new ArrayList(),
				lstTableSizes = new ArrayList(),
				lstMessages = new ArrayList(),
				lstFilters = new ArrayList(),
				lst_sub_tbl_head = new ArrayList();

	lstContent.Add(myReport);
	lstMessages.Add(title);
	lstTableSizes.Add(size);

	string[] par = csvHeader.Split(','); 
	
	if (sizes == "")
	{
		for (int t = 0; t < par.Length; ++t)
		{
			sizes += (size / par.Length).ToString() + ",";
		}

		sizes = sizes.TrimEnd(',');
	}

	for (int t = 0; t < par.Length; ++t)
		lst_sub_tbl_head.Add(par[t]);

	lstHeader.Add(lst_sub_tbl_head);

	return CodeReport ( title, head, disp_head, ref lstHeader, ref lstContent, sizes );
}

public string SimpleReport(string title, int size, string csvHeader, string sizes, ref ArrayList myReport)
{
	return SimpleReport(title, "Resultados", size, csvHeader, sizes, ref myReport);
}

public string SimpleReportAlt(string title, int size, string csvHeader, string sizes, ref ArrayList myReport)
{
	return SimpleReport("", title, size, csvHeader, sizes, ref myReport);
}

public bool changeColor = false;

public string CodeReport ( string info, string head, bool disp_head, ref ArrayList lstHeader, ref ArrayList lstContents, string sizes )
{
	string[] s_pw = sizes.Split(',');

	int t_size = 0;

	for (int t = 0; t < s_pw.Length; ++t)
		t_size += Convert.ToInt32(s_pw[t]);
	
	StringBuilder sb = new StringBuilder();

	sb.Append(info + "<span style='font-size:12px'><section class='widget2'><table class='table table-hover'>");

	ArrayList tmp_head_cur_categ = lstHeader[0] as ArrayList;
	ArrayList tmp_content_cur_categ = lstContents[0] as ArrayList;

	if (disp_head)
	{
		sb.Append("<thead><tr>");

		for (int t = 0; t < tmp_head_cur_categ.Count; ++t)
		{
			string cont = tmp_head_cur_categ[t].ToString();

			sb.Append("<th valign='top' align='left'><b>" + cont + "</b></th>");
		}

		sb.Append("</tr></thead>");
	}

	sb.Append("<tbody>");

	for (int t = 0; t < tmp_content_cur_categ.Count; ++t)
	{
		ArrayList tmp_line = tmp_content_cur_categ[t] as ArrayList;

		sb.Append("<tr>");

		for (int g = 0; g < tmp_line.Count; ++g)
			sb.Append("<td valign='top' width=\"" + s_pw[g] + "px\">" + tmp_line[g].ToString() + "</td>");

		sb.Append("</tr>");
	}

	sb.Append("</tbody></table></section></span>");

	return sb.ToString();
}

// sample

List<UserData> lst_report = new List<UserData>();

// add elements here...

ArrayList myReport = new ArrayList();

for (int t = 0; t < lst_report.Count; ++t)
{
	UserData p = lst_report[t];
	ArrayList columns = new ArrayList();

	columns.Add("<a href='SamplePage.aspx?cod=" + p["id"] + "'>" + p["login"] + "</a>");
	columns.Add(p["name"]);
	columns.Add(p["email"]);

	myReport.Add(columns);
}

LitRes.Text = var_util.SimpleReport(  "", 0, "Login,Full Name,Email", "100,180,120", ref myReport);

GeneralRe: Report builder in c# Pin
Zeyad Jalil12-Jan-16 6:59
professionalZeyad Jalil12-Jan-16 6:59 
GeneralRe: Report builder in c# Pin
rodrigogroff12-Jan-16 7:42
rodrigogroff12-Jan-16 7:42 
AnswerRe: Report builder in c# Pin
Brisingr Aerowing12-Jan-16 4:08
professionalBrisingr Aerowing12-Jan-16 4:08 
GeneralRe: Report builder in c# Pin
Zeyad Jalil12-Jan-16 6:59
professionalZeyad Jalil12-Jan-16 6:59 
GeneralRe: Report builder in c# Pin
Brisingr Aerowing12-Jan-16 13:31
professionalBrisingr Aerowing12-Jan-16 13:31 
AnswerRe: Report builder in c# Pin
Mycroft Holmes12-Jan-16 12:07
professionalMycroft Holmes12-Jan-16 12:07 
AnswerRe: Report builder in c# Pin
Gerry Schmitz12-Jan-16 16:39
mveGerry Schmitz12-Jan-16 16:39 
QuestionGood Example C# Datagrid and CRUD-Functionality Pin
gpc4411-Jan-16 23:36
gpc4411-Jan-16 23:36 
AnswerRe: Good Example C# Datagrid and CRUD-Functionality Pin
Garth J Lancaster11-Jan-16 23:55
professionalGarth J Lancaster11-Jan-16 23:55 
GeneralRe: Good Example C# Datagrid and CRUD-Functionality Pin
gpc4413-Jan-16 2:41
gpc4413-Jan-16 2:41 
QuestionThe best way to set all the datagrid cells of a row with the same value Pin
Member 1144944711-Jan-16 8:03
Member 1144944711-Jan-16 8:03 
AnswerRe: The best way to set all the datagrid cells of a row with the same value Pin
John Torjo11-Jan-16 13:59
professionalJohn Torjo11-Jan-16 13:59 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
Member 1144944711-Jan-16 22:49
Member 1144944711-Jan-16 22:49 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
John Torjo11-Jan-16 23:36
professionalJohn Torjo11-Jan-16 23:36 
AnswerRe: The best way to set all the datagrid cells of a row with the same value Pin
Pete O'Hanlon12-Jan-16 1:08
mvePete O'Hanlon12-Jan-16 1:08 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
Member 1144944712-Jan-16 1:33
Member 1144944712-Jan-16 1:33 
GeneralRe: The best way to set all the datagrid cells of a row with the same value Pin
Pete O'Hanlon12-Jan-16 2:01
mvePete O'Hanlon12-Jan-16 2:01 

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.