public ActionResult Trade(string shippingId)
        {
            int cnvrtShippingID = Convert.ToInt32(shippingId);

            ViewBag.Message = "Your Trade page.";
            Trading.BLL.Trade trade = new BLL.Trade();
            trade.TradeDBConnectionString = ConfigurationManager.ConnectionStrings["TradeConnectionString"].ConnectionString;
            UploadTradeVM uploadTrade = trade.GetShippingTradeDetails(cnvrtShippingID);

            uploadTrade = ReEvaluateUploadTrade(uploadTrade);
            return(View(uploadTrade));
        }
        public ActionResult Trade(UploadTrade uploadTrade, HttpPostedFileBase postedFile, string submitButton)
        {
            UploadTradeVM uploadTradeVM = new UploadTradeVM();

            try
            {
                switch (submitButton)
                {
                case "Search":
                    ModelState.Clear();

                    Trading.BLL.Trade trade = new BLL.Trade();
                    trade.TradeDBConnectionString = ConfigurationManager.ConnectionStrings["TradeConnectionString"].ConnectionString;
                    uploadTradeVM = trade.GetShippingTradeDetails(uploadTrade.ShippingId);
                    uploadTradeVM = ReEvaluateUploadTrade(uploadTradeVM);
                    if (uploadTrade.Shipping.SINo == null || uploadTrade.Shipping.SINo == string.Empty)
                    {
                        uploadTrade.IsSINoAvailable = false;
                    }
                    break;

                case "Upload":
                    if (postedFile != null)
                    {
                        string path = Server.MapPath("~/TradeShippingSheets/");
                        if (!Directory.Exists(path))
                        {
                            Directory.CreateDirectory(path);
                        }

                        postedFile.SaveAs(path + Path.GetFileName(postedFile.FileName));
                        uploadTradeVM = new UploadTradeVM()
                        {
                            Shipping             = new ViewModel.Shipping(),
                            DocumentInstructions = new List <DocumentInstructionVM>(),
                            ShippingModels       = new List <ShippingModelVM>()
                        };

                        ProcessInputFile((path + Path.GetFileName(postedFile.FileName)));
                    }
                    break;
                }
                return(View(uploadTradeVM));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }