Esempio n. 1
0
        public void Invertir()
        {
            var points = Points.Get();

            if (points == null || points.Count == 0)
            {
                return;
            }
            points.Reverse();
            SetLine(points);
        }
Esempio n. 2
0
 protected void SaveCommand(object sender, CommandEventArgs e)
 {
     try
     {
         var viaje = DAOFactory.ViajeDistribucionDAO.FindById(ControlandoId.Get());
         if (e.CommandName == "Cancel")
         {
             Controlar(viaje, false);
             SetView(Views.Control);
         }
         else
         {
             WebControl txt = null;
             foreach (C1GridViewRow row in gridEntregas.Rows)
             {
                 var txtKmControlado = row.FindControl("txtKmControlado") as TextBox;
                 txtKmControlado.CssClass = "LogicTextbox_Invalid";
                 var km = ValidateDouble(txtKmControlado.Text, "KM");
                 txtKmControlado.CssClass = "LogicTextbox";
                 var id      = Convert.ToInt32(gridEntregas.DataKeys[row.RowIndex].Value);
                 var entrega = viaje.Detalles.First(d => d.Id == id);
                 entrega.KmControlado = km;
                 DAOFactory.EntregaDistribucionDAO.SaveOrUpdate(entrega);
                 txt = txtKmControlado;
             }
             ShowInfo("Valores guardados correctamente");
             if (e.CommandName == "Control")
             {
                 Controlar(viaje, true);
                 Move(Navigate.Fwd);
             }
             else
             {
                 // recalcular total km controlado por javascript
                 if (txt != null)
                 {
                     var sh = new ScriptHelper(this);
                     sh.RegisterStartupScript("calcularTotal", string.Format("calcularTotal($get('{0}'));", txt.ClientID));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ShowError(ex);
     }
 }