public EOPE_Reporte_Presencia RegistrarPresencia(int iPerson_id, string sId_Perfil, string sId_Equipo, string sId_Cliente, string sId_PtoVenta, string sId_Categoria,
                                                         string sId_Marca, string sId_OpcionPresencia, string sFec_Reg_Cel, string sLatitud, string sLongitud, string sOrigen,
                                                         string sTipo_Canal, string sComentario, string sId_Reg_Presencia)
        {
            oConn = new Conexion(2);
            string id = oConn.ejecutarretornodeOUTPUT("STP_JVM_INSERTAR_PRESENCIA", 15, iPerson_id, sId_Perfil, sId_Equipo, sId_Cliente, sId_PtoVenta, sId_Categoria,
                                                      sId_Marca, sId_OpcionPresencia, sFec_Reg_Cel, sLatitud, sLongitud, sOrigen, sTipo_Canal, sComentario, sId_Reg_Presencia);

            EOPE_Reporte_Presencia oEOPE_Reporte_Presencia = new EOPE_Reporte_Presencia();

            oEOPE_Reporte_Presencia.Person_id          = iPerson_id;
            oEOPE_Reporte_Presencia.Id_Perfil          = sId_Perfil;
            oEOPE_Reporte_Presencia.Id_Equipo          = sId_Equipo;
            oEOPE_Reporte_Presencia.Id_Cliente         = sId_Cliente;
            oEOPE_Reporte_Presencia.Id_PtoVenta        = sId_PtoVenta;
            oEOPE_Reporte_Presencia.Id_Categoria       = sId_Categoria;
            oEOPE_Reporte_Presencia.Id_Marca           = sId_Marca;
            oEOPE_Reporte_Presencia.Id_OpcionPresencia = sId_OpcionPresencia;
            oEOPE_Reporte_Presencia.Fec_Reg_Cel        = sFec_Reg_Cel;
            oEOPE_Reporte_Presencia.Latitud            = sLatitud;
            oEOPE_Reporte_Presencia.Longitud           = sLongitud;
            oEOPE_Reporte_Presencia.Origen             = sOrigen;
            oEOPE_Reporte_Presencia.Tipo_Canal         = sTipo_Canal;
            oEOPE_Reporte_Presencia.Comentario         = sComentario;
            oEOPE_Reporte_Presencia.ID = Convert.ToInt64(id);

            return(oEOPE_Reporte_Presencia);
        }
Beispiel #2
0
        public EOPE_Reporte_Presencia RegistrarReportePresenciaDetalle_Pivot(long lId_Reg_Presencia, string sId_Producto, string sValor_Pop)
        {
            DOPE_Reporte_Presencia oDOPE_Reporte_Presencia  = new DOPE_Reporte_Presencia();
            EOPE_Reporte_Presencia oEOPE_Rreporte_Presencia = oDOPE_Reporte_Presencia.RegistrarPresenciaDetalle_Pivot(lId_Reg_Presencia, sId_Producto, sValor_Pop);

            oDOPE_Reporte_Presencia = null;

            return(oEOPE_Rreporte_Presencia);
        }
Beispiel #3
0
        public EOPE_Reporte_Presencia RegistrarReportePresencia_Pivot(string sId_Dato, string sId_Reg_Presencia, string IDPresencia)
        {
            DOPE_Reporte_Presencia oDOPE_Reporte_Presencia  = new DOPE_Reporte_Presencia();
            EOPE_Reporte_Presencia oEOPE_Rreporte_Presencia = oDOPE_Reporte_Presencia.RegistrarPresencia_Pivot(sId_Dato, sId_Reg_Presencia, IDPresencia);

            oDOPE_Reporte_Presencia = null;

            return(oEOPE_Rreporte_Presencia);
        }
Beispiel #4
0
        public EOPE_Reporte_Presencia RegistrarReportePresenciaDetalle(long lId_Reg_Presencia, string sId_Pop, string sValor_Pop, string sId_Producto, string sPrecio, string sStock,
                                                                       string sId_Observacion, string sObservacion)
        {
            DOPE_Reporte_Presencia oDOPE_Reporte_Presencia  = new DOPE_Reporte_Presencia();
            EOPE_Reporte_Presencia oEOPE_Rreporte_Presencia = oDOPE_Reporte_Presencia.RegistrarPresenciaDetalle(lId_Reg_Presencia, sId_Pop, sValor_Pop, sId_Producto, sPrecio, sStock,
                                                                                                                sId_Observacion, sObservacion);

            oDOPE_Reporte_Presencia = null;

            return(oEOPE_Rreporte_Presencia);
        }
