|
Kevin Marois wrote: What's the best way to notify the front end of a business rule or possible FK
violation?
Normally the front end should prevent business flows that allow that in the first place.
So if it does occur then an exception is acceptable.
Kevin Marois wrote: Throwing an exception doesn't seem right
For the most part is it exactly correct. The FK exists to represent a relationship that must always exist. For that failure to occur it means either a programming bug or a work flow problem. Either represents an 'exceptional' situation and thus an exception is in fact entirely appropriate.
In some cases, mostly where the front end might be less stringent then it might be the back ends responsibility to validate for errors. Reporting errors can have variety of solutions but it is something that the layer, not one specific method, should already have an idiom for dealing with. And exceptions are a possible solution although generally it would not be a generic exception but rather a layer specific one.
|
|
|
|
|
The module should be a windows application, made using visual
studio.There are two parts one for client side and the other for
server side.
Client side: client side part should detect the drive which is plugged
in. The details of the drive and the time for which it was plugged in
should be stored in database of server.
Server side: server side part contains a GUI in which all the IP
addresses of all the systems in the network are given in a list and
whenever an IP address is selected the log of all the drives plugged
in is retrieved from the database. ( for IP addresses there must be IP
detection system inbuilt in the module of server side which will store
the info of all systems in database.)
Please help me out. I don't have much time to submit this module.
Thankyou.
|
|
|
|
|
Shibbi wrote: Please help me out
Help you with what exactly? This is just a specification for the work you are supposed to be doing. Just because you have left it until the last minute to get started does not mean that someone else has to do it for you.
|
|
|
|
|
The module should be a windows application, made using visual
studio.There are two parts one for client side and the other for
server side.
Client side: client side part should detect the drive which is plugged
in. The details of the drive and the time for which it was plugged in
should be stored in database of server.
Server side: server side part contains a GUI in which all the IP
addresses of all the systems in the network are given in a list and
whenever an IP address is selected the log of all the drives plugged
in is retrieved from the database. ( for IP addresses there must be IP
detection system inbuilt in the module of server side which will store
the info of all systems in database.)
Please help me out. I don't have much time to submit this module.
Thankyou.
|
|
|
|
|
Hi To all
I am working on an auctioning system that i am developing with C# .NET 4.0. These auctioneers usually have outside auctions which are carried outside (where it would unreasonable to set up a computer network). The bidding's are recorded on paper and then saved onto the database from the papers.
What I want to do is this, I want each auctioneer to have their own handheld mobile computer like the ones offered by cipher labs (http://us.cipherlab.com/catalog.asp?CatID=7&SubcatID=2). The auctioneer will record each bidding on that mobile computer (these recordings should be saved as text file) so when they decide to upload the the bidding these files will be read by a separate module (developed by me) that will then read the file and save to the data to a database.
So can you assist me with devices and libraries that are compatible with such functions and that will help me achieve this feature that i would like to incorporate into my system
|
|
|
|
|
I think you might be starting with the wrong technology. Those hand held computers are primarily designed for reading bar codes and RF information.
What kind of auction do you envision? Something where the auctioneer posts and item and people bid out loud for it? Silent auction? Internet auction?
Obviously, the vocal bids could be pretty fast paced and difficult to record with something like this. You would be far better off with a tablet solution using Windows, Android or iOS.
I am not sure how much room you have to work with the solution you have above. I would definitely start off with an easier platform. I am sure that a small tablet is every bit as affordable and more technically open to work with.
Barring that, it does not look to me like this mobile computer works on the .NET platform, but rather plain C or BASIC.
|
|
|
|
|
hi guyz, i'm, having a problem. i've created a c# application. i want to package it and create a setup for it. the application is a database driven app but when i tried creating the setup, it installed on my own pc(the pc i use to develop it) but the setup does not install on any other computer. please how can i go about this.... thankz......
|
|
|
|
|
Well not being both telepathic and having a touch of magic I cannot read your thoughts to identify the error and cannot see the process and where it fails on any other machine.
A little LOT more detail is going to be required to trouble shoot that problem.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
@mycroft holmes, in short, i want to create a setup for an app that uses sqldatabaseCE(sql compact) as its database, how i'm gonna go about this.....
McLux
|
|
|
|
|
You need some Google foo[^] there is no in short about this issue, work through the examples.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi everybody,
I am making a simple tool to synchronize data from csv files to SQL Server Database.
My SCADA Signal transfer data through csv files (3 SCADA signals --> 3 csv files) and datas will be transfered 1time/1day.
And I will make a simple tool, read csv files and import to SQL Server Database.
My issues are:
1. I have no ideas how to handle the csv files when they were transfered back with diffirent names.
2. How to set time to synchronize (1time/1day).
3. Can I make a windows service to synchronize?
Please help me.
If you have the user interface for issue 1, please give me!
Thank you very much
|
|
|
|
|
|
I would use SQL Server Integration Service (SSIS) to do this using a scheduled job. All the infrastructure is already there, file handling, import and write to the database, job scheduling and logging can all be found in SSIS.
The only issue would be getting the files from your SCADA to a folder that SQL Server can see and you could use a mapped drive for that!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am using a Transaction by the following syntax for opening transactions
using(TransactionScope scope = new TransactionScope())
{
...
scope.Complete();
}
That's fine so far, but what I don't know is, if I have to explicity need to set the Transaction in the Command/Connection Object or if this is done implicity
My second question would be, if it is not done explicity: I actually create an Instance of another class within the TransactionScope where I do all the database operations, is there a way to access the open Transaction without passing the scope variable as a method parameter?
|
|
|
|
|
Dominik wrote: if I have to explicity need to set the Transaction in the Command/Connection Object or if this is done implicity Cannot be done implicit; what if you had two transactions? Which should be assigned?
The transaction is assigned to the IDbCommand object.
Dominik wrote: My second question would be, if it is not done explicity: I actually create an Instance of another class within the TransactionScope where I do all the database operations, is there a way to access the open Transaction without passing the scope variable as a method parameter? You'll have to pass it as a parameter.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I actually found out, that can access the Transaction by using Transaction.Current Property
The connections within a scope actually automatically asign the transaction
|
|
|
|
|
Hi
I have a loop that scan a list for missing dates in the first column, and then add those dates to complete the list. But in the second column I have values (close values for stocks), and I would like this code to add yesterdays value, typically Fridays value to Saturday and then Saturdays value to Sunday....
Does anyone know how to do this?
Here's the loop section in my code:
var DTsNotInTable = dts.Except(dt.Rows.Cast<DataRow>().Select(row1 => (DateTime)row1["date"]));
foreach (DateTime dateTime in DTsNotInTable)
dt.Rows.Add(dateTime, close[0]);
var ordered = dt.Rows.Cast<DataRow>().OrderBy(row1 => (DateTime)row1["date"]);
Kind regards
Espen
|
|
|
|
|
lordoftrades wrote: Does anyone know how to do this? I'd loop through the list in the database by selecting all id's. Keep the last "read" value, and if the current version is empty, insert that.
I'd recommend against using a DataTable and LINQ. You'd be changing the values in the in-memory datatable, and would still have to execute the SQL-queries to sync the data on disc.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks Eddy, I do not have much experience in programming in C#, so I'm on thin ice here. But I do not have any SQL related to this. The case is that I'm importing a file from Yahoo Finance, it's a stock, where I have set start-date and end-date.
My problem is that I also need to fill in all the missing days, like holidays and weekends etc. And I need to "copy" the last recorded value to the missing days that follows.
As for now I've just added "0" to those, because I should be able to create a formula later on that will detect this, but it would be much more clean if I could add quotes instead of just a zero.
This is my code (I guess it's pretty messy...):
public override void OnShutdown()
{
string[] row = new string[7];
double Close;
string currentLine;
var dates_in_IQB = new List<DateTime>();
int i = 0;
DateTime endDate =new DateTime(DateTimeEnd());
DateTime startDate = new DateTime (DateTimeStart());
for (var x = startDate; x <= endDate; x = x.AddDays(1)){
i = i + 1;
dates_in_IQB.Add(x);
double equity = AccountHistoryEquity(0, i);
OutputWriteLine(String.Format("Date {0}, Equity {1}",x ,equity));
if(Directory.Exists(_filePath)){
string lines = String.Format("{0}, {1}", x, equity);
file.WriteLine(lines, i);
file.Close();
}
}
}
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("date", typeof(DateTime)));
dt.Columns.Add(new DataColumn("close", typeof(double)));
string theURL = @"http://ichart.finance.yahoo.com/table.csv?s=msft"
+ @"&a=" + (startDate.Month - 1).ToString()
+ @"&b=" + startDate.Day.ToString()
+ @"&c=" + startDate.Year.ToString()
+ @"&d=" + (endDate.Month - 1).ToString()
+ @"&e=" + endDate.Day.ToString()
+ @"&f=" + endDate.Year.ToString()
+ @"&g=d&ignore=.csv";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(theURL);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
StringBuilder sb = new StringBuilder();
byte[] buf = new byte[8192];
string tempString = null;
int count = 0;
do
{
count = resStream.Read(buf, 0, buf.Length);
if (count != 0)
{
tempString = Encoding.ASCII.GetString(buf, 0, count);
sb.Append(tempString);
}
}
while (count > 0);
string data = sb.ToString();
String[] data2 = data.Split('\n');
int iteration = 0;
double[] open;
double[] high;
double[] low;
double[] close;
double[] volume;
double[] adjClose;
DateTime[] dates = new DateTime[data2.Length - 2];
open = new double[data2.Length - 2];
high = new double[data2.Length - 2];
low = new double[data2.Length - 2];
close = new double[data2.Length - 2];
volume = new double[data2.Length - 2];
adjClose = new double[data2.Length - 2];
foreach (string strLine in data2)
{
String[] entries = strLine.Split(',');
if ((iteration != 0) && (entries[0] != ""))
{
dates[iteration - 1] = System.Convert.ToDateTime(entries[0]);
open[iteration - 1] = System.Convert.ToDouble(entries[1]);
high[iteration - 1] = System.Convert.ToDouble(entries[2]);
low[iteration - 1] = System.Convert.ToDouble(entries[3]);
close[iteration - 1] = System.Convert.ToDouble(entries[4]);
volume[iteration - 1] = System.Convert.ToDouble(entries[5]);
adjClose[iteration - 1] = System.Convert.ToDouble(entries[6]);
dt.Rows.Add(new object[] {dates[iteration - 1], close[iteration - 1]});
}
iteration = iteration + 1;
}
DateTime minDT = dt.Rows.Cast<DataRow>().Min(row1 => (DateTime)row1["date"]);
DateTime maxDT = dt.Rows.Cast<DataRow>().Max(row1 => (DateTime)row1["date"]);
List<DateTime> dts = new List<DateTime>();
DateTime DT = minDT;
while (DT <= maxDT)
{
dts.Add(DT);
DT = DT.AddDays(1);
}
var DTsNotInTable = dts.Except(dt.Rows.Cast<DataRow>().Select(row1 => (DateTime)row1["date"]));
foreach (DateTime dateTime in DTsNotInTable)
dt.Rows.Add(dateTime, 0);
var ordered = dt.Rows.Cast<DataRow>().OrderBy(row1 => (DateTime)row1["date"]);
DataTable dt2 = ordered.CopyToDataTable();
foreach (DataRow row1 in dt2.Rows)
{
OutputWriteLine(String.Join(",", row1.ItemArray));
string lines = (String.Join(",", row1.ItemArray));
System.IO.StreamWriter file = new System.IO.StreamWriter(_filePath +"\\ref1.txt", true);{
file.WriteLine(lines);
file.Close();
}
}
}
Kind regards
Espen
|
|
|
|
|
lordoftrades wrote: This is my code (I guess it's pretty messy...): It looks more complicated than it needs to be; partly because it's a single method. Divide it in two separate steps;
public override void OnShutdown()
{
FetchCsvFile();
ProcessFile();
}
void FetchCsvFile()
{
}
void ProcessFile()
{
}
Once you have the CSV as a textfile, it be easy to ReadAllLines[^], without the need to split it at each line-ending. You could loop the result directly.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks Eddy, I'll try to implement this code in the weekend.
Kind regards
Espen
|
|
|
|
|
I do know that there is a way to get the LPARAM value of the usb device when the WndProc detects the usb device change (arrival or removal). The question is... is there a way to get the LPARAM value of the device when you turn on the software (with the usb device already plugged in and powered up)?
|
|
|
|
|
LPARAM is a C/C++ type defined & used by Windows for passing values with messages, it has nothing to do with USB devices. Also, does you question relate in any way to C#?
Use the best guess
|
|
|
|
|
yes. I'm overriding WndProc method to catch unplugging & plugging of the usb device. However is that the LParam is acquired in this WndProc process. When the software launches, the LParam for each device isn't acquired.
Also I was thinking of the other way around to get that is by restarting the usb devices at startup to trigger "unplugging" and acquire LParam. Unsure of the way to do this either.
|
|
|
|
|
Another guessing game! I have no idea what message you are trying to process, nor what values you should be receiving when the device changes status. And as I said before, devices have no concept of LPARAM .
Use the best guess
|
|
|
|