コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString.Count != 0)
     {
         string sPK = Request.QueryString["Co"].ToString();
         string sES = Request.QueryString["Es"].ToString();
         if (!sPK.Equals(""))
         {
             Compra = MC.ConsultarCompra(Convert.ToInt32(Request.QueryString["Co"].ToString()));
             AsigarCompra(Compra);
             if (sES.Equals("A"))
             {
                 btnAgregarCompra.Text = "Eliminar";
                 formulario.Visible    = false;
             }
             if (!IsPostBack)
             {
                 SincronizarTipoCambio();
             }
         }
         if (sPK.Equals(""))
         {
             Response.Redirect("Compras.aspx");
         }
     }
 }
コード例 #2
0
        public void EliminarCompra(int id)
        {
            FAJA_MODELDataContext dc = new FAJA_MODELDataContext();
            Buy_Bill Compra          = dc.Buy_Bill.First(c => c.BuyBil_PK == id);

            Compra.BuyBil_Status = "I";
            dc.SubmitChanges();

            foreach (Detail_Buy_Bill DBB in dc.Detail_Buy_Bill.Where(c => c.DetBuyBil_FK_BuyBil == id))
            {
                EliminarDetalleCompra(DBB.DetBuyBil_PK);
            }
        }
コード例 #3
0
        public Buy_Bill RegistrarCompra()
        {
            FAJA_MODELDataContext dc = new FAJA_MODELDataContext();
            Buy_Bill Compra          = new Buy_Bill();

            Compra.BuyBil_Date        = DateTime.Now;
            Compra.BuyBil_Description = "";
            Compra.BuyBil_Status      = "P";
            Compra.BuyBil_Total       = 0;
            dc.Buy_Bill.InsertOnSubmit(Compra);
            dc.SubmitChanges();
            return(Compra);
        }
コード例 #4
0
        public void EditarCompra(int id, string Des, Double venta)
        {
            FAJA_MODELDataContext dc = new FAJA_MODELDataContext();
            Buy_Bill Compra          = dc.Buy_Bill.First(c => c.BuyBil_PK == id);
            double   total           = 0;

            foreach (Detail_Buy_Bill DBB in dc.Detail_Buy_Bill.Where(c => c.DetBuyBil_FK_BuyBil == id && c.DetBuyBil_Status == "P"))
            {
                EditarDetalleCompra(DBB.DetBuyBil_PK);
                total += Convert.ToDouble(DBB.DetBuyBil_BuyPrice);
            }
            Compra.BuyBil_Description = Des;
            Compra.BuyBil_Total       = total * venta;
            Compra.BuyBil_Status      = "A";
            dc.SubmitChanges();
        }
コード例 #5
0
 protected void AsigarCompra(Buy_Bill bill)
 {
     txtDescripcion.Text = bill.BuyBil_Description;
 }