|
For a start your table structure is incorrect. Toxidrome with an ID and name is correct but your selected antidote should only store the ID and REFERENCE the toxidrome table to get the name.
You need to work with the ID's not the text of the name.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Thanks for the feed back, but this is my first project and I an having to lean along the way. this is all new to me. I have had to piece together what I can from YouTube vids and web searches. Can you elaborate a little more for me please.
Thanks
|
|
|
|
|
You have 2 major areas to learn about (each takes substantial time and effort to get the basics of) c# and database design. I suggest you get a couple of books and work your way through them, The way you are going about it is probably the worst method of learning this stuff, youtube and web searches are going to take you down a range of wrong paths.
If your goal is only to get the excel converted to an application then I highly recommend you get a professional to do the job, attempting to do it without a reasonable level of skill will only lead to years of angst (and lousy business practices).
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Hi I’m a newbie, 50 with a bad memory, so pls be toleraterant
I want my web app to allow a user, within a view, to navigate to a file of a document they scanned with a pc, then give it a guid and copy it to a new served location. How would I go about this? Would it be done in js? How about the guids? Would the view model carry some ready for use by the view/js? Or would you do it another way?
|
|
|
|
|
You definitely can't do it in C# - that runs on the Server, not the Client, so any file system interaction involves the server file system, not the client scanned data.
Having said that, you can't do it in JS either, as the browser has no access to client files systems either for security reasons!
What you would have to do is have the user upload the file to the server, then your C# renames the file, saves it locally, and if necessary sends the GUID back to the client so he can manually rename the file.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Ok, the pc is the server (IIS), but there are several pcs in the office all of which navigate the IIS on one of them. So, i want the user to navigate to the file they just scaned onto a network location (perhaps this should be a network attached NAS)
|
|
|
|
|
I'm not sure you can do that either: you can link to a remote file and open it in the browser just with an href:
<a href="file:\\192.168.0.11\Images\MyImage.jpg">Click here</a> and provided the user has permissions set for the NAS it'll open the image in the browser. (My NASes are SBM1, which Windows 10 doesn't like any more, so I have to use IP addresses instead of the server name).
But that won't open an external application for security reasons - the user would have to download the file and then open it themselves.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
That won't work; if the web page is served via http: or https: , it can't link to a file: URI.
The user would have to right-click the link, copy the URL, open a new tab, and paste the URL into it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
C**k!
You're right, of course - it works fine as local HTML, but won't work when served from IIS ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Maybe I need to explain better what I envisioned. User finds location of the pdf they just scanned in to a local network accessible location using a file finding dialogue. The path to that pdf is posted back to the controller. The post method then finds the file, copies it and then saves it with a guid in another more secure location.
|
|
|
|
|
Lmm Cams wrote: The post method then finds the file Just use a FileUpload control instead. Let the user pick what file to upload.
|
|
|
|
|
I have a DataTable as below:
Untitled — ImgBB[^]
For rows which have the same ID and Department if there were not at least a row that its planed end date and end date (C3 and C4) is the same, detect that ID and Department as inconsistent.
For example, for the given table, the answer should be like this:
3 — ImgBB[^]
Please guide me. I need an urgent help.
modified 7-Apr-21 13:46pm.
|
|
|
|
|
We can use Join() method to join columns 1,2 and 3 as keys and set column 4 as values of a dictionary.
Dictionary has ContainKeys() method which can be used to detect the same keys. If ContainKeys() method returned true, then check if Columns 3 and 4 are the same.
I cannot translate this idea into C# code. Maybe it's not correct.
Please help me.
Thanks
modified 7-Apr-21 14:34pm.
|
|
|
|
|
Do you have access to the source data? If so, you can do this within the sql.
For example:
SELECT id, department
FROM table
GROUP BY id, department, planned_end_date, end_date
HAVING COUNT(*) > 1
This will give you a list of id and department where there are at least 2 rows where dates do not match up.
|
|
|
|
|
No, I don't use SQL server. I retrieve my data from an Excel file. Actually I'm using DevExpress tools.
|
|
|
|
|
Finally, I found my own solution:
IWorkbook workbook = spreadsheetControl.Document;
Worksheet worksheet = workbook.Worksheets["DataSet1"];
CellRange range = worksheet.GetDataRange();
int LastRow = range.BottomRowIndex;
var detected_rows = new List<string>();
var mydic1 = new Dictionary<string, string>();
var keys1 = new List<string>();
var keys2 = new List<string>();
var keys3 = new List<string>();
var my_table4 = new DataTable();
for (int i = 1; i < LastRow + 1; i++)
{
if (worksheet.Cells[i, 10].DisplayText == "خاتمه یافته")
{
keys1.Add(string.Join(",", worksheet.Cells[i, 4].DisplayText, worksheet.Cells[i, 14].DisplayText, worksheet.Cells[i, 19].DisplayText));
keys2.Add(string.Join(",", worksheet.Cells[i, 26].DisplayText));
keys3.Add(string.Join(",", worksheet.Cells[i, 28].DisplayText));
}
}
for (int i = 0; i < keys1.Count; i++)
{
if (keys2[i] == keys3[i])
{
detected_rows.Add(keys1[i]);
}
}
for (int i = 0; i < keys1.Count; i++)
{
if (!mydic1.ContainsKey(keys1[i]))
{
mydic1.Add(keys1[i], keys2[i]);
}
}
for (int i = 0; i < detected_rows.Count; i++)
{
mydic1.Remove(detected_rows[i]);
}
List<string> my_keys = new List<string>(mydic1.Keys);
my_table4.Columns.Add("شماره دستورکار");
my_table4.Columns.Add("مرکز هزینه");
my_table4.Columns.Add("سال");
for (int i = 0; i < my_keys.Count; i++)
{
string text = my_keys[i];
string[] my_list = text.Split(',');
my_table4.Rows.Add(my_list[0], my_list[1], my_list[2]);
}
spreadsheetControl.Invoke((MethodInvoker)delegate { CreateSheet("Error Detection"); });
spreadsheetControl.Invoke((MethodInvoker)delegate { ClearSheet("Error Detection"); });
spreadsheetControl.Invoke((MethodInvoker)delegate { Filldata("Error Detection", my_table4, 0, 0, true); });
|
|
|
|
|
What is the fastest way of knowing whether an integer is odd or even?
|
|
|
|
|
|
Won't compile in C#!
if ((number & 0x01) == 1)
{
...
[edit] nor would my original ... precedence rulezz[/edit]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I still tend to think in C.
|
|
|
|
|
No worries, the principle still stands
|
|
|
|
|
|
|
I thought so - sometime I'll have to look at the IL to see why ...
But if you are looking for some real micro optimizations, this may be of use: Writing IL code on Visual Studio[^]
I haven't used it but it looks interesting, and I still believe that a human can produce better machine code than a compiler!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
No, that's wrong. It's a classic case of "measuring time but not looking at what the time was measured of".
The best the remainder solution can hope for, is that the JIT compiler recognizes it and turns it into the equivalent of the bitwise-AND solution, which happens for uint but not int . So at best it is the exact same code running, any differences observed in timing are just timing noise. And sometimes (eg for int ), it's just straight up worse to use the remainder instead of bitwise AND.
|
|
|
|