.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

generate a unique code

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :ASP.Net
 

Hiii Friends,

I have to generate a unique customer code like this-

'cbd'+first letter of customer name+incrementer

here

cbd is hard coded means reamain fixed in each customer code

first letter of cust_name is like Bell Companies- B

and

incrementer must be four digit number like 0001,0002,0888 etc.

Here incrementer should start with 0001 for each customer means

for EX-

BELL COMPANIES - CBDB0001 then it should increment for customers having name started with B

TEL POWERS- CBDT0001 then it should increment for customers having name started with T

hopefully all of u understand what i mean

plz rep asap

any help will be greatly appreciated

thanx and regards 




View Complete Post


More Related Resource Links

Stay Alert: Use Managed Code To Generate A Secure Audit Trail

  

In today's security-conscious environments, a reliable audit trail is a valuable forensic tool The Windows Server 2003 operating system provides features that let you enable a wide range of applications to make use of auditing functionality. This article looks at auditing from the operating system perspective and describes a sample managed code implementation that will allow you to add auditing to your own server applications.

Mark Novak

MSDN Magazine October 2005


Custom tool error: Failed to generate code for the service reference 'CompanyService'. Please che

  

A little background because I feel I have an out of the ordinary architecture in place and don't know if this is contributing to the problem. 

We have an existing ASP.net application that is undergoing expansion.  The new functionality is all written in Silverlight 4.  As part of that expansion I gutted all the old Linq to SQL and put Entity Framework 4 into place.  To do this I created a standard .net Class Library and added my edmx files there.  Naturally, the business entities created by this cannot be used in Silverlight.  So I created a Silverlight Class Library and added all the business entities to that Silverlight Class Library as linked files.  I changed the name space to be the same.

So I have the following assembly / namespaces

Company.Project.Dal.csproj / Company.Project.Entities (.net 4 class library)

Company.Project.Entities.csproj / Company.Project.Entities (SL4 class library)

With this architecture I was able to share my business entities with my SL enabled web services, my asp.net projects, my silverlight projects.  Really it's a beautiful thing.

Once this was done I added "message" classes to Company.Project.Dal and again shared them with the other entites using linked files.  These messages are things like MyObjectRequest; they are class

Use DB query result to generate Jquery required lines of code

  

Hello

I 'm gonna query database for photo records. each record include "photo path" where imagesURL  stored in string format

 I Choses my favorite Juqery plugin to show images. Plugin needs some lines of code like below.

How could I  generate these lines

<script>
$(function() {
$('#slideshow').crossSlide({
sleep: 2,
fade: 1
}, [
{ src: 'picture1.jpg' },
{ src: 'picture2.jpg' },
......
.....
{ src: 'picture4.jpg' }
])
});
</script>

Generate Unique Id

  
I want a list column that will generate a unique id everytime a new item is added to the list. The item will have a predefined prefix and then add a number. All the ones I have tried from other sites have failed. 

Can't get dataclasses1datacontext to generate code behind in .net 4.0 and vwd 2010 express

  

I am using a web application project in visual web developer express 2010 on Windows 7 x64 targeting .net 4.0.  I've linq to sql quite a bit with visual studio 2008 and it worked with no issues.  I added a dbml file to the root of my web site and dragged over my data model.  When I run my project, I get the following error:

Type 'DataClasses1DataContext' is not defined.  The line of code it is having a problem on is 

 Dim db As DataClasses1DataContext = New DataClasses1DataContext()

However, intellisense is recognizing dataclasses1datacontext as a valid class.  If I view the code on the dbml file, it has essentially an empty class definition.  It appears it didn't actually generate any code relating to my data model.  I tried adding system.data.linq, etc to my web.config file but it didn't make a difference.  I always get the error above.  Again, I'm using a web application project which appears to function a little differnetly than a web site project. 

Any ideas why I can't get this basic functionality that was working in 2008 to work in 2010?


how to generate a unique random number on a form submission?

  

I want to generate a unique random number everytime a user submits a form. As the form is submited the data of the form should be placed in a database and a unique random number should be generated so that the user can later use this unique random number to reterieve his details from the database that refer to his unique random id. The unique random number should be atleast 9 digits long. Please help me on this.


