public Boolean AnularDB(com_ListadoMateriales_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var address = context.com_ListadoMateriales.First
                                      (A => A.IdEmpresa == Info.IdEmpresa &&
                                      A.IdListadoMateriales == Info.IdListadoMateriales
                                      );

                    address.Estado         = "I";
                    address.Usuario        = Info.Usuario;
                    address.lm_Observacion = Info.lm_Observacion;
                    //contact = address;
                    context.SaveChanges();
                }
                msg = "Guardado con exito";
                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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;

                msg = "Error no se guardó " + ex.Message + " ";
                throw new Exception(ex.ToString());
            }
        }
Пример #2
0
 private void gridViewListMateriales_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         InfoListMat = (com_ListadoMateriales_Info)gridViewListMateriales.GetFocusedRow();
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
0
 public Boolean ModificarDB(com_ListadoMateriales_Info info, ref string msg)
 {
     try
     {
         return(Data.ModificarDB(info, ref msg));
     }
     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("", "ModificarDB", ex.Message), ex)
               {
                   EntityType = typeof(com_ListadoMateriales_Bus)
               };
     }
 }
        public com_ListadoMateriales_Info Get_Info_ListadoMateriales(int idempresa, decimal idLstMater)
        {
            com_ListadoMateriales_Info info  = new com_ListadoMateriales_Info();
            EntitiesCompras            oEnti = new EntitiesCompras();

            try
            {
                var select = from A in oEnti.vwcom_ListadoMateriales
                             where A.IdEmpresa == idempresa &&
                             A.IdListadoMateriales == idLstMater

                             select A;

                foreach (var item in select)
                {
                    info.IdEmpresa           = item.IdEmpresa;
                    info.IdSucursal          = item.IdSucursal;
                    info.IdOrdenTaller       = Convert.ToDecimal(item.IdOrdenTaller);
                    info.IdListadoMateriales = item.IdListadoMateriales;
                    info.FechaReg            = item.FechaReg;
                    info.Estado         = item.Estado;
                    info.ob_descripcion = item.ob_descripcion;
                    //info.ot_descripcion = item.ot_descripcion;
                    info.lm_Observacion = item.lm_Observacion;
                    info.su_descripcion = item.Su_Descripcion;
                    info.CodObra        = item.CodObra;
                    info.Motivo         = item.Motivo;
                    info.Usuario        = item.Usuario;
                }
                return(info);
            }
            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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        public List <com_ListadoMateriales_Info> Get_List_ListadoMateriales(int idempresa)
        {
            List <com_ListadoMateriales_Info> Lst = new List <com_ListadoMateriales_Info>();
            EntitiesCompras oEnti = new EntitiesCompras();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoMateriales
                            where q.IdEmpresa == idempresa
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoMateriales_Info Obj = new com_ListadoMateriales_Info();
                    Obj.IdEmpresa           = item.IdEmpresa;
                    Obj.IdListadoMateriales = item.IdListadoMateriales;
                    Obj.IdSucursal          = item.IdSucursal;
                    Obj.IdOrdenTaller       = Convert.ToDecimal(item.IdOrdenTaller);
                    Obj.FechaReg            = item.FechaReg;
                    Obj.Estado         = item.Estado;
                    Obj.ob_descripcion = "[" + item.CodObra + "] " + item.ob_descripcion;
                    //Obj.ot_descripcion = item.ot_descripcion;
                    Obj.lm_Observacion = item.lm_Observacion;
                    Obj.CodObra        = item.CodObra;
                    Obj.Usuario        = item.Usuario;
                    Obj.Motivo         = item.Motivo;
                    Obj.su_descripcion = item.Su_Descripcion;

                    Lst.Add(Obj);
                }
                return(Lst);
            }
            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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GrabarDB(com_ListadoMateriales_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var address = new com_ListadoMateriales();
                    int idEmp   = GetId(info.IdEmpresa, ref mensaje);
                    id = idEmp;

                    address.IdListadoMateriales = id;
                    address.IdEmpresa           = info.IdEmpresa;
                    address.ot_IdSucursal       = info.IdSucursal;
                    address.CodObra             = info.CodObra;
                    address.IdOrdenTaller       = (decimal)info.IdOrdenTaller;
                    address.FechaReg            = info.FechaReg;
                    address.Estado         = info.Estado;
                    address.Usuario        = info.Usuario;
                    address.Motivo         = info.Motivo.Trim();
                    address.lm_Observacion = info.lm_Observacion;

                    context.com_ListadoMateriales.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el Listado de Materiales #: " + id.ToString() + " exitosamente.";
                }
                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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Пример #7
