public static void Create(RECEPCION_MATERIAL recep_mat_new) { using (BODEXDataContext ctx = new BODEXDataContext()) { ctx.ListaRecepcionMaterial.InsertOnSubmit(recep_mat_new); ctx.SubmitChanges(); } }
public static void Delete(RECEPCION_MATERIAL recep_mat_del) { using (BODEXDataContext ctx = new BODEXDataContext()) { RECEPCION_MATERIAL borrar = (from recep_mat in ctx.ListaRecepcionMaterial where recep_mat.RM_ID.Equals(recep_mat_del.RM_ID) select recep_mat).First<RECEPCION_MATERIAL>(); ctx.ListaRecepcionMaterial.DeleteOnSubmit(borrar); ctx.SubmitChanges(); } }
public static void Update(RECEPCION_MATERIAL recep_mat_upd) { using (BODEXDataContext ctx = new BODEXDataContext()) { RECEPCION_MATERIAL RecepcionMaterial = (from recep_mat in ctx.ListaRecepcionMaterial where recep_mat.RM_ID.Equals(recep_mat_upd.RM_ID) select recep_mat).First<RECEPCION_MATERIAL>(); RecepcionMaterial.RM_ENCARGADO_RECEPCION = recep_mat_upd.RM_ENCARGADO_RECEPCION; RecepcionMaterial.RM_FECHA = recep_mat_upd.RM_FECHA; ctx.SubmitChanges(); } }
protected void Ingresar(object sender, EventArgs e) { ASPxButton boton = (ASPxButton)sender; Control main = boton.Parent; string encargado = "Bodega"; Label usuario = (Label)main.Parent.Parent.FindControl("lblUsuario"); if (usuario != null) encargado = usuario.Text; ASPxListBox list = (ASPxListBox)main.FindControl("ASPxListBox1"); ASPxComboBox combo = (ASPxComboBox)main.FindControl("ASPxComboBox1"); string id_compra = ASPxComboBox1.SelectedItem.Value.ToString(); if (list.Items.Count == 0) return; SOLICITUD_COMPRA compra = CRUD_SolicitudCompra.Read(Int32.Parse(id_compra)); RECEPCION_MATERIAL recepcion = new RECEPCION_MATERIAL(); recepcion.RM_ENCARGADO_RECEPCION = encargado; recepcion.RM_FECHA = DateTime.Now; CRUD_RecepcionMaterial.Create(recepcion); int id_recep = (Int32)CRUD_RecepcionMaterial.getEnd().RM_ID; foreach (ListEditItem item in list.Items) { MATERIAL material = CRUD_Material.Read(Int32.Parse(item.GetValue("M_ID").ToString())); DETALLE_RECEPCION_MATERIAL detalle = new DETALLE_RECEPCION_MATERIAL(); detalle.RM_ID = id_recep; detalle.M_ID = material.M_ID; detalle.DRM_CANTIDAD = Int32.Parse(item.GetValue("D_CANTIDAD").ToString()); CRUD_RecepcionMaterialDetalle.Create(detalle); } compra.E_ID = 2; CRUD_SolicitudCompra.Update(compra); COMPRA_RECEPCION ligar = new COMPRA_RECEPCION(); ligar.SC_ID = compra.SC_ID; ligar.RM_ID = id_recep; CRUD_CompraRecepcion.Create(ligar); Response.Redirect("~/RecepcionMaterial.aspx"); }
partial void DeleteRECEPCION_MATERIAL(RECEPCION_MATERIAL instance);
partial void UpdateRECEPCION_MATERIAL(RECEPCION_MATERIAL instance);
partial void InsertRECEPCION_MATERIAL(RECEPCION_MATERIAL instance);