示例#1
0
    private string GetResponsableArea(int idArea)
    {
        string sRes = "";

        //PreventaArea oArea = PreventaArea.Select(tr, idArea);
        IB.SUPER.ADM.SIC.Models.AreaPreventa oArea = new IB.SUPER.ADM.SIC.Models.AreaPreventa();
        IB.SUPER.ADM.SIC.BLL.AreaPreventa    oElem = new IB.SUPER.ADM.SIC.BLL.AreaPreventa();
        oArea = oElem.Select(idArea);

        sRes = "OK@#@" + oArea.t001_idficepi_responsable.ToString() + "@#@" + oArea.Responsable;

        oElem.Dispose();

        return(sRes);
    }
示例#2
0
    private void CargarArea(int idArea)
    {
        //PreventaArea oArea = PreventaArea.Select(tr, idArea);
        IB.SUPER.ADM.SIC.Models.AreaPreventa oArea = new IB.SUPER.ADM.SIC.Models.AreaPreventa();
        IB.SUPER.ADM.SIC.BLL.AreaPreventa    oElem = new IB.SUPER.ADM.SIC.BLL.AreaPreventa();
        oArea          = oElem.Select2(idArea);
        txtArea.Text   = oArea.ta200_denominacion;
        hdnIdArea.Text = oArea.ta200_idareapreventa.ToString();
        //Por defecto el responsable de un subarea es el del área
        if (this.hdnIDResponsable.Text == "")
        {
            this.hdnIDResponsable.Text  = oArea.t001_idficepi_responsable.ToString();
            this.txtDesResponsable.Text = oArea.Responsable;
        }

        oElem.Dispose();
    }
    private void CargarDatosItem(int idArea)
    {
        IB.SUPER.ADM.SIC.Models.AreaPreventa oArea = new IB.SUPER.ADM.SIC.Models.AreaPreventa();
        IB.SUPER.ADM.SIC.BLL.AreaPreventa    oElem = new IB.SUPER.ADM.SIC.BLL.AreaPreventa();

        oArea = oElem.Select2(idArea);
        //PreventaArea oArea = PreventaArea.Select(null, idArea);
        txtID.Text             = idArea.ToString();
        txtDenominacion.Text   = oArea.ta200_denominacion;
        hdnIDResponsable.Text  = oArea.t001_idficepi_responsable.ToString();
        txtDesResponsable.Text = oArea.Responsable;
        if (oArea.ta200_estadoactiva)
        {
            chkActivo.Checked = true;
        }
        else
        {
            chkActivo.Checked = false;
        }

        oElem.Dispose();

        #region Datos del PT
        if (oArea.t331_idpt != null)
        {
            IB.SUPER.SIC.Models.ProyectoTecnico oPT     = new IB.SUPER.SIC.Models.ProyectoTecnico();
            IB.SUPER.SIC.BLL.ProyectoTecnico    oElemPT = new IB.SUPER.SIC.BLL.ProyectoTecnico();
            oPT = oElemPT.Select((int)oArea.t331_idpt);
            this.hdnIDPT.Value       = oPT.t331_idpt.ToString();
            this.txtNumPT.Text       = oPT.t331_idpt.ToString("#,###");
            this.txtPT.Text          = oPT.t331_despt;
            this.hdnT305IdProy.Value = oPT.t305_idproyectosubnodo.ToString();
            this.txtNumPE.Text       = oPT.t301_idproyecto.ToString("#,###");
            this.txtPE.Text          = oPT.t301_denominacion;

            oElemPT.Dispose();
        }
        #endregion
    }
    private string Grabar(string strDatosBasicos, string strFiguras)
    {
        string sResul = "";
        int    nID    = -1;

        string[] aDatosBasicos = null;
        IB.SUPER.ADM.SIC.Models.AreaPreventa oArea  = new IB.SUPER.ADM.SIC.Models.AreaPreventa();
        IB.SUPER.ADM.SIC.Models.AreaPreventa oAreaD = new IB.SUPER.ADM.SIC.Models.AreaPreventa();
        IB.SUPER.ADM.SIC.BLL.AreaPreventa    oElem  = new IB.SUPER.ADM.SIC.BLL.AreaPreventa();

        IB.SUPER.ADM.SIC.Models.FiguraAreaPreventa oFigura  = new IB.SUPER.ADM.SIC.Models.FiguraAreaPreventa();
        IB.SUPER.ADM.SIC.BLL.FiguraAreaPreventa    oElemFig = new IB.SUPER.ADM.SIC.BLL.FiguraAreaPreventa();
        try
        {
            #region Datos Generales

            if (strDatosBasicos != "")//No se ha modificado nada de la pestaña general
            {
                aDatosBasicos = Regex.Split(strDatosBasicos, "##");
                ///aDatosBasicos[0] = ID
                ///aDatosBasicos[1] = Denominacion
                ///aDatosBasicos[2] = IDResponsable
                ///aDatosBasicos[3] = Activo
                ///aDatosBasicos[4] = IdPadre
                ///aDatosBasicos[5] = IdPT
                oArea.ta199_idunidadpreventa    = short.Parse(aDatosBasicos[4]);
                oArea.ta200_denominacion        = aDatosBasicos[1];
                oArea.ta200_estadoactiva        = (aDatosBasicos[3] == "1") ? true : false;
                oArea.t001_idficepi_responsable = int.Parse(aDatosBasicos[2]);
                if (aDatosBasicos[5] != "")
                {
                    oArea.t331_idpt = int.Parse(aDatosBasicos[5]);
                }

                oAreaD = oElem.SelectPorDenominacion(oArea.ta200_denominacion);

                if (aDatosBasicos[0] == "") //insert
                {
                    if (oAreaD != null)
                    {
                        return("AVISO2@#@Ya existe un área con la misma denominación");               //throw new Exception("Ya existe un área con la misma denominación");
                    }
                    nID = oElem.Insert(oArea);
                }
                else //update
                {
                    nID = int.Parse(aDatosBasicos[0]);
                    if (oAreaD != null && oAreaD.ta200_idareapreventa != nID)
                    {
                        return("AVISO2@#@Ya existe un área con la misma denominación");
                    }
                    oArea.ta200_idareapreventa = nID;
                    oElem.Update(oArea);
                }
            }

            #endregion

            #region Datos Figuras
            if (strFiguras != "")//No se ha modificado nada de la pestaña de Figuras
            {
                string[] aUsuarios = Regex.Split(strFiguras, "///");
                foreach (string oUsuario in aUsuarios)
                {
                    if (oUsuario == "")
                    {
                        continue;
                    }
                    string[] aFig = Regex.Split(oUsuario, "##");
                    ///aFig[0] = bd
                    ///aFig[1] = idUsuario
                    ///aFig[2] = Figuras

                    if (aFig[0] == "D")
                    {
                        //PreventaAreaFiguras.DeleteUsuario(tr, nID, int.Parse(aFig[1]));
                        oElemFig.Delete(nID, int.Parse(aFig[1]));
                    }
                    else
                    {
                        string[] aFiguras = Regex.Split(aFig[2], ",");
                        foreach (string oFig in aFiguras)
                        {
                            if (oFig == "")
                            {
                                continue;
                            }
                            string[] aFig2 = Regex.Split(oFig, "@");
                            ///aFig2[0] = bd
                            ///aFig2[1] = Figura
                            oFigura.ta200_idareapreventa = nID;
                            oFigura.t001_idficepi        = int.Parse(aFig[1]);
                            oFigura.ta202_figura         = aFig2[1];
                            if (aFig2[0] == "D")
                            {
                                //PreventaAreaFiguras.Delete(tr, nID, int.Parse(aFig[1]), aFig2[1]);
                                oElemFig.DeleteFigura(nID, int.Parse(aFig[1]), aFig2[1]);
                            }
                            else
                            {
                                //PreventaAreaFiguras.Insert(tr, nID, int.Parse(aFig[1]), aFig2[1]);
                                oElemFig.Insert(oFigura);
                            }
                        }
                    }
                }
            }
            #endregion

            sResul = "OK@#@" + nID.ToString("#,###");
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al grabar los datos.", ex, false);
        }
        finally
        {
            oElem.Dispose();
            oElemFig.Dispose();
        }
        return(sResul);
    }