protected void btnSaveMatrix_Click(object sender, EventArgs e) { int count = this.materialCtrlForMatrix.Materials.Count; if (count > 0 && !this.materialCtrlForMatrix.DeltaMaterials.IsEmpty()) { Material keyTerial = null; if (this.materialCtrlForMatrix.DeltaMaterials.Inserted.Count > 0) { keyTerial = this.materialCtrlForMatrix.DeltaMaterials.Inserted[this.materialCtrlForMatrix.DeltaMaterials.Inserted.Count - 1]; } else if (this.materialCtrlForMatrix.DeltaMaterials.Updated.Count > 0) { keyTerial = this.materialCtrlForMatrix.DeltaMaterials.Updated[this.materialCtrlForMatrix.DeltaMaterials.Updated.Count - 1]; } if (keyTerial != null) { string[] itemsInfio = this.materialCtrlForMatrix.RequestContext.Split(';'); string processKey = itemsInfio[2]; using (Stream LoadFile = keyTerial.GetTemporaryContent(this.materialCtrlForMatrix.RootPathName)) { WfMatrix.ImportExistMatrixFromExcel2007(LoadFile, null, processKey); } } } }
protected void uploadProgress_DoUploadProgress(HttpPostedFile file, UploadProgressResult result) { var fileType = Path.GetExtension(file.FileName).ToLower(); if (fileType != ".xml" && fileType != ".xlsx") { throw new Exception("'{0}' must be a xml or xlsx file."); } UploadProgressStatus status = new UploadProgressStatus(); status.CurrentStep = 1; status.MinStep = 0; status.MaxStep = 20; Action notifier = () => { if (status.CurrentStep + 1 < status.MaxStep) { status.CurrentStep++; } status.Response(); }; if (fileType == ".xml") { WfMatrix.ImportExistMatrixFromExcelXml(file.InputStream, notifier, ProcessKey); } else if (fileType == ".xlsx") { WfMatrix.ImportExistMatrixFromExcel2007(file.InputStream, notifier, ProcessKey); } result.DataChanged = true; result.CloseWindow = true; }