コード例 #1
0
    private void UpdateItemHojaRuta(GridEditableItem editedItem, long IdItemHoja, long IdPlantilla)
    {
        #region Recupero los  Datos Ingresado por el usuario

        GridEditManager editMan = editedItem.EditManager;

        string   AuditadoPor             = (Session["usuario"] as Entidades.SegUsuario).Login;
        DateTime HojaFechaControlado     = DateTime.Now;
        string   ComentarioGralIngresado = ((TextBox)editedItem.FindControl("txtComentarioGralEdit")).Text;
        string   ComentarioItemHoja      = ((TextBox)editedItem.FindControl("txtComentarioItemHoja")).Text;
        DateTime?FechaAprobacionItemHoja = null;

        if ((editMan.GetColumnEditor("HojaFechaAprobacioncolumn") as GridDateTimeColumnEditor).Text != "")
        {
            FechaAprobacionItemHoja = DateTime.Parse((editMan.GetColumnEditor("HojaFechaAprobacioncolumn") as GridDateTimeColumnEditor).Text);
        }


        #endregion


        Entidades.HojasDeRuta CurrentItem = (from i in Contexto.HojasDeRuta
                                             where i.IdHojaDeRuta == IdItemHoja
                                             select i).FirstOrDefault();



        TempComentarioGrales CurrentComentario = (from C in ComentariosGrales
                                                  where C.IdPlantilla == IdPlantilla
                                                  select C).FirstOrDefault <TempComentarioGrales>();


        if (!CurrentItem.PlantillaReference.IsLoaded)
        {
            CurrentItem.PlantillaReference.Load();
        }
        if (CurrentComentario == null)
        {
            ComentariosGral coment = new ComentariosGral();
            coment.Comentario       = ComentarioGralIngresado;
            coment.ContratoEmpresas = CurrentTempCabecera.ContratoEmpresas;
            coment.Plantilla        = CurrentItem.Plantilla;
            Contexto.AddObject("ComentariosGral", coment);
        }
        else
        {
            Entidades.ComentariosGral CurrentComentarioGral = (from c in Contexto.ComentariosGral
                                                               where c.Plantilla.IdPlantilla == IdPlantilla &&
                                                               c.ContratoEmpresas.IdContratoEmpresas == CurrentTempCabecera.ContratoEmpresas.IdContratoEmpresas
                                                               select c).FirstOrDefault();

            CurrentComentarioGral.Comentario = ComentarioGralIngresado;
        }



        CurrentItem.AuditadoPor         = AuditadoPor;
        CurrentItem.HojaFechaControlado = HojaFechaControlado;
        CurrentItem.HojaComentario      = ComentarioItemHoja;
        CurrentItem.HojaFechaAprobacion = FechaAprobacionItemHoja;
        if (FechaAprobacionItemHoja != null)
        {
            CurrentItem.HojaAprobado = true;
        }
        else
        {
            CurrentItem.HojaAprobado = false;
        }


        Contexto.SaveChanges();
        CargarDatosSession();
        gvItemHoja.Rebind();
    }
コード例 #2
0
    private void InsertContrato(GridEditFormInsertItem editedItem)
    {
        #region Genero el CONTRATO con los datos ingresado por el usuario
        long            idCategoria_Ingresada = 0;
        GridEditManager editMan                        = editedItem.EditManager;
        string          codigo_Ingresado               = ((TextBox)editedItem.FindControl("TextBoxCodigo")).Text;
        string          servicio_Ingresado             = ((TextBox)editedItem.FindControl("TextBoxServicio")).Text;
        long            idContratista_Ingresado        = long.Parse(((RadComboBox)editedItem.FindControl("RadComboBoxContratista")).SelectedValue);
        long            idTipoContrato_Ingresado       = long.Parse(((RadComboBox)editedItem.FindControl("cboTipoContrato")).SelectedValue);
        long            idContratadoPor_Ingresado      = long.Parse(((RadComboBox)editedItem.FindControl("cboContratadoPor")).SelectedValue);
        DateTime        fechaInicioContrato_Ingresado  = DateTime.Parse((editedItem.FindControl("TextBoxFechaInicio") as TextBox).Text);
        DateTime        fechaFinContrato_Ingresado     = DateTime.Parse((editedItem.FindControl("TextBoxFechaVencimiento") as TextBox).Text);
        DateTime?       fechaPorrogaContrato_Ingresado = null;

        if (((RadComboBox)editedItem.FindControl("cboCategoria")).SelectedValue != "")
        {
            idCategoria_Ingresada = long.Parse(((RadComboBox)editedItem.FindControl("cboCategoria")).SelectedValue);
        }


        if ((editedItem.FindControl("TextBoxProrroga") as TextBox).Text != "")
        {
            fechaPorrogaContrato_Ingresado = DateTime.Parse((editedItem.FindControl("TextBoxProrroga") as TextBox).Text);
        }


        if ((from c in Contexto.Contrato
             where c.Codigo == codigo_Ingresado.Trim()
             select c).Count() > 0)
        {
            string scriptstring = "radalert('<h4>No se puede crear el contrato ya que el nro del mismo ya existe!</h4>', 330, 100, 'Contratos');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", scriptstring, true);
            return;
        }



        Entidades.Contrato _Contrato = new Entidades.Contrato();
        _Contrato.Codigo           = codigo_Ingresado;
        _Contrato.Servicio         = servicio_Ingresado;
        _Contrato.FechaInicio      = fechaInicioContrato_Ingresado;
        _Contrato.FechaVencimiento = fechaFinContrato_Ingresado;
        _Contrato.Contratadopor    = Contexto.Clasificacion.Where(w => w.IdClasificacion == idContratadoPor_Ingresado).FirstOrDefault();
        _Contrato.TipoContrato     = Contexto.Clasificacion.Where(w => w.IdClasificacion == idTipoContrato_Ingresado).FirstOrDefault();

        if (idCategoria_Ingresada > 0)
        {
            _Contrato.objCategoria = Contexto.Clasificacion.Where(w => w.IdClasificacion == idCategoria_Ingresada).FirstOrDefault();
        }


        #endregion

        #region Genero el CONTRATO-EMPRESA con los datos ingresado por el usuario

        Entidades.ContratoEmpresas _ContEmp = new Entidades.ContratoEmpresas();
        IEnumerable <KeyValuePair <string, object> > entityKeyValues =
            new KeyValuePair <string, object>[] {
            new KeyValuePair <string, object>("IdEmpresa", idContratista_Ingresado)
        };
        EntityKey         key  = new EntityKey("EntidadesConosud.Empresa", entityKeyValues);
        Entidades.Empresa _emp = (Entidades.Empresa)Contexto.GetObjectByKey(key);

        _ContEmp.EsContratista = true;
        _ContEmp.Contrato      = _Contrato;
        _ContEmp.Empresa       = _emp;

        Contexto.AddObject("EntidadesConosud.ContratoEmpresas", _ContEmp);

        #endregion

        #region Genero el ENCABEZADO Y LAS HOJAS con los datos ingresado por el usuario

        DateTime FFin = DateTime.Now;
        if (_Contrato.Prorroga.HasValue)
        {
            FFin = _Contrato.Prorroga.Value;
        }
        else
        {
            FFin = _Contrato.FechaVencimiento.Value;
        }

        DateTime FechaInicio = new DateTime(_Contrato.FechaInicio.Value.Year, _Contrato.FechaInicio.Value.Month, 1);

        Helpers.GenerarHojadeRuta(Contexto, FechaInicio, FFin, _ContEmp);

        #endregion

        Contexto.SaveChanges();
        CargarSessionContratos();
    }
コード例 #3
0
    private void UpdateItemHojaRuta(long IdItemHoja, long IdPlantilla)
    {
        #region Recupero los  Datos Ingresado por el usuario


        string   AuditadoPor             = (Session["usuario"] as Entidades.SegUsuario).Login;
        DateTime HojaFechaControlado     = DateTime.Now;
        string   ComentarioGralIngresado = txtComentarioGral.Text;
        string   ComentarioItemHoja      = txtComentarioItem.Text;
        DateTime?FechaAprobacionItemHoja = txtFechaAprobacion.SelectedDate;


        #endregion


        Entidades.HojasDeRuta CurrentItem = (from i in Contexto.HojasDeRuta
                                             where i.IdHojaDeRuta == IdItemHoja
                                             select i).FirstOrDefault();



        TempComentarioGrales CurrentComentario = (from C in ComentariosGrales
                                                  where C.IdPlantilla == IdPlantilla
                                                  select C).FirstOrDefault <TempComentarioGrales>();


        if (!CurrentItem.PlantillaReference.IsLoaded)
        {
            CurrentItem.PlantillaReference.Load();
        }
        if (CurrentComentario == null)
        {
            ComentariosGral coment = new ComentariosGral();
            coment.Comentario       = ComentarioGralIngresado;
            coment.ContratoEmpresas = CurrentTempCabecera.ContratoEmpresas;
            coment.Plantilla        = CurrentItem.Plantilla;
            Contexto.AddObject("ComentariosGral", coment);
        }
        else
        {
            Entidades.ComentariosGral CurrentComentarioGral = (from c in Contexto.ComentariosGral
                                                               where c.Plantilla.IdPlantilla == IdPlantilla &&
                                                               c.ContratoEmpresas.IdContratoEmpresas == CurrentTempCabecera.ContratoEmpresas.IdContratoEmpresas
                                                               select c).FirstOrDefault();

            CurrentComentarioGral.Comentario = ComentarioGralIngresado;
        }



        CurrentItem.AuditadoPor         = AuditadoPor;
        CurrentItem.HojaFechaControlado = HojaFechaControlado;
        CurrentItem.HojaComentario      = ComentarioItemHoja;
        CurrentItem.HojaFechaAprobacion = FechaAprobacionItemHoja;

        if (FechaAprobacionItemHoja != null)
        {
            CurrentItem.HojaAprobado       = true;
            CurrentItem.AuditoriaTerminada = true;
        }
        else
        {
            CurrentItem.HojaAprobado       = false;
            CurrentItem.AuditoriaTerminada = false;
        }


        Contexto.SaveChanges();
        CargarDatosSession();
        gvItemHoja.Rebind();
        upGrilla.Update();
    }
コード例 #4
0
    private void InsertContrato(GridEditFormInsertItem editedItem)
    {
        #region Genero el CONTRATO con los datos ingresado por el usuario

        GridEditManager editMan                   = editedItem.EditManager;
        string          codigo_Ingresado          = (editMan.GetColumnEditor("Codigo") as GridTextBoxColumnEditor).Text;
        string          servicio_Ingresado        = (editMan.GetColumnEditor("Servicio") as GridTextBoxColumnEditor).Text;
        long            idContratista_Ingresado   = long.Parse(((RadComboBox)editedItem.FindControl("cboContratista")).SelectedValue);
        long            idTipoContrato_Ingresado  = long.Parse(((RadComboBox)editedItem.FindControl("cboTipoContrato")).SelectedValue);
        long            idContratadoPor_Ingresado = long.Parse(((RadComboBox)editedItem.FindControl("cboContratadoPor")).SelectedValue);
        long            idCategoria_Ingresado     = long.Parse(((RadComboBox)editedItem.FindControl("cboCategoria")).SelectedValue);
        long            idArea_Ingresado          = long.Parse(((RadComboBox)editedItem.FindControl("cboArea")).SelectedValue);


        string GestorNombre_Ingresado = ((TextBox)editedItem.FindControl("txtNombreGestor")).Text;
        string GestorEmail_Ingresado  = ((TextBox)editedItem.FindControl("txtEmailGestor")).Text;
        string FiscalNombre_Ingresado = ((TextBox)editedItem.FindControl("txtNombreFiscales")).Text;
        string FiscalEmail_Ingresado  = ((TextBox)editedItem.FindControl("txtEmailFiscales")).Text;


        DateTime fechaInicioContrato_Ingresado  = DateTime.Parse((editedItem.FindControl("TextBoxFechaInicio") as TextBox).Text);
        DateTime fechaFinContrato_Ingresado     = DateTime.Parse((editedItem.FindControl("TextBoxFechaVencimiento") as TextBox).Text);
        DateTime?fechaPorrogaContrato_Ingresado = null;

        if ((editedItem.FindControl("TextBoxProrroga") as TextBox).Text != "")
        {
            fechaPorrogaContrato_Ingresado = DateTime.Parse((editedItem.FindControl("TextBoxProrroga") as TextBox).Text);
        }

        Entidades.Contrato _Contrato = new Entidades.Contrato();
        _Contrato.Codigo           = codigo_Ingresado.Trim();
        _Contrato.Servicio         = servicio_Ingresado;
        _Contrato.FechaInicio      = fechaInicioContrato_Ingresado;
        _Contrato.FechaVencimiento = fechaFinContrato_Ingresado;
        _Contrato.Contratadopor    = idContratadoPor_Ingresado;
        _Contrato.TipoContrato     = idTipoContrato_Ingresado;
        _Contrato.Categoria        = idCategoria_Ingresado;
        _Contrato.Area             = idArea_Ingresado;
        _Contrato.GestorNombre     = GestorNombre_Ingresado;
        _Contrato.GestorEmail      = GestorEmail_Ingresado;
        _Contrato.FiscalNombre     = FiscalNombre_Ingresado;
        _Contrato.FiscalEmail      = FiscalEmail_Ingresado;

        #endregion

        #region Genero el CONTRATO-EMPRESA con los datos ingresado por el usuario

        Entidades.ContratoEmpresas _ContEmp = new Entidades.ContratoEmpresas();
        IEnumerable <KeyValuePair <string, object> > entityKeyValues =
            new KeyValuePair <string, object>[] {
            new KeyValuePair <string, object>("IdEmpresa", idContratista_Ingresado)
        };
        EntityKey         key  = new EntityKey("EntidadesConosud.Empresa", entityKeyValues);
        Entidades.Empresa _emp = (Entidades.Empresa)Contexto.GetObjectByKey(key);

        _ContEmp.EsContratista = true;
        _ContEmp.Contrato      = _Contrato;
        _ContEmp.Empresa       = _emp;

        Contexto.AddObject("EntidadesConosud.ContratoEmpresas", _ContEmp);

        #endregion

        #region Genero el ENCABEZADO Y LAS HOJAS con los datos ingresado por el usuario

        DateTime FFin = DateTime.Now;
        if (_Contrato.Prorroga.HasValue)
        {
            FFin = _Contrato.Prorroga.Value;
        }
        else
        {
            FFin = _Contrato.FechaVencimiento.Value;
        }

        DateTime FechaInicio = new DateTime(_Contrato.FechaInicio.Value.Year, _Contrato.FechaInicio.Value.Month, 1);

        Helpers.GenerarHojadeRuta(Contexto, FechaInicio, FFin, _ContEmp);

        #endregion

        Contexto.SaveChanges();
        CargarSessionContratos();
        RadGrid1.Rebind();
    }