Beispiel #5
0
        public EOPE_Reporte_Presencia RegistrarReportePresencia(int iPerson_id, string sId_Perfil, string sId_Equipo, string sId_Cliente, string sId_PtoVenta, string sId_Categoria,
                                                                string sId_Marca, string sId_OpcionPresencia, string sFec_Reg_Cel, string sLatitud, string sLongitud, string sOrigen,
                                                                string sTipo_Canal, string sComentario, string sId_Reg_Presencia)
        {
            DOPE_Reporte_Presencia oDOPE_Reporte_Presencia  = new DOPE_Reporte_Presencia();
            EOPE_Reporte_Presencia oEOPE_Rreporte_Presencia = oDOPE_Reporte_Presencia.RegistrarPresencia(iPerson_id, sId_Perfil, sId_Equipo, sId_Cliente, sId_PtoVenta, sId_Categoria, sId_Marca, sId_OpcionPresencia, sFec_Reg_Cel, sLatitud, sLongitud, sOrigen,
                                                                                                         sTipo_Canal, sComentario, sId_Reg_Presencia);

            oDOPE_Reporte_Presencia = null;

            return(oEOPE_Rreporte_Presencia);
        }
        public EOPE_Reporte_Presencia RegistrarPresencia_Pivot(string sId_Dato, string sId_Reg_Presencia, string IDPresencia)
        {
            string id = "";

            oConn = new Conexion(2);
            id    = oConn.ejecutarretornodeOUTPUT("STP_JVM_INSERTAR_PRESENCIA_PIVOT", 2, sId_Dato, sId_Reg_Presencia, id);

            EOPE_Reporte_Presencia oEOPE_Reporte_Presencia = new EOPE_Reporte_Presencia();

            oEOPE_Reporte_Presencia.ID = Convert.ToInt64(id);

            return(oEOPE_Reporte_Presencia);
        }
        public EOPE_Reporte_Presencia RegistrarPresenciaDetalle_Pivot(long lId, string sId_Producto, string sPrecio)
        {
            oConn = new Conexion(2);
            oConn.ejecutarDataTable("STP_JVM_INSERTAR_PRESENCIA_DETALLE_PIVOT", lId, sId_Producto, sPrecio);

            EOPE_Reporte_Presencia oEOPE_Reporte_Presencia = new EOPE_Reporte_Presencia();

            oEOPE_Reporte_Presencia.ID_REG_PRESENCIA = lId;
            oEOPE_Reporte_Presencia.Precio           = sPrecio;
            oEOPE_Reporte_Presencia.Id_Producto      = sId_Producto;


            return(oEOPE_Reporte_Presencia);
        }
        public EOPE_Reporte_Presencia RegistrarPresenciaDetalle(long lId_Reg_Presencia, string sId_Pop, string sValor_Pop, string sId_Producto, string sPrecio, string sStock,
                                                                string sId_Observacion, string sObservacion)
        {
            oConn = new Conexion(2);
            oConn.ejecutarDataTable("STP_JVM_INSERTAR_PRESENCIA_DETALLE", lId_Reg_Presencia, sId_Pop, sValor_Pop, sId_Producto, sPrecio, sStock,
                                    sId_Observacion, sObservacion);

            EOPE_Reporte_Presencia oEOPE_Reporte_Presencia = new EOPE_Reporte_Presencia();

            oEOPE_Reporte_Presencia.ID_REG_PRESENCIA = lId_Reg_Presencia;
            oEOPE_Reporte_Presencia.Id_Pop           = sId_Pop;
            oEOPE_Reporte_Presencia.Valor_Pop        = sValor_Pop;
            oEOPE_Reporte_Presencia.Id_Producto      = sId_Producto;
            oEOPE_Reporte_Presencia.Precio           = sPrecio;
            oEOPE_Reporte_Presencia.Stock            = sStock;
            oEOPE_Reporte_Presencia.Id_Observacion   = sId_Observacion;
            oEOPE_Reporte_Presencia.Observacion      = sObservacion;


            return(oEOPE_Reporte_Presencia);
        }
Beispiel #9
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);
            }
        }