Results 1 to 2 of 2

Thread: generic id length of 8

  1. #1
    Junior Member
    Join Date
    Feb 2009
    Answers
    1

    generic id length of 8

    I want to generate generic ID id length should 8dig/char first 2 dig/char are related to company and remaining are employ id this is first case and second one is first 2 are company,next 2 are branch id and remaining are employ id. It should be generate after submit employ name


  2. #2
    Junior Member
    Join Date
    Mar 2009
    Answers
    2

    Re: generic id length of 8

    You need somthing like...

    public string generateid(int empid , int case)
    {
    if (case == 1) // case 1 here
    {
    comname = employee company name;
    generateid = comname+empid;
    }
    if (case == 2) // if case 2 then process the above as you wish
    {
    comname = employee company name;
    branchid = branch of employee or compnay;
    generateid = comname+branchid+empid;
    }

    //If the Length of generateid is less then 8 then add Zeros or Other Chars
    for (int i=0;i= 8;i++) //Double check the syntax here
    {
    if (generateid.Length <> 8)
    {
    generateid = "0" + generateid;
    }
    i++
    }


    return generateid

    }


    then you call the above function in your code to retrive the Generic ID such as
    String MyGeneratedID = generateid(1, 1)

    hope this helps !!

    Last edited by gurdeeptoor; 03-29-2009 at 07:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact