public Boolean AnularDB(prod_GestionProductivaTechos_CusTalme_Cab_Info info)
 {
     try
     {
         using (EntitiesProduccion context = new EntitiesProduccion())
         {
             var contact = context.prod_GestionProductivaTechos_CusTalme_Cab.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdGestionProductiva == info.IdGestionProductiva);
             if (contact != null)
             {
                 contact.Estado = "I";
                 context.SaveChanges();
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
         mensaje = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.ToString());
     }
 }
        public Boolean GuardarDB(prod_GestionProductivaTechos_CusTalme_Cab_Info Info, ref decimal Id)
        {
            try
            {
                List <prod_GestionProductivaTechos_CusTalme_Cab_Info> Lst = new List <prod_GestionProductivaTechos_CusTalme_Cab_Info>();
                using (EntitiesProduccion Context = new EntitiesProduccion())
                {
                    var Address = new prod_GestionProductivaTechos_CusTalme_Cab();

                    Address.IdEmpresa               = Info.IdEmpresa;
                    Address.IdGestionProductiva     = Id = GetId(Info.IdEmpresa);
                    Address.IdProducto_MateriaPrima = Info.IdProducto_MateriaPrima;
                    Address.Fecha        = Info.Fecha;
                    Address.IdModeloProd = Info.IdModeloProd;
                    Address.HrsTurno     = Info.HrsTurno;
                    Address.Tprep        = Info.Tprep;
                    Address.Despacho     = Info.Despacho;
                    Address.Factor       = Info.Factor;
                    Address.Num_Personas = Info.Num_Personas;
                    Address.Consumo      = Info.Consumo;
                    Address.Chatarra     = Info.Chatarra;
                    Address.IdTurno      = Info.IdTurno;

                    Address.ip               = Info.ip;
                    Address.Fecha_Transac    = Info.Fecha_Transac;
                    Address.nom_pc           = Info.nom_pc;
                    Address.IdUsuarioUltModi = Info.IdUsuarioUltModi;
                    Address.Fecha_UltMod     = Info.Fecha_UltMod;
                    Address.Estado           = "A";

                    Info.ListaDetalle.ForEach(var => { var.IdGestionProductiva = Address.IdGestionProductiva; var.IdEmpresa = Address.IdEmpresa; });

                    Context.prod_GestionProductivaTechos_CusTalme_Cab.Add(Address);
                    Context.SaveChanges();

                    if (dataDetalle.GuardarDB(Info.ListaDetalle))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
コード例 #3
0
        void Get()
        {
            try
            {
                Info          = new prod_GestionProductivaTechos_CusTalme_Cab_Info();
                Info.Chatarra = Convert.ToDouble(txtChatarra.EditValue);

                Info.Consumo = Convert.ToDouble(txtConsumo.EditValue);

                if (txtDespacho.Text != "")
                {
                    string[] I   = txtDespacho.Text.Split(':');
                    TimeSpan hrI = new TimeSpan(Convert.ToInt16(I[0]), Convert.ToInt16(I[1]), 0);
                    Info.Despacho = hrI;
                }

                Info.IdModeloProd = Convert.ToInt32(CmbTipoModelo.EditValue);
                Info.Factor       = Convert.ToDouble(txtFactor.EditValue);
                Info.Fecha        = Convert.ToDateTime(dtpFecha.EditValue);
                if (txtHrsTurno.Text != "")
                {
                    string[] I   = txtHrsTurno.Text.Split(':');
                    TimeSpan hrI = new TimeSpan(Convert.ToInt16(I[0]), Convert.ToInt16(I[1]), 0);
                    Info.HrsTurno = hrI;
                }
                Info.IdEmpresa = param.IdEmpresa;
                Info.IdProducto_MateriaPrima = Convert.ToDecimal(cmbMateriaPrima.EditValue);
                Info.IdTurno      = Convert.ToInt32(CmbTurno.EditValue);
                Info.Num_Personas = Convert.ToInt32(txtNumPersona.EditValue);

                //Info.Tprep=txtTPrep.Text;
                if (txtTPrep.Text != "")
                {
                    string[] I   = txtTPrep.Text.Split(':');
                    TimeSpan hrI = new TimeSpan(Convert.ToInt16(I[0]), Convert.ToInt16(I[1]), 0);
                    Info.Tprep = hrI;
                }


                for (int i = 0; i < GridView.RowCount; i++)
                {
                    prod_GestionProductivaTechos_CusTalme_Detalle_Info Item = (prod_GestionProductivaTechos_CusTalme_Detalle_Info)GridView.GetRow(i);
                    if (Item != null)
                    {
                        Info.ListaDetalle.Add(Item);
                    }
                }
                Info.IdGestionProductiva = Convert.ToDecimal((txtIdGestion.EditValue == "") ? 0 : txtIdGestion.EditValue);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
コード例 #4
0
 private void gridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         Info = (prod_GestionProductivaTechos_CusTalme_Cab_Info)gridView.GetFocusedRow();
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
     }
 }
 public Boolean AnularDB(prod_GestionProductivaTechos_CusTalme_Cab_Info Info)
 {
     try
     {
         cl_parametrosGenerales_Bus param = cl_parametrosGenerales_Bus.Instance;
         Info.IdusuarioUltAnu = param.IdUsuario;
         Info.Fecha_UltAnu    = param.Fecha_Transac;
         Info.nom_pc          = param.nom_pc;
         Info.ip = param.ip;
         return(Data.AnularDB(Info));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "AnularDB", ex.Message), ex)
               {
                   EntityType = typeof(prod_GestionProductivaTechos_CusTalme_Cab_Bus)
               };
     }
 }
 public Boolean GuardarDB(prod_GestionProductivaTechos_CusTalme_Cab_Info Info, ref decimal Id)
 {
     try
     {
         Info.Fecha_Transac    = param.Fecha_Transac;
         Info.Fecha_UltMod     = param.Fecha_Transac;;
         Info.IdUsuario        = param.IdUsuario;
         Info.IdUsuarioUltModi = param.IdUsuario;
         Info.nom_pc           = param.nom_pc;
         Info.ip = param.ip;
         return(Data.GuardarDB(Info, ref Id));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GuardarDB", ex.Message), ex)
               {
                   EntityType = typeof(prod_GestionProductivaTechos_CusTalme_Cab_Bus)
               };
     }
 }