Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

clemenslinders

@clemenslinders
About
Posts
11
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • MVC Core 3.1 I need to display multiple images (with transparency) on top of each other as 1 image
    C clemenslinders

    Hi Richard, Thanks for your effort. I currently have no development PC at my disposal. But it looks very easy and logical. I will give this a try asap and I expect no troubles. Kind regards, Clemens Linders

    ASP.NET asp-net question json architecture

  • MVC Core 3.1 I need to display multiple images (with transparency) on top of each other as 1 image
    C clemenslinders

    Hi Richard, Just how would I do this in CSS or SVG? Kind regards, Clemens Linders

    ASP.NET asp-net question json architecture

  • MVC Core 3.1 I need to display multiple images (with transparency) on top of each other as 1 image
    C clemenslinders

    LS, I need to display one image that is made up of multiple images with each a transparency. So image one has a bike on the left and the rest of the image is transparent and the second image has a car on the right (again the rest is transparent), then I would need to display one image with a bike on the left and a car on the right. How can I accomplish this in MVC Core 3.1? As the user can select the images that build the total image I cannot prebuild this image. Kind regards, Clemens Linders

    ASP.NET asp-net question json architecture

  • C# and ODATA CRUD communication with D365BC web service
    C clemenslinders

    Hi Richard, I am pretty sure that Json shouldn't be a problem, because when I read the data I use a Json deserializer. There really are three different kind of web services: - SOAP - ODATA v3 - ODATA v4 This is the working code I use to read data using the ODATA V4 web service:

            listBox1.Items.Clear();
            WorkersReadFromAlWebService = new List();
            string \_url = "https://api.businesscentral.dynamics.com/v2.0/SomeFunkyGuid/Sandbox/ODataV4/Company('CRONUS%20NL')/WorkersWebService";//CardPage
                       HttpWebRequest \_request = (HttpWebRequest)WebRequest.Create(\_url);
            \_request.ContentType = "application/json; charset=utf-8";
            \_request.Headers\["Authorization"\] = "Basic " + Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes("UserName:Password"));
            \_request.PreAuthenticate = true;
            HttpWebResponse \_response = \_request.GetResponse() as HttpWebResponse;
            using (Stream \_responseStream = \_response.GetResponseStream())
            {
                StreamReader \_reader = new StreamReader(\_responseStream, Encoding.UTF8);
                string \_content = \_reader.ReadToEnd();
    
                string \_jasonPart = GetJsonPartMultiRecord(\_content);
    
                List \_jWorkers = JsonConvert.DeserializeObject\>(\_jasonPart);
    
                foreach (var \_worker in \_jWorkers)
                {
                    WorkersReadFromAlWebService.Add(\_worker);
                    listBox1.Items.Add(\_worker.Last\_Name + " / " + \_worker.First\_name + " (No: " + \_worker.No + ")");
                }
            }
    
            ClearWorker();
    
    C# csharp database visual-studio winforms wcf

  • C# and ODATA CRUD communication with D365BC web service
    C clemenslinders

    Hi Richard, I changed the CreateWorkersAsync:

        static async Task CreateWorkerAsync(WorkersClass \_worker)
        {
            string \_url = "https://api.businesscentral.dynamics.com/v2.0/SomeFunkyGuid/Sandbox/ODataV4/Company('CRONUS%20NL')/WorkersWebService";//Card Page
            string \_userName = "UserName";
            string \_wsKey = "Password";
            byte\[\] \_authenticationParameter = Encoding.UTF8.GetBytes(\_userName + ":" + \_wsKey);
            \_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(\_authenticationParameter));
            HttpResponseMessage response = await \_client.PostAsJsonAsync(\_url, \_worker);
            response.EnsureSuccessStatusCode();
    
            // return URI of the created resource.
            return response.Headers.Location;
        }
    

    I didn't make any other changes. I now no longer get the error 401 Not Authorized. Now I get the error: 400 Bad request We're one step closer. Do you have any idea why I could get this Bad request?? Kind regards, Clemens Linders

    C# csharp database visual-studio winforms wcf

  • C# and ODATA CRUD communication with D365BC web service
    C clemenslinders

    Hi Richard, Thanks for your reply. If I used the code you profided me but I cannot pass 'data' to _client as it expects a class and not Json data. If I create a class and fill it, like in the MS Docs page you provided, than I get error 401 not authorized.

            WorkersClass \_data = new WorkersClass();
            \_data.E\_Tag = string.Empty;
            \_data.No = tbNo.Text;
            \_data.First\_name = tbFirstName.Text;
            \_data.Last\_Name = tbLastName.Text;
            \_data.FunctionName = tbFunctionName.Text;
    
            var url = await CreateWorkerAsync(\_data);
    
        static async Task CreateWorkerAsync(WorkersClass \_worker)
        {
            string \_url = "https://api.businesscentral.dynamics.com/v2.0/SomeFunkyGuid/Sandbox/ODataV4/Company('CRONUS%20NL')/WorkersWebService";//Card Page
            string \_userName = "UserName";
            string \_wsKey = "Password";
            \_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(\_userName, \_wsKey); 
            HttpResponseMessage response = await \_client.PostAsJsonAsync(\_url, \_worker);
            response.EnsureSuccessStatusCode();
    
            // return URI of the created resource.
            return response.Headers.Location;
        }
    

    I tried the following:

            var body = new
            {
                E\_Tag = string.Empty,     // Unique key
                No = tbNo.Text,
                First\_name = tbFirstName.Text,
                Last\_Name = tbLastName.Text,
                FunctionName = tbFunctionName.Text,
            };
    
    
            string json = JsonConvert.SerializeObject(body);
            byte\[\] data = Encoding.UTF8.GetBytes(json);
    
            var url = await CreateWorkerAsync(data);
    

    The error I get is: Argument 1: cannot convert from byte[] to WorkersClass. If I look at _client.PostAsJsonAsync, than I don't see a other solution where it says I can pass Json data? I feel that I am close, but I think I miss the final step. Hope you can help me. Kind regards, Clemens Linders

    C# csharp database visual-studio winforms wcf

  • C# and ODATA CRUD communication with D365BC web service
    C clemenslinders

    I have a problem where C# cannot Create/Update/Delete through an ODATA web service running from D365BC. PS I am using VS 2019, C# winforms. Our company is going to use Dynamics 365 Business Central (D365BC), which uses the programming language AL. AL is a nice language but some things we will simply prefer to do in C#. In D365BC you can easily create tables and pages (objects that consume these tables). And for each page you can create a web service by simply clicking a checkbox. These web service can be used to communicate via SOAP/ODATA v3 and ODATA v4. All are available at the same time. So creating a web service that allows communication with a table created in D365BC is fairly easy. If I use the SOAP webservice I can perform all CRUD functions. But when I use ODATA (either v3 or v4) I can read from the web service but I cannot Create/Update or Delete. The reason that we may occasionally want to use ODATA, is that ODATA is faster than SOAP. The code I have in D365BC: A simple table where every field is a record in a SQL table.

    table 50109 "Workers"
    {
    DataClassification = ToBeClassified;

    fields
    {
        field(1; "No."; Code\[20\])
        {
            DataClassification = ToBeClassified;
        }
    
        field(10; "First name"; Text\[50\])
        {
            DataClassification = ToBeClassified;
        }
    
        field(20; "Last Name"; Text\[50\])
        {
            DataClassification = ToBeClassified;
    
        }
    
        field(40; FunctionName; Text\[50\])
        {
            DataClassification = ToBeClassified;
    
        }
    }
    
    trigger OnInsert()
    var
        myInt: Integer;
    begin
    
    end;
    
    trigger OnModify()
    var
        myInt: Integer;
    begin
    
    end;
    
    trigger OnDelete()
    var
        myInt: Integer;
    begin
    
    end;
    

    }

    The card page that uses the table and has the ability to make a web service out of the used table.

    page 50108 "Workers Card"
    {
    PageType = Card;
    ApplicationArea = All;
    UsageCategory = Administration;
    SourceTable = Workers;

    layout
    {
        area(Content)
        {
            group(General)
            {
                field("No."; "No.")
                {
                    ApplicationArea = Basic;
                    Importance = Promoted;
                }
    
                field("First name"; "First name")
                {
                    ApplicationArea = Basic;
                }
    
    C# csharp database visual-studio winforms wcf

  • What is your C64?
    C clemenslinders

    Hi, My first computer was a Sharp computer with tape-drive, it was a cp/m machine. I quickly sold it to buy an IBM compatible PC. I was able to change the 8086 CPU (running at an incredible 4.77MHz) for a super fast Nec V20 CPU running at 8MHz. As a student I spend almost al the money I earned working in the weekends and holidays on this machine. I bought an EGA monitor with 16 colors!! (Yes 16, not 16 million) before that I had an amber colored display (It was so much more interesting to call it amber than orange). Than I bought my first (second hand) harddisk of an incredible 5Mb. It was the size of a shoe box and when you turned it on you could hear it slowly coming up to speed. It than made all kinds of clicking sounds before it would become idle. I think this process took about 30 seconds and I always had the feeling it would drain so much power that my mum would come up because the lights downstairs would dim. Of course this wasn't the case, but this harddrive made you feel as if it did. I bought it second hand for a couple of hundred US$ but when it was purchased new about 5 years earlier the first owner must have paid at least a couple of thousand dollars, they were very expansive in the beginning. The disk drive was 360Kb (and that was double sided). These disks would cost about 3 to 5 US$ a piece. And me and my friends would play Frogger or King's Quest. I also purchased an additional 8087 co-processor for super fast math and a special memory board to upgrade the memory to an astonashing 1Mb (640KB for MS-DOS than some 128Kb got lost and an additional 256Kb as a really super fast memory drive). Well I still had a lot of fun on with this machine and so did my friends. At my school, with some 600 students, I was the only one with a PC. Most kids had no computer and if they had a computer it would be a Commodore 64, Atari or Sinclair Spectrum. I really liked MS-DOS and my keyboard was so much larger than that of a Sinclair Spectrum.... I learned BASIC and let the computer draw by calculations some nice looking pictures on the screen (in two colors so either black or white). The EGA card had a resolution of 640 x 350 and before all these dots were calculated it took my computer about 10 minutes!!! Later on I started selling computers and started my own computer store and after that I started programming. So at the end I guess it was worth it. Kind regards, Clemens Linders

    The Lounge question hardware learning

  • Old floppies
    C clemenslinders

    Old floppies, that's been a while. When you succeed in reading your discs you should realize that there is a strong possibility that you get read errors. These floppies were not always very reliable. I once owned 5 computer stores and had a lot of experience with hardware, but I must say that I didn't know about the formatting issue. A few years ago someone who once was a customer from the old days visited me asking more or less the same question. I advised him to setup a Windows 95 or 98 machine. Make sure that the internet was accessible and email the rescued files to himself. Because being able to access your floppies does not mean you can access the data on them in Windows 10. You still need to get the content to your new machine. If you email the content that shouldn't be a problem. I also think that you will never get your USB floppy drive working on Windows 95/98. Windows 98 already had some USB functionality, but I don't think that you get that up and running because there was no plug and play (or should I say plug and pray) in those days. But you question did sent me back in time when I was a young lad and purchased floppies. One disc could hold multiple games like Frogger. Nowadays it is unthinkable that you can do anything with a medium as small as 360Kb/720Kb/1.2Mb/1.44Mb or last version 2.88Mb. PS one 360Kb disc cost about US$ 5 in those days. But in the time that I used the 360Kb discs I had a 5Mb harddrive. It was as big as a shoe box. It made a clicking sound when it started up. And you could hear the discs increase velocity and you more or less expected the lights to dim because of the power usage and sound it made (which of course it didn't). Well that was totally besides the point, just a walk down memory lane. I hope you find a solution. If you live in The Netherlands I can borrow you a mainboard/floppy-drives/Windows CD, but I assume that you live in the states. But also where you live there must be some people that still have some 'old junk' from the past. Kind regards, Clemens Linders

    The Lounge question help

  • What C# tools do you recommend?
    C clemenslinders

    LS, I converted a few VB6 programs to C# and some more from VB.NET. When I joined the firm that I am currently working for they had a bunch of VB6 and VB.Net software and they wanted this translated to C# asap. Ofcourse the best way is to start all over, but that was not an option my boss wanted (and he is the boss so he decides). So I used VS2008 (it has a wizard for this) to translate VB6 into VB.NET.(Google will tell you how, but it is pretty straight forward). And for the VB.NET programs I used SharpDevelop 4.4 (make sure to use this version and NOT a newer version, because for some reason the took the convert option out). SharpDeveloper 4.4 (I am sure using google you can find this free software) has an option to convert VB.Net to C#. Load the VB.NET solution in SharpDevelop. Right click the solution and click Convert => C# (it has other convert options as well). You will find that is not perfect. A lot of times you will need to replace brackets like ( with [. Strings in VB.Net start counting from 1 in C# this is 0 (if you didn't use VS2008's wizard to convert from VB6 to VB.Net than you need to keep this in mind). You will need to create new screens (you can select everything and copy this to a new screen) and than make sure that the code is bound to this screen. You will also need to select for instance your buttons and select the correct click event to the click event of this button. Than when you compile there will be some references to some VB.NET stuff that cause an error which you will need to remove. Start with a simple project. If need be create a helloworld in VB6 and convert thus. I used these options to convert about 15 projects to C# and it saved us a lot of time. You will get the hang of it as to where you will need to make changes, in most cases it is the same kind of stuff that goes wrong. You will also find that VB.NET is a lot more forgiving than C#. When you work with a database and retrieve info, there will not be a conversion to string. And when you use this method you will sonn find out that you need to go through the code and add '.ToString()' when you collect info from a database. There are function in VB that have no counterpart in C# (if I am not mistaken Mid or MidStr is such a function). SharpDevelop will add some DLL so that you can still use these functions. As the majority of the applications already was in VB.Net I am not sure if there are many functions in VB6 that do not have a counterpart in VB.Net. I do not think it will be that m

    The Lounge csharp tools help question

  • updating an SQL table in C#
    C clemenslinders

    Hi I'm using some DevExpress components in C#. Using sqlConnection, sqlDataAdapter, dataSet, gridControl (a Datagrid) and controlNavigator (to choose insert record, edit record etc.). When I make my program I can see all the data in the table. Using the controlNavigator I can add records, delete them etc. I use Microsoft SQL server 2000. I understand that my program loads a local copy of the database and at the end I have to let the program know that the real table now needs to be updated. I made a button under which I can test some commands. I tried sqlDataAdapter1.Update(dataset11) and sqlDataAdapter1.Update(DataSet11,"films") (where films is the name of the table) also I tried dataSet11.acceptchanges(). No matter what I try each time when I quit the program and restart the program my table is empty. What do I need to do to effectivly change/update the real table?? I would like a solution where I can input/change data in the datagrid using the controlNavigator and then by adding somewhere some extra code make the changes permanent. I hope someone can help Kind regards, Clem

    Database database csharp sql-server sysadmin help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups