|
It's time to lose the training wheels and convert yourself to C#. All of the same power, and more, without the verbosity.
Embrace the curly brace!
|
|
|
|
|
I belive internet is the best source.
|
|
|
|
|
I have this SQL Statement "SELECT vYear, EmpCode, VacType, DocNum, DocDate, DepCode, SecCode, vName, vStart, vEnd, vDays, LType, CUsrName, CDate, MUsrName, MDate, Result, Reson, EmpCode_Act, MngID
FROM NetVac
WHERE ('12/07/2022' BETWEEN vStart AND vEnd) AND (vYear = 2022) AND (EmpCode = 5229) AND (VacType <> 10) AND (VacType <> 15) AND (VacType <> 16) AND (VacType <> 17) AND (VacType <> 18) AND (VacType <> 19) AND
(VacType <> 20) AND (VacType <> 21) AND (VacType <> 23) AND (VacType <> 24) AND (Result <> 1) OR
(vYear = 2022) AND (EmpCode = 5229) AND (VacType <> 10) AND (VacType <> 15) AND (VacType <> 16) AND (VacType <> 17) AND (VacType <> 18) AND (VacType <> 19) AND (VacType <> 20) AND (VacType <> 21) AND
(VacType <> 23) AND (VacType <> 24) AND (Result <> 1) AND (CONVERT(DATETIME, '2022-07-13 00:00:00', 102) BETWEEN vStart AND vEnd)" and it work fine, i would like to do the same with EF but not using ADO or >,<
Can anybody help me
|
|
|
|
|
If you are using Entity Framework and you want to use BETWEEN, the standard way is to use => and<=.
|
|
|
|
|
I'd start by looking at what your SQL is trying to do and simplify it. From what I can see, your WHERE clause can be reduced to
vYear = 2022
AND EmpCode = 5229
AND NOT VacType IN (10, 15, 16, 17, 18, 19, 20, 21, 23, 24)
AND Result <> 1
AND ('12/07/2022' BETWEEN vStart AND vEnd
OR CONVERT(DATETIME, '2022-07-13 00:00:00', 102) BETWEEN vStart AND vEnd
)
I do not understand what the date ranges are for and why there are two different ways of representing dates unless your data has two sets of texts neither as real dates, in which case the comparisons are meaningless.
|
|
|
|
|
I would like to display numbers from a loop from 0 - 100 for multiples of 3 to display the number for multiples of 5 to display the number for multiples of 3 and 5 to display the number
|
|
|
|
|
|
Using asp.net I would like to display numbers from 1 to 100 for multiples of 3 display fizz for multiples of 5 display buzz for multiples of 3 and 5 display fizz buzz
|
|
|
|
|
|
Now that you're reposting the exact same non-question again, I take it you're going to fail the assignment now?
|
|
|
|
|
Hi,
I'm trying to make a document comparison viewer for web browser that feels as same as Microsoft word's 'Track Changes' and 'Compare' (options available in Review Tab).
I am already using Aspose.Words to convert every file type to docx and compare two files which gives me a redline copy merged into one single document. What i want to get is the resulting document(s) in a **side by side comparison** on UI. Also i want to give the ability to do the basic:
1. Get a summary of changes made and able to navigate as to where to changes are made in the document.(Scroll to the position of change in the document, just like Review Pane in MS word)
2. Accept and Reject those changes and download the revised document.
3. Able to compare text as well as non text related changes.
I've looked for many 3rd party tools but always end up in a limitation surrounding them, to list a few
1. GroupDocs.Comparison - Gives navigation and auto scroll but in a
merged document not in side by side view. Also, does not gives a document but a set of images.
2. Draftable - Compares only text and style, no image/tagged file
objection insertion or deletion. No option to accept or reject
changes
3. ipdf-net - No option to accept or reject changes.
4. PrizmDocs Document Compare API - No navigation to where the change is made in the document. Also no side by side comparison.
5. Litera Compare: No side by side comparison.
Where i could such 3rd party SDK that would help me achieve my objective or is there any was i could overcome the limitations i am getting from the tolls I've looked at ? The main concern is to have a navigation/mapping of change made to its position in the document and ability accept or reject those changes.
|
|
|
|
|
Don't post the same questions in multiple forums. Once is enough.
|
|
|
|
|
Hi
I am looking for some solution to call an API method inside another API. I am working on DotNet EF Core Web API project. I have implemented several Web APIs within the project....I can call some Web API Post method by defining data for the insertion....The data is inserted successfully in the respective table related to API. What I want to do is that after successful insertion of data , logging information is need to be added in some table related to other API in same project/solution.
The question is how can we pass data from first API to other to solve this ?
OR
How can we invoke Post method of other API from first API to do this?
Any Suggestion plz
Thanks
|
|
|
|
|
I would think logging of data transactions would be performed at the database level!
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Sorry, we need to do this at Web API level. The thing is that if some record is entered, updated or deleted using some API, another record needs to be added in some table using other API at the same time
Thanks
|
|
|
|
|
Wahaj Khan wrote: Sorry, we need to do this at Web API level That may not strictly be true though. You might think that you want to do this via Web API, but that is not the same as actually needing to do this via Web APIs.
The proposal here is not a good idea because you have introduced a transactional dependency into your API at this point. Suppose that the API that deletes the record happens successfully, and then calls the second API, which is down. What are you going to do at that point? Undelete the record?
If you are logging things happening at the database, let the database take care of the logging. Alternatively, you need to consider how to cope with failure conditions and look at techniques such as event passing, retry mechanisms, queues and the likes to see if they can help you in this situation.
Bottom line - your current design is borked if it's only relying on happy path scenarios.
|
|
|
|
|
Either create an instance of the controller class and call the action method directly, or have the API method pass the call through to another class which implements the logic, and call that from both.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Wahaj Khan wrote: The question is how can we pass data from first API to other to solve this ?
I can only suppose that you think that you are going to do this via the following
1. First API does just the main part of the functionality
2. That API exits (in some meaning of that word).
3. The log happens which invokes another API call.
Can you make that happen? Yes I believe so. It involves delving into some of the semantics of how it handles some of a Web call for you. For example you can intercept errors.
Should you do it? If there is only one method that needs this then no. Just do it in the same code that does the first functionaliy. If you want to do it with more than one API call, then start figuring out how the call flow is actually handled before it gets to your code and after it leaves your code. You should keep in mind that doing it this way ADDS complexity. That is because when something goes wrong it can interfere with stuff in unexpected ways (for example how you handle errors from the second call.)
|
|
|
|
|
Hello to all,
I'm developing a test console app that refers to an external dll, made with VS2022 and .net core 3.1.
Th console App should work on debian 10 and an arm processor.
I've installed all the netcore packages on debian, ad I've tested the "hello word" app in dotnet core.
Now I'm trying to create a "single file" .netcore console application that uses an external dll.
I've managed to have a "single file" application for the console app and a "single file" dll for the external library.
Every time I try to start the console app the system gives me the error:
A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/root/.net/SPLX/eY3MeD2sHDeSKgxGgVmzXD_NUUU2hdE=/].
If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET Core runtime can be found at:
- https:
Anyone knows how to solve this?
Thank you
|
|
|
|
|
I'm not sure whether this question is still relevant but it misses the most crucial piece: how does your project reference your library.
Anyways, the most convenient way of attaching external dependencies is Nuget package manager. You can learn more in official docs What is NuGet and what does it do? | Microsoft Docs[^]
|
|
|
|
|
i'm trying to update label named "timer" with values from my prank function
#pragma endregion
void prank()
{
Beep(1500, 200);
for(i=10;i>=0;i--)
{
Sleep(500);
this->timer->Text =i+"";
Beep(1500, 200);
}
}
private: System::Void joke_Load(System::Object ^ sender, System::EventArgs ^ e) {
TopMost = true;
backgroundWorker1->RunWorkerAsync(1);
}
private: System::Void button1_Click(System::Object ^ sender, System::EventArgs ^ e) {
joke^ nokno = gcnew joke();
nokno->Show();
}
private: System::Void label1_Click(System::Object ^ sender, System::EventArgs ^ e) {
}
public: System::Void backgroundWorker1_DoWork(System::Object ^ sender, System::ComponentModel::DoWorkEventArgs ^ e) {
prank();
}
public: System::Void backgroundWorker1_ProgressChanged(System::Object ^ sender, System::ComponentModel::DoWorkEventArgs ^ e)
{
this->timer->Text = i + "";
Beep(1500, 200);
}
private: System::Void start_Click(System::Object^ sender, System::EventArgs^ e) {
}
it's not supposed to be real timer or anything i just want it to happen in the background so i can make another actions.
the first Beep indicates for me that it starts but second one not really also i can't manage to use
backgroundWorker1_ProgressChanged
as you can see i have pitifully tried updating it ?traditional? way.
i'm learning to code by myself (also english so sorry ) and this is my first attempt to use background worker i could really use some suggestions and please keep them simple after all i'm simpleton?
modified 19-Apr-22 12:40pm.
|
|
|
|
|
Your prank function is running on a background thread, and cannot directly update any UI controls. When you try to set the timer's Text property, an exception will be thrown, but since you're not handing the RunWorkerCompleted event[^] to inspect the result, you never see it.
You need to call the BackgroundWorker.ReportProgress Method (System.ComponentModel) | Microsoft Docs[^] method to raise the ProgressChanged event on the UI thread to update the controls.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
public: System::Void joke_Load(System::Object^ sender, System::EventArgs^ e) {
bgwork->RunWorkerAsync();
}
public: System::Void labb_Click(System::Object^ sender, System::EventArgs^ e) {
Beep(2500, 100);
}
public: System::Void bgwork_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e)
{
for (i=10; i >=0; i--)
{
bgwork->ReportProgress(i);
Sleep(1000);
Beep(1500, 100);
}
e->Result =i;
}
public: System::Void bgwork_ProgressChanged(System::Object^ sender, System::ComponentModel::ProgressChangedEventArgs^ e)
{
this->faketimer->Text =e->ProgressPercentage.ToString()+"";
}
public: System::Void bgwork_RunWorkerCompleted(System::Object^ sender, System::ComponentModel::RunWorkerCompletedEventArgs^ e)
{
MessageBox::Show("ok", "ok", MessageBoxButtons::YesNo, MessageBoxIcon::Warning);
}
label "faketimer" still has default text
this piece with converting to string is something i saw in tutorial
i guess it will not work because my values are decrementing
|
|
|
|
|
|
yes i did , only left workerSupportsCancel to false because i don't really need this. I have abandoned that project couple days ago and now with another one i still have problem with the same thing
private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e) {
for (int day = 1; day <= 31; day++)
{
Beep(1500, 200);
Sleep(500);
backgroundWorker1->ReportProgress(day);
}
}
private: System::Void backgroundWorker1_ProgressChanged(System::Object^ sender, System::ComponentModel::ProgressChangedEventArgs^ e) {
progressBar1->Value += e->ProgressPercentage;
this->days->Text = (e->ProgressPercentage.ToString() + " day");
}
private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^ sender, System::ComponentModel::RunWorkerCompletedEventArgs^ e)
{
MessageBox::Show("next");
}
My backgroundWorker1->RunWorkerAsync(); is in form_load so it should start when i open it and still no success with this m*th*r******* label update.
There is also no beeping indicating this sh*t even works
Quote: I think i'm going to quit this sh*t start farming, somewhere nice with no internet access
|
|
|
|