Пример #1
0
        private void Delete(GridCommandEventArgs e)
        {
            int Id_FisCons = 0;

            DataRow[] Ar_dr;
            GridItem  gi = e.Item;

            Id_FisCons = Convert.ToInt32(((Label)gi.FindControl("lblId_FisCons")).Text);

            Ar_dr = dt.Select("Id_FisCons='" + Id_FisCons + "'");

            if (Ar_dr.Length > 0)
            {
                Ar_dr[0].Delete();
                dt.AcceptChanges();
            }
        }
        private void UpdateDefaultColumn(GridItem gi, bool Default)
        {
            LinkButton lb = gi.FindControl <LinkButton>("cmdDefaultProductVariant");

            if (lb != null)
            {
                if (Default)
                {
                    lb.Text    = AppLogic.GetString("admin.common.Yes", ThisCustomer.LocaleSetting);
                    lb.Enabled = false;
                }
                else
                {
                    lb.Text    = AppLogic.GetString("admin.productvariant.makedefault", ThisCustomer.LocaleSetting);
                    lb.Enabled = true;
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Determines the appropriate action and text for the published column of the entity RadGrid
        /// </summary>
        /// <param name="gi">The GridItem of the current row in the RadGrid</param>
        /// <param name="Published">A boolean value indicating the published status of the entity in the current row</param>
        private void UpdatePublishedColumn(GridItem gi, bool Published)
        {
            LinkButton lb = gi.FindControl <LinkButton>("cmdPublish");

            if (lb != null)
            {
                if (Published)
                {
                    lb.Text        = AppLogic.GetString("admin.entitygrid.unpublish", ThisCustomer.LocaleSetting);
                    lb.CommandName = "UnPublish";
                }
                else
                {
                    lb.Text        = AppLogic.GetString("admin.entitygrid.publish", ThisCustomer.LocaleSetting);
                    lb.CommandName = "Publish";
                }
            }
        }
Пример #4
0
        private void UpdateDeletedColumn(GridItem gi, bool Deleted)
        {
            ImageButton imgbtn = gi.FindControl <ImageButton>("imgDelete");

            if (Deleted)
            {
                imgbtn.ImageUrl      = "~/App_Themes/Admin_Default/images/undelete.png";
                imgbtn.ToolTip       = "UnDelete Entity";
                imgbtn.CommandName   = "UnDeleteEntity";
                imgbtn.OnClientClick = "return confirm('Are you sure you want to undelete this entity?');";
            }
            else
            {
                imgbtn.ImageUrl      = "~/App_Themes/Admin_Default/images/delete.png";
                imgbtn.ToolTip       = "Delete Entity";
                imgbtn.CommandName   = "DeleteEntity";
                imgbtn.OnClientClick = "return confirm('Are you sure you want to delete this entity?');";
            }
        }
Пример #5
0
        protected void btn_validar_Pres_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < gv_presencia.Items.Count; i++)
            {
                GridItem item = gv_presencia.Items[i];

                CheckBox cb_validar_presencia  = (CheckBox)item.FindControl("cb_validar_presencia");
                Label    lbl_validar_presencia = (Label)item.FindControl("lbl_validar_presencia");
                Label    lbl_id_cliente        = (Label)item.FindControl("lbl_id_cliente");
                Label    lbl_id_node           = (Label)item.FindControl("lbl_id_node");
                Label    lbl_fecha             = (Label)item.FindControl("lbl_fecha");
                Label    lbl_id_mercaderista   = (Label)item.FindControl("lbl_id_mercaderista");

                int    node            = Int32.Parse(lbl_id_node.Text);
                string cliente         = lbl_id_cliente.Text;
                string fecha           = lbl_fecha.Text;
                int    id_mercaderista = Int32.Parse(lbl_id_mercaderista.Text);

                string select = String.Format("nodocomercial={0} and PDV_Client='{1}'  and fec_reg_cel='{2}' and id_mercaderista={3}", node, cliente, fecha, id_mercaderista);

                DataRow[] filasActualizar = Productos.Select(select);

                if (cb_validar_presencia.Enabled == true && filasActualizar != null && filasActualizar.Length > 0)
                {
                    bool validar = cb_validar_presencia.Checked;
                    if (validar != Convert.ToBoolean(filasActualizar[0]["validado"].ToString()))
                    {
                        string UpdateMasa = "";
                        Array.ForEach(filasActualizar, delegate(DataRow fila)
                        {
                            UpdateMasa      += (fila["id_detalle_presencia"].ToString() + ",");
                            fila["validado"] = validar;
                        });
                        UpdateMasa = UpdateMasa.Remove(UpdateMasa.Length - 1, 1);
                        update_stock_detalle_validado_masa(UpdateMasa, validar, cmbTipo_reporte.SelectedValue);
                    }
                    if (validar)
                    {
                        lbl_validar_presencia.Text      = "Valido";
                        lbl_validar_presencia.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        lbl_validar_presencia.Text      = "Invalidado";
                        lbl_validar_presencia.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
        }
        protected void rgOrdenCompra_ItemDataBound(object sender, GridItemEventArgs e)
        {
            try
            {
                if (e.Item is GridHeaderItem)
                {
                    GridHeaderItem header = (GridHeaderItem)e.Item;
                    header["ventaMes0"].Text = string.Concat("Venta ", this.VentaMes0Desc);
                    header["ventaMes1"].Text = string.Concat("Venta ", this.VentaMes1Desc);
                    header["ventaMes2"].Text = string.Concat("Venta ", this.VentaMes2Desc);
                    header["ventaMes3"].Text = string.Concat("Venta ", this.VentaMes3Desc);

                    GridItem cmdItem = rgOrdenCompra.MasterTableView.GetItems(GridItemType.CommandItem)[0];
                    cmdItem.FindControl("AddNewRecordButton").Parent.Visible = false;
                }
            }
            catch (Exception ex)
            {
                DisplayMensajeAlerta(string.Concat(ex.Message, "rgOrdenCompra_ItemDataBound"));
            }
        }
        private void UpdateSeg(GridCommandEventArgs e)
        {
            try
            {
                GridItem gi = e.Item;

                RadDatePicker rdf = ((RadDatePicker)gi.FindControl("rdFecha"));

                //if (!validarFecha(rdf, e))
                //{
                //    return;
                //}

                if (((RadTextBox)gi.FindControl("txtObservaciones")).Text == "" ||
                    !((RadDatePicker)gi.FindControl("rdFecha")).SelectedDate.HasValue)
                {
                    e.Canceled = true;
                    this.Alerta("Todos los campos son requeridos.");
                    return;
                }

                SeguimientoProductos SegPrd = new SeguimientoProductos();
                SegPrd.Id_SegPrd       = Convert.ToInt32(((Label)gi.FindControl("lblSegId2")).Text);
                SegPrd.Id_Emp          = this.sesion.Id_Emp;
                SegPrd.Id_Cd           = this.sesion.Id_Cd_Ver;
                SegPrd.Id_Prd          = Convert.ToInt32(this.HF_ID.Value);
                SegPrd.Seg_fecha       = Convert.ToDateTime(((RadDatePicker)gi.FindControl("rdFecha")).SelectedDate);
                SegPrd.Seg_Comentarios = ((RadTextBox)gi.FindControl("txtObservaciones")).Text;

                CN_ProSeguimientoPrd CNProSeguimientoPrd = new CN_ProSeguimientoPrd();
                int verificador = -1;

                CNProSeguimientoPrd.ModificaObservaciones(SegPrd, this.sesion.Emp_Cnx, ref verificador);

                if (verificador > 0)
                {
                    this.Inicializar();
                }
                else
                {
                    this.Alerta("Ocurrio un error al intentar guardar la observación");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #8
0
        protected void rgJADuty_ItemDataBound(object sender, GridItemEventArgs e)
        {
            HideRefreshButton(e);
            GridItem gridItem = e.Item;

            //Issue Id: 28
            //Author: Deepali Anuje
            //Date Fixed: 1/29/2012
            //Description: Duty/KSA Screen of JA: Display Duty KSAs on This Screen
            if (gridItem.ItemType == GridItemType.Item || gridItem.ItemType == GridItemType.AlternatingItem)
            {
                RadListBox rdutyqual = gridItem.FindControl("radListDutyQual") as RadListBox;
                if (gridItem.DataItem is JobAnalysisDuty)
                {
                    JobAnalysisDuty JADuty = gridItem.DataItem as JobAnalysisDuty;
                    List <JobAnalysisDutyKSAFactor> qualList = JADuty.GetJobAnalysisDutyKSAFactorByJADutyID();
                    rdutyqual.DataSource = qualList;
                    rdutyqual.DataBind();
                    rdutyqual.Visible = (qualList.Count > 0);
                }
            }
        }
Пример #9
0
        protected void grdEntities_ItemCreated(object sender, GridItemEventArgs e)
        {
            GridItem gridItem = e.Item;

            var  chkShowDeleted = ctrlSearch.FindControl <CheckBox>("chkShowDeleted");
            bool showDeleted    = chkShowDeleted != null && chkShowDeleted.Checked;

            if (gridItem.ItemType != GridItemType.Item && gridItem.ItemType != GridItemType.AlternatingItem)
            {
                return;
            }

            GridEntity gridEntity = gridItem.DataItem as GridEntity;

            if (gridEntity == null)
            {
                return;
            }

            UpdatePublishedColumn(gridItem, gridEntity.Published);
            UpdateDeletedColumn(gridItem, gridEntity.Deleted);

            // find the expand/collapse button
            Button ctrl = gridItem.FindControl <Button>("GECBtnExpandColumn");

            if (ctrl == null)
            {
                return;
            }

            // Hide the expand button if the entity has no children or only has deleted children and Show Deleted is not checked.
            // The ordering of operands is to make the SQL call at the end run only if everything else is false.
            bool hideExpandButton = !gridEntity.HasChildren || (!showDeleted && Entity.GetChildrenEntities(gridEntity.EntityType, gridEntity.ID).All(entity => entity.Deleted));

            if (hideExpandButton)
            {
                ctrl.Visible = false;
            }
        }
        private void Update(GridCommandEventArgs e)
        {
            try
            {
                int    Id          = 0;
                string Descripcion = "";
                int    Disponible  = 0;
                int    Cantidad    = 0;
                double precio      = 0;

                GridItem gi = e.Item;

                if (((RadNumericTextBox)gi.FindControl("txtId")).Text == "")
                {
                    e.Canceled = true;
                    this.Alerta("No se ha capturado un producto");
                    return;
                }

                Id          = Convert.ToInt32(((RadNumericTextBox)gi.FindControl("txtId")).Value.HasValue ? ((RadNumericTextBox)gi.FindControl("txtId")).Value.Value : -1);
                Descripcion = ((RadTextBox)gi.FindControl("txtDescripcion")).Text;
                Disponible  = Convert.ToInt32(((Label)gi.FindControl("lblDisponibleEdit")).Text);
                Cantidad    = Convert.ToInt32(((RadNumericTextBox)gi.FindControl("txtCantidad")).Text);
                precio      = ((RadNumericTextBox)gi.FindControl("txtPrecio")).Text != "" ? Convert.ToDouble(((RadNumericTextBox)gi.FindControl("txtPrecio")).Text) : 0;

                DataRow[] Ar_dr = list.Select("Id='" + Id + "'");
                if (Ar_dr.Length > 0)
                {
                    Ar_dr[0].BeginEdit();
                    Ar_dr[0]["Id"]          = Id;
                    Ar_dr[0]["Descripcion"] = Descripcion;
                    Ar_dr[0]["Disponible"]  = Disponible;
                    Ar_dr[0]["Cantidad"]    = Cantidad;
                    Ar_dr[0]["precio"]      = precio;
                    Ar_dr[0].AcceptChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void grdFollowUpBudget_ItemCreated(object sender, GridItemEventArgs e)
        {
            try
            {
                string budgetVersion = ReturnBudgetVersionFromCombo();
                if (!IsDeleteButtonEnable())
                {
                    if (e.Item is GridFooterItem)
                    {
                        GridFooterItem commandItem = e.Item as GridFooterItem;
                        IndImageButton button      = commandItem.FindControl("btnDelete") as IndImageButton;
                        button.Enabled = false;

                        button.ImageUrl = ResolveUrl("~/Images/buttons_delete_disabled.png");
                    }
                    if (e.Item is GridItem)
                    {
                        GridItem itm = e.Item as GridItem;
                        CheckBox ck  = itm.FindControl("chkDeleteCol") as CheckBox;
                        if (ck != null)
                        {
                            ck.Enabled = false;
                        }
                    }
                }
                if (e.Item is GridFooterItem)
                {
                    GridFooterItem commandItem = e.Item as GridFooterItem;
                    LinkButton     navigateAll = commandItem.FindControl("btnNavigateAll") as LinkButton;
                    if (IsBATAOrPM(currentUser) || IsFunctionalManager(currentUser))
                    {
                        switch (CmbTypeSelectedValue)
                        {
                        case ApplicationConstants.BUDGET_TYPE_INITIAL:
                            navigateAll.PostBackUrl = "~/Pages/Budget/WPPreselection/WPPreselection.aspx?Code=" + ApplicationConstants.MODULE_INITIAL + "&IdAssociate=" + ApplicationConstants.INT_NULL_VALUE + "&BudgetVersion=" + budgetVersion + "&IsFromFollowUp=1";
                            break;

                        case ApplicationConstants.BUDGET_TYPE_REVISED:
                            navigateAll.PostBackUrl = "~/Pages/Budget/WPPreselection/WPPreselection.aspx?Code=" + ApplicationConstants.MODULE_REVISED + "&IdAssociate=" + ApplicationConstants.INT_NULL_VALUE + "&BudgetVersion=" + budgetVersion + "&IsFromFollowUp=1";
                            break;

                        case ApplicationConstants.BUDGET_TYPE_TOCOMPLETION:
                            navigateAll.PostBackUrl = "~/Pages/Budget/WPPreselection/WPPreselection.aspx?Code=" + ApplicationConstants.MODULE_REFORECAST + "&IdAssociate=" + ApplicationConstants.INT_NULL_VALUE + "&BudgetVersion=" + budgetVersion + "&IsFromFollowUp=1";
                            break;

                        default:
                            navigateAll.PostBackUrl = "~/Pages/Budget/WPPreselection/WPPreselection.aspx?Code=" + ApplicationConstants.MODULE_INITIAL + "&IdAssociate=" + ApplicationConstants.INT_NULL_VALUE;
                            break;
                        }
                        navigateAll.PostBackUrl += "&BudgetType=" + (cmbType.SelectedIndex - 1);
                    }
                    else
                    {
                        navigateAll.Visible = false;
                    }
                }
            }
            catch (IndException ex)
            {
                ShowError(ex);
                return;
            }
            catch (Exception ex)
            {
                ShowError(new IndException(ex));
                return;
            }
        }
Пример #12
0
    public void CreateExpandCollapseButton(GridItem item, string columnUniqueName)
    {
        if (item is GridDataItem)
        {
            if (item.FindControl("MyExpandCollapseButton") == null)
            {
                Button button = new Button();
                button.Click += new EventHandler(button_Click);
                button.CommandName = "ExpandCollapse";
                button.CssClass = (item.Expanded) ? "rgCollapse" : "rgExpand";
                button.ID = "MyExpandCollapseButton";

                if (item.OwnerTableView.HierarchyLoadMode == GridChildLoadMode.Client)
                {
                    string script = String.Format(@"$find(""{0}"")._toggleExpand(this, event); return false;", item.Parent.Parent.ClientID);

                    button.OnClientClick = script;
                }

                int level = item.ItemIndexHierarchical.Split(':').Length;
                if (level > 1)
                {
                    button.Style["margin-left"] = level * 10 + "px";
                }

                TableCell cell = ((GridDataItem)item)[columnUniqueName];
                cell.Controls.Add(button);
                cell.Controls.Add(new LiteralControl("&nbsp;"));
                cell.Controls.Add(new LiteralControl(((GridDataItem)item).GetDataKeyValue(columnUniqueName).ToString()));
            }
        }
    }
Пример #13
0
    protected void PopulateLine (GridItem item)
    {
        FinancialAccount account = (FinancialAccount)item.DataItem;

        if (account == null)
        {
            return;
        }

        Label labelAccountName = (Label)item.FindControl("LabelAccountName");
        Literal literalLastYear = (Literal)item.FindControl("LiteralLastYear");
        Literal literalQ1 = (Literal)item.FindControl("LiteralQuarter1");
        Literal literalQ2 = (Literal)item.FindControl("LiteralQuarter2");
        Literal literalQ3 = (Literal)item.FindControl("LiteralQuarter3");
        Literal literalQ4 = (Literal)item.FindControl("LiteralQuarter4");
        Literal literalYtd = (Literal)item.FindControl("LiteralThisYear");

        PopulateDualFigure(literalLastYear, "LastYear", 0, account.Identity);
        PopulateDualFigure(literalQ1, "Q1", 1, account.Identity);
        PopulateDualFigure(literalQ2, "Q2", 2, account.Identity);
        PopulateDualFigure(literalQ3, "Q3", 3, account.Identity);
        PopulateDualFigure(literalQ4, "Q4", 4, account.Identity);
        PopulateDualFigure(literalYtd, "Ytd", 5, account.Identity);
        labelAccountName.Text = account.Name;
    }
        protected void grdProducts_ItemCreated(object sender, GridItemEventArgs e)
        {
            RadGrid  grdProducts = ctrlSearch.FindControl <RadGrid>("grdProducts");
            GridItem gi          = e.Item;

            if (e.Item is GridDataItem)
            {
                if (e.Item.OwnerTableView.Name.EqualsIgnoreCase("Master"))
                {
                    //Parent product grid
                    string productID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ProductID"].ToString();

                    HyperLink lnkEdit       = (HyperLink)e.Item.FindControl("lnkEdit");
                    HyperLink lnkAddVariant = (HyperLink)e.Item.FindControl("lnkAddVariant");
                    HyperLink lnkName       = (HyperLink)e.Item.FindControl("lnkName");

                    if (lnkEdit != null)
                    {
                        lnkEdit.ImageUrl              = "~/App_Themes/Admin_Default/images/edit.png";
                        lnkEdit.Attributes["src"]     = "#";
                        lnkEdit.Attributes["style"]   = "cursor:pointer;";
                        lnkEdit.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", productID, e.Item.ItemIndex);
                        lnkEdit.ToolTip = AppLogic.GetString("admin.productgrid.EditProduct", ThisCustomer.LocaleSetting);

                        lnkAddVariant.ImageUrl = "~/App_Themes/Admin_Default/images/add.png";
                        lnkAddVariant.ToolTip  = AppLogic.GetString("admin.productgrid.AddNewVariant", ThisCustomer.LocaleSetting);
                        lnkAddVariant.Attributes["onclick"] = String.Format("return VariantShowInsertForm('{0}');", productID);
                        lnkAddVariant.Attributes["style"]   = "cursor:pointer;";
                        lnkAddVariant.Attributes["src"]     = "#";

                        lnkName.Attributes["src"]     = "#";
                        lnkName.Attributes["onClick"] = String.Format("return ShowEditForm('{0}','{1}');", productID, e.Item.ItemIndex);
                        lnkName.Attributes["style"]   = "cursor:pointer;";
                    }
                }
                else if (e.Item.OwnerTableView.Name.EqualsIgnoreCase("ProductVariants"))
                {
                    //We are working with variants
                    GridProductVariant item = (GridProductVariant)e.Item.DataItem;

                    if (item != null)
                    {
                        string productID = item.ProductID.ToString();
                        string variantID = item.VariantID.ToString();

                        HyperLink lnkEditVariant = (HyperLink)e.Item.FindControl("lnkEditVariant");

                        if (lnkEditVariant != null)
                        {
                            lnkEditVariant.ImageUrl              = "~/App_Themes/Admin_Default/images/edit.png";
                            lnkEditVariant.Attributes["src"]     = "#";
                            lnkEditVariant.Attributes["onclick"] = String.Format("return VariantShowEditForm('{0}','{1}','{2}');", variantID, e.Item.ItemIndex, productID);
                            lnkEditVariant.Attributes["style"]   = "cursor:pointer;";
                            lnkEditVariant.ToolTip = AppLogic.GetString("admin.productgrid.EditVariant", ThisCustomer.LocaleSetting);
                        }
                    }
                }
            }


            if (gi.ItemType == GridItemType.Item || gi.ItemType == GridItemType.AlternatingItem)
            {
                // we have a product variant grid row
                if (gi.OwnerTableView.Name.EqualsIgnoreCase("ProductVariants"))
                {
                    GridProductVariant pv = gi.DataItem as GridProductVariant;

                    if (pv != null)
                    {
                        UpdatePublishedColumn(gi, pv.Published, false);
                        UpdateDefaultColumn(gi, pv.IsDefault);
                        UpdateDeletedColumn(gi, pv.Deleted, false);

                        LinkButton lnkName = (LinkButton)gi.FindControl("lnkName");

                        if (lnkName != null)
                        {
                            lnkName.Attributes["onclick"] = String.Format("return VariantShowEditForm('{0}','{1}',{2});", pv.VariantID.ToString(), gi.ItemIndex.ToString(), pv.ProductID.ToString());
                            lnkName.Attributes["src"]     = "#";
                            lnkName.Attributes["style"]   = "cursor:pointer;";
                        }
                    }
                }
                else  // we have a product grid row
                {
                    GridProduct p = gi.DataItem as GridProduct;

                    if (p != null)
                    {
                        UpdatePublishedColumn(gi, p.Published, true);
                        UpdateDeletedColumn(gi, p.Deleted, true);

                        HyperLink lnkName = (HyperLink)gi.FindControl("lnkName");

                        if (lnkName != null)
                        {
                            lnkName.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", p.ProductID.ToString(), gi.ItemIndex.ToString());
                            lnkName.Attributes["src"]     = "#";
                            lnkName.Attributes["style"]   = "cursor:pointer;";
                        }
                    }
                }
            }
        }
        protected void rgDet_ItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                int    Id_ClpDet  = 0;
                int    Tprecio    = 0;
                string TPrecioStr = "";
                string Precio     = "";
                double Pesos      = 0;

                DataRow[] dr;

                GridItem  gi = null;
                DataRow[] Ar_dr;

                switch (e.CommandName)
                {
                case "InitInsert":
                    if (rgDet.EditItems.Count > 0)
                    {
                        Alerta("Ya está editando un registro");
                        e.Canceled = true;
                    }
                    break;

                case "PerformInsert":
                    gi = e.Item;


                    if (((RadComboBox)gi.FindControl("RadComboBox1")).Text == "" ||
                        ((RadNumericTextBox)gi.FindControl("RadNumericTextBox2")).Text == "")
                    {
                        e.Canceled = true;
                        break;
                    }

                    Tprecio    = Convert.ToInt32(((RadComboBox)gi.FindControl("RadComboBox1")).SelectedValue);
                    TPrecioStr = ((RadComboBox)gi.FindControl("RadComboBox1")).Text;
                    Precio     = ((RadComboBox)gi.FindControl("RadComboBox2")).FindItemByValue(((RadComboBox)gi.FindControl("RadComboBox1")).SelectedValue).Text;
                    Pesos      = Convert.ToDouble(((RadNumericTextBox)gi.FindControl("RadNumericTextBox2")).Text);

                    Id_ClpDet = dt.Rows.Count;

                    dr = dt.Select("TPrecio='" + Tprecio + "'");
                    if (dr.Length > 0)
                    {
                        Alerta("Ya se ha establecido un tipo de precio " + TPrecioStr);
                        e.Canceled = true;
                        return;
                    }

                    dt.Rows.Add(new object[] {
                        Id_ClpDet,
                        Tprecio,
                        TPrecioStr,
                        Precio,
                        Pesos
                    });
                    break;

                case "Update":
                    gi = e.Item;

                    if (((RadComboBox)gi.FindControl("RadComboBox1")).Text == "" ||
                        ((RadNumericTextBox)gi.FindControl("RadNumericTextBox2")).Text == "")
                    {
                        e.Canceled = true;
                        break;
                    }

                    Tprecio    = Convert.ToInt32(((RadComboBox)gi.FindControl("RadComboBox1")).SelectedValue);
                    TPrecioStr = ((RadComboBox)gi.FindControl("RadComboBox1")).Text;
                    Precio     = ((RadComboBox)gi.FindControl("RadComboBox2")).FindItemByValue(((RadComboBox)gi.FindControl("RadComboBox1")).SelectedValue).Text;
                    Pesos      = Convert.ToDouble(((RadNumericTextBox)gi.FindControl("RadNumericTextBox2")).Text);
                    Id_ClpDet  = Convert.ToInt32(((Label)gi.FindControl("lblold0")).Text);

                    dr = dt.Select("TPrecio='" + Tprecio + "'");
                    //if (dr.Length > 0)
                    //{
                    //    Alerta("Ya se ha establecido un tipo de precio " + TPrecioStr);
                    //    e.Canceled = true;
                    //    return;
                    //}

                    Ar_dr = dt.Select("Id_ClpDet='" + Id_ClpDet + "'");
                    if (Ar_dr.Length > 0)
                    {
                        Ar_dr[0].BeginEdit();
                        Ar_dr[0]["Tprecio"]    = Tprecio;
                        Ar_dr[0]["TPrecioStr"] = TPrecioStr;
                        Ar_dr[0]["Precio"]     = Precio;
                        Ar_dr[0]["Pesos"]      = Pesos;
                        Ar_dr[0].AcceptChanges();
                    }
                    break;

                case "Delete":
                    gi        = e.Item;
                    Id_ClpDet = Convert.ToInt32(((Label)gi.FindControl("Label0")).Text);
                    Ar_dr     = dt.Select("Id_ClpDet='" + Id_ClpDet + "'");
                    if (Ar_dr.Length > 0)
                    {
                        Ar_dr[0].Delete();
                        dt.AcceptChanges();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
Пример #16
0
        protected void gv_incidencias_ItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                panelEdit.DataBind();
                RadBinaryImage_fotoBig.DataBind();
                RadBinaryImage_fotoBig.Visible = false;
                //GridItem item = gv_Foto.Items[e.Item.ItemIndex];
                int a = e.Item.ItemIndex;
                if (a == -1)
                {
                    return;
                }
                GridItem item = gv_incidencias.Items[e.Item.ItemIndex];



                Label lbl_id_reg_foto = (Label)item.FindControl("lbl_id_reg_foto");

                Label lbl_Id_Reg_Fotogr = (Label)item.FindControl("Id_incidencia");
                if (e.CommandName == "VERFOTO")
                {
                    Session["iidregft"] = Convert.ToInt32(lbl_id_reg_foto.Text);
                    Session["Id_repft"] = Convert.ToInt32(lbl_Id_Reg_Fotogr.Text);

                    DataTable dt    = null;
                    Conexion  Ocoon = new Conexion();
                    //string sidregft = ((LinkButton)sender).CommandArgument;
                    int iidregft = Convert.ToInt32(lbl_id_reg_foto.Text);

                    dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_REG_FOTO", iidregft);
                    if (dt.Rows.Count == 0)
                    {
                        lblencabezado.Text     = "INFORMACION";
                        lblmensajegeneral.Text = "La Foto Seleccionada no existe";
                        ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/warning_blue.png";
                        divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#53A2FF; height:169px;background-color:#9FCBFF";
                        ModalPopupMensaje.Show();
                        return;
                    }
                    byte[] byteArrayIn = (byte[])dt.Rows[0]["foto"];

                    Session["array"] = byteArrayIn;
                    RadBinaryImage_viewFoto.DataValue = byteArrayIn;
                    ModalPopupExtender_viewfoto.Show();

                    //Response.Redirect("verFoto.aspx?iidregft=" + iidregft, true);
                }
                else if (e.CommandName == "EDITFOTO")
                {
                    //string sidregft = ((LinkButton)senser).CommandArgument;
                    int iidregft = Convert.ToInt32(lbl_id_reg_foto.Text);
                    int Id_repft = Convert.ToInt32(lbl_Id_Reg_Fotogr.Text);
                    if (iidregft == 0)
                    {
                        lblencabezado.Text     = "INFORMACION";
                        lblmensajegeneral.Text = "La Foto Seleccionada no existe";
                        ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/warning_blue.png";
                        divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#53A2FF; height:169px;background-color:#9FCBFF";
                        ModalPopupMensaje.Show();

                        return;
                    }
                    else
                    {
                        RadBinaryImage imageBinary = (RadBinaryImage)item.FindControl("RadBinaryImage_foto");

                        RadBinaryImage_fotoBig.DataValue = imageBinary.DataValue;
                        RadBinaryImage_fotoBig.Visible   = false;
                        Session["iidregft"] = iidregft;
                        Session["Id_repft"] = Id_repft;
                    }
                    ModalPopup_Edit.Show();
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
                Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
        protected void rgDet_ItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                string    anyo            = "";
                string    anyo_old        = "";
                string    mes             = "";
                string    mesStr          = "";
                string    mes_old         = "";
                double    presupuesto     = 0;
                double    presupuesto_old = 0;
                GridItem  gi = null;
                DataRow[] Ar_dr;

                switch (e.CommandName)
                {
                case "PerformInsert":
                    gi = e.Item;


                    if (((RadNumericTextBox)gi.FindControl("RadNumericTextBox1")).Text == "" ||
                        ((RadComboBox)gi.FindControl("RadComboBox1")).SelectedIndex == 0 ||
                        ((RadNumericTextBox)gi.FindControl("RadNumericTextBox2")).Text == "")
                    {
                        Alerta("El año, mes y presupuesto son obligatorios");
                        e.Canceled = true;
                        break;
                    }


                    anyo        = ((RadNumericTextBox)gi.FindControl("RadNumericTextBox1")).Text;
                    mes         = ((RadComboBox)gi.FindControl("RadComboBox1")).SelectedValue;
                    mesStr      = ((RadComboBox)gi.FindControl("RadComboBox1")).Text;
                    presupuesto = Convert.ToDouble(((RadNumericTextBox)gi.FindControl("RadNumericTextBox2")).Text);


                    Ar_dr = dt.Select("Anyo='" + anyo + "' and Mes='" + mes + "'");
                    if (Ar_dr.Length == 0)
                    {
                        dt.Rows.Add(new object[] { anyo, mes, mesStr, presupuesto });
                    }
                    else
                    {
                        Alerta("El presupuesto para ese periodo ya existe.");
                        e.Canceled = true;
                    }
                    break;

                case "Update":
                    gi = e.Item;

                    if (((RadNumericTextBox)gi.FindControl("RadNumericTextBox1")).Text == "" ||
                        ((RadComboBox)gi.FindControl("RadComboBox1")).SelectedIndex == 0 ||
                        ((RadNumericTextBox)gi.FindControl("RadNumericTextBox2")).Text == "")
                    {
                        Alerta("El año, mes y presupuesto son obligatorios");
                        e.Canceled = true;
                    }

                    anyo            = ((RadNumericTextBox)gi.FindControl("RadNumericTextBox1")).Text;
                    mes             = ((RadComboBox)gi.FindControl("RadComboBox1")).SelectedValue;
                    mesStr          = ((RadComboBox)gi.FindControl("RadComboBox1")).Text;
                    presupuesto     = Convert.ToDouble(((RadNumericTextBox)gi.FindControl("RadNumericTextBox2")).Text);
                    anyo_old        = ((Label)gi.FindControl("lblold1")).Text;
                    mes_old         = ((Label)gi.FindControl("lblold2")).Text;
                    presupuesto_old = Convert.ToDouble(((Label)gi.FindControl("lblold3")).Text);

                    Ar_dr = dt.Select("Anyo='" + anyo + "' and Mes='" + mes + "'");
                    if (Ar_dr.Length != 0)
                    {
                        Alerta("El presupuesto para ese periodo ya existe.");
                        e.Canceled = true;
                        return;
                    }

                    Ar_dr = dt.Select("Anyo='" + anyo_old + "' and Mes='" + mes_old + "' and Presupuesto='" + presupuesto_old + "'");
                    if (Ar_dr.Length > 0)
                    {
                        Ar_dr[0].BeginEdit();
                        Ar_dr[0]["Anyo"]        = anyo;
                        Ar_dr[0]["Mes"]         = mes;
                        Ar_dr[0]["MesStr"]      = mesStr;
                        Ar_dr[0]["Presupuesto"] = presupuesto;
                        Ar_dr[0].AcceptChanges();
                    }
                    break;

                case "Delete":
                    gi              = e.Item;
                    anyo_old        = ((Label)gi.FindControl("label1")).Text;
                    mes_old         = ((Label)gi.FindControl("Label4")).Text;
                    presupuesto_old = Convert.ToDouble(((Label)gi.FindControl("label3")).Text);
                    Ar_dr           = dt.Select("Anyo='" + anyo_old + "' and Mes='" + mes_old + "' and Presupuesto='" + presupuesto_old + "'");
                    if (Ar_dr.Length > 0)
                    {
                        Ar_dr[0].Delete();
                        dt.AcceptChanges();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
Пример #18
0
        private void Modificar(GridCommandEventArgs e)
        {
            try
            {
                GridItem gi = e.Item;

                if (HFCapUsuario.Value == "False")
                {
                    if (((RadNumericTextBox)gi.FindControl("TxtId_Cte")).Text == "" ||
                        ((RadTextBox)gi.FindControl("TxtSol_CteNombre")).Text == "")
                    {
                        Alerta("Todos los campos son requeridos");
                        e.Canceled = true;
                        return;
                    }
                }
                else
                {
                    if (((RadNumericTextBox)gi.FindControl("TxtId_Cte")).Text == "" ||
                        ((RadTextBox)gi.FindControl("TxtSol_CteNombre")).Text == "" ||
                        ((RadTextBox)gi.FindControl("TxtSol_UsuFinal")).Text == "")
                    {
                        Alerta("Todos los campos son requeridos");
                        e.Canceled = true;
                        return;
                    }
                }



                SolConvenioDet s = new SolConvenioDet();
                s.Id_Cte        = int.Parse(((RadNumericTextBox)gi.FindControl("TxtId_Cte")).Text);
                s.Sol_CteNombre = ((RadTextBox)gi.FindControl("TxtSol_CteNombre")).Text.Trim();
                s.Sol_UsuFinal  = ((RadTextBox)gi.FindControl("TxtSol_UsuFinal")).Text.Trim();
                s.Id_Unique     = ((Label)gi.FindControl("LblId_UniqueE")).Text.Trim();
                s.Id_Ter        = int.Parse(((RadNumericTextBox)gi.FindControl("TxtId_Ter")).Text);
                s.SolTer_Nombre = ((RadTextBox)gi.FindControl("TxtSolTer_Nombre")).Text.Trim();

                //if (ListDet.Where(x => x.Id_Cte == s.Id_Cte).ToList().Count > 0)
                //{
                //    Alerta("El cliente ya fue agregado");
                //    e.Canceled = true;
                //    return;
                //}

                ListDet.Where(x => x.Id_Unique == s.Id_Unique).ToList()[0].Id_Cte        = s.Id_Cte;
                ListDet.Where(x => x.Id_Unique == s.Id_Unique).ToList()[0].Sol_CteNombre = s.Sol_CteNombre;
                ListDet.Where(x => x.Id_Unique == s.Id_Unique).ToList()[0].Sol_UsuFinal  = s.Sol_UsuFinal;
                ListDet.Where(x => x.Id_Unique == s.Id_Unique).ToList()[0].Id_Ter        = s.Id_Ter;
                ListDet.Where(x => x.Id_Unique == s.Id_Unique).ToList()[0].SolTer_Nombre = s.SolTer_Nombre;


                rgSolicitudDet.Rebind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #19
0
        protected void gv_presencia_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            try
            {
                lblmensaje.Text = "";
                Conexion Ocoon      = new Conexion();
                DateTime Fec_reg_bd = DateTime.Today;

                GridItem item = gv_presencia.Items[e.Item.ItemIndex];

                CheckBox cb_validar_presencia  = (CheckBox)item.FindControl("cb_validar_presencia");
                Label    lbl_validar_presencia = (Label)item.FindControl("lbl_validar_presencia");
                Label    lbl_id_cliente        = (Label)item.FindControl("lbl_id_cliente");
                Label    lbl_id_node           = (Label)item.FindControl("lbl_id_node");
                Label    lbl_fecha             = (Label)item.FindControl("lbl_fecha");
                Label    lbl_id_mercaderista   = (Label)item.FindControl("lbl_id_mercaderista");

                int    node            = Int32.Parse(lbl_id_node.Text);
                string cliente         = lbl_id_cliente.Text;
                string fecha           = lbl_fecha.Text;
                int    id_mercaderista = Int32.Parse(lbl_id_mercaderista.Text);
                bool   validado        = cb_validar_presencia.Checked;
                string Message         = "";

                List <object[]> ArrayEditorValue = new List <object[]>();

                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager  editMan    = editedItem.EditManager;

                foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                {
                    if (column is IGridEditableColumn)
                    {
                        IGridEditableColumn editableCol = (column as IGridEditableColumn);
                        if (editableCol.IsEditable)
                        {
                            IGridColumnEditor editor      = editMan.GetColumnEditor(editableCol);
                            string            editorType  = editor.ToString();
                            string            editorText  = "unknown";
                            object            editorValue = null;
                            if (editor is GridNumericColumnEditor)
                            {
                                editorText  = (editor as GridNumericColumnEditor).Text;
                                editorValue = (editor as GridNumericColumnEditor).NumericTextBox.DbValue;
                                object[] EditValue = new object[2];
                                EditValue[0] = column.HeaderText;
                                EditValue[1] = editorText;
                                ArrayEditorValue.Add(EditValue);
                            }
                            if (editor is GridDateTimeColumnEditor)
                            {
                                editorText = (editor as GridDateTimeColumnEditor).Text;
                                Fec_reg_bd = Convert.ToDateTime(editorText);
                            }
                        }
                    }
                }
                string    selectDatosRegistro = String.Format("nodocomercial={0} and PDV_Client='{1}' and fec_reg_cel='{2}' and id_mercaderista={3}", node, cliente, fecha, id_mercaderista);
                DataRow[] Datos = Productos.Select(selectDatosRegistro);
                if (Datos.Count() > 0)
                {
                    string sId_Reg_Presencia = Datos[0]["id_detalle_presencia"].ToString();
                    Datos = null;

                    foreach (object[] value in ArrayEditorValue)
                    {
                        string updatValor = "";
                        int    count      = 0;
                        string cabecera   = value[0].ToString();
                        string valor      = value[1].ToString();

                        if (!valor.Equals(""))
                        {
                            string    select          = String.Format("nodocomercial={0} and PDV_Client='{1}' and fec_reg_cel='{2}' and id_mercaderista={3} and dato='{4}'", node, cliente, fecha, id_mercaderista, cabecera);
                            DataRow[] filasActualizar = Productos.Select(select);

                            if (filasActualizar.Length == 0)
                            { //Crear el registro
                                string    selectProducto = String.Format("dato='{4}'", node, cliente, fecha, id_mercaderista, cabecera);
                                DataRow[] CodProducto    = Productos.Select(selectProducto);
                                string    sId_Dato       = CodProducto[0]["cod_dato"].ToString();
                                CodProducto = null;
                                OPE_Reporte_Presencia  oOPE_Reporte_Presencia  = new OPE_Reporte_Presencia();
                                EOPE_Reporte_Presencia oEOPE_Reporte_Presencia = oOPE_Reporte_Presencia.RegistrarReportePresencia_Pivot(sId_Dato, sId_Reg_Presencia, "");
                                oOPE_Reporte_Presencia.RegistrarReportePresenciaDetalle_Pivot(Convert.ToInt64(oEOPE_Reporte_Presencia.ID), sId_Dato, valor);
                            }
                            else
                            {//Actualizar el registro
                                string NomProduct  = "";
                                double valors      = double.Parse(valor);
                                double valorActual = 0;
                                double valorTotal  = 0;
                                Array.ForEach(filasActualizar, delegate(DataRow fila)
                                {
                                    updatValor      += (fila["id_detalle_presencia"].ToString() + ",");
                                    fila["validado"] = validado;
                                    valorActual      = double.Parse(fila["valor"].ToString());
                                    NomProduct       = fila["dato"].ToString();
                                    count++;
                                    TipoReporte = fila["opcion_reporte"].ToString();
                                    valorTotal += double.Parse(fila["valor"].ToString());
                                });

                                //updatValor = updatValor.Remove(updatValor.Length - 1, 1);se remplazo por el Sub String :Ing Ditmar Estrada, 17/05/2012 - 12:31pm
                                updatValor = updatValor.Substring(0, updatValor.Length - 1);
                                if (valors != valorTotal)
                                {
                                    Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_PRESENCIA_COLGATE_PIVOT", updatValor, TipoReporte, valor, Fec_reg_bd, Session["sUser"].ToString(), DateTime.Now, validado);
                                }
                                if (filasActualizar.Count() > 1)
                                {
                                    Message += string.Format("El producto {0} contiene {1} registros, debe invalidar algunos de ellos.<br />", NomProduct, count);
                                }
                            }
                        }
                    }
                }
                else
                {
                    lblmensaje.ForeColor = System.Drawing.Color.Blue;
                    lblmensaje.Text      = "No es posible actualizar.";
                }
                cargarGrilla_Reporte_Presencia();
                lblmensaje.ForeColor = System.Drawing.Color.Blue;
                lblmensaje.Text      = Message; lblmensaje.Text = Message;
            }
            catch (Exception ex)
            {
                lblmensaje.Text = ex.ToString();
                Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
Пример #20
0
        /// <summary>
        /// Event that fires when an item is created in the grid.  Responseible for setting the values of
        /// the various controls in the different columns of the grid.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">GridItemEventArgs</param>
        protected void grdCustomers_ItemCreated(object sender, GridItemEventArgs e)
        {
            RadGrid  grdCustomers = ctrlSearch.FindControl <RadGrid>("grdCustomers");
            GridItem gi           = e.Item;

            if (gi.ItemType == GridItemType.Item || gi.ItemType == GridItemType.AlternatingItem)
            {
                GridCustomer gc = gi.DataItem as GridCustomer;

                if (gc != null)
                {
                    // Customer ID column
                    LinkButton lbtnID = gi.FindControl <LinkButton>("lbtnID");
                    lbtnID.Text = gc.CustomerID.ToString();

                    Literal ltCreated = gi.FindControl <Literal>("ltCreatedOn");
                    ltCreated.Text = Localization.ToThreadCultureShortDateString(gc.CreatedOn);

                    // Customer Name column
                    LinkButton lbtnName = gi.FindControl <LinkButton>("lbtnName");
                    lbtnName.Text = gc.Name;

                    // Order History column
                    LinkButton lbtnOrderHistory = gi.FindControl <LinkButton>("lbtnOrderHistory");

                    if (Customer.HasOrders(gc.CustomerID))
                    {
                        lbtnOrderHistory.Text        = AppLogic.GetString("admin.common.View", ThisCustomer.LocaleSetting);
                        lbtnOrderHistory.PostBackUrl = "cst_history.aspx?Customerid=" + gc.CustomerID;
                    }
                    else
                    {
                        lbtnOrderHistory.Text        = AppLogic.GetString("admin.common.None", ThisCustomer.LocaleSetting);
                        lbtnOrderHistory.PostBackUrl = String.Empty;
                        lbtnOrderHistory.Enabled     = false;
                    }

                    // Admin column
                    Literal ltIsAdmin        = gi.FindControl <Literal>("ltIsAdmin");
                    Button  btnSetAdmin      = gi.FindControl <Button>("btnSetAdmin");
                    Button  btnSetSuperAdmin = gi.FindControl <Button>("btnSetSuperAdmin");

                    if (gc.Admin > 0)
                    {
                        ltIsAdmin.Text = AppLogic.GetString("admin.common.Yes", ThisCustomer.LocaleSetting) + CommonLogic.IIF(gc.Admin.Equals(3), " (SuperUser)", "");

                        if (gc.Admin.Equals(3))
                        {
                            btnSetAdmin.Visible = false;

                            if (ThisCustomer.IsAdminSuperUser)
                            {
                                btnSetSuperAdmin.Text            = AppLogic.GetString("admin.customers.ClearSuperAdmin", ThisCustomer.LocaleSetting);
                                btnSetSuperAdmin.Visible         = true;
                                btnSetSuperAdmin.CommandName     = "ClearSuperAdmin";
                                btnSetSuperAdmin.CommandArgument = gc.CustomerID.ToString();
                            }
                            else
                            {
                                btnSetSuperAdmin.Visible = false;
                            }
                        }
                        else
                        {
                            if (ThisCustomer.IsAdminSuperUser)
                            {
                                btnSetAdmin.Text            = AppLogic.GetString("admin.customers.ClearAdmin", ThisCustomer.LocaleSetting);
                                btnSetAdmin.Visible         = true;
                                btnSetAdmin.CommandName     = "ClearAdmin";
                                btnSetAdmin.CommandArgument = gc.CustomerID.ToString();

                                btnSetSuperAdmin.Text            = AppLogic.GetString("admin.customers.SetSuperAdmin", ThisCustomer.LocaleSetting);
                                btnSetSuperAdmin.Visible         = true;
                                btnSetSuperAdmin.CommandName     = "SetSuperAdmin";
                                btnSetSuperAdmin.CommandArgument = gc.CustomerID.ToString();
                            }
                            else
                            {
                                btnSetSuperAdmin.Visible = false;
                                btnSetAdmin.Visible      = false;
                            }
                        }
                    }
                    else
                    {
                        ltIsAdmin.Text = AppLogic.GetString("admin.common.No", ThisCustomer.LocaleSetting);

                        if (ThisCustomer.IsAdminSuperUser)
                        {
                            btnSetAdmin.Text            = AppLogic.GetString("admin.customers.SetAdmin", ThisCustomer.LocaleSetting);
                            btnSetAdmin.Visible         = true;
                            btnSetAdmin.CommandName     = "SetAdmin";
                            btnSetAdmin.CommandArgument = gc.CustomerID.ToString();

                            btnSetSuperAdmin.Text            = AppLogic.GetString("admin.customers.SetSuperAdmin", ThisCustomer.LocaleSetting);
                            btnSetSuperAdmin.Visible         = true;
                            btnSetSuperAdmin.CommandName     = "SetSuperAdmin";
                            btnSetSuperAdmin.CommandArgument = gc.CustomerID.ToString();
                        }
                        else
                        {
                            btnSetSuperAdmin.Visible = false;
                            btnSetAdmin.Visible      = false;
                        }
                    }

                    // Subscription column
                    Literal ltSubscriptionExpiresOn = gi.FindControl <Literal>("ltSubscriptionExpiresOn");
                    ltSubscriptionExpiresOn.Text = CommonLogic.IIF(gc.SubscriptionExpires.Equals(DateTime.MinValue), AppLogic.GetString("admin.common.NA", ThisCustomer.LocaleSetting), Localization.ParseLocaleDateTime(gc.SubscriptionExpires.ToString(), ThisCustomer.LocaleSetting).ToShortDateString());

                    // Email column
                    Literal ltEmailMailTo = gi.FindControl <Literal>("ltEmailMailTo");
                    Literal ltOkToEmail   = gi.FindControl <Literal>("ltOkToEmail");

                    ltEmailMailTo.Text = "<a href=\"mailto:" + gc.Email + "\">" + gc.Email + "</a>";
                    ltOkToEmail.Text   = "OkToEmail:" + CommonLogic.IIF(gc.OkToEmail, AppLogic.GetString("admin.common.Yes", ThisCustomer.LocaleSetting), AppLogic.GetString("admin.common.No", ThisCustomer.LocaleSetting));

                    // billing address column
                    Literal ltAddress = gi.FindControl <Literal>("ltAddress");

                    ltAddress.Text = Customer.BillToAddress(false, true, gc.CustomerID, "<br/>");

                    // nuke column
                    Button btnNuke = gi.FindControl <Button>("btnNuke");
                    btnNuke.OnClientClick = "return confirm('" + AppLogic.GetString("admin.customers.NukeCustomerConfirmation", ThisCustomer.LocaleSetting).Replace(@"'", @"\'").Replace("\\n", " ").Replace("\n", " ") + "');";

                    // nuke and ban column
                    Button btnNukeBan = gi.FindControl <Button>("btnNukeBan");
                    btnNukeBan.OnClientClick = "return confirm('" + AppLogic.GetString("admin.customers.NukeCustomerConfirmation", ThisCustomer.LocaleSetting).Replace(@"'", @"\'").Replace("\\n", " ").Replace("\n", " ") + "');";
                }
            }
        }
Пример #21
0
        protected void gv_precios_UpdateCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                lblmensaje.Text = "";
                Conexion Ocoon = new Conexion();

                GridItem item = gv_precios.Items[e.Item.ItemIndex];

                Label lbl_id_StockDetalle = (Label)item.FindControl("lbl_id_StockDetalle");
                int   iid_det             = Convert.ToInt32(lbl_id_StockDetalle.Text.Trim());

                CheckBox ckvalidado = (CheckBox)item.FindControl("cb_validar");



                List <object> ArrayEditorValue = new List <object>();

                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager  editMan    = editedItem.EditManager;

                foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                {
                    if (column is IGridEditableColumn)
                    {
                        IGridEditableColumn editableCol = (column as IGridEditableColumn);
                        if (editableCol.IsEditable)
                        {
                            IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);

                            string editorType  = editor.ToString();
                            string editorText  = "unknown";
                            object editorValue = null;

                            if (editor is GridNumericColumnEditor)
                            {
                                editorText  = (editor as GridNumericColumnEditor).Text;
                                editorValue = (editor as GridNumericColumnEditor).NumericTextBox.DbValue;
                                ArrayEditorValue.Add(editorValue);
                            }

                            if (editor is GridDateTimeColumnEditor)
                            {
                                editorText  = (editor as GridDateTimeColumnEditor).Text;
                                editorValue = (editor as GridDateTimeColumnEditor).PickerControl;
                                ArrayEditorValue.Add(editorValue);
                            }
                        }
                    }
                }
                DateTime Fec_reg_bd = Convert.ToDateTime((ArrayEditorValue[0] as RadDateTimePicker).SelectedDate);


                string ingreso = ArrayEditorValue[1].ToString();
                string pedido  = ArrayEditorValue[2].ToString();


                Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_STOCK_SANFERNDO", iid_det, pedido, ingreso, Fec_reg_bd, Session["sUser"].ToString(), DateTime.Now, ckvalidado.Checked);

                cargarGrilla_Precio();
            }
            catch (Exception ex)
            {
                lblmensaje.Text = ex.ToString();
                Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
Пример #22
0
        void ordersRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
            {
                GridItem    item = e.Item as GridItem;
                DataRowView drv  = e.Item.DataItem as DataRowView;

                ePointState collectionPointState = (ePointState)Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["CollectionPointStateId"].ToString());
                ePointState deliveryPointState   = (ePointState)Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["deliveryPointStateId"].ToString());

                int collectionPointId = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["CollectionPointId"].ToString());
                int deliveryPointId   = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["DeliveryPointId"].ToString());

                DateTime collectAt     = Convert.ToDateTime(((System.Data.DataRowView)e.Item.DataItem)["CollectionDateTime"].ToString());
                DateTime collectAtBy   = Convert.ToDateTime(((System.Data.DataRowView)e.Item.DataItem)["CollectionByDateTime"].ToString());
                DateTime deliverAt     = Convert.ToDateTime(((System.Data.DataRowView)e.Item.DataItem)["DeliveryDateTime"].ToString());
                DateTime deliverAtFrom = Convert.ToDateTime(((System.Data.DataRowView)e.Item.DataItem)["DeliveryFromDateTime"].ToString());

                bool collectionIsAnyTime = Convert.ToBoolean(((System.Data.DataRowView)e.Item.DataItem)["CollectionIsAnyTime"].ToString());
                bool deliveryIsAnyTime   = Convert.ToBoolean(((System.Data.DataRowView)e.Item.DataItem)["DeliveryIsAnyTime"].ToString());

                int         lcid       = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["LCID"].ToString());
                decimal     rate       = Convert.ToDecimal(((System.Data.DataRowView)e.Item.DataItem)["ForeignRate"].ToString());
                HiddenField hidOrderID = e.Item.FindControl("hidOrderChanged") as HiddenField;

                TextBox txtCollectAt        = e.Item.FindControl("txtCollectAt") as TextBox;
                TextBox txtCollectionAtTime = e.Item.FindControl("txtCollectionAtTime") as TextBox;
                TextBox txtDeliverAt        = e.Item.FindControl("txtDeliverAt") as TextBox;
                TextBox txtDeliverAtTime    = e.Item.FindControl("txtDeliverAtTime") as TextBox;
                TextBox txtRate             = e.Item.FindControl("txtRate") as TextBox;

                txtCollectAt.Attributes.Add("hidOrderID", hidOrderID.ClientID);
                txtCollectionAtTime.Attributes.Add("hidOrderID", hidOrderID.ClientID);
                txtDeliverAt.Attributes.Add("hidOrderID", hidOrderID.ClientID);
                txtDeliverAtTime.Attributes.Add("hidOrderID", hidOrderID.ClientID);
                txtRate.Attributes.Add("hidOrderID", hidOrderID.ClientID);

                CollectionDateManager.TargetControls.Add(new TargetInput(txtCollectAt.UniqueID, true));
                DeliveryDateManager.TargetControls.Add(new TargetInput(txtDeliverAt.UniqueID, true));

                TimeManager.TargetControls.Add(new TargetInput(txtCollectionAtTime.UniqueID, true));
                TimeManager.TargetControls.Add(new TargetInput(txtDeliverAtTime.UniqueID, true));

                RateManager.TargetControls.Add(new TargetInput(txtRate.UniqueID, true));

                txtCollectAt.Text        = collectAt.ToString();
                txtCollectionAtTime.Text = collectAt.ToString();
                txtDeliverAt.Text        = deliverAt.ToString();
                txtDeliverAtTime.Text    = deliverAt.ToString();

                if (collectionIsAnyTime)
                {
                    txtCollectionAtTime.Text = "";
                }
                else
                {
                    txtCollectAt.Enabled = txtCollectionAtTime.Enabled = (collectAt == collectAtBy);
                }

                if (deliveryIsAnyTime)
                {
                    txtDeliverAtTime.Text = "";
                }
                else
                {
                    txtDeliverAt.Enabled = txtDeliverAtTime.Enabled = (deliverAt == deliverAtFrom);
                }

                txtRate.Text = rate.ToString();

                int    orderId = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem)["OrderId"].ToString());
                string collectionPointDescription       = ((System.Data.DataRowView)e.Item.DataItem)["CollectionPointDescription"].ToString();
                string deliveryPointDescription         = ((System.Data.DataRowView)e.Item.DataItem)["DeliveryPointDescription"].ToString();
                bool   itemHasPointsThatRequireApproval = false;

                // Set the hidden field order id.
                HtmlInputHidden hidOrderId = (HtmlInputHidden)item.FindControl("hidOrderId");
                hidOrderId.Value = orderId.ToString();

                // Only show approval hyperlink if point is unapproved.
                if (collectionPointState == ePointState.Unapproved)
                {
                    itemHasPointsThatRequireApproval = true;
                    Literal litCollectFrom = item.FindControl("litCollectFrom") as Literal;
                    litCollectFrom.Controls.Add(new LiteralControl(string.Format(unApprovedPoint, ((System.Data.DataRowView)e.Item.DataItem)["CollectionPointDescription"].ToString(), string.Format("javascript:openDialogWithScrollbars('ApproveOrderPoint.aspx?PointId={0}&OrderId={1}&Ptype={2}',0,0);", collectionPointId, orderId, "C"))));
                }
                else
                {
                    Label lblCollectFromPoint = (Label)item.FindControl("lblCollectFromPoint");
                    lblCollectFromPoint.Text = collectionPointDescription;
                }

                if (deliveryPointState == ePointState.Unapproved)
                {
                    itemHasPointsThatRequireApproval = true;
                    Literal litDeliverTo = item.FindControl("litDeliverTo") as Literal;
                    litDeliverTo.Controls.Add(new LiteralControl(string.Format(unApprovedPoint, ((System.Data.DataRowView)e.Item.DataItem)["DeliveryPointDescription"].ToString(), string.Format("javascript:openDialogWithScrollbars('ApproveOrderPoint.aspx?PointId={0}&OrderId={1}&Ptype={2}',0,0);", deliveryPointId, orderId, "D"))));
                }
                else
                {
                    Label lblDeliverToPoint = (Label)item.FindControl("lblDeliverToPoint");
                    lblDeliverToPoint.Text = deliveryPointDescription;
                }

                CheckBox selectionCheckbox = (CheckBox)item.FindControl("chkSelectOrder");
                if (itemHasPointsThatRequireApproval)
                {
                    selectionCheckbox.Enabled = false;
                }
                else
                {
                    selectionCheckbox.Attributes.Add("onclick", "javascript:ChangeList(event,this);");
                }
            }
        }
        protected void gv_competencia_UpdateCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                lblmensaje.Text = "";
                Conexion Ocoon = new Conexion();

                GridItem item = gv_competencia.Items[e.Item.ItemIndex];

                Label lbl_id_regcompetencia = (Label)item.FindControl("lblregcompetencia");
                int   iid_regcompetencia    = Convert.ToInt32(lbl_id_regcompetencia.Text.Trim());


                CheckBox ckvalidado = (CheckBox)item.FindControl("cb_validar");
                //psalas, 16/08/2011, se agrega esta logica porque en la tabla ope_reporte_competencia,
                //los validados se consideran como 0 y los invalidados como 1
                if (ckvalidado.Checked == true)
                {
                    ckvalidado.Checked = false;
                }
                else
                {
                    ckvalidado.Checked = true;
                }


                List <object> ArrayEditorValue = new List <object>();

                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager  editMan    = editedItem.EditManager;

                foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
                {
                    if (column is IGridEditableColumn)
                    {
                        IGridEditableColumn editableCol = (column as IGridEditableColumn);
                        if (editableCol.IsEditable)
                        {
                            IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);

                            string editorType  = editor.ToString();
                            string editorText  = "unknown";
                            object editorValue = null;

                            if (editor is GridNumericColumnEditor)
                            {
                                editorText  = (editor as GridNumericColumnEditor).Text;
                                editorValue = (editor as GridNumericColumnEditor).NumericTextBox.DbValue;
                                ArrayEditorValue.Add(editorValue);
                            }

                            if (editor is GridDateTimeColumnEditor)
                            {
                                editorText  = (editor as GridDateTimeColumnEditor).Text;
                                editorValue = (editor as GridDateTimeColumnEditor).PickerControl;
                                ArrayEditorValue.Add(editorValue);
                            }
                        }
                    }
                }

                DateTime promocionini  = Convert.ToDateTime((ArrayEditorValue[0] as RadDateTimePicker).SelectedDate);
                DateTime promocionfin  = Convert.ToDateTime((ArrayEditorValue[1] as RadDateTimePicker).SelectedDate);
                string   precioregular = ArrayEditorValue[2].ToString();
                //psalas. 16/08/2011. se agrega preciooferta por requerimiento san fernando
                string preciooferta = ArrayEditorValue[3].ToString();

                string strpromocionini = Convert.ToString(promocionini);
                string strpromocionfin = Convert.ToString(promocionfin);


                Ocoon.ejecutarDataReader("UP_WEBXPLORA_OPE_ACTUALIZAR_REPORTE_COMPETENCIA_SF_MODERNO", iid_regcompetencia, precioregular, preciooferta, strpromocionini, strpromocionfin, Session["sUser"].ToString(), DateTime.Now, ckvalidado.Checked);
                cargarGrilla_Competencias();
            }
            catch (Exception ex)
            {
                lblmensaje.Text = ex.ToString();
                Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
Пример #24
0
        private void PerformInsert(GridCommandEventArgs e)
        {
            int    Id_Emp          = 0;
            int    Id_Cd           = 0;
            int    Id_Fis          = 0;
            int    Id_FisCons      = 0;
            int    Id_Cte          = 0;
            int    Id_Ter          = 0;
            int    Fis_Consignados = 0;
            string Id_CteStr       = "";
            string Id_TerStr       = "";

            DataRow[] Ar_dr;
            GridItem  gi = e.Item;

            if (((RadNumericTextBox)gi.FindControl("txtIdCte")).Text == "" ||
                ((RadNumericTextBox)gi.FindControl("txtIdTer")).Text == "" ||
                ((RadNumericTextBox)gi.FindControl("txtFis_Consignados")).Text == "")
            {
                e.Canceled = true;
                this.Alerta("Todos los campos son requeridos");
                return;
            }

            Sesion session = new Sesion();

            session = (Sesion)Session["Sesion" + Session.SessionID];

            Id_Emp          = session.Id_Emp;
            Id_Cd           = session.Id_Cd_Ver;
            Id_Fis          = Convert.ToInt32(MaximoId("CapFisico", "Id_Fis"));
            Id_FisCons      = dt.Rows.Count + Convert.ToInt32(MaximoId("CapFisicoConsignado", "Id_FisCons"));
            Id_Cte          = Convert.ToInt32(((RadNumericTextBox)gi.FindControl("txtIdCte")).Text);
            Id_CteStr       = ((RadTextBox)gi.FindControl("txtCliente")).Text;
            Id_Ter          = Convert.ToInt32(((RadNumericTextBox)gi.FindControl("txtIdTer")).Text);
            Id_TerStr       = ((RadComboBox)gi.FindControl("Cmb_Id_Ter")).SelectedItem.Text;
            Fis_Consignados = Convert.ToInt32(((RadNumericTextBox)gi.FindControl("txtFis_Consignados")).Text);

            Ar_dr = dt.Select("Id_Emp='" + Id_Emp + "' and Id_Cd='" + Id_Cd + "' and Id_FisCons='" + Id_FisCons + "'");
            DataRow[] Ar_Dr2 = dt.Select("Id_Emp='" + Id_Emp + "' and id_cd='" + Id_Cd + "' and Id_Cte='" + Id_Cte + "' and Id_Ter='" + Id_Ter + "'");
            if (Ar_dr.Length > 0)
            {
                this.Alerta("Producto ya capturado");
                e.Canceled = true;
            }
            else if (Ar_Dr2.Length > 0)
            {
                this.Alerta("El cliente-territorio ya fue capturado");
                e.Canceled = true;
            }
            else
            {
                dt.Rows.Add(new object[] {
                    Id_Emp,
                    Id_Cd,
                    Id_Fis,
                    Id_FisCons,
                    Id_Cte,
                    Id_CteStr,
                    Id_Ter,
                    Id_TerStr,
                    Fis_Consignados
                });
            }
        }