public List <imp_gastosximport_x_empresa_Info> Get_List_gastosximport_x_empresa(int IdEmpresa)
        {
            List <imp_gastosximport_x_empresa_Info> lst = new List <imp_gastosximport_x_empresa_Info>();
            EntitiesImportacion IMP = new EntitiesImportacion();

            try
            {
                var Consulta = from q in IMP.imp_gastosxImport_x_Empresa
                               where q.IdEmpresa == IdEmpresa
                               select q;

                foreach (var item in Consulta)
                {
                    imp_gastosximport_x_empresa_Info obj = new imp_gastosximport_x_empresa_Info();
                    obj.IdEmpresa        = item.IdEmpresa;
                    obj.IdGastoImp       = item.IdGastoImp;
                    obj.IdCtaCble        = item.IdCtaCble;
                    obj.debcre_DebBanco  = item.debcre_DebBanco;
                    obj.debCre_Provicion = item.debCre_Provicion;

                    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.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GuardarDB(imp_gastosximport_x_empresa_Info Info)
        {
            try
            {
                using (EntitiesImportacion Context = new EntitiesImportacion())
                {
                    var Address = new imp_gastosxImport_x_Empresa();

                    Address.debcre_DebBanco   = Info.debcre_DebBanco;
                    Address.debCre_Provicion  = Info.debCre_Provicion;
                    Address.IdGastoImp        = Info.IdGastoImp;
                    Address.IdEmpresa         = Info.IdEmpresa;
                    Address.IdCtaCble         = Info.IdCtaCble;
                    Address.AfectaLiquidacion = Info.AfectaLiquidacion;
                    Context.imp_gastosxImport_x_Empresa.Add(Address);
                    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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        void CargarGridGastoXImportacionXEmpresa()
        {
            try
            {
                LstGastosXimport      = _GastXimp_B.Get_List_gastosxImport();
                LstGastoXImprXEmpresa = _GastoxImpxEmpre_B.Get_List_gastosximport_x_empresa();

                var Lst = from q in LstGastoXImprXEmpresa
                          join e in LstGastosXimport
                          on new { q.IdGastoImp } equals new { e.IdGastoImp }
                where q.IdEmpresa == param.IdEmpresa
                select new { q.IdEmpresa, q.IdGastoImp, q.IdCtaCble, q.debCre_Provicion, q.debcre_DebBanco, e.ga_decripcion, e.CodGastoImp, q.AfectaLiquidacion };

                LstGastoXImprXEmpresa = new List <imp_gastosximport_x_empresa_Info>();

                foreach (var item in Lst.ToList())
                {
                    imp_gastosximport_x_empresa_Info obj = new imp_gastosximport_x_empresa_Info();
                    obj.CodGastoImp       = item.CodGastoImp;
                    obj.debcre_DebBanco   = (item.debcre_DebBanco == "C") ? "CREDITO" : "DEBITO";
                    obj.debCre_Provicion  = (item.debCre_Provicion == "C") ? "CREDITO" : "DEBITO";;
                    obj.ga_decripcion     = item.ga_decripcion;
                    obj.IdCtaCble         = item.IdCtaCble;
                    obj.IdGastoImp        = item.IdGastoImp;
                    obj.AfectaLiquidacion = item.AfectaLiquidacion;
                    if (item.IdCtaCble == null)
                    {
                        obj.EstaEnBase = "N";
                    }
                    else
                    {
                        obj.EstaEnBase = "S";
                    }
                    LstGastoXImprXEmpresa.Add(obj);
                }
                gridControlParametros.DataSource = LstGastoXImprXEmpresa;
                ct_Plancta_Info = _plancta_bus.Get_List_Plancta_x_ctas_Movimiento(param.IdEmpresa, ref MensajeError);//.FindAll(var => var.IdNivelCta == 6);
                //ct_Plancta_Info.ForEach(var => var.IdCtaCblePadre = "");

                repositoryItemGridLookUpEdit1.DataSource = ct_Plancta_Info;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString());
            }
        }
예제 #4
0
 public Boolean Guardar(imp_gastosximport_x_empresa_Info Info)
 {
     try
     {
         Info.debcre_DebBanco  = Info.debcre_DebBanco[0].ToString();
         Info.debCre_Provicion = Info.debCre_Provicion[0].ToString();
         return(odata.GuardarDB(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("", "Guardar", ex.Message), ex)
               {
                   EntityType = typeof(imp_gastosximport_x_empresa_Bus)
               };
     }
 }