示例#1
0
        private void barEditItemCentroCosto_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                ct_Centro_costo_Info Info = new ct_Centro_costo_Info();
                ct_centro_costo_sub_centro_costo_Info InfoSubcentro_costo = new ct_centro_costo_sub_centro_costo_Info();
                string centro_costo = (string)barEditItemCentroCosto.EditValue;

                InfoSubcentro_costo.IdCentroCosto_sub_centro_costo = "Todos";
                InfoSubcentro_costo.Centro_costo = "Todos";

                if (centro_costo == "Todos" || centro_costo == null)
                {
                    lstSubcentro_costo = busSubcentro_costo.Get_list_centro_costo_sub_centro_costo(param.IdEmpresa);

                    cmb_subCentro_costo.DataSource = lstSubcentro_costo;
                    lstSubcentro_costo.Add(InfoSubcentro_costo);
                    barEditItemCentroCosto.EditValue    = centro_costo;
                    barEditItemSubCentroCosto.EditValue = "Todos";
                }
                else
                {
                    lstSubcentro_costo = busSubcentro_costo.Get_list_centro_costo_sub_centro_costo(param.IdEmpresa, centro_costo);
                    lstSubcentro_costo.Add(InfoSubcentro_costo);
                    cmb_subCentro_costo.DataSource      = lstSubcentro_costo;
                    barEditItemSubCentroCosto.EditValue = "Todos";
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
示例#2
0
 private void bei_Centro_costo_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (bei_Centro_costo.EditValue != null)
         {
             info_Centro_costo = lst_Centro_costo.FirstOrDefault(q => q.IdCentroCosto == bei_Centro_costo.EditValue.ToString());
             if (info_Centro_costo != null)
             {
                 lst_Centro_costo_sub_centro_costo = bus_Centro_costo_sub_centro_costo.Get_list_centro_costo_sub_centro_costo(param.IdEmpresa, info_Centro_costo.IdCentroCosto);
             }
             else
             {
                 lst_Centro_costo_sub_centro_costo = bus_Centro_costo_sub_centro_costo.Get_list_centro_costo_sub_centro_costo(param.IdEmpresa);
             }
         }
         else
         {
             lst_Centro_costo_sub_centro_costo = bus_Centro_costo_sub_centro_costo.Get_list_centro_costo_sub_centro_costo(param.IdEmpresa);
         }
         cmb_Centro_costo_sub_centro_costo.DataSource = lst_Centro_costo_sub_centro_costo;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
 public void limpiarGe()
 {
     try
     {
         _Accion           = Cl_Enumeradores.eTipo_action.grabar;
         Info_centro_costo = new ct_Centro_costo_Info();
         txt_codigo.Text   = "";
         txt_nombre.Text   = "";
         cmb_centro_costo_padre.EditValue = "";
         cmb_centro_costo_padre.Enabled   = true;
         cmb_nivel.SelectedValue          = 1;
         chk_es_cta_movi.Checked          = false;
         chk_estado.Checked      = true;
         lblAnulado.Visible      = false;
         txt_codigo_alterno.Text = "";
         txt_codigo.Clear();
         txt_nombre.Clear();
         Info_centro_costo = new ct_Centro_costo_Info();
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public void cmb_centro_costo_padre_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                Info_padre_centro_costo = listCentro_costo_padre.FirstOrDefault(v => v.IdCentroCosto == Convert.ToString(cmb_centro_costo_padre.EditValue));
                string MensajeError = "";

                if (_Accion == Info.General.Cl_Enumeradores.eTipo_action.grabar && Info_padre_centro_costo != null)
                {
                    txt_codigo.Text         = Info_padre_centro_costo.IdCentroCosto + Centro_costo_Bus.Get_IdCentroCosto(Info_padre_centro_costo.IdEmpresa, Info_padre_centro_costo, ref MensajeError);
                    txt_nombre.Text         = Info_padre_centro_costo.Centro_costo;
                    cmb_nivel.SelectedValue = Info_padre_centro_costo.IdNivel + 1;
                    chk_estado.Checked      = true;

                    var maxvalue = ListNivelCta.Max(x => x.IdNivel);

                    if ((Int32)maxvalue == Info_padre_centro_costo.IdNivel + 1)
                    {
                        chk_es_cta_movi.Checked = true;
                    }
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        public Boolean AnularDB(ct_Centro_costo_Info info, ref string MensajeError)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_centro_costo.FirstOrDefault(dinfo => dinfo.IdEmpresa == info.IdEmpresa && dinfo.IdCentroCosto == info.IdCentroCosto);

                    if (contact != null)
                    {
                        contact.pc_Estado = "I";
                        context.SaveChanges();
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                MensajeError = ex.Message;
                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(), "", MensajeError, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
        private void cmb_Sub_centro_costo_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmb_Centro_costo.EditValue != null)
                {
                    string idCentro_costo = cmb_Centro_costo.EditValue.ToString();
                    info_Centro_costo = list_Centro_costo.FirstOrDefault(q => q.IdCentroCosto == idCentro_costo && param.IdEmpresa == q.IdEmpresa);

                    if (cmb_Sub_centro_costo.EditValue != null)
                    {
                        string idCentro_costo_sub_centro_costo = cmb_Sub_centro_costo.EditValue.ToString();
                        info_Centro_costo_sub_centro_costo = list_Centro_costo_sub_centro_costo.FirstOrDefault(q => q.IdEmpresa == param.IdEmpresa && q.IdCentroCosto_sub_centro_costo == idCentro_costo_sub_centro_costo && q.IdCentroCosto == idCentro_costo);
                    }
                    else
                    {
                        info_Centro_costo_sub_centro_costo = null;
                    }
                }
                else
                {
                    info_Centro_costo_sub_centro_costo = null;
                }
                event_delegate_cmb_Sub_centro_costo_EditValueChanged(sender, e);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
示例#7
0
        public Boolean GrabarDB(ct_Centro_costo_Info info, ref string MensajeError)
        {
            try
            {
                if (info.IdCentroCosto == "")
                {
                    ct_Centro_costo_Info InfoCentro_costo_padre = new ct_Centro_costo_Info();

                    if (InfoCentro_costo_padre.IdCentroCosto != null)
                    {
                        info.IdCentroCosto = Get_IdCentroCosto(info.IdEmpresa, InfoCentro_costo_padre, ref MensajeError);
                    }
                    else// este caso es por q es raiz no tiene padre
                    {
                        info.IdCentroCosto = Get_IdCentroCosto_x_Raiz(info.IdEmpresa, ref MensajeError);
                    }
                }

                return(data.GrabarDB(info, ref MensajeError));
            }
            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("", "GrabarDB", ex.Message), ex)
                      {
                          EntityType = typeof(ct_Centro_costo_Bus)
                      };
            }
        }
        private void cmb_Centro_costo_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmb_Centro_costo.EditValue != null)
                {
                    string idCentro_costo = cmb_Centro_costo.EditValue.ToString();
                    info_Centro_costo = list_Centro_costo.FirstOrDefault(q => q.IdCentroCosto == idCentro_costo && q.IdEmpresa == param.IdEmpresa);
                    if (info_Centro_costo != null)
                    {
                        list_Centro_costo_sub_centro_costo = bus_Centro_costo_sub_centro_costo.Get_list_centro_costo_sub_centro_costo(info_Centro_costo.IdEmpresa, info_Centro_costo.IdCentroCosto);
                    }
                    else
                    {
                        list_Centro_costo_sub_centro_costo = new List <ct_centro_costo_sub_centro_costo_Info>();
                    }
                    cmb_Sub_centro_costo.Properties.DataSource    = list_Centro_costo_sub_centro_costo;
                    cmb_Sub_centro_costo.Properties.ValueMember   = "IdCentroCosto_sub_centro_costo";
                    cmb_Sub_centro_costo.Properties.DisplayMember = "Centro_costo2";
                }
                else
                {
                    info_Centro_costo = null;
                    cmb_Sub_centro_costo.EditValue                = null;
                    list_Centro_costo_sub_centro_costo            = new List <ct_centro_costo_sub_centro_costo_Info>();
                    cmb_Sub_centro_costo.Properties.DataSource    = list_Centro_costo_sub_centro_costo;
                    cmb_Sub_centro_costo.Properties.ValueMember   = "IdCentroCosto_sub_centro_costo";
                    cmb_Sub_centro_costo.Properties.DisplayMember = "Centro_costo2";
                }


                if (foco_Centro_costo)
                {
                    if (info_Centro_costo != null)
                    {
                        info_Cliente_x_centro_costo = list_Cliente_x_Centro_costo.FirstOrDefault(q => q.IdCentroCosto_cc == info_Centro_costo.IdCentroCosto);
                        if (info_Cliente_x_centro_costo != null)
                        {
                            cmb_Cliente.EditValue = info_Cliente_x_centro_costo.IdCliente_cli;
                        }
                        else
                        {
                            cmb_Cliente.EditValue = null;
                        }
                    }
                    else
                    {
                        cmb_Cliente.EditValue = null;
                    }
                }
                event_delegate_cmb_Centro_costo_EditValueChanged(sender, e);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
示例#9
0
 private void toolStripButtonSeleccionar_Click(object sender, EventArgs e)
 {
     try
     {
         CentroCostoInfo = _CentroCostoInfo;
         this.Close();
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#10
0
 /// <summary>
 /// Esta función es para obtener todo el info del Centro de Costo en el combo
 /// </summary>
 /// <returns></returns>
 public ct_Centro_costo_Info Get_CentroCosto()
 {
     try
     {
         ct_Centro_costo_Info infoCentro = ListaCentroCosto.FirstOrDefault(v => v.IdCentroCosto == Convert.ToString(cmb_CentroCosto.EditValue));
         return(infoCentro);
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         return(new ct_Centro_costo_Info());
     }
 }
示例#11
0
 public Boolean AnularDB(ct_Centro_costo_Info info, ref string MensajeError)
 {
     try
     {
         return(data.AnularDB(info, ref MensajeError));
     }
     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(ct_Centro_costo_Bus)
               };
     }
 }
示例#12
0
 public void setInfo(ct_Centro_costo_Info _Info)
 {
     try
     {
         Info_centro_costo = _Info;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#13
0
        public void cmbCentroCosto_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                InfoCentroCosto = (ct_Centro_costo_Info)cmbCentroCosto.Properties.View.GetFocusedRow();

                this.Event_cmbCentroCosto_EditValueChanged(sender, e);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
示例#14
0
 public Boolean GrabarDB(ct_Centro_costo_Info info, ref string MensajeError)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             EntitiesDBConta EDB = new EntitiesDBConta();
             var             Q   = from per in EDB.ct_centro_costo
                                   where per.IdCentroCosto.Trim() == info.IdCentroCosto.Trim() && per.IdEmpresa == info.IdEmpresa
                                   select per;
             if (Q.ToList().Count == 0)
             {
                 var address = new ct_centro_costo();
                 address.IdEmpresa          = info.IdEmpresa;
                 address.IdCentroCosto      = info.IdCentroCosto;
                 address.CodCentroCosto     = (info.CodCentroCosto == null) ? info.IdCentroCosto : info.CodCentroCosto.Trim();
                 address.Centro_costo       = info.Centro_costo;
                 address.IdCentroCostoPadre = (info.IdCentroCostoPadre == "") ? null : info.IdCentroCostoPadre;
                 address.IdCatalogo         = info.IdCatalogo;
                 address.pc_EsMovimiento    = info.pc_EsMovimiento;
                 address.IdCtaCble          = (info.IdCtaCble == null) ? "1" : info.IdCtaCble;
                 address.IdNivel            = (info.IdNivel == 0) ? 1 : info.IdNivel;
                 address.pc_Estado          = info.pc_Estado;
                 address.Fecha_Transac      = info.Fecha_Transac;
                 address.IdUsuario          = info.IdUsuario;
                 context.ct_centro_costo.Add(address);
                 context.SaveChanges();
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         MensajeError = ex.Message;
         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(), "", MensajeError, "",
                                                                                   "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
示例#15
0
 private void cmbCentroCosto_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         SearchLookUpEdit edit     = sender as SearchLookUpEdit;
         int    rowHandle          = edit.Properties.GetIndexByKeyValue(edit.EditValue);
         object row                = edit.Properties.View.GetRow(rowHandle);
         ct_Centro_costo_Info info = (ct_Centro_costo_Info)row;
         _DescripcionCentroCosto = info.Centro_costo;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(ex.ToString());
     }
 }
 public ct_Centro_costo_Info Get_info_centro_costo()
 {
     try
     {
         if (beiCentro_costo.EditValue == null)
         {
             return(null);
         }
         info_centro_costo = lst_centro_costo.FirstOrDefault(q => q.IdEmpresa == param.IdEmpresa && q.IdCentroCosto == beiCentro_costo.EditValue.ToString());
         return(info_centro_costo);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(ex.ToString());
         return(null);
     }
 }
示例#17
0
        public List <ct_Centro_costo_Info> Get_list_Centro_Costo_x_cliente(int IdEmpresa, ref string MensajeError)
        {
            try
            {
                List <ct_Centro_costo_Info> lM = new List <ct_Centro_costo_Info>();

                using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ())
                {
                    var select = from q in Context.vwfa_cliente_x_ct_centro_costo
                                 where q.IdEmpresa_cc == IdEmpresa
                                 select q;

                    foreach (var item in select)
                    {
                        ct_Centro_costo_Info Cln_cc = new ct_Centro_costo_Info();
                        Cln_cc.IdEmpresa          = item.IdEmpresa_cc;
                        Cln_cc.IdCentroCosto      = item.IdCentroCosto_cc;
                        Cln_cc.pc_Estado          = item.pc_Estado;
                        Cln_cc.Centro_costo       = item.nom_Centro_costo;
                        Cln_cc.pe_cedulaRuc       = item.pe_cedulaRuc;
                        Cln_cc.pe_direccion       = item.pe_direccion;
                        Cln_cc.IdEmpresa_cli      = item.IdEmpresa_cli;
                        Cln_cc.IdCliente_cli      = item.IdCliente_cli;
                        Cln_cc.Descripcion_Ciudad = item.Descripcion_Ciudad;
                        Cln_cc.pe_celular         = item.pe_celular;
                        Cln_cc.pe_correo          = item.pe_correo;
                        lM.Add(Cln_cc);
                    }
                }
                return(lM);
            }

            catch (Exception ex)
            {
                MensajeError = ex.Message;
                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(), "", MensajeError, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                return(new List <ct_Centro_costo_Info>());
            }
        }
示例#18
0
        public List <ct_Centro_costo_Info> Get_list_Centro_Costo_cuentas_de_Movimiento(int IdEmpresa, ref string MensajeError)
        {
            try
            {
                List <ct_Centro_costo_Info> lM           = new List <ct_Centro_costo_Info>();
                EntitiesDBConta             OECentroCost = new EntitiesDBConta();
                var selectCentroCost = from C in OECentroCost.vwct_centro_costo
                                       where C.IdEmpresa == IdEmpresa && C.pc_EsMovimiento == "S"
                                       select C;

                foreach (var item in selectCentroCost)
                {
                    ct_Centro_costo_Info Cbt = new ct_Centro_costo_Info();
                    Cbt.IdEmpresa          = item.IdEmpresa;
                    Cbt.IdCentroCosto      = item.IdCentroCosto; //se quito el trim
                    Cbt.CodCentroCosto     = item.CodCentroCosto;
                    Cbt.Centro_costo2      = "[" + item.IdCentroCosto.Trim() + "] - " + item.Centro_costo.Trim();
                    Cbt.Centro_costo       = item.Centro_costo.Trim();
                    Cbt.IdCentroCostoPadre = item.IdCentroCostoPadre;
                    Cbt.IdCatalogo         = Convert.ToDecimal(item.IdCatalogo);
                    Cbt.pc_EsMovimiento    = item.pc_EsMovimiento;
                    Cbt.IdNivel            = item.IdNivel;
                    Cbt.IdCtaCble          = item.IdCtaCble;
                    Cbt.Centro_costoPadre  = item.Centro_costoPadre;
                    Cbt.pc_Estado          = item.pc_Estado;
                    Cbt.Sestado            = (item.pc_Estado == "A") ? "ACTIVO" : "*ANULADO*";

                    lM.Add(Cbt);
                }
                return(lM);
            }

            catch (Exception ex)
            {
                MensajeError = ex.Message;
                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(), "", MensajeError, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
示例#19
0
 private void treeListClient_CC_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
 {
     try
     {
         TreeListNode childNode = (TreeListNode)e.Node;
         if (_List_centro_costo_Info != null)
         {
             _Centro_costo_Info = (ct_Centro_costo_Info)treeListClient_CC.GetDataRecordByNode(childNode);
         }
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         NameMetodo = NameMetodo + " - " + ex.ToString();
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                         , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#20
0
        public List <ct_Centro_costo_Info> Get_list_Centro_Costo_cuentas_padre(int IdEmpresa, ref string MensajeError)
        {
            try
            {
                List <ct_Centro_costo_Info> lM           = new List <ct_Centro_costo_Info>();
                EntitiesDBConta             OECentroCost = new EntitiesDBConta();
                var selectCentroCost = from C in OECentroCost.vwct_centro_costo
                                       where C.IdEmpresa == IdEmpresa
                                       //&& C.pc_EsMovimiento == "N" Comentada debido a que en el caso de grafinpren todos generan movimientos
                                       select C;

                foreach (var item in selectCentroCost)
                {
                    ct_Centro_costo_Info Cbt = new ct_Centro_costo_Info();
                    Cbt.IdEmpresa          = item.IdEmpresa;
                    Cbt.IdCentroCosto      = item.IdCentroCosto; //se quito el trim
                    Cbt.CodCentroCosto     = item.CodCentroCosto;
                    Cbt.Centro_costo2      = "[" + item.IdCentroCosto.Trim() + "] - " + item.Centro_costo.Trim();
                    Cbt.Centro_costo       = item.Centro_costo;
                    Cbt.IdCentroCostoPadre = item.IdCentroCostoPadre;
                    Cbt.pc_EsMovimiento    = item.pc_EsMovimiento;
                    Cbt.IdNivel            = item.IdNivel;
                    Cbt.IdCtaCble          = item.IdCtaCble;
                    Cbt.Centro_costoPadre  = item.Centro_costoPadre;

                    lM.Add(Cbt);
                }
                return(lM);
            }

            catch (Exception ex)
            {
                MensajeError = ex.Message;
                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(), "", MensajeError, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
示例#21
0
        public List <ct_Centro_costo_Info> Get_list_Centro_Costo(int IdEmpresa, ref string MensajeError)
        {
            try
            {
                List <ct_Centro_costo_Info> lM           = new List <ct_Centro_costo_Info>();
                EntitiesDBConta             OECentroCost = new EntitiesDBConta();
                var selectCentroCost = from C in OECentroCost.vwct_centro_costo
                                       where C.IdEmpresa == IdEmpresa
                                       select C;

                foreach (var item in selectCentroCost)
                {
                    ct_Centro_costo_Info Cbt = new ct_Centro_costo_Info();
                    Cbt.IdEmpresa          = item.IdEmpresa;
                    Cbt.IdCentroCosto      = item.IdCentroCosto.Trim();
                    Cbt.CodCentroCosto     = item.CodCentroCosto.Trim();
                    Cbt.Centro_costo       = item.Centro_costo;
                    Cbt.Centro_costo2      = "[" + item.IdCentroCosto + "]" + item.Centro_costo;
                    Cbt.IdCentroCostoPadre = item.IdCentroCostoPadre;// DEBE TRAER NULL SI NO TIENE PADRE
                    Cbt.IdCatalogo         = Convert.ToDecimal(item.IdCatalogo);
                    Cbt.pc_EsMovimiento    = item.pc_EsMovimiento;
                    Cbt.IdNivel            = item.IdNivel;
                    Cbt.pc_Estado          = item.pc_Estado;
                    Cbt.Centro_costoPadre  = item.Centro_costoPadre;
                    Cbt.IdCtaCble          = (item.IdCtaCble != null)?item.IdCtaCble.Trim():"";
                    lM.Add(Cbt);
                }
                return(lM);
            }

            catch (Exception ex)
            {
                MensajeError = ex.Message;
                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(), "", MensajeError, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
示例#22
0
        public void treeListPlanCta_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            try
            {
                TreeListNode childNode = (TreeListNode)e.Node;

                _Centro_costo_Info = (ct_Centro_costo_Info)treeListPlanCta.GetDataRecordByNode(childNode);
                if (_Centro_costo_Info != null)
                {
                    _centro_costo_PadreInfo = _List_centro_costo_Info.Find(delegate(ct_Centro_costo_Info ca) { return(ca.IdCentroCosto == _Centro_costo_Info.IdCentroCostoPadre && ca.IdEmpresa == _Centro_costo_Info.IdEmpresa); });
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#23
0
 public ct_Centro_costo_Info Get_info_Centro_costo()
 {
     try
     {
         if (bei_Centro_costo.EditValue != null)
         {
             info_Centro_costo = lst_Centro_costo.FirstOrDefault(q => q.IdCentroCosto == bei_Centro_costo.EditValue.ToString());
             return(info_Centro_costo);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         return(null);
     }
 }
        void frmCentro_costo_sub_centro_costo_event_frmCon_CentroCosto_SubCentroCosto_Mant_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (cmb_Centro_costo.EditValue != null)
                {
                    string idCentro_costo = cmb_Centro_costo.EditValue.ToString();
                    info_Centro_costo = list_Centro_costo.FirstOrDefault(q => q.IdCentroCosto == idCentro_costo && q.IdEmpresa == param.IdEmpresa);

                    list_Centro_costo_sub_centro_costo            = bus_Centro_costo_sub_centro_costo.Get_list_centro_costo_sub_centro_costo(info_Centro_costo.IdEmpresa, info_Centro_costo.IdCentroCosto);
                    cmb_Sub_centro_costo.Properties.DataSource    = list_Centro_costo_sub_centro_costo;
                    cmb_Sub_centro_costo.Properties.ValueMember   = "IdCentroCosto_sub_centro_costo";
                    cmb_Sub_centro_costo.Properties.DisplayMember = "Centro_costo2";
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
示例#25
0
        public Boolean ModificarDB(ct_Centro_costo_Info info, ref string MensajeError)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_centro_costo.FirstOrDefault(minfo => minfo.IdCentroCosto == info.IdCentroCosto && minfo.IdEmpresa == info.IdEmpresa);

                    if (contact != null)
                    {
                        contact.IdEmpresa          = info.IdEmpresa;
                        contact.IdCentroCosto      = info.IdCentroCosto;
                        contact.CodCentroCosto     = (info.CodCentroCosto == null) ? info.IdCentroCosto : info.CodCentroCosto.Trim();
                        contact.Centro_costo       = info.Centro_costo;
                        contact.IdCentroCostoPadre = (info.IdCentroCostoPadre == "") ? null : info.IdCentroCostoPadre;
                        contact.IdCatalogo         = info.IdCatalogo;
                        contact.IdNivel            = Convert.ToByte(info.IdNivel);
                        contact.pc_EsMovimiento    = (info.pc_EsMovimiento == "")? "S" : Convert.ToString(info.pc_EsMovimiento);
                        contact.IdCtaCble          = info.IdCtaCble;
                        contact.pc_Estado          = info.pc_Estado;
                        contact.IdUsuarioUltMod    = info.IdUsuarioUltMod;
                        contact.Fecha_UltMod       = info.Fecha_UltMod;
                        context.SaveChanges();
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                MensajeError = ex.Message;
                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(), "", MensajeError, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
 public ct_Centro_costo_Info Get_Info_Centro_costo()
 {
     try
     {
         if (cmb_Centro_costo.EditValue != null)
         {
             string idCentro_costo = cmb_Centro_costo.EditValue.ToString();
             info_Centro_costo = list_Centro_costo.FirstOrDefault(q => q.IdCentroCosto == idCentro_costo);
         }
         else
         {
             info_Centro_costo = null;
         }
         return(info_Centro_costo);
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
         return(null);
     }
 }
示例#27
0
 private void Cargar_Centro_Costo()
 {
     try
     {
         ListaCentroCosto = BusCentroCosto.Get_list_Centro_Costo(param.IdEmpresa, ref mensaje);
         if (Mostrar_Registro_Todos == true)
         {
             ct_Centro_costo_Info InfoTodos = new ct_Centro_costo_Info();
             InfoTodos.IdEmpresa     = param.IdEmpresa;
             InfoTodos.IdCentroCosto = "";
             InfoTodos.Centro_costo2 = "TODOS";
             ListaCentroCosto.Add(InfoTodos);
         }
         cmb_CentroCosto.Properties.DataSource = ListaCentroCosto;
         Cargar_SubCentroCosto();
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
示例#28
0
        public string Get_IdCentroCosto(int IdEmpresa, ct_Centro_costo_Info idCentro_Costo_padre, ref string MensajeError)
        {
            try
            {
                decimal idCta         = 0;
                string  MiNumConCeros = "";

                List <ct_Centro_costo_nivel_Info> listaNivel = new List <ct_Centro_costo_nivel_Info>();
                List <ct_Centro_costo_Info>       listaCta   = new List <ct_Centro_costo_Info>();
                ct_Centro_costo_nivel_Data        Nive_D     = new ct_Centro_costo_nivel_Data();

                listaNivel = Nive_D.Get_Info_Centro_Costo_nivel(IdEmpresa);
                listaCta   = data.Get_list_Centro_Costo(IdEmpresa, ref MensajeError);


                //int digitosPadre = (from cta in listaNivel where cta.IdNivel == idCentro_Costo_padre.IdNivel select cta.ni_digitos).ToList().First();
                int digitosHijo = (from cta in listaNivel where cta.IdNivel == idCentro_Costo_padre.IdNivel + 1 select cta.ni_digitos).ToList().FirstOrDefault();


                var NumCtaHija_Ulti = (from cta in listaCta
                                       where cta.IdCentroCostoPadre == idCentro_Costo_padre.IdCentroCosto
                                       select cta.IdCentroCosto).Max();

                string NumCtaHija_Ultima_sinPadre = "";

                if (NumCtaHija_Ulti == null)
                {
                    NumCtaHija_Ultima_sinPadre = "0";
                }
                else
                {
                    NumCtaHija_Ultima_sinPadre = Convert.ToString(NumCtaHija_Ulti.Substring(NumCtaHija_Ulti.Length - digitosHijo, digitosHijo));
                }

                string validaNumCtaHijo = "";
                string val = "9";


                for (int i = 0; i < digitosHijo; i++)
                {
                    validaNumCtaHijo = val + validaNumCtaHijo;
                }

                idCta = Convert.ToDecimal(NumCtaHija_Ultima_sinPadre) + 1;

                if (validaNumCtaHijo != "")
                {
                    if (idCta > Convert.ToDecimal(validaNumCtaHijo))
                    {
                        return("");
                    }
                    else
                    {
                        MiNumConCeros = "000000000000" + idCta;
                        MiNumConCeros = MiNumConCeros.Remove(0, MiNumConCeros.Length - digitosHijo);
                    }
                }

                return(MiNumConCeros);
            }
            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("", "Get_IdCentroCosto", ex.Message), ex)
                      {
                          EntityType = typeof(ct_Centro_costo_Bus)
                      };
            }
        }
示例#29
0
 public void ucCon_CentroCosto_ctas_Movi1_Event_cmbCentroCosto_EditValueChanged(object sender, EventArgs e)
 {
     Centro_cos_info = ucCon_CentroCosto_ctas_Movi1.InfoCentroCosto;
 }
示例#30
0
        private void UCInv_MenuReportes_2_Load(object sender, EventArgs e)
        {
            try
            {
                in_Producto_Info        infoProducto     = new in_Producto_Info();
                in_movi_inven_tipo_Info infoMoviTipi     = new in_movi_inven_tipo_Info();
                cp_proveedor_Info       infoProvee       = new cp_proveedor_Info();
                ct_Centro_costo_Info    infoCentro_costo = new ct_Centro_costo_Info();
                ct_centro_costo_sub_centro_costo_Info infoSubcentro_costo = new ct_centro_costo_sub_centro_costo_Info();
                in_movi_inven_tipo_Info info_movimiento = new in_movi_inven_tipo_Info();

                string msg = "";

                dtpDesde.EditValue = DateTime.Now.AddMonths(-1);
                dtpHasta.EditValue = DateTime.Now.AddMonths(1);

                lstSucuInfo = busSucursal.Get_List_Sucursal_Todos(param.IdEmpresa);
                cmbSucursal_Grid.DataSource = lstSucuInfo;

                lstBodegaInfo             = busBodega.Get_List_Bodega(param.IdEmpresa, Cl_Enumeradores.eTipoFiltro.todos);
                cmbBodega_Grid.DataSource = lstBodegaInfo;

                infoProducto.IdProducto     = 0;
                infoProducto.pr_descripcion = "Todos";

                infoProvee.IdProveedor = 0;
                infoProvee.pr_nombre   = "Todos";

                infoMoviTipi.IdMovi_inven_tipo = 0;
                infoMoviTipi.tm_descripcion    = "Todos";

                infoCentro_costo.IdCentroCosto = "Todos";
                infoCentro_costo.Centro_costo  = "Todos";

                infoSubcentro_costo.IdCentroCosto_sub_centro_costo = "Todos";
                infoSubcentro_costo.Centro_costo = "Todos";

                lstProductoInfo = busProducto.Get_list_Producto(param.IdEmpresa);
                lstProductoInfo.Add(infoProducto);
                cmbProducto_Grid.DataSource = lstProductoInfo.OrderBy(q => q.IdProducto).ToList();

                lstMoviTipiInfo = busMoviTip.Get_List_movi_inven_tipo(param.IdEmpresa);
                lstMoviTipiInfo.Add(infoMoviTipi);
                CmbTipoMov_Grid.DataSource = lstMoviTipiInfo.OrderBy(q => q.IdMovi_inven_tipo).ToList();

                listProveedor = busProveedor.Get_List_proveedor(param.IdEmpresa);
                listProveedor.Add(infoProvee);
                cmbProveedor_Grid.DataSource = listProveedor;

                lstCentro_costo = busCentro_costo.Get_list_Centro_Costo(param.IdEmpresa, ref msg);
                lstCentro_costo.Add(infoCentro_costo);
                cmb_centroCosto.DataSource = lstCentro_costo;

                lstSubcentro_costo = busSubcentro_costo.Get_list_centro_costo_sub_centro_costo(param.IdEmpresa);
                lstSubcentro_costo.Add(infoSubcentro_costo);
                cmb_subCentro_costo.DataSource = lstSubcentro_costo;

                lst_Categoria            = bus_Categoria.Get_List_categorias(param.IdEmpresa);
                cmb_Categoria.DataSource = lst_Categoria;

                lst_Linea            = bus_Linea.Get_List_Linea(param.IdEmpresa, "");
                cmb_Linea.DataSource = lst_Linea;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }