Exemple #1
0
        protected void reorderDetalles_ItemDataBound(object sender, ReorderListItemEventArgs e)
        {
            var data = e.Item.DataItem as EntregaDistribucion;

            if (data == null)
            {
                return;
            }
            var color     = GetColor(data.Viaje.Id);
            var backColor = new RGBColor {
                Color = color
            };
            var foreColor = new RGBColor {
                Color = GetForeColor(color)
            };

            var panelHandle = e.Item.GetControl("panelHandle") as Panel;
            var panelItem   = e.Item.GetControl("panelItem") as Panel;
            var intercalado = e.Item.DataItemIndex == selectedIndex;

            panelItem.Visible   = !intercalado;
            panelHandle.Visible = intercalado;
            var panel = intercalado ? panelHandle : panelItem;

            (panel.GetControl("litColor") as Literal).Text      = string.Format("background-color: #{0}; color: #{1};", backColor.HexValue, foreColor.HexValue);
            (panel.GetControl("lblOrden") as Label).Text        = (orden++).ToString("0");
            (panel.GetControl("lblDescripcion") as Label).Text  = data.Descripcion;
            (panel.GetControl("lblCliente") as Label).Text      = data.Cliente != null ? data.Cliente.Descripcion : string.Empty;
            (panel.GetControl("lblDemora") as Label).Text       = (data.TipoServicio != null ? data.TipoServicio.Demora : 0) + "min";
            (panel.GetControl("lblTipoServicio") as Label).Text = data.Linea != null ? string.Empty : ("[" + (data.TipoServicio != null ? data.TipoServicio.Descripcion : "ninguno") + "]");
            var lblHora = (panel.GetControl("lblHora") as Label);

            lblHora.Text      = data.Programado.ToString("HH:mm");
            lblHora.ForeColor = Color.Green;
        }
Exemple #2
0
    protected void rolMeasurementUnitsConverts_ItemDataBound(object sender, ReorderListItemEventArgs e)
    {
        ReorderListItem         rolItem         = e.Item as ReorderListItem;
        LinkButton              btn             = rolItem.FindControl("btnUpdate") as LinkButton;
        Label                   textLine        = rolItem.FindControl("lbMeasurementUnitsConvertText") as Label;
        MeasurementUnitsConvert MeasuresConvert = e.Item.DataItem as MeasurementUnitsConvert;

        if (MeasuresConvert != null)
        {
            btn.PostBackUrl = string.Format("~/Admin/MeasurementUnitsConvert.aspx?ConvertId={0}", MeasuresConvert.ConvertId);
            string   from    = MeasuresConvert.FromQuantity.ToString();
            string[] fromStr = from.Split('.');
            if (fromStr[1] == "00")
            {
                from = fromStr[0];
            }

            string   to    = MeasuresConvert.ToQuantity.ToString();
            string[] toStr = to.Split('.');
            if (toStr[1] == "00")
            {
                to = toStr[0];
            }

            Food            food = BusinessFacade.Instance.GetFood(MeasuresConvert.FoodId);
            MeasurementUnit sourceMeasureUnit = BusinessFacade.Instance.GetMeasurementUnit(MeasuresConvert.FromUnitId);
            MeasurementUnit targetMeasureUnit = BusinessFacade.Instance.GetMeasurementUnit(MeasuresConvert.ToUnitId);

            textLine.Text = string.Format("{0} {1} {2} = {3} {4}", from, sourceMeasureUnit.UnitName, food.FoodName, to, targetMeasureUnit.UnitName);
        }

        //btn = rolItem.FindControl("btnDelete") as LinkButton;
        // btn.Visible = MeasuresConvert.AllowDelete;
    }
    protected void rolMeasurementUnitsConverts_ItemDataBound(object sender, ReorderListItemEventArgs e)
    {
        ReorderListItem         rolItem         = e.Item as ReorderListItem;
        LinkButton              btn             = rolItem.FindControl("btnUpdate") as LinkButton;
        Label                   textLine        = rolItem.FindControl("lbMeasurementUnitsConvertText") as Label;
        MeasurementUnitsConvert MeasuresConvert = e.Item.DataItem as MeasurementUnitsConvert;

        if (MeasuresConvert != null)
        {
            btn.PostBackUrl = string.Format("~/Admin/MeasurementUnitsConvert.aspx?ConvertId={0}", MeasuresConvert.ConvertId);
            string   from    = MeasuresConvert.FromQuantity.ToString();
            string[] fromStr = from.Split('.');
            if (fromStr[1] == "00")
            {
                from = fromStr[0];
            }

            string   to    = MeasuresConvert.ToQuantity.ToString();
            string[] toStr = to.Split('.');
            if (toStr[1] == "00")
            {
                to = toStr[0];
            }


            textLine.Text = string.Format("{0} {1} {2} = {3} {4}", from, MeasuresConvert.SOURCE_UNIT_NAME, MeasuresConvert.FOOD_NAME, to, MeasuresConvert.TARGET_UNIT_NAME);
        }

        //btn = rolItem.FindControl("btnDelete") as LinkButton;
        // btn.Visible = MeasuresConvert.AllowDelete;
    }
    protected void rolShopDepartments_ItemDataBound(object sender, ReorderListItemEventArgs e)
    {
        ReorderListItem rolItem = e.Item as ReorderListItem;
        LinkButton      btn     = rolItem.FindControl("btnUpdate") as LinkButton;
        ShopDepartment  dep     = e.Item.DataItem as ShopDepartment;

        if (dep != null)
        {
            btn.PostBackUrl = string.Format("~/Admin/ShopDepartment.aspx?depId={0}", dep.ShopDepartmentId);
        }

        btn         = rolItem.FindControl("btnDelete") as LinkButton;
        btn.Visible = dep.AllowDelete;
    }
    protected void rolMeasurementUnits_ItemDataBound(object sender, ReorderListItemEventArgs e)
    {
        ReorderListItem rolItem = e.Item as ReorderListItem;
        LinkButton      btn     = rolItem.FindControl("btnUpdate") as LinkButton;
        MeasurementUnit unit    = e.Item.DataItem as MeasurementUnit;

        if (unit != null)
        {
            btn.PostBackUrl = string.Format("~/Admin/MeasurementUnit.aspx?unitId={0}", unit.UnitId);
        }

        btn         = rolItem.FindControl("btnDelete") as LinkButton;
        btn.Visible = unit.AllowDelete;
    }
    protected void rolGeneralItems_ItemDataBound(object sender, ReorderListItemEventArgs e)
    {
        ReorderListItem rolItem = e.Item as ReorderListItem;
        LinkButton      btn     = rolItem.FindControl("btnUpdate") as LinkButton;
        GeneralItem     Item    = e.Item.DataItem as GeneralItem;

        if (Item != null)
        {
            btn.PostBackUrl = string.Format("~/Admin/GeneralItem.aspx?ItemId={0}", Item.GeneralItemId);
        }

        btn         = rolItem.FindControl("btnDelete") as LinkButton;
        btn.Visible = Item.AllowDelete;
        btn.Attributes.Add("ItemId", Item.GeneralItemId.ToString());
    }
Exemple #7
0
        /*
         * protected void rptLocations_ItemDataBound(object sender, RepeaterItemEventArgs e)
         * {
         *  Location location = e.Item.DataItem as Location;
         *  if (location != null)
         *  {
         *      using (Label lbl = e.Item.FindControl("lblSubLocation") as Label)
         *      {
         *          if (lbl != null && location.Children.Count > 0)
         *          {
         *              lbl.Text = string.Format("({0})", location.Children.Count);
         *          }
         *      }
         *
         *      using (HyperLink hpl = e.Item.FindControl("hplEdit") as HyperLink)
         *      {
         *          if (hpl != null)
         *          {
         *              hpl.NavigateUrl =
         *                  string.Format(
         *                      "/Modules/TourManagement/Admin/PositionEdit.aspx?NodeId={0}&SectionId={1}&LocationId={2}",
         *                      Request.QueryString["NodeId"], Request.QueryString["SectionId"], location.Id);
         *          }
         *      }
         *
         *      using (HyperLink hpl = e.Item.FindControl("hplLocation") as HyperLink)
         *      {
         *          if (hpl != null)
         *          {
         *              hpl.NavigateUrl =
         *                  string.Format(
         *                      "/Modules/TourManagement/Admin/PositionList.aspx?NodeId={0}&SectionId={1}&LocationId={2}",
         *                      Request.QueryString["NodeId"], Request.QueryString["SectionId"], location.Id);
         *          }
         *      }
         *
         *      using (Label labelID = e.Item.FindControl("lblID") as Label)
         *      {
         *          if (labelID!=null)
         *          {
         *              labelID.Text = string.Format("ID:{0}", location.Id);
         *          }
         *      }
         *  }
         * }
         *
         * protected void rptLocations_ItemCommand(object source, RepeaterCommandEventArgs e)
         * {
         *  Location location;
         *  switch (e.CommandName)
         *  {
         *      case "View":
         *          location = Module.LocationGetById(Convert.ToInt32(e.CommandArgument));
         *          imgLocationView.ImageUrl = location.Image;
         *          lblLocationName.Text = location.Name;
         *          ModalPopupExtender.Show();
         *          break;
         *      case "Delete":
         *          location = Module.LocationGetById(Convert.ToInt32(e.CommandArgument));
         *          Module.Delete(location);
         *          GetDataSource();
         *          rptLocations.DataBind();
         *          break;
         *      default:
         *          break;
         *  }
         * }
         */
        #endregion

        #region -- Reorder List --
        protected void reorderListLocation_ItemDataBound(object sender, ReorderListItemEventArgs e)
        {
            Location location = e.Item.DataItem as Location;

            if (location != null)
            {
                using (Label lbl = e.Item.FindControl("lblSubLocation") as Label)
                {
                    if (lbl != null && location.Children.Count > 0)
                    {
                        lbl.Text = string.Format("({0})", location.Children.Count);
                    }
                }

                using (HyperLink hpl = e.Item.FindControl("hplEdit") as HyperLink)
                {
                    if (hpl != null)
                    {
                        hpl.NavigateUrl =
                            string.Format(
                                "/Modules/TourManagement/Admin/PositionEdit.aspx?NodeId={0}&SectionId={1}&LocationId={2}",
                                Request.QueryString["NodeId"], Request.QueryString["SectionId"], location.Id);
                    }
                }

                using (HyperLink hpl = e.Item.FindControl("hplLocation") as HyperLink)
                {
                    if (hpl != null)
                    {
                        hpl.NavigateUrl =
                            string.Format(
                                "/Modules/TourManagement/Admin/PositionList.aspx?NodeId={0}&SectionId={1}&LocationId={2}",
                                Request.QueryString["NodeId"], Request.QueryString["SectionId"], location.Id);
                    }
                }

                using (Label labelID = e.Item.FindControl("lblID") as Label)
                {
                    if (labelID != null)
                    {
                        labelID.Text = string.Format("ID:{0}", location.Id);
                    }
                }
            }
        }