コード例 #1
0
ファイル: CrucesAdmin.cs プロジェクト: JoseLuisPerez91/SIPRED
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            bool   _Connection = new lSerializados().CheckConnection(Configuration.UrlConnection);
            string _Message    = "No existe conexión con el servidor de datos... Contacte a un Administrador de Red para ver las opciones de conexión.";
            string _Title      = "Conexión de Red";

            if (_Connection)
            {
                int          Row     = DtCruces.CurrentCell.RowIndex;
                int          IDCruce = Convert.ToInt32(DtCruces.Rows[Row].Cells[0].Value.ToString());
                DialogResult dialogo = MessageBox.Show("Desea eliminar el cruce número " + IDCruce.ToString() + "?",
                                                       "Confirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dialogo == DialogResult.Yes)
                {
                    _Message = ((cmbTipo.SelectedIndex == 0) ? "- Debe seleccionar un tipo de plantilla" : "");
                    if (_Message.Length > 0)
                    {
                        MessageBox.Show(_Message, "Información Faltante", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    DialogResult _response = DialogResult.None;

                    oCruce _Template = new oCruce()
                    {
                        IdCruce         = IDCruce,
                        IdTipoPlantilla = cmbTipo.SelectedIndex,
                        Concepto        = "",
                        Formula         = "",
                        Condicion       = "",
                        Nota            = "",
                        LecturaImportes = 0
                    };
                    KeyValuePair <bool, string[]> _result = new lCrucesAdmin(_Template, "E").Delete();
                    string _Messages = "";
                    foreach (string _Msg in _result.Value)
                    {
                        _Messages += ((_Messages.Length > 0) ? "\r\n" : "") + _Msg;
                    }
                    if (_result.Key && _response != DialogResult.Yes)
                    {
                        _Messages = "Cruce eliminado con éxito";
                    }
                    MessageBox.Show(_Messages, (_result.Key) ? "Proceso Existoso" : "Información Faltante", MessageBoxButtons.OK, (_result.Key) ? MessageBoxIcon.Information : MessageBoxIcon.Exclamation);
                    if (_result.Key)
                    {
                        this.Hide();
                    }
                }
            }
            else
            {
                MessageBox.Show(_Message, _Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: CrucesAdmin.cs プロジェクト: JoseLuisPerez91/SIPRED
        private void btnModificar_Click(object sender, EventArgs e)
        {
            string _Message = ((cmbTipo.SelectedIndex == 0) ? "- Debe seleccionar un tipo de plantilla" : "");

            if (_Message.Length > 0)
            {
                MessageBox.Show(_Message, "Información Faltante", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            int             Row     = DtCruces.CurrentCell.RowIndex;
            int             IDCruce = Convert.ToInt32(DtCruces.Rows[Row].Cells[0].Value.ToString());
            oCruce          _Cruce  = _Cruces.Where(o => o.IdCruce == IDCruce).FirstOrDefault();
            ActualizarCruce form    = new ActualizarCruce(IDCruce, _Cruce, cmbTipo.SelectedIndex, "M");

            form.Text = "Modificar cruce";
            form.ShowDialog();
            CargaDTCruces();
        }
コード例 #3
0
 public lCrucesAdmin(oCruce _Template, string accion) : base(_Template)
 {
     Template = _Template;
     if ((accion == "A") || (accion == "M"))
     {
         if (Template.IdTipoPlantilla == 0)
         {
             _Messages.Add("Debe seleccionar un tipo.");
         }
         if (string.IsNullOrEmpty(Template.Concepto) || string.IsNullOrWhiteSpace(Template.Concepto))
         {
             _Messages.Add("Debe seleccionar un concepto.");
         }
         if (string.IsNullOrEmpty(Template.Formula) || string.IsNullOrWhiteSpace(Template.Formula))
         {
             _Messages.Add("Debe seleccionar un formula.");
         }
     }
 }
コード例 #4
0
        public ActualizarCruce(int IdCruce, oCruce _Cruce, int IDPlantilla, string Accion)
        {
            InitializeComponent();
            txtNro.Text = IdCruce.ToString();
            if (_Cruce != null)
            {
                txtConcepto.Text = _Cruce.Concepto;
                string[] Formula = _Cruce.Formula.Split('=');
                txtcruzar.Text    = Formula[0];
                txtcontra.Text    = Formula[1];
                txtCondicion.Text = _Cruce.Condicion;
                if (txtCondicion.Text.Trim() != "")
                {
                    txtCondicion.ReadOnly  = false;
                    chkCondicionar.Checked = true;
                }
                txtNota.Text             = _Cruce.Nota;
                rbConsideraSigno.Checked = (_Cruce.LecturaImportes == 1);
                rbVabsoluto.Checked      = (_Cruce.LecturaImportes == 0);
            }
            accion = Accion;

            TpPlantilla = IDPlantilla;
        }
コード例 #5
0
 public aCrucesAdmin(oCruce _Template) : base()
 {
 }
コード例 #6
0
ファイル: CrucesAdmin.cs プロジェクト: JoseLuisPerez91/SIPRED
        /// <summary>
        /// Carga el Grid 2-Formulas y la descripción de la misma segun el click que haga el usuario en el Grid  1- Cruces
        /// </summary>
        /// <param name="Row"></param>
        private void CrucesCLick(int Row)
        {
            try
            {
                if (Row >= 0)
                {
                    int IDCruce = Convert.ToInt32(DtCruces.Rows[Row].Cells[0].Value.ToString());
                    int IdTp    = Convert.ToInt32(cmbTipo.SelectedValue);

                    Workbook  wb          = Globals.ThisAddIn.Application.ActiveWorkbook;
                    Worksheet xlSht       = null;
                    Range     currentCell = null;
                    Range     currentFind = null;
                    oCruce    _Cruce      = _Cruces.Where(o => o.IdCruce == IDCruce).FirstOrDefault();

                    _Cruce.setCeldas();
                    List <oCelda> CeldaNws = new List <oCelda>();
                    foreach (oCelda _Celda in _Cruce.CeldasFormula)
                    {
                        xlSht = (Worksheet)wb.Worksheets.get_Item(_Celda.Anexo);
                        int _maxValue = xlSht.UsedRange.SpecialCells(XlCellType.xlCellTypeLastCell).Row;

                        currentCell = (Range)xlSht.get_Range("A1", "A" + (_maxValue).ToString());
                        currentFind = currentCell.Find(_Celda.Indice, Type.Missing, XlFindLookIn.xlValues, XlLookAt.xlPart,
                                                       XlSearchOrder.xlByRows, XlSearchDirection.xlNext, false,
                                                       Type.Missing, Type.Missing);

                        _Celda.Fila = currentFind.Row;

                        currentCell = (Range)xlSht.Cells[_Celda.Fila, 2];
                        if (currentCell.get_Value(Type.Missing) != null)
                        {
                            _Celda.Concepto = currentCell.get_Value(Type.Missing).ToString();
                        }
                        else
                        {
                            _Celda.Concepto = "";
                        }

                        CeldaNws.Add(_Celda);
                    }

                    var _FormulaI = (from x in CeldaNws
                                     select new
                    {
                        Anexo = x.Anexo,
                        Indice = x.Indice,
                        x.Concepto,
                        Col = Generales.ColumnAdress(x.Columna),
                        CodSAT = ""
                    }).ToList();

                    DtFormula.DataSource = ToDataTable(_FormulaI);
                    txtDetalle.Text      = "Cruce: " + _Cruce.Formula + System.Environment.NewLine + "Condición: " + _Cruce.Condicion;
                }
                else
                {
                    DtFormula.DataSource = null;
                    txtDetalle.Text      = "";
                }
            }
            catch
            {
                this.Hide();
                MessageBox.Show("Archivo no válido, favor de generar el archivo mediante el AddIn D.SAT", "Información Incorrecta", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
        private void btguardar_Click(object sender, EventArgs e)
        {
            bool   _Connection = new lSerializados().CheckConnection(Configuration.UrlConnection);
            string _Message    = "No existe conexión con el servidor de datos... Contacte a un Administrador de Red para ver las opciones de conexión.";
            string _Title      = "Conexión de Red";

            if (_Connection)
            {
                _Message  = (txtConcepto.Text.Trim() == "") ? "- Debe indicar concepto." : "";
                _Message += (txtcruzar.Text.Trim() == "") ? ((_Message.Length > 0) ? "\r\n" : "") + "- Debe indicar cruzar." : "";
                _Message += (txtcontra.Text.Trim() == "") ? ((_Message.Length > 0) ? "\r\n" : "") + "- Debe indicar contra." : "";
                _Message += (chkCondicionar.Checked && txtCondicion.Text.Trim() == "") ? ((_Message.Length > 0) ? "\r\n" : "") + "- Debe indicar condición." : "";

                if (_Message.Length > 0)
                {
                    MessageBox.Show(_Message, "Información Faltante", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                DialogResult _response = DialogResult.None;
                string       Formulax  = (txtcruzar.Text + "=" + txtcontra.Text);
                string       condicion = "";
                int          Valor     = 0;
                if (chkCondicionar.Checked)
                {
                    condicion = txtCondicion.Text;
                }
                if (rbConsideraSigno.Checked)
                {
                    Valor = 1;
                }

                oCruce _Template = new oCruce()
                {
                    IdCruce         = Convert.ToInt32(txtNro.Text),
                    IdTipoPlantilla = TpPlantilla,//buscar
                    Concepto        = txtConcepto.Text,
                    Formula         = Formulax,
                    Condicion       = condicion,
                    Nota            = txtNota.Text,
                    LecturaImportes = Valor
                };

                if (accion == "A")
                {
                    KeyValuePair <bool, string[]> _result = new lCrucesAdmin(_Template, accion).Add();

                    string _Messages = "";
                    foreach (string _Msg in _result.Value)
                    {
                        _Messages += ((_Messages.Length > 0) ? "\r\n" : "") + _Msg;
                    }
                    if (_result.Key && _response != DialogResult.Yes)
                    {
                        _Messages = "Cruce agregado con éxito";
                    }
                    MessageBox.Show(_Messages, (_result.Key) ? "Proceso Existoso" : "Información Faltante", MessageBoxButtons.OK, (_result.Key) ? MessageBoxIcon.Information : MessageBoxIcon.Exclamation);
                    if (_result.Key)
                    {
                        this.Hide();
                    }
                }
                else
                if (accion == "M")
                {
                    KeyValuePair <bool, string[]> _result = new lCrucesAdmin(_Template, accion).Update();

                    string _Messages = "";
                    foreach (string _Msg in _result.Value)
                    {
                        _Messages += ((_Messages.Length > 0) ? "\r\n" : "") + _Msg;
                    }
                    if (_result.Key && _response != DialogResult.Yes)
                    {
                        _Messages = "Cruce modificado con éxito";
                    }
                    MessageBox.Show(_Messages, (_result.Key) ? "Proceso Existoso" : "Información Faltante", MessageBoxButtons.OK, (_result.Key) ? MessageBoxIcon.Information : MessageBoxIcon.Exclamation);
                    if (_result.Key)
                    {
                        this.Hide();
                    }
                }
            }
            else
            {
                MessageBox.Show(_Message, _Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }