public Boolean GuardarDB(prod_ModeloProduccion_x_Producto_CusTal_Info Info, ref String Mensaje) { try { List <prod_ModeloProduccion_x_Producto_CusTal_Info> Lst = new List <prod_ModeloProduccion_x_Producto_CusTal_Info>(); using (EntitiesProduccion Context = new EntitiesProduccion()) { var Address = new prod_ModeloProduccion_x_Producto_CusTal(); Address.IdEmpresa = Info.IdEmpresa; Address.IdModeloProd = Info.IdModeloProd; Address.IdProducto = Info.IdProducto; Address.Tipo = Info.Tipo; Context.prod_ModeloProduccion_x_Producto_CusTal.Add(Address); Context.SaveChanges(); Mensaje = "Guardado Ok"; } 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); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
void Guardar() { try { if (Validar() == false) { return; } CmbModeloProduccion.Focus(); if (CmbModeloProduccion.EditValue != null || CmbModeloProduccion.Text != "[Vacío]") { foreach (var item in Grid) { prod_ModeloProduccion_x_Producto_CusTal_Info ItemProd = new prod_ModeloProduccion_x_Producto_CusTal_Info(); ItemProd.IdProducto = item.IdProducto; ItemProd.IdEmpresa = param.IdEmpresa; ItemProd.Tipo = "MATPRIMA"; ItemProd.IdModeloProd = Convert.ToInt32(CmbModeloProduccion.EditValue); string Men = ""; if (Bus.GuardarDB(ItemProd, ref Men)) { } else { } } foreach (var item in Prod) { prod_ModeloProduccion_x_Producto_CusTal_Info ItemProd = new prod_ModeloProduccion_x_Producto_CusTal_Info(); ItemProd.IdProducto = item.IdProducto; ItemProd.IdEmpresa = param.IdEmpresa; ItemProd.Tipo = "PRODTERMI"; ItemProd.IdModeloProd = Convert.ToInt32(CmbModeloProduccion.EditValue); string Men = ""; if (Bus.GuardarDB(ItemProd, ref Men)) { } else { } } MessageBox.Show("Proceso Realizado Con exito"); } else { MessageBox.Show("Por Favor Seleccione Modelo de Produccion"); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); } }
public Boolean GuardarDB(prod_ModeloProduccion_x_Producto_CusTal_Info Info, ref String Mensaje) { try { return(Data.GuardarDB(Info, ref Mensaje)); } 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("", "GuardarDB", ex.Message), ex) { EntityType = typeof(prod_ModeloProduccion_x_Producto_CusTal_Bus) }; } }