public Boolean GrabarDB(com_ListadoMateriales_Det_Info Info, com_ListadoMateriales_Det_Info Info_, ref string msg) { try { using (EntitiesCompras context = new EntitiesCompras()) { var address = new com_ListadoMateriales_Det_x_com_GenerOCompra_Det(); address.go_IdEmpresa = Info.IdEmpresa; address.go_IdDetTrans = Info.IdDetTrans; address.go_IdTransaccion = Info.IdTransaccion; address.lm_IdEmpresa = Info_.IdEmpresa; address.lm_IdListadoMateriales = Info_.IdListadoMateriales; address.lm_IdDetalle = Info_.IdDetalle; context.com_ListadoMateriales_Det_x_com_GenerOCompra_Det.Add(address); context.SaveChanges(); msg = "Se ha procedido a grabar el registro 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 = ex.ToString(); throw new Exception(ex.ToString()); } }
public Boolean ActualizarEstadoAprob(com_ListadoMateriales_Det_Info Info, ref string msg) { try { using (EntitiesCompras context = new EntitiesCompras()) { var contact = context.com_ListadoMateriales_Det.FirstOrDefault(obj => obj.IdEmpresa == Info.IdEmpresa && obj.IdListadoMateriales == Info.IdListadoMateriales && obj.IdDetalle == Info.IdDetalle); if (contact != null) { contact.IdEstadoAprob = Info.lm_IdEstadoAprobado; 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()); } }
public List <com_ListadoMateriales_Det_Info> Get_List_ListadoMateriales_Det(int IdEmpresa, decimal IdListadoMat, int IdDetalle) { try { List <com_ListadoMateriales_Det_Info> Lst = new List <com_ListadoMateriales_Det_Info>(); EntitiesCompras oEnti = new EntitiesCompras(); var Query = from q in oEnti.vwcom_GenerOCompra_Det where q.IdEmpresa == IdEmpresa && q.IdListadoMateriales == IdListadoMat && q.IdDetalle == IdDetalle select q; foreach (var item in Query) { com_ListadoMateriales_Det_Info Obj = new com_ListadoMateriales_Det_Info(); Obj.IdEmpresa = item.IdEmpresa; Obj.IdTransaccion = item.IdTransaccion; Obj.IdDetTrans = item.IdDetTrans; Obj.IdProveedor = (item.IdProveedor == null)? -1:(decimal)item.IdProveedor; Obj.CodObra = item.CodObra; Obj.obra = item.ob_descripcion; Obj.IdOrdenTaller = item.IdOrdenTaller; Obj.Motivo = item.Motivo; Obj.IdProducto = item.IdProducto; Obj.Unidades = item.Cantidad; Obj.Det_Kg = item.Kg; Obj.go_IdEstadoAprob = item.IdEstadoAprob; Obj.mr_codigo = item.mr_codigo; Obj.mr_descripcion = item.mr_descripcion; Obj.ea_codigo = item.ea_codigo; Obj.ea_descripcion = item.ea_descripcion; Obj.ot_codigo = item.ot_codigo; Obj.pr_descripcion = item.pr_descripcion; Obj.pr_codigo = item.pr_codigo; Obj.ob_descripcion = item.ob_descripcion; Obj.prov_descripcion = item.prov_descripcion; Obj.FechaRequer = item.FechaRequer; Obj.IdListadoMateriales = (decimal)item.IdListadoMateriales; Obj.IdDetalle = (int)item.IdDetalle; Obj.IdOrdencompra = item.oc_IdOrdenCompra; Obj.oc_idempresa = item.oc_IdEmpresa; Obj.producto = item.pr_descripcion + "[" + item.pr_codigo + "/" + item.IdProducto + "] "; Obj.solicitante = item.usuariosolicitante; Obj.precio = (double)item.precio; 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()); } }
//private void cmbMotivo_Validating(object sender, CancelEventArgs e) //{ // try // { // if (cmbMotivo.SelectedItem == null) // { // cmbMotivo.Text = ""; // } // } // catch (Exception ex) // { // Log_Error_bus.Log_Error(ex.ToString()); // MessageBox.Show(ex.ToString()); // } //} private void gridvwDetListMateriales_KeyPress(object sender, KeyPressEventArgs e) { try { com_ListadoMateriales_Det_Info Temp = new com_ListadoMateriales_Det_Info(); Temp = (com_ListadoMateriales_Det_Info)gridvwDetListMateriales.GetFocusedRow(); if ((e.KeyChar == (char)8)) { if (MessageBox.Show("¿Desea eliminar el producto: " + Temp.pr_descripcion + " de la Lista ?", "Eliminar producto", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { List <com_ListadoMateriales_Det_Info> lsttemp = new List <com_ListadoMateriales_Det_Info>(); for (int i = 0; i < gridvwDetListMateriales.RowCount; i++) { if (i != gridvwDetListMateriales.FocusedRowHandle) { var ass = (com_ListadoMateriales_Det_Info)gridvwDetListMateriales.GetRow(i); if (ass != null) { com_ListadoMateriales_Det_Info row = new com_ListadoMateriales_Det_Info(); row.IdEmpresa = param.IdEmpresa; row.CodObra = Obra.get_item(); //row.IdOrdenTaller = Convert.ToInt32(UltraCmbOrdenTaller.EditValue); row.Det_Kg = ass.Det_Kg; row.IdDetalle = 0; row.IdListadoMateriales = 0; row.IdProducto = ass.IdProducto; if (ass.IdProducto == 0) { MessageBox.Show("Debe corregir su seleccion de productos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } row.Unidades = ass.Unidades; row.pr_codigo = ass.pr_codigo; row.pr_descripcion = ass.pr_descripcion; if (row.Unidades != 0 && row.Det_Kg != 0) { lsttemp.Add(row); } } } } gridCtrlDetListMateriales.DataSource = lsttemp; LstInfoLMat = (List <com_ListadoMateriales_Det_Info>)gridvwDetListMateriales.DataSource; } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
public List <com_ListadoMateriales_Det_Info> Get_List_ListadoMateriales_Det(int IdEmpresa, decimal idLstMater) { List <com_ListadoMateriales_Det_Info> Lst = new List <com_ListadoMateriales_Det_Info>(); EntitiesCompras oEnti = new EntitiesCompras(); try { var Query = from q in oEnti.vwcom_ListadoMateriales_Detalle where q.IdEmpresa == IdEmpresa && q.IdListadoMateriales == idLstMater select q; foreach (var item in Query) { com_ListadoMateriales_Det_Info Obj = new com_ListadoMateriales_Det_Info(); Obj.IdEmpresa = item.IdEmpresa; Obj.IdOrdenTaller = Convert.ToDecimal(item.IdOrdenTaller); Obj.IdListadoMateriales = item.IdListadoMateriales; Obj.IdDetalle = item.IdDetalle; Obj.IdProducto = item.IdProducto; Obj.Unidades = item.Unidades; Obj.Det_Kg = item.Det_Kg; Obj.CodObra = item.CodObra; Obj.pr_codigo = item.pr_codigo; Obj.pr_descripcion = item.pr_descripcion; Obj.pr_largo = item.pr_largo; Obj.lm_IdEstadoAprobado = item.IdEstadoAprob; Obj.largo_pieza_entera = item.largo_pieza_entera; Obj.cantidad_pieza_entera = item.cantidad_pieza_entera; Obj.largo_pieza_complementaria = item.largo_pieza_complementaria; Obj.cantidad_pieza_complementaria = item.cantidad_pieza_complementaria; Obj.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria; Obj.largo_despunte1 = item.largo_despunte1; Obj.cantidad_despunte1 = item.cantidad_despunte1; Obj.es_despunte_usable1 = item.es_despunte_usable1; Obj.largo_despunte2 = item.largo_despunte2; Obj.cantidad_despunte2 = item.cantidad_despunte2; Obj.es_despunte_usable2 = item.es_despunte_usable2; 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(); throw new Exception(ex.ToString()); } }
public Boolean ActualizarEstadoAprob(com_ListadoMateriales_Det_Info Info, ref string msg) { try { return(Data.ActualizarEstadoAprob(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("", "ActualizarEstadoAprob", ex.Message), ex) { EntityType = typeof(com_ListadoMateriales_Det_Bus) }; } }
public Boolean GrabarDB(com_ListadoMateriales_Det_Info GO, com_ListadoMateriales_Det_Info LM, ref string msg) { try { return(Data.GrabarDB(GO, LM, 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("", "com_ListadoMateriales_Det_x_com_GenerOCompra_Det_Bus", ex.Message), ex) { EntityType = typeof(com_ListadoMateriales_Det_x_com_GenerOCompra_Det_Bus) }; } }
public com_ListadoMateriales_Det_Info Get_Info_ListadoMateriales_Det(int IdEmpresa, decimal IdTransacion, int IdDetTrans) { com_ListadoMateriales_Det_Info obj = new com_ListadoMateriales_Det_Info(); EntitiesCompras oEnti = new EntitiesCompras(); try { var det = oEnti.com_GenerOCompra_Det.FirstOrDefault( var => var.IdEmpresa == IdEmpresa && var.IdTransaccion == IdTransacion && var.IdDetTrans == IdDetTrans); if (det != null) { obj.IdEmpresa = det.IdEmpresa; obj.IdTransaccion = det.IdTransaccion; obj.IdDetTrans = det.IdDetTrans; obj.IdProveedor = Convert.ToDecimal(det.IdProveedor); obj.CodObra = det.CodObra; obj.IdOrdenTaller = det.IdOrdenTaller; obj.Motivo = det.Motivo; obj.IdProducto = det.IdProducto; obj.Unidades = det.Cantidad; obj.Det_Kg = det.Kg; obj.go_IdEstadoAprob = det.IdEstadoAprob; obj.FechaRequer = det.FechaRequer; obj.IdListadoMateriales = Convert.ToDecimal(det.IdListadoMateriales); obj.IdDetalle = Convert.ToInt32(det.IdDetalle); obj.precio = Convert.ToDouble(det.precio); obj.oc_idempresa = det.oc_IdEmpresa; obj.IdOrdencompra = det.oc_IdOrdenCompra; obj.solicitante = det.usuariosolicitante; } return(obj); } 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()); } }
private void gridvwDetListMateriales_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { InfoDet = new com_ListadoMateriales_Det_Info(); InfoDet = (com_ListadoMateriales_Det_Info)this.gridvwDetListMateriales.GetFocusedRow(); Double LongitudProductoOT; //LongitudProductoOT = Convert.ToDouble(txtLongitudProductoOT.Text); if (e.Column.Name == "col_IdProducto" || e.Column.Name == "ColCantidad_pieza_entera" || e.Column.Name == "ColCantidad_total_pieza_complementaria") { foreach (var item in ListaBind) { var itemProd = listProducto.FirstOrDefault(p => p.IdProducto == InfoDet.IdProducto); double?suma_largo_restante_pedido = LstInfoLMatxObra.AsEnumerable().Where(row => row.IdProducto == InfoDet.IdProducto).Sum(row => row.largo_restante); if (item.IdProducto == InfoDet.IdProducto) { item.pr_largo = itemProd.pr_largo; //if (LongitudProductoOT <= itemProd.pr_largo) //{ // item.largo_pieza_entera = LongitudProductoOT; //} //else //{ // item.largo_pieza_entera = itemProd.pr_largo; // item.largo_pieza_complementaria = LongitudProductoOT - Convert.ToDouble(itemProd.pr_largo); //} } item.Unidades = Convert.ToDouble(item.cantidad_pieza_entera) + Convert.ToDouble(item.cantidad_total_pieza_complementaria); } } } catch (Exception ex) { Log_Error_bus = new tb_sis_Log_Error_Vzen_Bus(); Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//private void cmbMotivo_ValueChanged_1(object sender, EventArgs e) { } private void gridvwDetListMateriales_FocusedColumnChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventArgs e) { try { com_ListadoMateriales_Det_Info Info = new com_ListadoMateriales_Det_Info(); int i = 0; //idprod //i = gridvwDetListMateriales.FocusedRowHandle; Info = (com_ListadoMateriales_Det_Info)gridvwDetListMateriales.GetFocusedRow(); in_Producto_Info prod = new in_Producto_Info(); if (Info != null) { prod = BusProd.Get_Info_BuscarProducto(Info.IdProducto, param.IdEmpresa); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
public List <com_ListadoMateriales_Det_Info> Get_List_ListadoDespunteMateriales_Det(int IdEmpresa, string CodObra) { List <com_ListadoMateriales_Det_Info> Lst = new List <com_ListadoMateriales_Det_Info>(); EntitiesCompras oEnti = new EntitiesCompras(); try { var Query = from q in oEnti.vwcom_AllListDetMateriales where q.IdEmpresa == IdEmpresa && q.CodObra == CodObra //&& q.largo_despunte1 != null select q; foreach (var item in Query) { com_ListadoMateriales_Det_Info Obj = new com_ListadoMateriales_Det_Info(); Obj.IdEmpresa = item.IdEmpresa; Obj.IdOrdenTaller = Convert.ToDecimal(item.IdOrdenTaller); Obj.ot_IdSucursal = item.IdSucursal; Obj.IdListadoMateriales = item.IdListadoMateriales; Obj.IdDetalle = item.IdDetalle; Obj.IdProducto = item.IdProducto; Obj.Unidades = item.Unidades; Obj.Det_Kg = item.Det_Kg; Obj.CodObra = item.CodObra; Obj.pr_codigo = item.pr_codigo; Obj.pr_descripcion = item.pr_descripcion; Obj.lm_IdEstadoAprobado = item.IdEstadoAprob; Obj.ea_codigo = item.IdEstadoAprob; Obj.ea_descripcion = item.ea_descripcion; Obj.FechaRequer = item.FechaReg; Obj.mr_descripcion = item.mr_descripcion; Obj.Motivo = item.Motivo; Obj.ob_descripcion = item.ob_descripcion; //Obj.ot_codigo = item.ot_descripcion; Obj.obra = item.ob_descripcion; Obj.largo_restante = item.largo_restante; Obj.producto = item.pr_descripcion + "[" + item.pr_codigo + "/" + item.IdProducto + "] "; Obj.solicitante = item.Usuario; Obj.largo_pieza_entera = item.largo_pieza_entera; Obj.cantidad_pieza_entera = item.cantidad_pieza_entera; Obj.largo_pieza_complementaria = item.largo_pieza_complementaria; Obj.cantidad_pieza_complementaria = item.cantidad_pieza_complementaria; Obj.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria; Obj.largo_despunte1 = item.largo_despunte1; Obj.cantidad_despunte1 = item.cantidad_despunte1; Obj.es_despunte_usable1 = item.es_despunte_usable1; Obj.largo_despunte2 = item.largo_despunte2; Obj.cantidad_despunte2 = item.cantidad_despunte2; Obj.es_despunte_usable2 = item.es_despunte_usable2; Obj.largo_total = item.largo_total; 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(); throw new Exception(ex.ToString()); } }
public com_ListadoMateriales_Det_x_com_GenerOCompra_Det_Info Get_Info_ListadoMateriales_Det_x_com_GenerOCompra_Det(com_ListadoMateriales_Det_Info Info, ref string msg) { com_ListadoMateriales_Det_x_com_GenerOCompra_Det_Info info = new com_ListadoMateriales_Det_x_com_GenerOCompra_Det_Info(); EntitiesCompras oEnti = new EntitiesCompras(); try { var select = from A in oEnti.com_ListadoMateriales_Det_x_com_GenerOCompra_Det where A.go_IdEmpresa == Info.IdEmpresa && A.go_IdTransaccion == Info.IdTransaccion && A.go_IdDetTrans == Info.IdDetTrans select A; foreach (var item in select) { info.go_IdEmpresa = item.go_IdEmpresa; info.go_IdTransaccion = item.go_IdTransaccion; info.go_IdDetTrans = item.go_IdDetTrans; info.lm_IdEmpresa = item.lm_IdEmpresa; info.lm_IdListadoMateriales = item.lm_IdListadoMateriales; info.lm_IdDetalle = item.lm_IdDetalle; } 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; msg = ex.ToString(); throw new Exception(ex.ToString()); } }
public Boolean getDet() { try { List <com_ListadoMateriales_Det_Info> lsttemp = new List <com_ListadoMateriales_Det_Info>(); for (int i = 0; i < gridvwDetListMateriales.RowCount; i++) { var ass = (com_ListadoMateriales_Det_Info)gridvwDetListMateriales.GetRow(i); if (ass != null) { com_ListadoMateriales_Det_Info row = new com_ListadoMateriales_Det_Info(); row.IdEmpresa = param.IdEmpresa; row.CodObra = Obra.get_item(); //row.IdOrdenTaller = Convert.ToInt32(UltraCmbOrdenTaller.EditValue); row.Det_Kg = ass.Det_Kg; row.IdDetalle = 0; row.IdListadoMateriales = 0; row.IdProducto = ass.IdProducto; row.lm_IdEstadoAprobado = "PEN"; row.pr_largo = ass.pr_largo; row.largo_total = ass.largo_total; row.largo_restante = ass.largo_restante; row.largo_pieza_entera = ass.largo_pieza_entera; row.cantidad_pieza_entera = ass.cantidad_pieza_entera; row.largo_pieza_complementaria = ass.largo_pieza_complementaria; row.cantidad_pieza_complementaria = ass.cantidad_pieza_complementaria; row.cantidad_total_pieza_complementaria = ass.cantidad_total_pieza_complementaria; row.largo_despunte1 = ass.largo_despunte1; row.cantidad_despunte1 = ass.cantidad_despunte1; row.es_despunte_usable1 = ass.es_despunte_usable1; row.largo_despunte2 = ass.largo_despunte2; row.cantidad_despunte2 = ass.cantidad_despunte2; row.es_despunte_usable2 = ass.es_despunte_usable2; if (ass.IdProducto == 0) { MessageBox.Show("Debe corregir su seleccion de productos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } row.Unidades = ass.Unidades; row.pr_codigo = ass.pr_codigo; row.pr_descripcion = ass.pr_descripcion; if (row.Unidades > 0) { lsttemp.Add(row); } else { MessageBox.Show("Debe corregir la cantidad de los productos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } } //gridCtrlDetListMateriales.DataSource = lsttemp; LstInfoLMat = lsttemp; //LstInfoLMat = (List<com_ListadoMateriales_Det_Info>)gridvwDetListMateriales.DataSource; if (LstInfoLMat.Count < 1) { MessageBox.Show("Debe ingresar los Materiales para la Orden de Taller", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } return(true); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); return(false); } }