private void gridViewcotizamant_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            try
            {
                com_cotizacion_compra_det_Info row1 = new com_cotizacion_compra_det_Info();
                row1 = (com_cotizacion_compra_det_Info)gridViewcotizamant.GetRow(e.RowHandle);

                e.HitInfo.Column.FieldName = gridViewcotizamant.FocusedColumn.FieldName;

                if (e.HitInfo.Column.FieldName == "Check")
                {
                    if ((bool)gridViewcotizamant.GetFocusedRowCellValue(col_Check))
                    {
                        gridViewcotizamant.SetFocusedRowCellValue(col_Check, false);
                        gridViewcotizamant.SetFocusedRowCellValue(colCant_a_cotizar, 0);
                    }

                    else
                    {
                        gridViewcotizamant.SetFocusedRowCellValue(col_Check, true);
                        gridViewcotizamant.SetFocusedRowCellValue(colsaldo, 0);
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
        public Boolean ModificarDB(com_cotizacion_compra_det_Info info, ref string msg)
        {
            try
            {
                using (EntitiesCompras Context = new EntitiesCompras())
                {
                    var contact = Context.com_cotizacion_compra.FirstOrDefault(A => A.IdEmpresa == info.IdEmpresa && A.IdEmpresa == info.IdEmpresa);

                    if (contact != null)
                    {
                        contact.Observacion = info.Observacion;
                        Context.SaveChanges();
                    }
                }
                msg = "Grabación exitosa..";
                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);
                msg = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg);
                throw new Exception(ex.ToString());
            }
        }
        public List <com_cotizacion_compra_det_Info> Get_list_Cotizacion_detalle(int IdEmpresa, int IdSucursal, decimal IdCotizacion)
        {
            try
            {
                List <com_cotizacion_compra_det_Info> lm = new List <com_cotizacion_compra_det_Info>();
                EntitiesCompras OEEtapa = new EntitiesCompras();

                var registros = from A in OEEtapa.vwcom_cotizacion_compra_det_Saldos
                                where A.IdEmpresa == IdEmpresa &&
                                A.IdSucursal == IdSucursal &&
                                A.IdCotizacion == IdCotizacion
                                orderby A.IdEmpresa
                                select A;
                foreach (var item in registros)
                {
                    com_cotizacion_compra_det_Info info = new com_cotizacion_compra_det_Info();

                    info.IdEmpresa_lq = item.IdEmpresa;
                    info.IdEmpresa    = item.IdEmpresa;
                    info.IdSucursal   = item.IdSucursal;
                    info.IdCotizacion = IdCotizacion;

                    info.IdListadoMateriales_lq = Convert.ToDecimal(item.IdListadoMateriales_lq);
                    info.IdDetalle_lq           = Convert.ToInt32(item.IdDetalle_lq);
                    info.Su_Descripcion         = item.nom_sucursal;
                    info.FechaReg           = Convert.ToDateTime(item.FechaReg);
                    info.IdProducto         = Convert.ToDecimal(item.Idproducto);
                    info.Cant_soli          = Convert.ToDouble(item.Cant_soli);
                    info.Cant_a_cotizar     = Convert.ToDouble(item.Cant_a_cotizar);
                    info.Secuencia          = item.Secuencia;
                    info.Cant_a_cotizar_AUX = Convert.ToDouble(item.Cant_a_cotizar);
                    info.Cant_soli_AUX      = Convert.ToDouble(item.Cant_soli);

                    info.pr_descripcion = item.pr_descripcion;
                    info.saldo          = item.saldo;
                    info.saldo_AUX      = item.saldo;

                    lm.Add(info);
                }
                return(lm);
            }
            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.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }
Ejemplo n.º 4
0
 public Boolean ModificarDB(com_cotizacion_compra_det_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_cotizacion_compra_Bus)
               };
     }
 }
        private void gridViewcotizamant_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                com_cotizacion_compra_det_Info info = new com_cotizacion_compra_det_Info();
                Info1 = (com_cotizacion_compra_det_Info)this.gridViewcotizamant.GetFocusedRow();
                info  = ListaBind.FirstOrDefault(q => q.IdProducto == Info1.IdProducto && q.IdListadoMateriales_lq == Info1.IdListadoMateriales_lq && q.IdDetalle_lq == Info1.IdDetalle_lq && q.IdSucursal == Info1.IdSucursal);

                if (e.Column.Name == "colCant_a_cotizar")
                {
                    double Cant_a_cotizar = Convert.ToDouble(gridViewcotizamant.GetFocusedRowCellValue(colCant_a_cotizar));
                    double saldo          = Convert.ToDouble(gridViewcotizamant.GetFocusedRowCellValue(colsaldo));

                    foreach (var item in ListaBind)
                    {
                        if (item.IdProducto == info.IdProducto && item.IdListadoMateriales_lq == info.IdListadoMateriales_lq && item.IdDetalle_lq == info.IdDetalle_lq && item.IdSucursal == info.IdSucursal)
                        {
                            if (Cant_a_cotizar < 0 || Cant_a_cotizar > saldo || saldo == 0 || Cant_a_cotizar == 0)
                            {
                                item.Cant_a_cotizar = item.Cant_a_cotizar_AUX;
                                item.saldo          = item.saldo_AUX;
                                item.Check          = false;
                                return;
                            }

                            if (Cant_a_cotizar <= saldo)
                            {
                                item.saldo = item.saldo_AUX - item.Cant_a_cotizar;
                                item.Check = true;
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
        public void GetDetalle()
        {
            try
            {
                int focus = this.gridViewcotizamant.FocusedRowHandle;
                gridViewcotizamant.FocusedRowHandle = focus + 1;

                Listdet = new List <com_cotizacion_compra_det_Info>();

                foreach (var item in ListaBind)
                {
                    com_cotizacion_compra_det_Info info = new com_cotizacion_compra_det_Info();


                    if (item.Check == true)
                    {
                        info.IdEmpresa              = infoCotiza.IdEmpresa;
                        info.IdCotizacion           = Convert.ToDecimal(txtnumcotizaion.Text);
                        info.IdProducto             = item.IdProducto;
                        info.Cant_a_cotizar         = item.Cant_a_cotizar;
                        info.Cant_soli              = item.Cant_soli_AUX;
                        info.IdEmpresa_lq           = item.IdEmpresa_lq;
                        info.IdListadoMateriales_lq = item.IdListadoMateriales_lq;
                        info.IdDetalle_lq           = item.IdDetalle_lq;

                        Listdet.Add(info);
                    }
                }
                //    }
                //}
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }