|
Hi
This is Murthy. Anybody has a C# Code
to generate 12 digit Unique Promotion Codes/Coupon Numbers.
Those numbers should not be generated in sequence like 10234, 10235, 10236 etc...
All the numbers should be generated in random and should not be duplicated.
Example:
1. Promotion Codes for Product Discounts.
2. Prepaid Recharge Coupons for Mobile Phones etc.
Thanks
Murthy.
|
|
|
|
|
Most likely what you want is for the last digit to be a checksum, so you can verify the codes are genuine. If you need to generate a random sequence, your best bet is to create an int list, and use a random generator to pull numbers out of it at random positions.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have this code in file default.aspx below :
<asp:DataList id="DstAlbum" RepeatColumns="3" RepeatDirection = "Horizontal" BackColor="#FFFFFF" OnItemDataBound="Album_DataList_ItemDataBound"> <ItemTemplate> <tr>
<td><table width="100%" style="WIDTH:100%"> <tr>
<td align="center"><asp:HyperLink id=Album_name NavigateUrl='<%# "AlbumDetail.aspx"+"?"+"id+Album="+Server.UrlEncode(DataBinder.Eval(Container.DataItem, "id_Album").ToString()) +"&" +""%>' style="font-size: 10pt; color: #000000" runat="server"> <%#Convert.ToString(DataBinder.Eval(Container.DataItem, "TenAlbum")) %> </asp:HyperLink> </td></tr>
<tr><td><input type=hidden id=Album_image runat="server" value=<%#Convert.ToString(DataBinder.Eval(Container.DataItem, "AnhBia")) %> NAME="Album_image"></td></tr>
</table></td></tr> </ItemTemplate>
</asp:DataList>
And file default.aspx.cs below :
private void Page_Load(object sender, System.EventArgs e)
{
string strConn = "Integrated Security = SSPI;" + "InitialCatalog=HopNhac_Database;" +
"Data Source=localhost;";
string strSQL = "Select id_Album,TenAlbum,AnhBia From tblAlbum";
SqlDataAdapter dad = new SqlDataAdapter(strSQL,strConn);
DataSet dst = new DataSet();
dad.Fill(dst,"tblAlbum");
DataView Source;
Source = new DataView(dst.Tables[0]);
DstAlbum.DataSource = Source;
DstAlbum.DataBind();
}
public void Album_DataList_ItemDataBound(Object Sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{ ((HyperLink)e.Item.FindControl("Album_name")).Text ="<img border=\"0\" src=\"" + ((DataRowView)e.Item.DataItem )["AnhBia"].ToString() + "\"></td><td valign=\"top\"><table width=\"100%\" style=\"width:100%\"><tr><td style=\"background-color: #FFFFFF; border-style: inset; border-width: 0\"><font style=\"font-size: 10pt; color: #CE7E00; font-weight: bold\"><b>" + ((DataRowView)e.Item.DataItem )["TenAlbum"].ToString() + "</b>";
}
}
When I compiled , it take an error : 'System.Web.UI.Control' does not contain a definition for 'DataItem'.
And that error is Hyperlink at default.aspx file.
somewhere is paradise.
|
|
|
|
|
noone help me..hix..
nothing
|
|
|
|
|
Hai,
On RichTextBox Control, there's a property "DetectUrls". When the property value is "true" then any word begin with "www." on that richTextBox will be treated as Hyperlink.
my Question :
How do we treat the text on richTextBox as hyperlink manually?
Or, maybe there's any class that we could edit so there will be more word pattern to be treated as hyperlink?
thankz for the information
Mail me at erwin@holyknight.us
|
|
|
|
|
wienzzz wrote: How do we treat the text on richTextBox as hyperlink manually?
Probably by using regex on the string.
wienzzz wrote: Mail me at erwin@holyknight.us
No-one is going to mail you, except spam bots. The site mails you when people reply to your messages, if you gave the site your address. I hope you d id, seeing as you're giving it to the world at large.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Regex? I don't think that's what I mean.
I suppose Regex is used to check over some word pattern, right?
what I mean here is how to make some String (i.e hello, it is me) to be treated as hyperlink. Just like in html, when you want to put some hyperlink you put tag <a href> </a> between the string.
<code>
<a href="[this is the link to be clicked]">hello, it is me</a>
</code>
I've search through RichTextBox methods and properties, but I found nothing related to the hyperlink thing except DetectUrls and LinkClicked.
Why am I using this?
well, I try to retrieve some data in database and present them in the richTextBox. some fields need to be hidden until someone want to show it. And I'm thinking of using the hyperlink to be the trigger to show the hidden field.
thankz for the info
Newbie..
Newbie..
Newbie..
Newbie..
Newbie..
-- modified at 1:00 Wednesday 10th October, 2007
|
|
|
|
|
wienzzz wrote: Regex? I don't think that's what I mean.
That is the good and fastest method to find any text matching to a pattern.
wienzzz wrote: what I mean here is how to make some String (i.e hello, it is me) to be treated as hyperlink.
You need to write a Regex pattern that finds "hello" from the text, and replaces the match with <a href="[this is the link to be clicked]">hello, it is me</a>
|
|
|
|
|
Hello!
You might want to take a look here[^]
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
wow
good stuff mav!
this is what I'm looking for.
thankz.
I will start to explore your project
thankz a lot
Newbie..
Newbie..
Newbie..
Newbie..
Newbie..
|
|
|
|
|
I HAVE A PROBLEM!
I WANT TO RUN AN EXE FILE FROM MY PROJECT WITHOUT ANY DEPENDECIES.
FOR EXAMPLE I WANT TO RUN A FAX PROGRAM OR MICROSOFT WORD OR PAINT OR ANY PROGRAM JUST WITH THEIR FILE ADDRESS. WITHOUT ANY DEPENDENCIES!
I WANT GET ADDRESS OF EXECUTIVE FILE AND THEN RUN IT
PLZ HELP ME, FRIENDS
TNX
|
|
|
|
|
Hi
First thing, don't post in all caps. It's the equivalent of shouting on the internet, and it only discourages folks from answering your question.
Regarding your question, look at the Process.Start[^] method.
|
|
|
|
|
I have very pleased for your answer
I was realy Shouting for help
because i must do this in a comercial project and i was chil from helping!
i'm not a good programmer, because I'm analyst
i dont know about special abilities in programming
tnx for your help
with the best regards
|
|
|
|
|
Masterhame wrote: I was realy Shouting for help
Don't. Everyone here wants help, why is your request more important ? It's not, and it's rude to shout.
Masterhame wrote: because i must do this in a comercial project and i was chil from helping!
i'm not a good programmer, because I'm analyst
Sounds like the usual disaster. Why are you working on a commercial project if you're not a developer ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Masterhame wrote: because i must do this in a comercial project and i was chil from helping!
i'm not a good programmer, because I'm analyst
If you're not a software developer, you shouldn't be working on a commercial software project. I'd talk to your manager and let him know this is going to turn out badly.
|
|
|
|
|
I have very pleased for your answer
I was realy Shouting for help
because i must do this in a comercial project and i was chil from helping!
i'm not a good programmer, because I'm analyst
i dont know about special abilities in programming
tnx for your help
with the best regards
|
|
|
|
|
Hi all,
Not sure if this is possible, but in a console app, is it possible to move the cursor 1 space to the left and replace the console text with a space (clearing last keystroke)?
Thanks in advance
|
|
|
|
|
Write out a '\b' (backspace) character.
|
|
|
|
|
I tried that and I'm finding that it's not deleting, the cursor doesn't delete, it just goes back to the same pos.
System.Console.WriteLine("*******************************");
System.Console.WriteLine("Press 'Q' to Quit ");
System.Console.WriteLine("Press 'A' to go again");
System.Console.WriteLine("Press 'N' to start");
System.Console.WriteLine("*******************************");
do
{
try{
System.Console.Write("\b");
stop = validate(System.Console.ReadKey().KeyChar); //Return false if != (q,a,n)
if (!stop) {
System.Console.Write("\b");
}
}catch(System.Exception){
stop = false;
}
} while (!stop);
|
|
|
|
|
Write out a backspace character, then a space! The space overwites the last char. Not sure how you would actually remove it completely but, y'know.
Console.Write("\b ");
Should replace the last char with a space.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Console.Write("\b \b"); should do it.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Oh, sure, just give him the whole solution, geeze.
|
|
|
|
|
Howdy people,
I was wondering if any of you serialization experts know if this is possible. I've trawled through MSDN a few times, but no luck so far.
I have an XML document like this:
<Item>
<ID>1</ID>
<SubItem>test1</SubItem>
<SubItem>test2</SubItem>
<SubItem>test3</SubItem>
<SubItem>test4</SubItem>
</Item>
And at the end of it, I want to end up with:
class MySuperDuperClass {
public string ID
public string[] SubItems
}
Any ideas if this is doable with plain serialization? Or is working with the XML nodes/queries the only way to go?
- Phil
|
|
|
|
|
I feel you can do this easily using XML nodes/queries. So why you are considering serialization ? Sorry If I misunderstood your question.
|
|
|
|
|
Thanks for your answer Navaneeth. It can definitely be done easily without serialization, and I am just investigating if it is even possible to do it with serialization.
- Phil
|
|
|
|