need help to generate unique random numbers

  

I want to generate a unique random number everytime a user submits a form. As the form is submited the data of the form should be placed in a database and a unique random number should be generated so that the user can later use this unique random number to reterieve his details from the database that refer to his unique random id. The unique random number should be atleast 9 digits long. Please help me on this.


how to generate the tabcontrol in code behind in WPF application

  

Hi All

 I Am new in WPF application i need to develop the application how the VS2010  solution Explorer Tree view is working when user click the particular file it open in the new tab in the same way i need to develope to my application.

What i am done is i have the menu item like

new

open

when user click the menu item  dynamically add the tab item with menu name . my problem is when i select the first menu item its working fine . when i am trying to click the next menu item it show error like this

--> Element already has a logical parent. It must be detached from the old parent before it is attached to a new one.

how to fix this problem any one help me.

this is my code in code behind

TabControl item_tabs = new TabControl();
    TabItem newtab1 = new TabItem();
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
      item_tabs = (TabControl)this.FindName("itemtab1");
    }

    private void new_men_Click(object sender, RoutedEventArgs e)
    {
      // TabControl item_tabs = (TabControl)this.FindName("itemtab1");
      int count = item_tabs.Items.Count;
      if (count == 0)
      {
        string itemname = new_men.Name.ToString();
        // newtab1.Content = itemname;
        newtab1.Header = itemname;
        item_tabs.Items.Add(newtab1);
      

Submitting Infopath forms to a Sharepoint Library - how can I generate a unique name for each record

  

I have published an Infopath form to a Sharepoint Library. What is the best way to ensure the following:

1. have a name per saved form (I do have a name field which has a set certain amount of available names in it which I am currently using as the form name - coming from an XML file)
2. users can edit already submitted forms without changing the name of the saved form
3. Ensure that users who may create a new form which happens to have more or less the same data as a previously saved form don't end up overwriting the existing one and hence I end up loosing saved data?

Using the name field + allow overwrite will allow me to have a unique name for the form and allow it to be overwritten but if I create a new form with the same name and maybe just a few small differences I will overwrite the existing form which is what I don't want - someone may not realise that an existing form with the relevant information already exists and we could loose already saved information

Any advice would be greatly appreciated.

Thanks,
Declan.


The step did not generate any output. Process Exit Code 0. The Step Succeeded

  

Hi All,

We have a job which calls a dts package. The status after the run of this step is The step did not generate any output.  Process Exit Code 0.  The step succeeded.

What does that mean when it says Did not generate any output?

Thanks,


Thanks very much, Manoj Deshpande.

How to auto-generate object initzializer code according to any given class definition?

  

Hello!

I think this is at least somewhat connected to reflection so I posted it here.

I work with WCF and Web Services right now. Of course I use the tools provided to generate code from the WSDL documents, hence, for every datatype, a corresponding class is generated. As the WS has loads of types with nested subtypes, I get about 80 usually small classes, only having a few members. In order to implement all that, I have to initialize the classes over and over again.

So I wonder, if there is no way, to use reflection to automatically generate  code (object inizializer) from the class definition, including all subclasses?

Ideal would be a snipped - so that I just enter the name of any random class and dynamically get the full initializer generated. Do snippets actually have the power to do that?

As this will save a lot of stupid typing, I also wonder, if there aren't already any tools, snippets or widgets that do this? I assumed that is is something many programmers might need, but google did not show anything like it.

Thank you very much!


Create an Infopath form to generate unique number MOSS 2007

  

I created an infopath form that would auto generate a number to each form from following instructions at the following site.

http://enterprise-solutions.swits.net/browserforms/autonumber-infopath-form-submitted-sharepoint-library.htm

 

 

I am wondering if it is possible to change the starting point of the ID field within sharepoint.  It starts at 1.  I would like it to start at 1000. and add 1 number each time a new infopath form is added. Or would I add a different field to accomplish this.


Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

  
When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

  
You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

  
Free C# Code Snippets

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend