|
You're approaching the problem in completely the wrong way here. You're starting off with a title and a physical structure, without getting to the finer points of what your requirements actually are. That's the thing you should be looking into first - once you've sorted the requirements and your design out, then the organisation of the solution architecture should become apparent.
|
|
|
|
|
I agree. Like most applications, ERP are usually specific to the organization, so rarely(if not impossible) can you build an ERP system that has the most features that will be reused on your future projects. Like Pete said, understand the requirements before building an architecture.
Ignorance of the ability brings disability.
|
|
|
|
|
There are lots of things you have to plan before start developing.
1) What are the module you want in the ERP. (Like,- Sales, Purchase and all that).
2) Who will be your client.
3) Other requirements.
|
|
|
|
|
Are you serious? Do you know how much work is involved in developping an ERP?
|
|
|
|
|
I've spent the entire night trying to do one simple thing - populate a ListView from a DataTable and display it. That isn't asking so much, is it? From MSDN, I learned that I have to use Details view to display multiple columns containing subitems, so I tried that. In VS2010 the IDE claims that View.Details is not defined, though in Designer View I can set the View Property to Details. All examples in MSDN include the line: ListView1.View = View.Details but it doesn't exist in VS 2010. Having made the proper setting in Designer View, I set about creating something useful. Or so I thought.
What I'm trying to accomplish is to display a list of SQL Server instances on the network, and ask the user where to create a new database. Enumerating the available instances is easy, as the SqlSourceEnumerator.GetDataSources() method works great, returning a table with 4 columns of text. Using the DataTable.Columns.ColumnName() method does a nice job of populating the headers for my ListView, too. And adding ListItems and SubItems works fine, as well, as I can see the data being transferred when I step through the code using the debugger. But when it finally gets down to displaying the ListView, nothing is displayed but the headers! And even though I've set the AutoResizeColumns property to HeaderSize , they don't resize at all! My code follows, and any suggestions would be most welcome, especially if they involve sacrificing small animals - I'm in that sort of mood.
private void frmMain_Load(object sender, EventArgs e)
{
DataStuff MyData = new DataStuff();
DataTable MyTable = MyData.GetSources();
lvDataSources.HeaderStyle = ColumnHeaderStyle.Nonclickable;
lvDataSources.AutoResizeColumns((ColumnHeaderAutoResizeStyle.HeaderSize));
if (MyTable != null)
{
for (int i =0; i < MyTable.Columns.Count; i++)
{
ColumnHeader hdr = new ColumnHeader();
hdr.Text = MyTable.Columns[i].ColumnName;
lvDataSources.Columns.Add(hdr);
}
foreach (DataRow row in MyTable.Rows)
{
ListViewItem lvItem = new ListViewItem(row[0].ToString());
for (int i =1;i < MyTable.Columns.Count;i++)
{
if (row[i] != null)
lvItem.SubItems.Add(row[i].ToString());
else
lvItem.SubItems.Add("N/A");
}
}
lvDataSources.Show();
}
}
Will Rogers never met me.
|
|
|
|
|
You have missed out on adding item to the listview in the foreach loop. BTW View.Details is available to me.
Missed out on the AutoResize thing. Do it after you have added the columns and it will work.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
Bingo! How could I have missed that rather obvious step?
Note to Self: Do not stare at the same non-working code block for 6 hours straight. Walk away...
On the resizing thing, it seems to have two styles; one according to the header width, the other to match the data. What if some headers are wider than the data, and others not?
Will Rogers never met me.
|
|
|
|
|
"All examples in MSDN include the line: ListView1.View = View.Details but it doesn't exist in VS 2010."
A quick look at your code says: replace ListView1 with lvDataSources in the examples and you will be fine. All that I can see you need to do, is add the line
lvDataSources.Items.Add(lvItem);
to the bottom of your foreach loop, and it should work.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I hate forehead slappers like that...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
they are healthier than botox.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I'm not too sure about that. My ears are still ringing.
Will Rogers never met me.
|
|
|
|
|
Yup, I plain missed that last step. And as d@nish pointed out, the resizing thing goes at the end. I thought it was a property for an automatic behavior, and didn't have to be explicitly called. My bad...
Thanks!
Will Rogers never met me.
|
|
|
|
|
Hi
I am moving from mainframe to C#. So trying some basic C# programs ( I am like LKG in c#)
I wrote a simple temp conversion class as follows
namespace TempConversions
{
public class Temperature
{
private float temp, newTemp;
public Temperature(string thisTemp)
{
temp = Convert.ToSingle(thisTemp);
}
public string getCels()
{
newTemp = 5 * (temp - 32) / 9;
return newTemp.ToString();
}
}
}
Now I want to write another test class from where I need to give in temp in *F and get the converted temp in degree celcius,
I am stuck in syntax to call this Temperature class. Any help on the syntax will be really appreciated.
namespace TempConversions
{
class TestTempConv
{
public static void Main(string[] args)
{
float testTemp ;
//convert float to temp
//invoke Temperature.GetCels method
//Print temp in degree celcius
}
}
}
|
|
|
|
|
Hi,
1.
welcome to CodeProject and to C#. I hope you have chosen a good introductory book and plan to study it front to back over time. In my opinion a book is the best way to get a consistent and global insight in a technology or language.
2.
please use PRE tags when showing a code snippet; either type them like so <PRE>my code</PRE> or use the "code block" widget above the text editor field. It will show formatted code, which is much more readable.
3.
The way you have organized the Temperature class, you need to create a Temperature object using the new keyword, then call its getCels() method, like so:
public static void Main(string[] args)
{
for(int i=1; i<args.Length; i++) {
string fahrentheit=args[i];
Temperature tempObject=new Temperature(fahrenheit);
string celsius=tempObject.getCels();
Console.WriteLine(fahrenheit+" F = "+celsius+" C");
}
}
That should work, I haven't tested it, there may be a minor hickup somewhere.
4.
And then I have a lot of comments:
a) it is not so nice to have a Temperature constructor that takes a string as a parameter; "separation of concerns" would dictate that turning a string into a number is not a job for the Temperature class; likewise, getCels() should return a number, not a string.
b) the normal way to convert strings to numbers is by calling type.Parse() or better yet type.TryParse() where type is the type you want as a result.
c) when the Temperature class only serves a single purpose, it would be easier to just have a static method that takes a number of degrees Fahrenheit, and returns the equivalent number of degrees Celsius, like so:
public static float ToCelsius(float fahrenheit) {
return ((fahrenheit-32.0f)*5.0f/9.0f);
}
That way, you don't need to create Temperature objects, you simply call the method:
float fahrentheit=float.Parse(args[i]);
float celsius=Temperature.ToCelsius(fahrenheit);
Console.WriteLine(fahrenheit.ToString()+" F = "+celsius.ToString()+" C");
d) please note I also used more appropriate variable and method names, more in line with C# tradition.
I hope this gets you going.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Saturday, May 14, 2011 11:17 PM
|
|
|
|
|
Thanks very much for swift response. What would be a good book you will recommend for beginners like me. Also I will adhere to the format you have prescribed to post questions.
I will try out your suggestions for the code and report my progress.
cheers, Ravi
|
|
|
|
|
I seldom recommend a specific book as it depends on your personal taste, and your prior knowledge about programming in general, other languages, etc. I normally suggest one visits a real (or virtual) book store, looks at 5 or 10 books, and buys 1 or 2. It has been a long time I learned about .NET and C#, I then was quite happy with the Microsoft Step by Step series of books.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Welcome to CP, and to C#, Ravi.
I've been working at learning C# myself, and I've found Professional C# 2005 with .NET 3.0 by Wrox Press very helpful. It is not, by far, a perfect text, but it's taught me a lot, and my friends here at CodeProject regularly supplement my knowledge.
Will Rogers never met me.
|
|
|
|
|
Charles Petzold has written a great introductory book which you can find here[^].
The best things in life are not things.
|
|
|
|
|
SFORavi wrote: Convert.ToSingle
Other than ChangeType, never use the Convert class -- there is always a better way.
|
|
|
|
|
PIEBALDconsult wrote: Other than ChangeType, never use the Convert class -- there is
always a better way.
For example?
|
|
|
|
|
SFORavi wrote: I am moving from mainframe to C#.
And are you moving from procedural programming to Object Oriented programming as well?
If yes then note that you will need to think differently about designing code. It is not just a matter of understanding the syntax.
|
|
|
|
|
i want to control my network adapter with my pro
can i disable and enable it or can i control internet access with my pro ?
if you can , i don't want to use API methods
tanks
MM
|
|
|
|
|
MohammedMahmoud wrote: can i disable and enable it or can i control internet access with my pro ?
That probably depends on exactly what you mean.
From the technical standpoint you do not "have" internet access. What you have is the ability for your IP traffic and probably more specifically TCP requests to reach other computers (of which those compose the internet.)
And denying access to that depends on your exact network setup. So for example if you have a typical home setup with a desktop and and cable modem then you would want to configure the cable modem to stop allowing traffic to and from external IP sources. That would leave local traffic still working but the internet would not be accessible.
However to do that you must interact with the cable modem box and there is no specific fixed way to do that.
Conversely if you are talking about creating a firewall via C# then that is a different solution as well.
MohammedMahmoud wrote: if you can , i don't want to use API methods
Then no.
The term "C#" is used to refer to both the language and the .Net API. And like most or perhaps all languages you cannot not do any real work in the language without using 'libraries' that come with the language. For C# that is the .Net API.
Myself when I want to disable network access, which is not the same as internet access, I use Process to run the 'ipconfig' command with the '/release/' option. Of course it is a good idea to set it back up again.
|
|
|
|
|
ok friend
just try to give me a solution
i want to click button in my application to disable the network adapter , and other button to enable it
i want to control the network adapter
thanks
|
|
|
|
|
As I said....
Myself when I want to disable network access, which is not the same as internet access, I use Process to run the 'ipconfig' command with the '/release/' option. Of course it is a good idea to set it back up again.
The name of the class is 'Process'.
The commands are
ipconfig /release
ipconfig /renew
You should try those commands yourself before programing them.
|
|
|
|