public errorCompositeType AddExchangeFile(ExchangeFileCompositeType tect) { errorCompositeType lstError = new errorCompositeType(); try { ExchangeFile te = new ExchangeFile(); te.InsertTaskExchange(tect); lstError.bError = true; lstError.sError = ""; return(lstError); } catch (Exception ex) { lstError.bError = false; lstError.sError = ex.Message; return(lstError); } }
protected void btnGrabar_Click(object sender, EventArgs e) { try { util.GetActionMenu(mpMenu.SelectedItem.Value); var efct = new ExchangeFileCompositeType(); var em = new ExchangeFileManager(); if (RadAsyncUpload1.UploadedFiles.Count > 0) { efct.sLabel = RadAsyncUpload1.UploadedFiles[0].FileName; efct.iTiype = 1; efct.iExchange = int.Parse(lblIdExchange.Text); efct.sURL = ConfigurationManager.AppSettings["URLArchivos"].ToString() + '\\' + efct.iExchange; var DIR = new DirectoryInfo(efct.sURL); if (!DIR.Exists) { DIR.Create(); } RadAsyncUpload1.UploadedFiles[0].SaveAs(efct.sURL + "\\" + RadAsyncUpload1.UploadedFiles[0].FileName); em.AddExchangeFile(efct); util.ErroDisplay(5, string.Empty, ref lblMessage); gvDocuments.Rebind(); } else { Util.isRequired("", "Archivo "); } } catch (AccessViolationException ave) { Alert.Permisos(this.Page); } catch (ArgumentException ae) { util.ErroDisplay(3, ae.Message, ref lblMessage); } catch (Exception ex) { util.ErroDisplay(1, ex.Message, ref lblMessage); } }