0
        void cargagrid(com_ListadoMateriales_Info InfoLMat)
        {
            try
            {
                LstInfoLMat = BusDetLMat.Get_List_ListadoMateriales_Det(InfoLMat.IdEmpresa, InfoLMat.IdListadoMateriales);
                //gridCtrlDetListMateriales.DataSource = LstInfoLMat;

                ListaBind = new BindingList <com_ListadoMateriales_Det_Info>(LstInfoLMat);
                gridCtrlDetListMateriales.DataSource = ListaBind;


                ListInfoListadoElementosDet_x_Obra        = new List <com_ListadoElementos_x_OT_Det_Info>();
                ListInfoListadoElementosDet_x_Obra        = BusListadoElementosDet.Get_List_ListadoElementos_x_OT_Det(InfoLMat.IdEmpresa, InfoLMat.CodObra);
                gridCtrlDetListMaterialesxObra.DataSource = ListInfoListadoElementosDet_x_Obra;
                gridvwDetListMaterialesxObra.ExpandAllGroups();
                //cargagrid_InventarioFisico();
                carga_MPPreasignado_x_Obra();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
        public Boolean ModificarDB(com_ListadoMateriales_Info info, ref string msg)
        {
            try
            {
                using (EntitiesCompras context = new EntitiesCompras())
                {
                    var contact = context.com_ListadoMateriales.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa &&
                                                                               obj.IdListadoMateriales == info.IdListadoMateriales);


                    if (contact != null)
                    {
                        contact.FechaReg       = info.FechaReg;
                        contact.Motivo         = info.Motivo;
                        contact.Usuario        = info.Usuario;
                        contact.lm_Observacion = info.lm_Observacion;
                        contact.Estado         = info.Estado;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar elListado de Materiales #: " + info.IdListadoMateriales.ToString() + " exitosamente.";
                    }
                }
                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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Пример #9
0
        public void setCab(com_ListadoMateriales_Info InfoLisMat)
        {
            prd_OrdenTaller_Info InfoOT = new prd_OrdenTaller_Info();

            try
            {
                // LLENAR LOS COMBOS DE LOS DATOS DE LA ORDEN

                InfoLMat = InfoLisMat;
                ucGe_Sucursal_combo1.set_SucursalInfo(InfoLisMat.IdSucursal);
                Obra.set_item(InfoLisMat.CodObra);
                dtpFechareg.Value = InfoLisMat.FechaReg;
                //UltraCmbOrdenTaller.EditValue = InfoLisMat.IdOrdenTaller;
                //InfoOT = BUSOT.ObtenerUnaOT(param.IdEmpresa, InfoLisMat.IdSucursal, InfoLisMat.IdOrdenTaller, InfoLisMat.CodObra);
                //txtCodOT.Text = InfoOT.Codigo;
                //txtProdTerm.Text = "[" + InfoOT.IdProducto + "][" + InfoOT.NomProducto + "]";
                //txtPesoUnit.Text = Convert.ToString(InfoOT.PesoUnitario);
                //txtUnit.Text = Convert.ToString(InfoOT.CantidadPieza);
                //txtTtPeso.Text = Convert.ToString(InfoOT.TotalPeso);
                txtIdLMat.Text = Convert.ToString(InfoLisMat.IdListadoMateriales);
                //dTPFecRegOT.Value = InfoOT.FechaReg;
                txtUsuario.Text     = InfoLisMat.Usuario;
                txtObservacion.Text = InfoLisMat.lm_Observacion;
                //txtIdOT.Text =Convert.ToString( InfoOT.IdOrdenTaller);
                if (InfoLisMat.Estado == "I")
                {
                    lblAnulado.Visible = true;
                    set_Accion(Cl_Enumeradores.eTipo_action.consultar);
                }
                cargagrid(InfoLisMat);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.Message);
            }
        }