Commit 365b21d2 authored by Deepak Kumar S's avatar Deepak Kumar S

Initial Master Commit

parents
# Created by https://www.toptal.com/developers/gitignore/api/dotnetcore,visualstudio,windows
# Edit at https://www.toptal.com/developers/gitignore?templates=dotnetcore,visualstudio,windows
### DotnetCore ###
# .NET Core build folders
bin/
obj/
# Common node modules locations
/node_modules
/wwwroot/node_modules
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
# JetBrains Rider
*.sln.iml
### VisualStudio Patch ###
# Additional files built by Visual Studio
# End of https://www.toptal.com/developers/gitignore/api/dotnetcore,visualstudio,windows
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ExcelDataReader" Version="2.1.2.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
</ItemGroup>
</Project>
\ No newline at end of file
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Text;
namespace ASMSupportCenter.Common
{
internal class ApiService
{
private static readonly HttpClient client = new HttpClient();
public class ApiResponse
{
public string Id { get; set; }
public string Status { get; set; }
public object Response { get; set; }
public object Error { get; set; }
public Message[] Messages { get; set; }
public Exception Exception { get; set; }
public int Count { get; set; }
public object Validations { get; set; }
}
public class Message
{
public string Type { get; set; }
public string MessageDesc { get; set; }
}
public ApiResponse CommonApiCallWithAPIKeyAsync(string url, string jsonData, string token = null)
{
// Add headers
client.DefaultRequestHeaders.Clear();
//client.DefaultRequestHeaders.Add("x-api-key", "XDv+RXu/EcmsrBg0mAbbjSa8QZyiyXICre5NNQH6FuVhUDHhoYGg0VHQ27doIkYXQv/RgTst/ESG+qYd71XtdjwrFZCCxQxNO0DsP3fv/26qh76WXDaYHGB7cS8syXKI+dQxgkX24UsVKFOixFrYxW11pMXGl3/2qKYJa/UK4ws1yAZ45F0WX3gzQcomd4liNI9Q+ny2xg8atNAp70yS7DzyBonz6CU+PXKy5VuqnE7mTVLjGYWryZ0tyehF9gtPTrsI3rQtv9cWFPXfiAdVoeLS60ZbR9u8AQUQh0u95CFBd5VjUW0t4RvV+W7ZTusdtF0voQw+O2sdHTZdStfG9dbwj3Ys7QAKNCaGVZ3JGIhftNeYKoKpknPwdMe0MQmtXe4bhGbSX1JH71tY/jm9MdMWgiC4WFyaWprY4aFrXC+9mMIuBEw6Kq0BKohe7Ncqz7PAuENw8iU94ME8ZPnfFGA6M4EsZiWheNi9FVdPZN0=");
//client.DefaultRequestHeaders.Add("HostName", "aws.gateway");
if (token == null && String.IsNullOrEmpty(token))
{
token = GetBarrierTokenUsingServiceKey();
}
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", token);
// Create the request content
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
try
{
// Send POST request
HttpResponseMessage response = client.PostAsync(url, content).Result;
// Ensure response is successful
response.EnsureSuccessStatusCode();
// Read response content
string responseBody = response.Content.ReadAsStringAsync().Result;
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(responseBody);
return apiResponse;
}
catch (HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
return null;
}
}
public string GetTokenAsync(string username, string password)
{
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
{
username = "sdeepakkumar@20cube.com";
password = "Cube@1234";
}
var requestUri = "https://sitauth.myhub.plus/token";
var requestBody = $"grant_type=password&username={username}&password={password}&ExternalURL=sittc.myhub.plus&TimeZone=-330";
var content = new StringContent(requestBody, Encoding.UTF8, "application/json");
// Add headers to the request
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add("accept", "application/json, text/plain, */*");
client.DefaultRequestHeaders.Add("accept-language", "en-US,en;q=0.9");
client.DefaultRequestHeaders.Add("origin", "https://sit.myhub.plus");
client.DefaultRequestHeaders.Add("priority", "u=1, i");
client.DefaultRequestHeaders.Add("referer", "https://sit.myhub.plus/");
client.DefaultRequestHeaders.Add("sec-ch-ua", "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"Google Chrome\";v=\"128\"");
client.DefaultRequestHeaders.Add("sec-ch-ua-mobile", "?0");
client.DefaultRequestHeaders.Add("sec-ch-ua-platform", "\"Windows\"");
client.DefaultRequestHeaders.Add("sec-fetch-dest", "empty");
client.DefaultRequestHeaders.Add("sec-fetch-mode", "cors");
client.DefaultRequestHeaders.Add("sec-fetch-site", "same-site");
client.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36");
try
{
// Send POST request
HttpResponseMessage response = client.PostAsync(requestUri, content).Result;
// Ensure the request was successful
response.EnsureSuccessStatusCode();
// Read the response as a string
string responseData = response.Content.ReadAsStringAsync().Result;
// Parse the JSON response to get the token
var jsonResponse = JObject.Parse(responseData);
string token = jsonResponse["token_type"]?.ToString() + " " + jsonResponse["access_token"]?.ToString();
return token;
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
return null;
}
}
public string GetBarrierTokenUsingServiceKey()
{
string barrierToken = string.Empty;
using HttpClient client = new();
string json = JsonConvert.SerializeObject(new
{
ServeKey = Constants.Tokens.eaxisSeriveKey
});
StringContent content = new(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = client.PostAsync(Constants.Urls.eaxisAuth, content).Result;
_ = response.EnsureSuccessStatusCode();
string responseString = response.Content.ReadAsStringAsync().Result;
JObject jsonObj = JObject.Parse(responseString);
if (jsonObj != null && jsonObj["Status"]?.ToString() == "Success")
{
barrierToken = jsonObj["Response"]?["AuthToken"]?.ToString();
}
return barrierToken;
}
}
}
using System.Windows.Forms;
using static ASMSupportCenter.Common.ApiService;
namespace ASMSupportCenter.Common
{
internal class CommonMethods
{
public void PopulateDataGridView(DataGridView gridView, ApiResponse apiResponse)
{
gridView.AutoGenerateColumns = false;
// Add columns to DataGridView
if (!gridView.Columns.Contains("Id"))
gridView.Columns.Add("Id", "Id");
if (!gridView.Columns.Contains("Status"))
gridView.Columns.Add("Status", "Status");
if (!gridView.Columns.Contains("Response"))
gridView.Columns.Add("Response", "Response");
if (!gridView.Columns.Contains("Error"))
gridView.Columns.Add("Error", "Error");
if (!gridView.Columns.Contains("Count"))
gridView.Columns.Add("Count", "Count");
if (!gridView.Columns.Contains("Validations"))
gridView.Columns.Add("Validations", "Validations");
if (!gridView.Columns.Contains("Messages"))
gridView.Columns.Add("Messages", "Messages");
if (!gridView.Columns.Contains("Exception"))
gridView.Columns.Add("Exception", "Exception");
// Add a row to DataGridView with the values from the ApiResponse object
gridView.Rows.Add(
apiResponse.Id,
apiResponse.Status,
apiResponse.Response != null ? apiResponse.Response.ToString() : "",
apiResponse.Error != null ? apiResponse.Error.ToString() : "",
apiResponse.Count,
apiResponse.Validations != null ? apiResponse.Validations.ToString() : "",
apiResponse.Messages != null ? string.Join(", ", apiResponse.Messages.Select(m => m.MessageDesc)) : "",
apiResponse.Exception != null ? apiResponse.Exception.Message : ""
);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ASMSupportCenter.Common
{
public static class Constants
{
public static class Tokens
{
public const string intSeriveKey = "Cm1UWWQld6jRvNGUSMb6IK5GKTIC/j6GYhZq9ym+SANV/KykrGG/7huI0tnwdXkzIx5YMkoN+Cd2zXXCtrtYPz9byDr7UdWHRihCVGZkGPU=";
public const string eaxisSeriveKey = "nMyBHUuKIL6QlZ0ijiP1wOy/nCWeJhPvLkmpNnxuKoc8MH2QH/u80YwbyzUpUCXhNB8/+q1w0rgu/xktQyN/1y6XQtlLek2yDOQPFycEwsM=";
}
public static class Urls
{
//Host
public const string hostName = "https://siteaxis.myhub.plus";
//Auth Apis
public const string intAuth = "https://sitihubauth.myhub.plus/Token/ServiceAccount";
public const string eaxisAuth = "https://sitauth.myhub.plus/Token/ServiceAccount";
//Eaxis Apis
public const string wmsConFindAll = "https://siteaxis.myhub.plus/TmsConsignment/FindAll";
public const string wmsConSelectedUpdate = "https://siteaxis.myhub.plus/TmsConsignment/SelectedUpdate";
public const string wmsConSelectedUpdateWithOutGetMany = "https://siteaxis.myhub.plus/TmsConsignment/SelectedUpdateWithOutGetMany";
//FX Apis
public const string orgInsert = "https://sitfx.myhub.plus/Org/Insert";
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ASMSupportCenter.ConsigneeBulkUpload
{
public class Consignee
{
public string ConsigneeName { get; set; }
public string Address { get; set; }
public string State { get; set; }
public string City { get; set; }
public string PostCode { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
public string ConsigneeCode { get; set; }
public string LocalPort { get; set; }
public string LocalPortDesc { get; set; }
public string StateCode { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string Language { get; set; }
}
}
namespace ASMSupportCenter.ConsigneeBulkUpload
{
partial class ConsigneeBulkUpload
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
button1 = new Button();
dataGridView1 = new DataGridView();
button2 = new Button();
textBox1 = new TextBox();
dataGridView2 = new DataGridView();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridView2).BeginInit();
SuspendLayout();
//
// button1
//
button1.Location = new Point(12, 12);
button1.Name = "button1";
button1.Size = new Size(167, 34);
button1.TabIndex = 0;
button1.Text = "Please Select The File";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Location = new Point(12, 52);
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowTemplate.Height = 25;
dataGridView1.Size = new Size(800, 400);
dataGridView1.TabIndex = 1;
//
// button2
//
button2.Location = new Point(185, 12);
button2.Name = "button2";
button2.Size = new Size(75, 34);
button2.TabIndex = 2;
button2.Text = "Post";
button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click;
//
// textBox1
//
textBox1.Location = new Point(12, 458);
textBox1.Multiline = true;
textBox1.Name = "textBox1";
textBox1.Size = new Size(1300, 200);
textBox1.TabIndex = 3;
//
// dataGridView2
//
dataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView2.Location = new Point(818, 52);
dataGridView2.Name = "dataGridView2";
dataGridView2.RowTemplate.Height = 25;
dataGridView2.Size = new Size(500, 400);
dataGridView2.TabIndex = 4;
//
// ConsigneeBulkUpload
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1184, 749);
Controls.Add(dataGridView2);
Controls.Add(textBox1);
Controls.Add(button2);
Controls.Add(dataGridView1);
Controls.Add(button1);
Name = "ConsigneeBulkUpload";
Text = "ConsigneeBulkUpload";
WindowState = FormWindowState.Maximized;
Load += ConsigneeBulkUpload_Load;
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
((System.ComponentModel.ISupportInitialize)dataGridView2).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button button1;
private DataGridView dataGridView1;
private Button button2;
private TextBox textBox1;
private DataGridView dataGridView2;
}
}
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
This diff is collapsed.
namespace WinFormsApp1
{
partial class Home
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
menuStrip1 = new MenuStrip();
homeToolStripMenuItem = new ToolStripMenuItem();
wMSToolStripMenuItem = new ToolStripMenuItem();
weightCorrectionToolStripMenuItem = new ToolStripMenuItem();
parameterCorrectionToolStripMenuItem = new ToolStripMenuItem();
consigneeBulkCreationToolStripMenuItem = new ToolStripMenuItem();
fRTToolStripMenuItem = new ToolStripMenuItem();
taskSuspentionToolStripMenuItem = new ToolStripMenuItem();
sendingAgentResceivingAgentIssueToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.Items.AddRange(new ToolStripItem[] { homeToolStripMenuItem, wMSToolStripMenuItem, fRTToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.RenderMode = ToolStripRenderMode.System;
menuStrip1.Size = new Size(984, 24);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "Main";
//
// homeToolStripMenuItem
//
homeToolStripMenuItem.Name = "homeToolStripMenuItem";
homeToolStripMenuItem.Size = new Size(52, 20);
homeToolStripMenuItem.Text = "Home";
//
// wMSToolStripMenuItem
//
wMSToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { weightCorrectionToolStripMenuItem, parameterCorrectionToolStripMenuItem, consigneeBulkCreationToolStripMenuItem });
wMSToolStripMenuItem.Name = "wMSToolStripMenuItem";
wMSToolStripMenuItem.Size = new Size(47, 20);
wMSToolStripMenuItem.Text = "WMS";
//
// weightCorrectionToolStripMenuItem
//
weightCorrectionToolStripMenuItem.Name = "weightCorrectionToolStripMenuItem";
weightCorrectionToolStripMenuItem.Size = new Size(204, 22);
weightCorrectionToolStripMenuItem.Text = "Weight Correction";
weightCorrectionToolStripMenuItem.Click += weightCorrectionToolStripMenuItem_Click;
//
// parameterCorrectionToolStripMenuItem
//
parameterCorrectionToolStripMenuItem.Name = "parameterCorrectionToolStripMenuItem";
parameterCorrectionToolStripMenuItem.Size = new Size(204, 22);
parameterCorrectionToolStripMenuItem.Text = "Parameter Correction";
//
// consigneeBulkCreationToolStripMenuItem
//
consigneeBulkCreationToolStripMenuItem.Name = "consigneeBulkCreationToolStripMenuItem";
consigneeBulkCreationToolStripMenuItem.Size = new Size(204, 22);
consigneeBulkCreationToolStripMenuItem.Text = "Consignee Bulk Creation";
consigneeBulkCreationToolStripMenuItem.Click += consigneeBulkCreationToolStripMenuItem_Click;
//
// fRTToolStripMenuItem
//
fRTToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { taskSuspentionToolStripMenuItem, sendingAgentResceivingAgentIssueToolStripMenuItem });
fRTToolStripMenuItem.Name = "fRTToolStripMenuItem";
fRTToolStripMenuItem.Size = new Size(37, 20);
fRTToolStripMenuItem.Text = "FRT";
//
// taskSuspentionToolStripMenuItem
//
taskSuspentionToolStripMenuItem.Name = "taskSuspentionToolStripMenuItem";
taskSuspentionToolStripMenuItem.Size = new Size(270, 22);
taskSuspentionToolStripMenuItem.Text = "Task Suspention";
//
// sendingAgentResceivingAgentIssueToolStripMenuItem
//
sendingAgentResceivingAgentIssueToolStripMenuItem.Name = "sendingAgentResceivingAgentIssueToolStripMenuItem";
sendingAgentResceivingAgentIssueToolStripMenuItem.Size = new Size(270, 22);
sendingAgentResceivingAgentIssueToolStripMenuItem.Text = "Sending Agent Receiving Agent Issue";
//
// Home
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(984, 749);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Name = "Home";
Text = "ASM Support Center";
Load += Home_Load;
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem homeToolStripMenuItem;
private ToolStripMenuItem wMSToolStripMenuItem;
private ToolStripMenuItem weightCorrectionToolStripMenuItem;
private ToolStripMenuItem consigneeBulkCreationToolStripMenuItem;
private ToolStripMenuItem fRTToolStripMenuItem;
private ToolStripMenuItem taskSuspentionToolStripMenuItem;
private ToolStripMenuItem parameterCorrectionToolStripMenuItem;
private ToolStripMenuItem sendingAgentResceivingAgentIssueToolStripMenuItem;
}
}
using ASMSupportCenter.ConsigneeBulkUpload;
using ASMSupportCenter.WeightCorrection;
namespace WinFormsApp1
{
public partial class Home : Form
{
public Home()
{
InitializeComponent();
}
private void weightCorrectionToolStripMenuItem_Click(object sender, EventArgs e)
{
WeightCorrection wc = new WeightCorrection();
wc.ShowDialog();
}
private void Home_Load(object sender, EventArgs e)
{
WindowState = FormWindowState.Maximized;
}
private void consigneeBulkCreationToolStripMenuItem_Click(object sender, EventArgs e)
{
ConsigneeBulkUpload cb = new ConsigneeBulkUpload();
cb.ShowDialog();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
namespace WinFormsApp1
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Home());
}
}
}
\ No newline at end of file
namespace ASMSupportCenter.WeightCorrection
{
public class TmsConsignment
{
public string PK { get; set; }
public string ConsignmentNumber { get; set; }
public string StatusDesc { get; set; }
public string ServiceType { get; set; }
public string SenderCode { get; set; }
public string ReceiverCode { get; set; }
public string SenderRef { get; set; }
public string ReceiverRef { get; set; }
public string OrderRefNo { get; set; }
public string ClientCode { get; set; }
public string ManifestNumber { get; set; }
public DateTime? ExpectedPickupDateTime { get; set; }
public DateTime? ExpectedDeliveryDateTime { get; set; }
public object AdditionalRef4Type { get; set; }
public DateTime? ActualPickupDateTime { get; set; }
public object ActualDeliveryDateTime { get; set; }
public double InvoiceValue { get; set; }
public DateTime? InvoiceDate { get; set; }
public string LRNumber { get; set; }
public int NoOfBoxes { get; set; }
public double TotalVolume { get; set; }
public double TotalQuantity { get; set; }
public double TotalWeight { get; set; }
public double? CostVolumentricWeight { get; set; }
public double? CostChargeableWeight { get; set; }
public double? RevenueVolumentricWeight { get; set; }
public double? RevenueChargeableWeight { get; set; }
public string BranchCode { get; set; }
public string CompanyCode { get; set; }
public string DepartmentCode { get; set; }
public string TransporterCode { get; set; }
public string TransporterType { get; set; }
public bool IsPODUploaded { get; set; }
public object PODUploadedBy { get; set; }
public object UploadedDateTime { get; set; }
public object AdditionalRef2Code { get; set; }
public object AdditionalRef2Type { get; set; }
public DateTime? CreatedDateTime { get; set; }
public string CreatedBy { get; set; }
public DateTime? ModifiedDateTime { get; set; }
public string TMM_FK { get; set; }
public string ModifiedBy { get; set; }
public string Sender_FK { get; set; }
public string SenderName { get; set; }
public string Receiver_FK { get; set; }
public string ReceiverName { get; set; }
public string Client_FK { get; set; }
public string ClientName { get; set; }
public string SenderType { get; set; }
public string ReceiverType { get; set; }
public string DEP_FK { get; set; }
public string DepartmentName { get; set; }
public string BRN_FK { get; set; }
public string BranchName { get; set; }
public string CMP_FK { get; set; }
public string CompanyName { get; set; }
public string Transporter_FK { get; set; }
public string TransporterName { get; set; }
public int UploadedYetToVerify { get; set; }
public int InTransitYetToDeliver { get; set; }
public string Status { get; set; }
public object AdditionalRef3Type { get; set; }
public object SourceType { get; set; }
public object BookingID { get; set; }
public object ArrivedLocationDateTime { get; set; }
}
}
namespace ASMSupportCenter.WeightCorrection
{
partial class WeightCorrection
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
textBox1 = new TextBox();
button2 = new Button();
dataGridView1 = new DataGridView();
button1 = new Button();
dataGridView2 = new DataGridView();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridView2).BeginInit();
SuspendLayout();
//
// textBox1
//
textBox1.Location = new Point(12, 458);
textBox1.Multiline = true;
textBox1.Name = "textBox1";
textBox1.Size = new Size(1300, 200);
textBox1.TabIndex = 7;
//
// button2
//
button2.Location = new Point(185, 12);
button2.Name = "button2";
button2.Size = new Size(75, 34);
button2.TabIndex = 6;
button2.Text = "Post";
button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click;
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Location = new Point(12, 52);
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.RowTemplate.Height = 25;
dataGridView1.Size = new Size(800, 400);
dataGridView1.TabIndex = 5;
//
// button1
//
button1.Location = new Point(12, 12);
button1.Name = "button1";
button1.Size = new Size(167, 34);
button1.TabIndex = 4;
button1.Text = "Please Select The File";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// dataGridView2
//
dataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView2.Location = new Point(818, 52);
dataGridView2.Name = "dataGridView2";
dataGridView2.RowTemplate.Height = 25;
dataGridView2.Size = new Size(500, 400);
dataGridView2.TabIndex = 8;
//
// WeightCorrection
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1285, 594);
Controls.Add(dataGridView2);
Controls.Add(textBox1);
Controls.Add(button2);
Controls.Add(dataGridView1);
Controls.Add(button1);
Name = "WeightCorrection";
Text = "WeightCorrection";
Load += WeightCorrection_Load;
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
((System.ComponentModel.ISupportInitialize)dataGridView2).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBox1;
private Button button2;
private DataGridView dataGridView1;
private Button button1;
private DataGridView dataGridView2;
}
}
\ No newline at end of file
using ASMSupportCenter.Common;
using Excel;
using Newtonsoft.Json;
using System.Data;
using System.Text;
using static ASMSupportCenter.Common.ApiService;
namespace ASMSupportCenter.WeightCorrection
{
public partial class WeightCorrection : Form
{
DataTable dt = new DataTable();
public WeightCorrection()
{
InitializeComponent();
}
private void WeightCorrection_Load(object sender, EventArgs e)
{
WindowState = FormWindowState.Maximized;
}
private void button1_Click(object sender, EventArgs e)
{
try
{
// Register encoding provider to support additional encodings like Windows-1252
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "Excel Workbook|*.xls;*.xlsx", ValidateNames = true })
{
if (ofd.ShowDialog() == DialogResult.OK)
{
using (FileStream fileStream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read))
{
IExcelDataReader? reader = null;
// Check file extension and use the correct reader
if (Path.GetExtension(ofd.FileName).Equals(".xls", StringComparison.OrdinalIgnoreCase))
{
// Create reader for .xls (binary) files
reader = ExcelReaderFactory.CreateBinaryReader(fileStream);
}
else if (Path.GetExtension(ofd.FileName).Equals(".xlsx", StringComparison.OrdinalIgnoreCase))
{
// Create reader for .xlsx (OpenXML) files
reader = ExcelReaderFactory.CreateOpenXmlReader(fileStream);
}
if (reader != null)
{
reader.IsFirstRowAsColumnNames = true;
// Use the first row as column names
DataSet dataSet = reader.AsDataSet();
// Bind data to DataGridView
dataGridView1.DataSource = dataSet.Tables[0];
// Assuming the first table in the DataSet contains the consignee data
dt = dataSet.Tables[0];
// Close the reader
reader.Close();
}
}
}
}
}
catch (NotSupportedException ex)
{
MessageBox.Show($"Encoding issue: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
MessageBox.Show($"An error occurred: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private async void button2_Click(object sender, EventArgs e)
{
// Clear any previous columns
dataGridView2.Columns.Clear();
textBox1.AppendText("Weight Correction is in Progress" + Environment.NewLine);
TmsConsignment singletmsConsignment = new TmsConsignment();
List<ApiResponse> lstselectedUpdateResponse = new List<ApiResponse>();
async Task<StringBuilder> ProcessConsignmentsAsync(List<ConsignmentRow> lstConsignment)
{
ApiService apiService = new ApiService();
string token = apiService.GetBarrierTokenUsingServiceKey();
StringBuilder results = new StringBuilder();
foreach (ConsignmentRow item in lstConsignment)
{
results.Clear();
singletmsConsignment = GetEntityRefPK(token, item.ConsignmentNumber);
ApiResponse selectedUpdateResponse = new ApiResponse();
if (singletmsConsignment != null && !String.IsNullOrEmpty(singletmsConsignment.PK))
{
selectedUpdateResponse = await CallSelectedApi(singletmsConsignment, item.FinalCostWeight, item.FinalRevenueWeight, token);
}
selectedUpdateResponse.Id = singletmsConsignment?.ConsignmentNumber;
CommonMethods commonMethods = new CommonMethods();
commonMethods.PopulateDataGridView(dataGridView2, selectedUpdateResponse);
}
return results;
}
List<ConsignmentRow> lstConsignment = JsonConvert.DeserializeObject<List<ConsignmentRow>>(JsonConvert.SerializeObject(dt));
Task<StringBuilder> processTask = ProcessConsignmentsAsync(lstConsignment);
textBox1.AppendText("Weight Correction is completed" + Environment.NewLine);
}
private TmsConsignment GetEntityRefPK(string barrierToken, string ConsignmentNumber)
{
TmsConsignment singletmsConsignment = new TmsConsignment();
string TMC_PK = string.Empty;
using HttpClient client = new();
string json = JsonConvert.SerializeObject(new
{
FilterID = "TMSCON",
SearchInput = new[]
{
new { FieldName = "SelectedColumns", value = "TMC_PK,TMC_ConsignmentNumber,TMC_CostVolumentricWeight,TMC_revenueVolumentricWeight,TMC_CostChargeableWeight,TMC_RevenueChargeableWeight" },
new { FieldName = "UtctoLocalDateTime", value = "TMC_UploadedDateTime,TMC_CreatedDateTime,TMC_CreatedBy,TMC_ModifiedDateTime,TMC_ModifiedBy" },
new { FieldName = "FilterType", value = "DistributionConsignment" },
new { FieldName = "ConsignmentNumber", value = ConsignmentNumber }
}
});
if (!string.IsNullOrEmpty(barrierToken))
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", barrierToken);
StringContent content = new(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = client.PostAsync(Constants.Urls.wmsConFindAll, content).Result;
_ = response.EnsureSuccessStatusCode();
string responseString = response.Content.ReadAsStringAsync().Result;
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(responseString);
if (apiResponse != null && apiResponse.Status == "Success" && apiResponse.Response != null && apiResponse.Count > 0)
{
List<TmsConsignment> tmsConsignment = JsonConvert.DeserializeObject<List<TmsConsignment>>(apiResponse?.Response?.ToString());
singletmsConsignment = tmsConsignment?.Count > 0 ? tmsConsignment?.FirstOrDefault() : null;
}
return singletmsConsignment;
}
private async Task<ApiResponse> CallSelectedApi(TmsConsignment singletmsConsignment, string finalCostWeight, string finalRevenueWeight, string barrierToken)
{
string status = string.Empty;
using HttpClient client = new();
var columnUpdates = new List<object>
{
new
{
EntityRefPK = singletmsConsignment.PK,
Properties = new[]
{
new { PropertyName = "TMC_CostVolumentricWeight", PropertyNewValue = finalCostWeight, PropertyOldValue = singletmsConsignment.CostVolumentricWeight.ToString() },
new { PropertyName = "TMC_revenueVolumentricWeight", PropertyNewValue = finalRevenueWeight, PropertyOldValue = singletmsConsignment.RevenueVolumentricWeight.ToString() },
new { PropertyName = "TMC_CostChargeableWeight", PropertyNewValue = finalCostWeight, PropertyOldValue = singletmsConsignment.CostChargeableWeight.ToString() },
new { PropertyName = "TMC_RevenueChargeableWeight", PropertyNewValue = finalRevenueWeight, PropertyOldValue = singletmsConsignment.RevenueChargeableWeight.ToString() }
}
}
// Add more column updates as needed
};
string json = JsonConvert.SerializeObject(new
{
ColumnUpdate = columnUpdates
});
if (!string.IsNullOrEmpty(barrierToken))
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", barrierToken);
StringContent content = new(json, Encoding.UTF8, "application/json");
HttpResponseMessage response = client.PostAsync(Constants.Urls.wmsConSelectedUpdate, content).Result;
_ = response.EnsureSuccessStatusCode();
string responseString = response.Content.ReadAsStringAsync().Result;
ApiResponse apiResponse = JsonConvert.DeserializeObject<ApiResponse>(responseString);
return apiResponse;
}
}
public class ConsignmentRow
{
public string ConsignmentNumber { get; set; }
public string FinalCostWeight { get; set; }
public string FinalRevenueWeight { get; set; }
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35013.160
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASMSupportCenter", "WinFormsApp1\ASMSupportCenter.csproj", "{DD74BF4E-EE3F-4B80-8B61-F94DF4D4CB78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD74BF4E-EE3F-4B80-8B61-F94DF4D4CB78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD74BF4E-EE3F-4B80-8B61-F94DF4D4CB78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD74BF4E-EE3F-4B80-8B61-F94DF4D4CB78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD74BF4E-EE3F-4B80-8B61-F94DF4D4CB78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7184FC47-8792-4302-B155-9F84C618605F}
EndGlobalSection
EndGlobal
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment