protected void OnExport(object sender, EventArgs e) { try { string fileName = TBFileName.Text; fileName = Path.ChangeExtension(fileName, "csv"); byte[] fileBytes = null; byte[] imageFileBytes = null; PalletStacking.Export( DimCase, WeightCase, DimPallet, WeightPallet, MaxPalletHeight, BoxPositions, ChkbMirrorLength.Checked, ChkbMirrorWidth.Checked, InterlayersBoolArray, ref fileBytes, ParseImageFormat(ConfigSettings.ExportImageFormat), ref imageFileBytes); if (FtpHelpers.Upload(fileBytes, ConfigSettings.FtpDirectory, fileName, ConfigSettings.FtpUsername, ConfigSettings.FtpPassword) && FtpHelpers.Upload(imageFileBytes, ConfigSettings.FtpDirectory + "Images/", Path.ChangeExtension(fileName, ConfigSettings.ExportImageFormat), ConfigSettings.FtpUsername, ConfigSettings.FtpPassword)) { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", $"alert('{fileName} was successfully exported!');", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", $"alert('{ex.Message}');", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DropDownListFiles.DataSource = FtpHelpers.GetListOfFiles(ConfigSettings.FtpDirectory, ConfigSettings.FtpUsername, ConfigSettings.FtpPassword); DropDownListFiles.DataBind(); DimCase = new Vector3D(300.0, 280.0, 275.0); WeightCase = 1.0; WeightPallet = 23.0; PalletIndex = 0; NumberOfLayers = 8; BoxPositions = new List <BoxPositionIndexed>(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DropDownListFiles.DataSource = FtpHelpers.GetListOfFiles(ConfigSettings.FtpDirectory, ConfigSettings.FtpUsername, ConfigSettings.FtpPassword); DropDownListFiles.DataBind(); DimCase = new Vector3D(300.0, 280.0, 275.0); WeightCase = 1.0; DimPallet = new Vector3D(1200.0, 1000.0, 155.0); WeightPallet = 23.0; MaxPalletHeight = 1700.0; BoxPositions = new List <BoxPosition>(); } }
protected void OnOpenProject(object sender, EventArgs e) { // get selected file name var dimCase = Vector3D.Zero; double weightCase = 0.0; var dimPallet = Vector3D.Zero; double weightPallet = 0.0; bool MirrorX = false, MirrorY = false; int numberOfLayers = 0; List <BoxPositionIndexed> boxPositions = new List <BoxPositionIndexed>(); List <bool> interlayers = new List <bool>(); int layerDesignMode = 0; string filePath = DropDownListFiles.SelectedValue; byte[] fileContent = null; FtpHelpers.Download(ref fileContent, ConfigSettings.FtpDirectory, filePath, ConfigSettings.FtpUsername, ConfigSettings.FtpPassword); ExporterCSV_TechBSA.Import(new MemoryStream(fileContent), ref boxPositions, ref dimCase, ref weightCase, ref dimPallet, ref weightPallet, ref numberOfLayers, ref MirrorX, ref MirrorY, ref interlayers, ref layerDesignMode); DimCase = dimCase; WeightCase = weightCase; PalletIndex = 0; WeightPallet = weightPallet; NumberOfLayers = numberOfLayers; BoxPositions = boxPositions; LayersMirrorX = MirrorX; LayersMirrorY = MirrorY; LayerEdited = true; FileName = filePath; Interlayers = string.Concat(interlayers.Select(p => p ? "1" : "0").ToArray()); LayerDesignMode = layerDesignMode; if (ConfigSettings.WebGLMode) { Response.Redirect("ValidationWebGL.aspx"); } else { Response.Redirect("Validation.aspx"); } }
protected void OnOpenProject(object sender, EventArgs e) { // get selected file name var dimCase = Vector3D.Zero; double weightCase = 0.0; var dimPallet = Vector3D.Zero; double weightPallet = 0.0; bool MirrorX = false, MirrorY = false; int numberOfLayers = 0; List <BoxPositionIndexed> boxPositions = new List <BoxPositionIndexed>(); List <bool> interlayers = new List <bool>(); string filePath = DropDownListFiles.SelectedValue; byte[] fileContent = null; FtpHelpers.Download(ref fileContent, ConfigSettings.FtpDirectory, filePath, ConfigSettings.FtpUsername, ConfigSettings.FtpPassword); ExporterCSV_TechBSA.Import(new MemoryStream(fileContent), ref boxPositions, ref dimCase, ref weightCase, ref dimPallet, ref weightPallet, ref numberOfLayers, ref MirrorX, ref MirrorY, ref interlayers); string queryString = string.Empty; if (ConfigSettings.UseSessionState) { DimCase = dimCase; WeightCase = weightCase; PalletIndex = 0; WeightPallet = weightPallet; NumberOfLayers = numberOfLayers; BoxPositions = boxPositions; LayersMirrorX = MirrorX; LayersMirrorY = MirrorY; LayerEdited = true; FileName = filePath; Interlayers = string.Concat(interlayers.Select(p => p ? "1" : "0").ToArray());; } else { string interlayerArray = string.Concat(interlayers.Select(p => p ? "1" : "0").ToArray()); string fileBoxPositions = string.Empty; StringBuilder sb = new StringBuilder(); sb.Append(" ? "); sb.Append($"DimCase={dimCase}"); sb.Append($"WeightCase={weightCase}"); sb.Append($"&DimPallet={dimPallet}"); sb.Append($"&WeightPallet={weightPallet}"); sb.Append($"&NumberOfLayers={numberOfLayers}"); sb.Append($"&BoxPositionsFile={fileBoxPositions}"); sb.Append($"&LayerMirrorX={MirrorX}"); sb.Append($"&LayerMirrorY={MirrorY}"); sb.Append($"LayerEdited={true}"); sb.Append($"FileName={filePath}"); sb.Append($"Interlayers={interlayerArray}"); queryString = sb.ToString(); } if (ConfigSettings.WebGLMode) { Response.Redirect("ValidationWebGL.aspx" + queryString); } else { Response.Redirect("Validation.aspx" + queryString); } }