|
monu_khan wrote: i have give connection string
Do you also have a question?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Application configuration files are designed to provide this information without undo coding. Use the connection strings block in the xml to add connection string keys and then have your application blindly read it and use it.
Individual machines are responsible for their own configuration settings and that is the entire point of application configuration files.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
actually my problem is that how to pass enviornment.machinename value
<add key="con" value="server=Enviornment.Machinename\INFOSOFT\ist;database=sm;user id=sa;pwd=****" />
|
|
|
|
|
Hi!
I've got two picture boxes on my form. The variables "firstDice" and "secondDice" are two randomly generated integer values.
I've also got a label under each picturebox that shows the generated value just to be able to see if the right
picture is shown in the picturebox, but that's not always the case..
I'm pretty sure I'm doing something wrong in the code when the picture box is told its "file location", but what?
Code:
switch (firstDice)
{
case 1:
label1.Text = "1";
firstPictureLocation += "D:\\bilder\\1.gif";
picBoxDice1.ImageLocation = firstPictureLocation;
break;
case 2:
label1.Text = "2";
firstPictureLocation += "D:\\bilder\\2.gif";
picBoxDice1.ImageLocation = firstPictureLocation;
break;
case 3:
label1.Text = "3";
firstPictureLocation += "D:\\bilder\\3.gif";
picBoxDice1.ImageLocation = firstPictureLocation;
break;
case 4:
label1.Text = "4";
firstPictureLocation += "D:\\bilder\\4.gif";
picBoxDice1.ImageLocation = firstPictureLocation;
break;
case 5:
label1.Text = "5";
firstPictureLocation += "D:\\bilder\\5.gif";
picBoxDice1.ImageLocation = firstPictureLocation;
break;
case 6:
label1.Text = "6";
firstPictureLocation += "D:\\bilder\\6.gif";
picBoxDice1.ImageLocation = firstPictureLocation;
break;
}
switch (secondDice)
{
case 1:
label4.Text = "1";
secondPictureLocation += "D:\\bilder\\1.gif";
picBoxDice2.ImageLocation = firstPictureLocation;
break;
case 2:
label4.Text = "2";
secondPictureLocation += "D:\\bilder\\2.gif";
picBoxDice2.ImageLocation = firstPictureLocation;
break;
case 3:
label4.Text = "3";
secondPictureLocation += "D:\\bilder\\3.gif";
picBoxDice2.ImageLocation = firstPictureLocation;
break;
case 4:
label4.Text = "4";
secondPictureLocation += "D:\\bilder\\4.gif";
picBoxDice2.ImageLocation = firstPictureLocation;
break;
case 5:
label4.Text = "5";
secondPictureLocation += "D:\\bilder\\5.gif";
picBoxDice2.ImageLocation = firstPictureLocation;
break;
case 6:
label4.Text = "6";
secondPictureLocation += "D:\\bilder\\6.gif";
picBoxDice2.ImageLocation = firstPictureLocation;
break;
}
/Joplinazz
|
|
|
|
|
Joplinazz wrote: I'm pretty sure I'm doing something wrong in the code when the picture box is told its "file location", but what?
Well for one thing you have put VB style code in C#. That is not what the language was intended for.
Secondly, I would verify those paths for you but I can't seem to access your network.
Thirdly I would check to see if your code is upgradating the picture control but you did not post that code.
led mike
|
|
|
|
|
Err, yeah.
First problem:
switch (secondDice)
{
case 1:
label4.Text = "1";
secondPictureLocation += "D:\\bilder\\1.gif";
picBoxDice2.ImageLocation = firstPictureLocation;
break;
...
And second, why are you using += ? You should just be using = otherwise after a few changes, the path could look like this:
D:\\bilder\\1.gifD:\\bilder\\3.gifD:\\bilder\\2.gifD:\\bilder\\6.gif
And finally, you could ditch the switch statement and just use the generated number to get to the file, like:
firstPictureLocation = "D:\\bilder\\" + firstDice.ToString() + ".gif";
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Problem solved, I used Image img1 = Image.FromFile("D:\\bilder\\1.gif") and picBoxDice2.Image instead.
Thx both for your help though.
/Joplinazz
|
|
|
|
|
I'd suggest you put the below code in a method.
<br />
<br />
label.Text = ""; <br />
secondPictureLocation += "D:\\bilder\\number.gif"; picBoxDice.ImageLocation = firstPictureLocation;<br />
Coding 101, if something the same, or similar pops up more than 2 times give it it's own method.
|
|
|
|
|
I wanted to put some simple example code here to show how I am doing Data I/O between the BLL and the DL. Any comments would be great!
Data Layer DAO object:
public class CMItemDAO
{
public CMItemDAO()
{
//
// TODO: Add constructor logic here
//
}
public static IDataReader GetItems(int quantity, ItemManager.Item type)
{
string itemType = (type == ItemManager.Item.Document ? "SW" : "DOC");
String sSql = "SELECT CMLib_Key, CM_Number, Item_Name ";
sSql += "FROM ccdb.cclib WHERE Item_Type = :pITEMTYPE AND ROWNUM <= 10";
Database db = DatabaseFactory.CreateDatabase();
UserDBLogon(db, "xxxxxxxxx@xxxxxxxx.xxx", "WNhc(#111111111");
DbCommand cmd = db.GetSqlStringCommand(sSql);
db.AddInParameter(cmd, "pITEMTYPE", DbType.String, itemType);
return db.ExecuteReader(cmd);
}
------------How this is being called from the Business Layer:
public class ItemManager
{
public enum Item
{
Document,
Software
}
public ItemManager()
{
//
// TODO: Add constructor logic here
//
}
public static List<ICMItem> GetItems(int quantity, Item type)
{
Cache listCache = HttpRuntime.Cache;
List<ICMItem> list = new List<ICMItem>();
ICMItem iCMItem;
if (HttpRuntime.Cache["Item" + type.ToString()] != null &&
(HttpRuntime.Cache["Item" + type.ToString()] as List<ICMItem>).Count <= quantity)
{
list = ((HttpRuntime.Cache.Get("Item" + type.ToString()))) as List<ICMItem>;
list.RemoveRange(quantity, (list.Count - quantity));
}
else
{
using (IDataReader reader = CMItemDAO.GetItems(quantity, type))
{
while (reader.Read())
{
if (type == Item.Document)
iCMItem = new Document() as Document;
else
iCMItem = new Software();
iCMItem.CMLibraryKey = reader.GetInt32(0);
iCMItem.CMNumber = (string)reader[1];
if (reader.GetValue(2) != DBNull.Value)
iCMItem.ItemName = (string)reader.GetValue(2);
else
iCMItem.ItemName = "";
list.Add(iCMItem);
}
}
HttpRuntime.Cache.Insert("Item" + type.ToString(), list);
}
return list;
}
I hope this is not too much simple example code; however, any comments on how I am doing things would be great!
Thanks,
Steve
|
|
|
|
|
Business layer shouldn't know anything about the data layer internals. I mean data layer might be using database or some other data store. Business layer should be isolated. You are returning IDataReader instance and it tells your business layer knows about the data store. You should take a look at DTO (Data transfer object) for passing values between layers. (Information got from colin )
|
|
|
|
|
Hello all ,
I have developed a ecommerce web site, for which i want to integrate the payment gateway using paypal.
I want to accept the credit card details, user details such as Shipping, and billing and the contact details in my website. And process the payment using the Direct Payment API.
I tried since 5 to 6 days in the internet to search the solution to this problem, but i didn't got a single resource.
Also in paypal developer community and in paypal website, they have mentioned that, the Direct Payment API method will be applicable only to the US Customers. So it is not possible me to download any resources for this method.
Can any body help me regarding this problem. if any one has the solution this problem, please reply, or please provide any links, or some sample code for this problem in Asp.Net with C#.
Thank you,
regards,
|
|
|
|
|
Your best bet is to talk to the PayPal support folks and see if there are any other options opened to you.
Life, family, faith: Give me a visit.
From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'"
Judah Himango
|
|
|
|
|
You have not google it correctly.............. google it u will find code for it ,, with hidden tags in it ..and runat="server" to those and supply the values dynamically
It is simple .. i will fwd the complete code if possible
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
Use Google, I like their API better and use it for my purposes. Plus the TOS is so much better and the payment terms are more competitive. It is akin to having my own merchant account. (Google really should pay me for lauding their services so)
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I have added a NotifyIcon in Console application, but I am having a hard time disposing off the icon when the application exits.
Can anyone tell me the way ?
Thanks.
|
|
|
|
|
What do you mean? Are you talking about the way the icon stays in the tray, even after tha application exits until you hover over it, at which time it finally goes?
Because if you are it happens with everything. Before you exit you need to set the NotifyIcon'svisible property to false , then it will dissapear.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
He is running a NotifyIcon in Console app without a message pump...
|
|
|
|
|
Actually i think we resolved that, a few people gave answers and Ed Poor gave some example code.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
ptr2void wrote: I have added a NotifyIcon in Console application, but I am having a hard time disposing off the icon when the application exits.
You will have a hard time for the rest of your life with that design, I have tried to offer alternatives, but you are just to stubborn to trust another's opinion.
ptr2void wrote: Can anyone tell me the way ?
THERE IS NO WAY.
|
|
|
|
|
Your in a good mood, i can tell.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
SK Genius wrote: Your in a good mood, i can tell.
I just feel sorry for the square peg and the round hole ...
|
|
|
|
|
Hello everyone,
If we use foreach to iterate a Dictionary, it is only restricted that we can not insert new elements and remove exsting elements of the Dictionary.
And we are free (allowed) to change the content (mmber fields) of object pointed by the "value" reference of a key, right? Example,
foreach (KeyCollection<> k in someDictionary)
{
someDictionary[k].someOperation();
}
thanks in advance,
George
|
|
|
|
|
George_George wrote: And we are free (allowed) to change the content (mmber fields) of object pointed by the "value" reference of a key, right?
hard to say, since I'm not sure what you mean. your foreach syntax is wrong. why not try out using your favorite ide?
|
|
|
|
|
|
As long as you only read the value from the collection, you can do anything you like with it. It's only when you change anything that the dictionary itself is aware of that the enumerator is invalidated.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|