Architecture :: Method Return Types Object Vs String/bool

May 27, 2010

If I'm returning an object, then it's pretty straight-forward. However, if I'm just trying to return whether or not the method was successful or not, what's the best option? Sure ... bool seems obvious - but what if you need to debug or get some additional details out of the method than just "yes/no"? Well that's where a string becomes more obvious, right? You can leave it empty to say that the method was successful or chock it full of details in the case of an error. But this can make it less intuitive to others who may have to run your functions and it also jumbles up everything you wanted to pass back into one large string.

View 3 Replies


Similar Messages:

Return Multiple Types In Method's Signature?

Oct 13, 2010

I have two methods that do the similar thing. There are small differences here and there, which I can control by passing arguments to them when I call them, so I can effectively merge them. However one returns a string, and the other one an ArrayList. On the top of my head, I could merge them and return an Object, and then get the information I need. Is there a way though to return multiple types in the method's signature? What's the proper way to implement this?

View 5 Replies

AJAX :: JQuery Xml Compatible Page Method Return Types?

May 5, 2010

I have .aspx page methods with return type of string, which work great. I am using some jQuery ajax, and some .NET Ajax "PageMethods.methodName" syntax from the client side to successfully call these page methods. I need to return xml from a page method.... I would LOVE to be able to return system.Xml.Linq.XElement type from page method. I get a serialization circular reference error when I attempt to return XElement or XDocument. I don't really want to return XML.ToString() to client, and then convert string to xml in javascript. What return page method return type(s) would allow me to retrieve xml with jQuery ajax call? I know json is the alternative, but will not give me what I need this time.

View 3 Replies

Architecture :: Class Design - Application Allows Admins To Add Types Such As Document Types?

Oct 12, 2010

I have an application that allows admins to add types such as document types and training types that are in seperate tables with a foreign key in a transaction table.

When structuring my class I decided to go with an abstract-like pattern (without the factory methods though). So I have a Type abstract class that defines my Save, Delete, and GetList methods. I have a training type class that inherits this class. The thing is all types have 3 main properties - defined in the abstract base - but have different source tables and thus different store procedures in my DbCommand object. So basically I repeat setting up the same parameters on all the derived classes. I would like to implement the common stuff in the base but I am getting thrown off by the difference in data sources.

View 2 Replies

ADO.NET :: Return String In LINQ Method?

Mar 9, 2011

I'm really new to ASP.Net and for a school project we have to create a login form. Now I have managed to create a login with LINQ doing the following:

[Code]....

And in my html page:


protected void Test_Click(object sender, EventArgs e)

