예제 #1
0
        protected void btnAddAtencion_Click(object sender, EventArgs e)
        {
            string err = string.Empty;

            try
            {
                if (ValidCambio(out err))
                {
                    List <DTO.TipoCambioDTO> aux = TipoCambio;

                    var tipoCambio = new DTO.TipoCambioDTO();

                    for (int i = 0; i <= TipoCambio.Count - 1; i++)
                    {
                        if (TipoCambio[i].FechaInicio.ToShortDateString() == deVigDesde0.Date.ToShortDateString())
                        {
                            return;
                        }
                    }

                    tipoCambio.RecId       = aux.Count;
                    tipoCambio.Valor       = spDuracion0.Number;
                    tipoCambio.FechaInicio = deVigDesde0.Date;

                    for (int i = 0; i <= aux.Count - 1; i++)
                    {
                        if (aux[i].FechaInicio == tipoCambio.FechaInicio)
                        {
                            err = "Fecha ya asignada.";

                            return;
                        }
                    }

                    aux.Add(tipoCambio);

                    spDuracion0.Value = null;
                    deVigDesde0.Date  = DateTime.Today;

                    TipoCambio = aux;
                    RefreshAbmGrid(gvABM);
                }
                else
                {
                    throw new Exception(err);
                }
            }
            catch (Exception ex)
            {
                FormsHelper.MsgError(lblErrorProducto, ex);
            }
        }
예제 #2
0
        protected void btnAddAtencion_Click(object sender, EventArgs e)
        {
            string err = string.Empty;

            try
            {
                if (ValidCambio(out err))
                {
                    List<DTO.TipoCambioDTO> aux = TipoCambio;

                    var tipoCambio = new DTO.TipoCambioDTO();

                    for(int i = 0;i<=TipoCambio.Count-1;i++)
                    {
                        if (TipoCambio[i].FechaInicio.ToShortDateString() == deVigDesde0.Date.ToShortDateString())
                        {
                            return;
                        }
                    }

                    tipoCambio.RecId       = aux.Count;
                    tipoCambio.Valor       = spDuracion0.Number;
                    tipoCambio.FechaInicio = deVigDesde0.Date;

                    for (int i = 0; i <= aux.Count - 1; i++)
                    {
                        if(aux[i].FechaInicio == tipoCambio.FechaInicio)
                        {
                            err = "Fecha ya asignada.";

                            return;
                        }

                    }

                    aux.Add(tipoCambio);

                    spDuracion0.Value = null;
                    deVigDesde0.Date  = DateTime.Today;

                    TipoCambio = aux;
                    RefreshAbmGrid(gvABM);
                }
                else
                {
                    throw new Exception(err);
                }
            }
            catch (Exception ex)
            {
                FormsHelper.MsgError(lblErrorProducto, ex);
            }
        }