//----------------------------------------- private clsDocumentoVM DocumentoFind(int DocId) { clsDocumento oDocumento = new clsDocumento(clsAppInfo.Connection); clsDocumentoVM oDocumentoVM = new clsDocumentoVM(); try { oDocumento.DocId = DocId; if (oDocumento.FindByPK()) { oDocumentoVM.DocId = SysData.ToLong(oDocumento.DocId); oDocumentoVM.DocCod = SysData.ToStr(oDocumento.DocCod); oDocumentoVM.DocNem = SysData.ToStr(oDocumento.DocNem); oDocumentoVM.DocDes = SysData.ToStr(oDocumento.DocDes); oDocumentoVM.DocIso = SysData.ToStr(oDocumento.DocIso); oDocumentoVM.DocRev = SysData.ToStr(oDocumento.DocRev); oDocumentoVM.DocFec = SysData.ToStr(oDocumento.DocFec); oDocumentoVM.AplicacionId = SysData.ToLong(oDocumento.AplicacionId); oDocumentoVM.ModuloId = SysData.ToLong(oDocumento.ModuloId); oDocumentoVM.EstadoId = SysData.ToLong(oDocumento.EstadoId); } } catch (Exception exp) { throw exp; } finally { oDocumento.Dispose(); } return(oDocumentoVM); }
private void CargarGridTipoDocumento() { try { cdsDocumento.Clear(); Params.Clear(); DataTable dt = new DataTable(); BindingSource bs = new BindingSource(); clsDocumento objDocumento = new clsDocumento(); //Lenamos el DS de Categorias Params.Clear(); Data.DataModule.ParamByName(Params, "Datos", ""); Data.DataModule.FillDataSet(cdsDocumento, NombreDataSetDocumento, Params.ToArray()); dt = spDocumentoDS.Tables[NombreDataSetDocumento]; lstDocumento = objDocumento.FillList(dt); bs.DataSource = lstDocumento; lueTipoDocumento.EditValue = 0; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult DeleteConfirmed(int?DocId) { try { if (ReferenceEquals(DocId, null)) { return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = resources.Resources.IndiceNulo })); } clsDocumento oDocumento = new clsDocumento(clsAppInfo.Connection); oDocumento.WhereFilter = clsDocumento.WhereFilters.PrimaryKey; oDocumento.DocId = Convert.ToInt32(DocId); if (oDocumento.Delete()) { return(RedirectToAction("Index")); } ViewBagLoad(); clsDocumentoVM oDocVM = DocumentoFind(Convert.ToInt32(DocId)); return(View(oDocVM)); } catch (Exception exp) { return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = exp.Message })); } }
public ActionResult Edit(clsDocumentoVM oDocVM) { try { if (ModelState.IsValid) { clsDocumento oDocumento = new clsDocumento(clsAppInfo.Connection); DataMove(oDocumento, oDocVM, true); if (oDocumento.Update()) { return(RedirectToAction("Index")); } else { ViewBag.MessageErr = resources.Resources.NoActualizado; } } ViewBagLoad(); return(View(oDocVM)); } catch { return(View()); } }
private void btnFinalizar_Click(object sender, EventArgs e) { Controles.frmGauge gauge = new Controles.frmGauge(); gauge.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; gauge.pb.Minimum = 0; gauge.pb.Maximum = imagenesCapturadas.Images.Count - 1; gauge.pb.Value = 0; gauge.Show(); //Grabar y Cerrar el Formulario Cursor = Cursors.AppStarting; foreach (IScannedImage img in imagenesCapturadas.Images) { clsDocumento newDocumento = new clsDocumento("*"); newDocumento.idPadre = Convert.ToInt32(((Clases.clsNodoTiny)nodoActual.Tag).idNodo); newDocumento.idUnicoExpediente = Expediente.id; newDocumento.orden = 0; newDocumento.fijarImagen(img.GetImageBase64()); try { newDocumento.guardarDatos(Clases.vGlobales.id_User); } catch (InvalidOperationException er) { MessageBox.Show("Problemas al guardar Datos\n\r" + er.Message); Cursor = Cursors.Default; return; } try { newDocumento.guardarImagen(Clases.vGlobales.id_User); } catch (InvalidOperationException er) { MessageBox.Show("Problemas al guardar la Imagen\n\r" + er.Message); Cursor = Cursors.Default; return; } gauge.pb.PerformStep(); gauge.BringToFront(); System.Windows.Forms.Application.DoEvents(); } gauge.Close(); gauge.Dispose(); Cursor = Cursors.Default; bsalida = true; }
private void DataMove(clsDocumento oDocumento, clsDocumentoVM oDocVM, bool editing) { if (editing) { oDocumento.DocId = SysData.ToLong(oDocVM.DocId); } oDocumento.DocCod = SysData.ToStr(oDocVM.DocCod); oDocumento.DocNem = SysData.ToStr(oDocVM.DocNem); oDocumento.DocDes = SysData.ToStr(oDocVM.DocDes); oDocumento.DocIso = SysData.ToStr(oDocVM.DocIso); oDocumento.DocRev = SysData.ToStr(oDocVM.DocRev); oDocumento.DocFec = SysData.ToStr(oDocVM.DocFec); oDocumento.AplicacionId = SysData.ToLong(oDocVM.AplicacionId); oDocumento.ModuloId = SysData.ToLong(oDocVM.ModuloId); oDocumento.EstadoId = SysData.ToLong(oDocVM.EstadoId); }
private object Documentos() { clsDocumento oDocumento = new clsDocumento(clsAppInfo.Connection); List <clsDocumentoVM> oDocVM = new List <clsDocumentoVM>(); try { oDocumento.SelectFilter = clsDocumento.SelectFilters.Grid; oDocumento.WhereFilter = clsDocumento.WhereFilters.Grid; oDocumento.OrderByFilter = clsDocumento.OrderByFilters.Grid; if (oDocumento.Open()) { foreach (DataRow dr in oDocumento.DataSet.Tables[oDocumento.TableName].Rows) { oDocVM.Add(new clsDocumentoVM() { DocId = SysData.ToLong(dr["DocId"]), DocCod = SysData.ToStr(dr["DocCod"]), DocNem = SysData.ToStr(dr["DocNem"]), DocDes = SysData.ToStr(dr["DocDes"]), DocIso = SysData.ToStr(dr["DocCod"]), DocRev = SysData.ToStr(dr["DocRev"]), DocFec = SysData.ToStr(dr["DocRev"]), ModuloDes = SysData.ToStr(dr["ModuloDes"]), AplicacionDes = SysData.ToStr(dr["AplicacionDes"]), EstadoDes = SysData.ToStr(dr["EstadoDes"]) }); } } return(oDocVM); } catch (Exception exp) { throw exp; } finally { oDocumento.Dispose(); } return(oDocVM); }
public ActionResult Create(clsDocumentoVM oDocVM) { try { if (ModelState.IsValid) { clsDocumento oDocumento = new clsDocumento(clsAppInfo.Connection); DataMove(oDocumento, oDocVM, false); if (oDocumento.Insert()) { return(RedirectToAction("Index")); } } ViewBagLoad(); return(View(oDocVM)); } catch (Exception ex) { return(RedirectToAction("httpErrorMsg", "Error", new { MessageErr = ex.Message })); } }
private void btnFinalizar_Click(object sender, EventArgs e) { Cursor = Cursors.AppStarting; //Mandar Grabar los elementos en la Base de Datos //Grabar los Datos de los Expediente Clases.clsExpediente newExpediente = new Clases.clsExpediente("*"); newExpediente.idLlave = iTXTidUnico.Text.ToString().Trim(); newExpediente.idPadre = nodoBD.id; newExpediente.idFormulario = nodoBD.idFormulario.ToString(); try { newExpediente.guardarDatos(Clases.vGlobales.id_User); } catch (InvalidOperationException er) { MessageBox.Show("Problemas al guardar Datos\n\r" + er.Message); Cursor = Cursors.Default; return; } //Grabar los Campos del Expediente foreach (PropertyGridEx.CustomProperty p in PGExpediente.Item) { if (p.Value.ToString().Trim().Length != 0) { Clases.clsCampoDato campo = new Clases.clsCampoDato(Clases.clsCampoDato.TipoCampo.Expediente, newExpediente.id.ToString(), p.Tag.ToString()); campo.valor = p.Value.ToString(); if (!campo.guardarDatos(Clases.vGlobales.id_User)) { MessageBox.Show(campo.msgError, "Error al Guardar datos del Campo " + p.Tag); } } } //Grabar las imagenes en la Base de Datos //Por los Tipos de Documentos //Recorrer El arbol con los Tipos de Documentos. foreach (TreeNode nDocumento in tvTiposDocumentos.Nodes) { // Control de Avance de grabación Controles.frmGauge gauge = new Controles.frmGauge(); gauge.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; gauge.pb.Minimum = 0; gauge.pb.Maximum = imagenesCapturadas[nDocumento.Index].Images.Count - 1; gauge.pb.Value = 0; gauge.Show(); foreach (IScannedImage img in imagenesCapturadas[nDocumento.Index].Images) { clsDocumento newDocumento = new clsDocumento("*"); newDocumento.idPadre = Convert.ToInt16(nDocumento.Tag.ToString()); newDocumento.idUnicoExpediente = newExpediente.id; newDocumento.orden = imagenesCapturadas[nDocumento.Index].Images.IndexOf(img) + 1; newDocumento.fijarImagen(img.GetImageBase64()); try { newDocumento.guardarDatos(Clases.vGlobales.id_User); } catch (InvalidOperationException er) { MessageBox.Show("Problemas al guardar Datos\n\r" + er.Message); Cursor = Cursors.Default; return; } try { newDocumento.guardarImagen(Clases.vGlobales.id_User); } catch (InvalidOperationException er) { MessageBox.Show("Problemas al guardar la Imagen\n\r" + er.Message); Cursor = Cursors.Default; return; } gauge.pb.PerformStep(); gauge.BringToFront(); System.Windows.Forms.Application.DoEvents(); } gauge.Close(); gauge.Dispose(); } Cursor = Cursors.Default; bsalida = true; }