{

if (Class1.Controle(Convert.ToInt32(txt1.Text), txt2.Text))

[Code]....

I was thinking something amongst those lines, but I can't call p.GebruikerWachtwoord. So I'm guessing this is completely wrong.I hope somebody can help me figure this out, and I apologise for the poor explanation, English isn't my native language.

View 3 Replies

Security :: Method Adds A Return Url To Query String?

Jan 15, 2011

i call FormsAuthentication.RedirectToLoginPage() to redirect to login page. but there is one problem: this method adds a return url to query string.how should i disable this?

View 3 Replies

Architecture :: Create A Method Which Looks Through A Large String Of Text?

Feb 17, 2010

I need to create a method which looks through a large string of text, and determines which words (apart from words like "a" "and" "the") are the most frequently used. I would like to determine which are the top 3 most frequently used words in a string of text...is this possible?

View 4 Replies

Forms Data Controls :: Select Command And Gridview - Just Want To Return Rows Based On Bool Tick?

Sep 6, 2010

I have a table in my Database called Creditors.

One of the columns is Paid which is type Bool.

On my aspx I have an objectdatasource and gridview. In the DAL is a method called GetCreditors which

returns all the creditors into the Gridview.

In some cases the "paid" column is ticked and in other not.

I want to run a select query that only gets the rows where PAID is not Ticked. insead

of retrieving all.

View 1 Replies

ADO.NET :: How To Convert Bool Value Into String In LINQ

Dec 29, 2010

I have the following query in which I have to convert the 'bool' valu into 'string' value as "Y" or "N". I have a class defined called ChartDosCodeInfoStruct which definesQAIndicator as String. The value I am feteching from DB is a bool value. I need to take this bool value and accordingly assignQAIndicator= "Y" or "N".

UserManager userManager = (UserManager)BaseEntityManager<DataAccessLayer.User>.GetSingleInstance();
List<User> user = userManager.GetCodersForChart(_currentChart.ChartId);
UIConfigurationObject.CoderForChart.value = user.First().FullName.ToString();
[code]...

View 2 Replies

ADO.NET :: Cannot Convert String To Bool Error In LINQ

Oct 22, 2010

cannot convert string to bool error in LINQthis is my code:

[Code]....

View 4 Replies

Web Forms :: Error 25 / Cannot Convert Method Group Read To Non-delegate Type (bool)

Aug 30, 2013

I worked in C Sharp code works vote and found the problem appointed Data ReaderIf you will allow me in the solution

Error 25 Cannot convert method group 'Read' to non-delegate type 'bool'. Did you intend to invoke the method?

Show Erorr also 

Line 23: Con.Open ();Line 24: OleDbDataReader dr = cmd2.ExecuteReader ();Line 25: if (dr.Read)Line 26: {Line 27: label2.Text = dr (0);

code 

public partial class Default2 : System.Web.UI.Page
{
System.Data.OleDb.OleDbConnection Con = new System.Data.OleDb.OleDbConnection
(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString);
protected void Page_Load(object sender, EventArgs e)

[Code].....

View 1 Replies

Creating A Bool That Checks A String For Items For An Arraylist?

Feb 22, 2011

I need to create a public bool that checks a string for items in an arraylist.

Here is a vague sample of what I'm talking about..

[Code]....

I'm not experienced enough with the foreach statement to quite figure out what I'm doing wrong here.

View 5 Replies

Iterate Through A Dictionary Object That Can Contain A Object And Enum Types

Jul 20, 2010

Can you iterate through a dictionary object that can contain a object and enum types

foreach(Dictionary<someObject, enumType> myDic in myObjects) {
if(enumType.myType == enumType.Type) {
do something here...

}

View 1 Replies

How To Return Two Types Of Objects In MVC View

Mar 2, 2011

I have say class/ojbect one which I am returning as details. But then there is a second class that is related to the first that I want to list (and have an option to look at the details). How do I get return both of those?

Example is like in an item as the main piece but there may be details or other items that are related to the main item. I will select them with a linq query but then how do I return them to the same view?

Do I need to have some sort of partial or other form to display the second object type? I don't see where returning the view I can return both.

My thought for right now is to create a new class that contains both of the object types but I know there has to be a better way.

View 3 Replies

WCF / ASMX :: Regarding Web Service Return Types?

Jun 24, 2010

i have 10 employee objects.I want to return these 10 object from a web method to web service client.

View 6 Replies

Finding Types Of Tier Architecture?

Dec 28, 2010

How many tier architecture are there for ASP.NET?I know only one that is three tier architecture.Can anyone tell briefly about 4 tier architecture and other tier architecture?

View 6 Replies

Can Return Multiple Content Types Per One HTTP Request

Jul 31, 2010

Reporting system has list of available reports on a web page. When user clicks on a report new browser window opens, server starts to prepare report (winword document) and then sends it back after 2-10 seconds.

Code in the handler looks like the following:

context.Response.AddHeader("Content-Disposition",
"attachment;filename=report.doc");
context.Response.BinaryWrite(reportDocument);

Is it possible to prepare html content immediately send it back and then continue with time-consuming report preparation not closing connection?

View 3 Replies

Declare Return Type Of The Function When There Are Two Possible Returned Types?

Jan 25, 2010

I have the following statement, I want to turn it into a Public Shared Function :

If isEmployee Then
Dim employeeInstance As New Employee
employeeInstance = GetEmployeeInstanceByUserId(userId)
Return employeeInstance
Else
Dim studentInstance As New Student
studentInstance = GetStudentInstanceByUserId(userId)
Return studentInstance
End If

Public Shared Function GetWorkerInstance(Byval isEmployee as Boolean) As ...(not sure what to write here)...

There two possible return Type. I'm not sure what I should declare for the function return type.

View 2 Replies

MVC :: How To Return 401 Error From A Method Return ActionResult

Sep 28, 2010

how can i return 401 error from a method return ActionResult?

View 1 Replies

ADO.NET :: Cannot Convert From Ref Bool To Ref Bool?

Jan 31, 2011

i create a sproc for validation username and email address lilke below:now i use this sproc like below:

[Code]....

Error 6 The best overloaded method match for MisaghDataContext.usp_ValidUserNameEmail(string, string, ref bool?)' has some invalid arguments

View 4 Replies

Architecture :: Database Backed Entity Classes And Matching The Underlying Types For The ID Field

Jul 16, 2010

Database backed entity classes and matching the underlying types for the ID field. removed.

View 1 Replies

Copy Object Types In VB.NET?

Jul 29, 2010

I am building an ASP.NET application that needs dynamic tables. That's another issue that I've already posted about (and gotten a pretty good response!). Now, I'm running into another issue - I want to add new rows to my table, but given that I will have 10-12 tables on one page, each containing different objects in their rows (text boxes, check boxes, etc.) I need a way of simply generically adding a new row that has the same objects as the first row in the table. Here's my code:

Private Sub AddTableRow(ByRef originalTable As System.Web.UI.WebControls.Table)
Dim originalRow As System.Web.UI.WebControls.TableRow = originalTable.Rows(1)
Dim insertingRow As New System.Web.UI.WebControls.TableRow
Dim insertingCells(originalRow.Cells.Count) As System.Web.UI.WebControls.TableCell
Dim index As Integer = 0

[code]....

View 1 Replies

SQL Server :: How To Query Return All Data In Array Object / Collection Object

Sep 14, 2010

how to query return all data in Array Object ,Hash Table ,And DataTable dataRow

View 4 Replies

Architecture :: Looking For Better Way To Design, To Use Object's Properties With The Object Data Source?

May 10, 2010

I've posted the same question in the Object Data Source forum. This is a link to it http://forums.asp.net/t/1554083.aspx. Maybe I should've posted here to begin with. There seemed to be some overlap so I wasn't sure which was the best on to post the question in.

I'm trying to get a better understanding of how I could've designed my app so that the Object Data Source could work with the properties of my business objects. Please read the other post to see how it's currently being done. Sorry for the link to the other page. I didn't want to post a bunch of duplicate information. I would love to get some suggestions for alternative ways of doing this.

View 1 Replies

Visual Studio :: Why Javascript Functions Created With Declared Return Types Are Not Giving Intellisense Hints

Aug 13, 2010

I am trying to figure out why javascript functions I create with declared return types are not giving me intellisense hints. See code below, specifically updateNextItemTime in Sample.TodoList.

[Code]....

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved