Solved

display the output from method  on a label

Posted on 2006-06-22
4
199 Views
Last Modified: 2012-05-05
I have created a method in BLL and try to execute it when the use click the submit button.


I am trying to display the result of method on a label : i.e you have generated a new ticket sucessfully : Ticket number 4009. how can I display the output on a labe control?

result =   Add.AddNewTicket(create_date, callbackinfo, clinic_id, requestor, status_id, priority_id, issuetype_id, agent_id, issuedesc, RequestMethod_ID, followup, Log);

--Here is a method in BLL

  public  void  AddNewTicket(DateTime create_date, string callbackinfo, int clinic_id, string requestor, int status_id, int priority_ID, int issuetype_id, int agent_id, string issuedesc, int RequestMethod_ID, DateTime followup, string log)
        {
            Ticket_HeaderTableAdapter AddNewTicket = new Ticket_HeaderTableAdapter();

            try
            {
                AddNewTicket.FillAddNewTicket(create_date, callbackinfo, clinic_id, requestor, status_id, priority_ID, issuetype_id, agent_id, issuedesc, RequestMethod_ID, followup, log);

            }

            catch (Exception ex)
            {
            }
        }


--Here is the code behind

protected void Submit_Click(object sender, EventArgs e)
    {

        TicketBLL Add = new TicketBLL();

        string result;
        DateTime  create_date = Convert.ToDateTime(Label1.Text);
        string callbackinfo = TextBox2.Text;
        int clinic_id =  Convert.ToInt32(DropDownList1.SelectedValue);
        string requestor = TextBox1.Text;
        int status_id = Convert.ToInt32(DropDownList11.SelectedValue);
        int priority_id = Convert.ToInt32(DropDownList3.SelectedValue);
        int issuetype_id = Convert.ToInt32(DropDownList7.SelectedValue);
        int agent_id = Convert.ToInt32(DropDownList2.SelectedValue);
        string issuedesc = TextBox4.Text;
        int RequestMethod_ID = Convert.ToInt32(DropDownList6.SelectedValue);
        DateTime followup = Convert.ToDateTime(CompletionDate.Text);
        string Log = TextBox6.Text;

        Add.AddNewTicket(create_date, callbackinfo, clinic_id, requestor, status_id, priority_id, issuetype_id, agent_id, issuedesc, RequestMethod_ID, followup, Log);

       
}


       
       
    }
0
Comment
Question by:jung1975
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16964072
Is this all about getting an identity/auto-number value back from the database?

Bob
0
 

Author Comment

by:jung1975
ID: 16964097
yes..  the query regult  in data access layer returns something like "you have sucessfully  created a new ticket: 4 "
and I 'd like to display this result on the labe control ...
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 250 total points
ID: 16964184
1) Change the void to int and return a value from the function

2) Extract a number from the string using a regular expression:

using System;
using System.Text.RegularExpressions;

public class RegexParser
{

  public static string ExtractNumber(string input)
  {
   
    string pattern = @"\d+";

    Match match = Regex.Match(input, pattern);

    if (match.Success)
      return match.Value;
    return "";
  }

}

Example usage:
  int number = Convert.ToInt32(RegexParser.ExtractNumber(result));

Bob
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 250 total points
ID: 16965192
does AddNewTicket.FillAddNewTicket return a string "you have sucessfully  created a new ticket: 4 "

if yes, then change
public  void  AddNewTicket
as
public  string AddNewTicket

and
Add.AddNewTicket(create_date, callbackinfo, clinic_id, requestor, status_id, priority_id, issuetype_id, agent_id, issuedesc, RequestMethod_ID, followup, Log);
to
Label1.Text = Add.AddNewTicket(create_date, callbackinfo, clinic_id, requestor, status_id, priority_id, issuetype_id, agent_id, issuedesc, RequestMethod_ID, followup, Log);

Rejo
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now