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
using ASMSupportCenter.Common;
using Excel;
using Newtonsoft.Json;
using System.Data;
using System.Text;
using static ASMSupportCenter.Common.ApiService;
namespace ASMSupportCenter.ConsigneeBulkUpload
{
public partial class ConsigneeBulkUpload : Form
{
DataTable dt = new DataTable();
public ConsigneeBulkUpload()
{
InitializeComponent();
}
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 void ConsigneeBulkUpload_Load(object sender, EventArgs e)
{
WindowState = FormWindowState.Maximized;
}
private void button2_Click(object sender, EventArgs e)
{
List<Consignee> objConsignee = JsonConvert.DeserializeObject<List<Consignee>>(JsonConvert.SerializeObject(dt));
var objConsigneeGroupBy = objConsignee.GroupBy(c => c.ConsigneeCode);
// Iterate through each row in the DataTable
foreach (var item in objConsigneeGroupBy)
{
Root objRoot = new Root();
// Serialize and Deserialize the row into Consignee
Consignee objConsigneeSingle = JsonConvert.DeserializeObject<Consignee>(JsonConvert.SerializeObject(item.FirstOrDefault()));
if (objConsigneeSingle != null)
{
objRoot.OrgHeader = new OrgHeader();
objRoot.OrgHeader.PK = Guid.NewGuid();
objRoot.OrgHeader.FullName = objConsigneeSingle.ConsigneeName;
objRoot.OrgHeader.IsValid = true;
objRoot.OrgHeader.Code = objConsigneeSingle.ConsigneeCode;
objRoot.OrgHeader.IsActive = true;
objRoot.OrgHeader.IsConsignee = true;
objRoot.OrgHeader.Language = objConsigneeSingle.Language;
objRoot.OrgHeader.OAD_Address1 = objConsigneeSingle.Address1;
objRoot.OrgHeader.OAD_Address2 = objConsigneeSingle.Address2;
objRoot.OrgHeader.OAD_City = objConsigneeSingle.City;
objRoot.OrgHeader.OAD_State = objConsigneeSingle.StateCode;
objRoot.OrgHeader.OAD_PostCode = objConsigneeSingle.PostCode;
objRoot.OrgHeader.OAD_Mobile = objConsigneeSingle.Phone;
objRoot.OrgHeader.OAD_Email = objConsigneeSingle.Email;
objRoot.OrgHeader.OAD_RelatedPortCode = objConsigneeSingle.LocalPort;
objRoot.OrgHeader.OAD_RelatedPortCodeDesc = objConsigneeSingle.LocalPortDesc;
objRoot.OrgHeader.TenantCode = "20CUB";
objRoot.OrgHeader.OAD_CountryCode = "IN";
objRoot.OrgHeader.OAD_CountryCodeDesc = "India";
objRoot.OrgHeader.OAD_StateDesc = objConsigneeSingle.State;
objRoot.OrgHeader.SiteName = "";
objRoot.OrgHeader.RelatedPortCode = objConsigneeSingle.LocalPort;
objRoot.OrgAddress = new List<OrgAddress>();
foreach (var addressItem in item)
{
OrgAddress objOrgAddress = new OrgAddress();
objOrgAddress.AddressCapability = new List<AddressCapability>();
objOrgAddress.PK = Guid.NewGuid();
objOrgAddress.IsValid = true;
objOrgAddress.IsActive = true;
objOrgAddress.Code = addressItem.ConsigneeCode;
objOrgAddress.Language = "EGB";
objOrgAddress.CompanyNameOverride = null;
objOrgAddress.Address1 = addressItem.Address1;
objOrgAddress.Address2 = addressItem.Address2;
objOrgAddress.City = addressItem.City;
objOrgAddress.State = addressItem.State;
objOrgAddress.PostCode = addressItem.PostCode;
objOrgAddress.Phone = addressItem.Phone;
objOrgAddress.Fax = null;
objOrgAddress.Mobile = addressItem.Phone == null ? null : addressItem.Phone;
objOrgAddress.Email = addressItem.Email;
objOrgAddress.RelatedPortCode = addressItem.LocalPort;
objOrgAddress.ModifiedDateTime = DateTime.Now;
objOrgAddress.ModifiedBy = "asmsupport@20cube.com";
objOrgAddress.CreatedDateTime = DateTime.Now;
objOrgAddress.CreatedBy = "asmsupport@20cube.com";
objOrgAddress.StateId = 0;
objOrgAddress.Source = null;
objOrgAddress.ORG_FK = objRoot.OrgHeader.PK;
objOrgAddress.IsModified = true;
objOrgAddress.IsDeleted = false;
objOrgAddress.OrgTimeTable = null;
objOrgAddress.Latitude = null;
objOrgAddress.Longitude = null;
objOrgAddress.CountryCode = "IN";
objOrgAddress.TenantCode = "20CUB";
objOrgAddress.IsMainAddress = false;
objOrgAddress.Capabilities = null;
objOrgAddress.RGN_FK = null;
objOrgAddress.TMZ_FK = null;
objOrgAddress.RGN_Code = null;
objOrgAddress.TMZ_Code = null;
objOrgAddress.LanguageDesc = null;
objOrgAddress.StateDesc = addressItem.State;
objOrgAddress.RelatedPortDesc = addressItem.LocalPortDesc;
objOrgAddress.CountryDesc = "India";
objOrgAddress.RefType = null;
objOrgAddress.RefNumber = null;
objOrgAddress.GSTType = null;
objOrgAddress.GSTNo = null;
objOrgAddress.SiteId = null;
objOrgAddress.ExternalSiteId = null;
objOrgAddress.SiteName = null;
objOrgAddress.SiteNameId = null;
objOrgAddress.StateProvinceValidationRule = null;
objOrgAddress.IsCtyMstAvl = false;
objOrgAddress.AIREquipmentNeeded = null;
objOrgAddress.LCLEquipmentNeeded = null;
objOrgAddress.FCLEquipmentNeeded = null;
objOrgAddress.LoadingUnloadingConstraints = null;
objOrgAddress.OAD_IsSEZUnit = null;
AddressCapability objAddressCapability = new AddressCapability();
objAddressCapability.IsMapped = true;
objAddressCapability.IsValid = true;
objAddressCapability.IsMainAddress = true;
objAddressCapability.AddressType = "OFC";
objAddressCapability.AddressTypeDes = "Office Address";
objAddressCapability.OAD_FK = objOrgAddress.PK;
objAddressCapability.ORG_FK = objRoot.OrgHeader.PK;
objAddressCapability.TenantCode = "20CUB";
objAddressCapability.IsModified = true;
objOrgAddress.AddressCapability.Add(objAddressCapability);
objRoot.OrgAddress.Add(objOrgAddress);
}
objRoot.OrgCompanyData = new List<object>();
objRoot.OrgContact = new List<object>();
objRoot.OrgStaffAssignments = new List<object>();
objRoot.UIJobDocuments = new List<object>();
objRoot.UIJobComments = new List<object>();
objRoot.OrgRelatedParty = new List<object>();
objRoot.OrgSupplierBuyerLink = new List<object>();
objRoot.WmsClientParameterByWarehouse = new List<object>();
objRoot.WmsClientPickPackParamsByWms = new List<object>();
objRoot.OrgMiscServ = new OrgMiscServ();
objRoot.OrgTransporterConfig = new List<object>();
objRoot.OrgRefDate = new List<object>();
objRoot.TmsZone = new object();
objRoot.OrgBarcode = new object();
objRoot.objUIAccAPAccountDetails = new object();
objRoot.objUICurrencyUplift = new List<object>();
objRoot.UIOrgRefConfig = new List<object>();
objRoot.uIorgconfigs = new object();
objRoot.objUIOrgPartyMappingParametersList = new object();
objRoot.uIOrgBuyerSupplierMappingList = new object();
objRoot.objUIWmsSettings = new object();
objRoot.objUIAPBankDetails = new object();
objRoot.objUIMultipleBankdetails = new object();
objRoot.objUIOrgContactGroup = new object();
objRoot.objUIOrgContactGroupMapping = new object();
objRoot.objUIOrgInvGroupMapping = new object();
objRoot.SelectedCountryObj = new SelectedCountryObj();
//SendConsigneeDataToApi(objRoot, "https://fx.myhub.plus/Org/Insert");
ApiService apiService = new ApiService();
ApiResponse apiResponse = apiService.CommonApiCallWithAPIKeyAsync(Constants.Urls.orgInsert, JsonConvert.SerializeObject(objRoot));
CommonMethods commonMethods = new CommonMethods();
commonMethods.PopulateDataGridView(dataGridView2, apiResponse);
if (apiResponse.Status != "Success")
{
textBox1.AppendText(objConsigneeSingle.ConsigneeCode
+ "-" + apiResponse.Status + "-" + apiResponse.Messages?.FirstOrDefault()?.MessageDesc
+ " - " + apiResponse.Exception?.Message + Environment.NewLine);
}
else
{
textBox1.AppendText(objConsigneeSingle.ConsigneeCode
+ "-" + apiResponse.Status + Environment.NewLine);
}
}
}
}
}
}
<?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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ASMSupportCenter.ConsigneeBulkUpload
{
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class AddressCapability
{
public bool IsMapped { get; set; }
public bool IsValid { get; set; }
public bool IsMainAddress { get; set; }
public string AddressType { get; set; }
public string AddressTypeDes { get; set; }
public Guid OAD_FK { get; set; }
public Guid ORG_FK { get; set; }
public string TenantCode { get; set; }
public bool IsModified { get; set; }
}
public class OrgAddress
{
public Guid PK { get; set; }
public object IsValid { get; set; }
public object IsActive { get; set; }
public object Code { get; set; }
public string Language { get; set; }
public object CompanyNameOverride { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string PostCode { get; set; }
public object Phone { get; set; }
public object Fax { get; set; }
public string Mobile { get; set; }
public string Email { get; set; }
public string RelatedPortCode { get; set; }
public object ModifiedDateTime { get; set; }
public object ModifiedBy { get; set; }
public object CreatedDateTime { get; set; }
public object CreatedBy { get; set; }
public object StateId { get; set; }
public object Source { get; set; }
public Guid ORG_FK { get; set; }
public bool IsModified { get; set; }
public bool IsDeleted { get; set; }
public List<AddressCapability> AddressCapability { get; set; }
public object OrgTimeTable { get; set; }
public object Latitude { get; set; }
public object Longitude { get; set; }
public string CountryCode { get; set; }
public string TenantCode { get; set; }
public bool IsMainAddress { get; set; }
public object Capabilities { get; set; }
public object RGN_FK { get; set; }
public object TMZ_FK { get; set; }
public object RGN_Code { get; set; }
public object TMZ_Code { get; set; }
public object LanguageDesc { get; set; }
public string StateDesc { get; set; }
public string RelatedPortDesc { get; set; }
public string CountryDesc { get; set; }
public object RefType { get; set; }
public object RefNumber { get; set; }
public object GSTType { get; set; }
public object GSTNo { get; set; }
public object SiteId { get; set; }
public object ExternalSiteId { get; set; }
public string SiteName { get; set; }
public object SiteNameId { get; set; }
public string StateProvinceValidationRule { get; set; }
public bool IsCtyMstAvl { get; set; }
public object AIREquipmentNeeded { get; set; }
public object LCLEquipmentNeeded { get; set; }
public object FCLEquipmentNeeded { get; set; }
public object LoadingUnloadingConstraints { get; set; }
public object OAD_IsSEZUnit { get; set; }
}
public class OrgHeader
{
public Guid PK { get; set; }
public bool IsValid { get; set; }
public string Code { get; set; }
public bool IsActive { get; set; }
public string FullName { get; set; }
public bool IsConsignee { get; set; }
public bool IsConsignor { get; set; }
public bool IsTransportClient { get; set; }
public bool IsWarehouseClient { get; set; }
public bool IsTransporter { get; set; }
public bool IsForwarder { get; set; }
public bool IsShippingProvider { get; set; }
public bool IsMiscFreightServices { get; set; }
public bool IsAirCTO { get; set; }
public bool IsAirLine { get; set; }
public bool IsBroker { get; set; }
public bool IsContainerPark { get; set; }
public bool IsLocalTransport { get; set; }
public bool IsPackDepot { get; set; }
public bool IsSeaCTO { get; set; }
public bool IsShippingLine { get; set; }
public bool IsUnpackDepot { get; set; }
public bool IsRailHead { get; set; }
public bool IsRoadFreightDepot { get; set; }
public bool IsShippingConsortium { get; set; }
public bool IsFumigationContractor { get; set; }
public bool IsGlobalAccount { get; set; }
public bool IsNationalAccount { get; set; }
public bool IsSalesLead { get; set; }
public bool IsCompetitor { get; set; }
public bool IsTempAccount { get; set; }
public bool IsPersonalEffectsAccount { get; set; }
public object RL_NKClosestPort { get; set; }
public string Language { get; set; }
public object ModifiedDateTime { get; set; }
public object ModifiedBy { get; set; }
public object CreatedDateTime { get; set; }
public object CreatedBy { get; set; }
public int StateId { get; set; }
public object Source { get; set; }
public object SourceRefKey { get; set; }
public bool IsModified { get; set; }
public bool IsDuplicate { get; set; }
public object TMZ_FK { get; set; }
public object OAD_PK { get; set; }
public object OAD_Code { get; set; }
public object OAD_CompanyNameOverride { get; set; }
public string OAD_Address1 { get; set; }
public string OAD_Address2 { get; set; }
public string OAD_City { get; set; }
public string OAD_State { get; set; }
public string OAD_PostCode { get; set; }
public object OAD_Phone { get; set; }
public object OAD_Fax { get; set; }
public string OAD_Mobile { get; set; }
public string OAD_Email { get; set; }
public string OAD_RelatedPortCode { get; set; }
public bool IsStarred { get; set; }
public object Starred_FK { get; set; }
public object ProxyTenant_Code { get; set; }
public object ProxyTenant_FK { get; set; }
public string TenantCode { get; set; }
public string OAD_CountryCode { get; set; }
public bool IsDistributionCentre { get; set; }
public bool IsStore { get; set; }
public object TMZ_Name { get; set; }
public object STA_FK { get; set; }
public object RGN_FK { get; set; }
public object RGN_Code { get; set; }
public object RGN_Name { get; set; }
public object SharedTenantCode { get; set; }
public object OAD_Latitude { get; set; }
public object OAD_Longitude { get; set; }
public object OGNO { get; set; }
public string OAD_CountryCodeDesc { get; set; }
public string OAD_StateDesc { get; set; }
public string OAD_RelatedPortCodeDesc { get; set; }
public bool AutoSOConfirm { get; set; }
public object NameAndAddress { get; set; }
public object GSTType { get; set; }
public object GSTNo { get; set; }
public object SiteId { get; set; }
public object ExternalSiteId { get; set; }
public string SiteName { get; set; }
public object Self_FK { get; set; }
public object CustomerOrgCode { get; set; }
public bool IsDepot { get; set; }
public bool IsDataListValidation { get; set; }
public string RelatedPortCode { get; set; }
}
public class OrgMiscServ
{
public string PK { get; set; }
public object Airline3CharCode { get; set; }
public int IMEstDaysDeliveryAir { get; set; }
public int IMEstDaysDeliveryFCL { get; set; }
public int IMEstDaysDeliveryLCL { get; set; }
public object FollowUpMsg { get; set; }
public object IMMaxEFTAmount { get; set; }
public object IMMinEFTAmount { get; set; }
public object IMEFTBankAccount { get; set; }
public object IMEFTBankBSB { get; set; }
public object IMMergeCustomsInvoiceLinesBy { get; set; }
public object IMOrderLineAttrib1 { get; set; }
public object IMOrderLineAttrib2 { get; set; }
public object IMOrderLineAttrib3 { get; set; }
public int IMOriginalSeaBills { get; set; }
public int IMCopySeaBills { get; set; }
public object IMSendImportDocsTo { get; set; }
public object IMSendSeaImportDocsTo { get; set; }
public object IMImporterCategory { get; set; }
public int IMAirDepotFreeDays { get; set; }
public int IMSeaDepotFreeDays { get; set; }
public object IMOrderStatusCodePairList { get; set; }
public object IMOrderLineStatusCodePairList { get; set; }
public object IMFCLEquipmentNeeded { get; set; }
public object IMLCLEquipmentNeeded { get; set; }
public object IMAirEquipmentNeeded { get; set; }
public object IMDefaultINCOTerm { get; set; }
public object IMAutoPopulateOwnerRefWithOrderNums { get; set; }
public object IMPartAttrib1Type { get; set; }
public object IMPartAttrib1Name { get; set; }
public object IMPartAttrib2Type { get; set; }
public object IMPartAttrib2Name { get; set; }
public object IMPartAttrib3Type { get; set; }
public object IMPartAttrib3Name { get; set; }
public object IMDocumentAddressPreference { get; set; }
public object IMDefaultWarehousePickOption { get; set; }
public object IMInvoiceDetailReportSort { get; set; }
public object LandedCostMarginPercent1 { get; set; }
public object LandedCostMarginPercent2 { get; set; }
public object LandedCostMarginPercent3 { get; set; }
public object LastArchiveDate { get; set; }
public object EXExporterCategory { get; set; }
public object EXDefaultIncoTerm { get; set; }
public object EXFCLEquipmentNeeded { get; set; }
public object EXLCLEquipmentNeeded { get; set; }
public object EXAirEquipmentNeeded { get; set; }
public object EXDocumentAddressPreference { get; set; }
public object OCT_EXDefaultDGContact_FK { get; set; }
public object EXDefaultDGContactPhoneUsed { get; set; }
public object EXDefaultInvoicePriceFromProductLastCost { get; set; }
public object FWAgentCategory { get; set; }
public object FWHandlesSeaForPortOrCountry { get; set; }
public object FWHandlesAirForPortOrCountry { get; set; }
public object FWIATACode { get; set; }
public object FWIATAAccountNumber { get; set; }
public object WAA_WhsDefaultWarehouseArea_FK { get; set; }
public object BRN_WhsDefaultWarehouse_FK { get; set; }
public object CRCarrierCategory { get; set; }
public object SVServicesCategory { get; set; }
public object CMSalesCategory { get; set; }
public object CMCompetitorActivity { get; set; }
public object CMLastCallDate { get; set; }
public object CMClientSize { get; set; }
public object CMGrowthOutlook { get; set; }
public object CMFollowUpDate { get; set; }
public object CMEstimatedDateToClose { get; set; }
public object CMLeadType { get; set; }
public object EMP_NKCMLeadSourcePerson { get; set; }
public object CMD_NKCMMainImportCmdty { get; set; }
public object CMD_NKCMMainExportCmdty { get; set; }
public object CMTotalClientRevenue { get; set; }
public object CMPercentage { get; set; }
public object CMAcheivableClientRevenue { get; set; }
public object CMEstimatedProfit { get; set; }
public object CMWarehouseRevenue { get; set; }
public object CMConsultingRevenue { get; set; }
public int CMOverallClientRelation { get; set; }
public int CMClientsDesireToRemain { get; set; }
public int CMEaseClientCanBePoached { get; set; }
public int CMAmountOfElectronicIntegration { get; set; }
public object CMOverallEffectOfClientOnAirfreightCosts { get; set; }
public object CMOverallEffectOfClientOnLCLCosts { get; set; }
public object CMOverallEffectOfClientOnTEUCosts { get; set; }
public object CMOverallEffectOfClientOnWarehousingCosts { get; set; }
public object CMOverallEffectOfClientOnOtherCosts { get; set; }
public int CMAmountOfBusinessWon { get; set; }
public object CMSalesTerritory { get; set; }
public object CMCommission { get; set; }
public object CMClientCommenced { get; set; }
public object CICompetitorCategory { get; set; }
public int CIEstimatedStaffThisLocation { get; set; }
public object CITypeOfService { get; set; }
public int CIEstimatedStaffThisCountry { get; set; }
public object CISellingStyle { get; set; }
public object CITurnover { get; set; }
public object CIProfit { get; set; }
public object CICapitalEmployed { get; set; }
public int CICompetitiveRanking { get; set; }
public object CIStrength { get; set; }
public object CIWeaknesses { get; set; }
public object CIOpportunities { get; set; }
public object CIThreats { get; set; }
public object CustomAttrib1 { get; set; }
public object CustomAttrib2 { get; set; }
public object CustomAttrib3 { get; set; }
public object CustomDate1 { get; set; }
public object CustomDate2 { get; set; }
public object CustomDate3 { get; set; }
public object CustomDecimal1 { get; set; }
public object CustomDecimal2 { get; set; }
public object CustomDecimal3 { get; set; }
public object ORG_FK { get; set; }
public object IMLastOrderReference { get; set; }
public int WmsPickFromDefaultFIFO { get; set; }
public int WmsPickFromFullPallets { get; set; }
public int WmsPickFromConsolidatedFullPallets { get; set; }
public int WmsPickFromPickFaces { get; set; }
public int WmsPickFromPalletOverflow { get; set; }
public int WmsPickFromBrokenPallets { get; set; }
public int WmsPickSortArrivalDate { get; set; }
public int WmsPickSortExpiryDate { get; set; }
public int WmsPickSortPackingDate { get; set; }
public int WmsPickSortPickFace { get; set; }
public int WmsPickSortLocationRow { get; set; }
public int WmsPickSortLocationColumn { get; set; }
public int WmsPickSortLocationLevel { get; set; }
public int WmsExpiryNotificationPeriod { get; set; }
public object WmsClientInvoiceFormat { get; set; }
public object WmsOrderNumberUniquenessStrategy { get; set; }
public object SER_NKIMDefaultServiceLevel { get; set; }
public object SER_NKEXDefaultServiceLevel { get; set; }
public object EXGoodsDescription { get; set; }
public int WmsPutawayToLocation { get; set; }
public int WmsPutawayToPickFace { get; set; }
public int WmsPutawayToProductArea { get; set; }
public int WmsPutawayToClientArea { get; set; }
public int WmsPutawaySortLocationColumn { get; set; }
public int WmsPutawaySortLocationLevel { get; set; }
public int WmsPutawaySortLocationRow { get; set; }
public object IMInvoiceDetailReportSort2 { get; set; }
public object IMInvoiceDetailReportSort3 { get; set; }
public object EXHandlingInstuctions { get; set; }
public object EXMergeCustomsInvoiceLinesBy { get; set; }
public object EXPreAllocPrefix { get; set; }
public int CMNoOfEmployees { get; set; }
public object CMClientPortalHomePage { get; set; }
public object COU_NKEXDefaultCntryOfOrigin { get; set; }
public object CUR_NKFWDefCurrency { get; set; }
public object CUR_NKEXDefCurrency { get; set; }
public object CMDistanceCalculationProvider { get; set; }
public object CMDistanceCalculationVersion { get; set; }
public object CMDistanceCalculationMethod { get; set; }
public object WmsOrderFulfillmentRule { get; set; }
public object WmsPackingSlipOrderBy { get; set; }
public object CMPaidUpCapital { get; set; }
public object CMEstablishedDate { get; set; }
public object WmsDefaultWarehousePickMode { get; set; }
public object WmsTransportPayer { get; set; }
public bool WmsDefaultWarehouseRollUp { get; set; }
public bool WmsABCAnalysisEnabled { get; set; }
public object WmsABCAnalysisMethod { get; set; }
public object WmsABCAnalysisPeriod { get; set; }
public bool IsScanPackQtyAllowed { get; set; }
public bool IsLabelPrintedOnClosePackage { get; set; }
public bool IMShowDutyOnWarehouseEntries { get; set; }
public int MinimumShelfLifeAccepted { get; set; }
public int CRVoyageRecyclingPeriodInMonths { get; set; }
public bool IMAllowOrders { get; set; }
public bool FWDirectAMSReporter { get; set; }
public bool CMDoesExports { get; set; }
public bool CMDoesImports { get; set; }
public bool IMSendEftAuto { get; set; }
public bool CMUseTradeLaneFigures { get; set; }
public bool IMSendEntryWithPayAuthority { get; set; }
public bool CMIsHouseAccount { get; set; }
public bool IMIsGSTDeferred { get; set; }
public bool WmsOverrideSystemPickingRules { get; set; }
public bool WmsExpiryNotificationFromDefaults { get; set; }
public bool WmsOverrideSystemPutawayRules { get; set; }
public bool WmsPutawaySameProductTogether { get; set; }
public bool WmsEDIChangeMessageCancelOrderLinesNotIncludedInMessage { get; set; }
public bool WmsAutoPckEdiOrders { get; set; }
public bool IsValid { get; set; }
public bool CustomFlag1 { get; set; }
public bool CustomFlag2 { get; set; }
public bool CustomFlag3 { get; set; }
public bool CustomFlag4 { get; set; }
public bool IMImporterOwnsPartNumbers { get; set; }
public bool IMDefaultToNewOrdersToNextOrderNum { get; set; }
public bool IMAutoImpJobRefered { get; set; }
public bool IMEftCustomsFromImport { get; set; }
public bool IMPartAttrib1IsMandatory { get; set; }
public bool IMAttrib1IsKey { get; set; }
public bool IMPartAttrib2IsMandatory { get; set; }
public bool IMEftQuarantineFromImport { get; set; }
public bool IMAttrib2IsKey { get; set; }
public bool IMPartAttrib3IsMandatory { get; set; }
public bool IMAttrib3IsKey { get; set; }
public bool IMUseExpiryDate { get; set; }
public bool IMUsePackingDate { get; set; }
public bool IMImporterRequiresOrderNumbersOnDocs { get; set; }
public bool IMJobRequireOrderTrackLink { get; set; }
public bool IMEftHoldUntilPayAuthorised { get; set; }
public bool EXJobRequireOrderTrackLink { get; set; }
public bool EXExporterRequiresOrderNumbersOnDocs { get; set; }
public bool EXAllowedToPrintOriginalBL { get; set; }
public bool FWAgentBelongsToGroup { get; set; }
public bool FWHandlesAir { get; set; }
public bool FWHandlesSea { get; set; }
public bool FWRequestForCreditAllowed { get; set; }
public bool FWBillCollectFeesOnSingleInvoice { get; set; }
public bool FWDealDirectlyWithUltimates { get; set; }
public object ConsigneeAuthorityToLeave { get; set; }
public bool IMOwnsProducts { get; set; }
public object ConsignorAuthorityToLeave { get; set; }
public bool EXOwnsProducts { get; set; }
public object CMLastUnactionedCallDate { get; set; }
public object CMPeriodOfActivity { get; set; }
public object CMIndustryVertical { get; set; }
public object CMP_CMPreferredPaymentCompany_FK { get; set; }
public int WmsPickFromFIFOBulkOnly { get; set; }
public bool IsAutoPackAllowed { get; set; }
public bool WmsIsRecalculateOrderPricing { get; set; }
public int WmsOrderDefaultPickPriority { get; set; }
public object WCG_CartonGroup_FK { get; set; }
public object CMAuthorityToLeave { get; set; }
public bool TBAllowMixedAccountNumbersOnManifest { get; set; }
public bool IMAllowAttachedOrderXMLUpdate { get; set; }
public object WmsGenerateBackOrdersOnShortfalls { get; set; }
public object CreatedDateTime { get; set; }
public object CreatedBy { get; set; }
public object ModifiedDateTime { get; set; }
public object ModifiedBy { get; set; }
public object TenantCode { get; set; }
public object SAP_FK { get; set; }
public bool IsModified { get; set; }
public bool IsDeleted { get; set; }
public object FollowUpSource { get; set; }
public int FollowUpDue { get; set; }
public int WeekDay { get; set; }
public object OCT_EXDefaultDGContact { get; set; }
public object DGPhoneNumber { get; set; }
public object SharedTenantCode { get; set; }
public bool UserDiscretion { get; set; }
public bool IsApprovalRequired { get; set; }
public bool IMISProductDimension { get; set; }
public bool IMISPackageDimension { get; set; }
public object ORG_Notes { get; set; }
public object ORG_HandlingNotes { get; set; }
}
public class Root
{
public object QueueRefPK { get; set; }
public OrgHeader OrgHeader { get; set; }
public List<OrgAddress> OrgAddress { get; set; }
public List<object> OrgCompanyData { get; set; }
public List<object> OrgContact { get; set; }
public List<object> OrgStaffAssignments { get; set; }
public List<object> UIJobDocuments { get; set; }
public List<object> UIJobComments { get; set; }
public List<object> OrgRelatedParty { get; set; }
public List<object> OrgSupplierBuyerLink { get; set; }
public List<object> WmsClientParameterByWarehouse { get; set; }
public List<object> WmsClientPickPackParamsByWms { get; set; }
public OrgMiscServ OrgMiscServ { get; set; }
public List<object> OrgTransporterConfig { get; set; }
public List<object> OrgRefDate { get; set; }
public object TmsZone { get; set; }
public object OrgBarcode { get; set; }
public object objUIAccAPAccountDetails { get; set; }
public List<object> objUICurrencyUplift { get; set; }
public List<object> UIOrgRefConfig { get; set; }
public object uIorgconfigs { get; set; }
public object objUIOrgPartyMappingParametersList { get; set; }
public object uIOrgBuyerSupplierMappingList { get; set; }
public object objUIWmsSettings { get; set; }
public object objUIAPBankDetails { get; set; }
public object objUIMultipleBankdetails { get; set; }
public object objUIOrgContactGroup { get; set; }
public object objUIOrgContactGroupMapping { get; set; }
public object objUIOrgInvGroupMapping { get; set; }
public SelectedCountryObj SelectedCountryObj { get; set; }
}
public class SelectedCountryObj
{
public string PK { get; set; }
public string Code { get; set; }
public bool IsActive { get; set; }
public bool IsSystem { get; set; }
public string Desc { get; set; }
public string CountryDialingCode { get; set; }
public string AddressFormattingRule { get; set; }
public string EconomicGrouping { get; set; }
public string PostcodeValidationRule { get; set; }
public string StateProvinceValidationRule { get; set; }
public string RX_NKLocalCurrency { get; set; }
public string IsoAlpha3Code { get; set; }
public string IsoNumericUNM49Code { get; set; }
public string RX_NKAirWaybillCurrency { get; set; }
public string CreatedBy { get; set; }
public DateTime CreatedDateTime { get; set; }
public string ModifiedBy { get; set; }
public DateTime ModifiedDateTime { get; set; }
public int StateId { get; set; }
public string Source { get; set; }
public bool IsModified { get; set; }
public bool IsDeleted { get; set; }
public bool isStatelevelGST { get; set; }
public bool IsCtyMstAvl { get; set; }
}
}
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