Example #1
0
        public bool Delete(SalesDetailDTO entity)
        {
            SALES sales = new SALES();

            sales.ID = entity.SalesID;
            salesdao.Delete(sales);
            PRODUCT product = new PRODUCT();

            product.ID          = entity.ProductID;
            product.StockAmount = entity.StockAmount + entity.SalesAmount;
            productdao.Update(product);
            return(true);
        }
Example #2
0
    private void sALESRECORDToolStripMenuItem_Click(object sender, EventArgs e)
    {
        foreach (Form form in Application.OpenForms)
        {
            if (form.GetType() == typeof(SALES))
            {
                form.Activate();
                return;
            }
        }
        SALES s = new SALES();

        s.MdiParent = this;
        s.Show();
    }
Example #3
0
        protected void ib_agregar_Click(object sender, ImageClickEventArgs e)
        {
            SALES venta = new SALES();

            venta.num_factura     = Convert.ToInt32(lbl_NumeroFactura.Text.Trim());
            venta.Sub_total       = Convert.ToInt32(lbl_sub_total.Text.Trim());
            venta.Impuesto_ventas = Convert.ToInt32(lbl_sub_total.Text.Trim());
            venta.Total_pagar     = Convert.ToInt32(lbl_sub_total.Text.Trim());

            if (lbl_sub_total.Text != "" & lbl_impuestoventas.Text != "" & lbl_total.Text != "")
            {
                Logica.AgregarVenta(venta);

                Response.Write("<sript languaje=javascript>alert('Datos almacenados correctamente');</script>");
            }
        }
Example #4
0
 //CREATE Sale
 public JsonResult CreateSale(SALES sale)
 {
     try
     {
         db.SALES.Add(sale);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         Console.Write(e.Data + "Exception Occured");
         return(new JsonResult {
             Data = "Sale Create Failed", JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
     return(new JsonResult {
         Data = "Success", JsonRequestBehavior = JsonRequestBehavior.AllowGet
     });
 }
Example #5
0
 //GET Update Sale
 public JsonResult GetUpdateSale(int id)
 {
     try
     {
         SALES  sale  = db.SALES.Where(x => x.ID == id).SingleOrDefault();
         string value = JsonConvert.SerializeObject(sale, Formatting.Indented, new JsonSerializerSettings
         {
             ReferenceLoopHandling = ReferenceLoopHandling.Ignore
         });
         return(Json(value, JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         Console.Write(e.Data + "Exception Occured");
         return(new JsonResult {
             Data = "Sale Not Found", JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
 }
Example #6
0
        public bool Insert(SalesDetailDTO entity)
        {
            SALES sale = new SALES();

            sale.CategoryID         = entity.CategoryID;
            sale.ProductID          = entity.ProductID;
            sale.CustomerID         = entity.CustomerID;
            sale.ProductSalesPrice  = entity.Price;
            sale.ProductSalesAmount = entity.SalesAmount;
            sale.SalesDate          = entity.SalesDate;
            salesdao.Insert(sale);
            PRODUCT product = new PRODUCT();

            product.ID = entity.ProductID;
            int temp = entity.StockAmount - entity.SalesAmount;

            product.StockAmount = temp;
            productdao.Update(product);
            return(true);
        }
Example #7
0
        //UPDATE Sale
        public JsonResult UpdateSale(SALES sale)
        {
            try
            {
                SALES sa = db.SALES.Where(s => s.ID == sale.ID).SingleOrDefault();
                sa.CUSTOMERID = sale.CUSTOMERID;
                sa.PRODUCTID  = sale.PRODUCTID;
                sa.STOREID    = sale.STOREID;
                sa.DATESOLD   = sale.DATESOLD;

                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.Write(e.Data + "Exception Occured");
                return(new JsonResult {
                    Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            return(new JsonResult {
                Data = "Success", JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Example #8
0
    private void button3_Click(object sender, EventArgs e)
    {
        SALES s = new SALES();

        s.Show();
    }
Example #9
0
        public void Delete(SALES sales)
        {
            SALESRepository rep = new SALESRepository(connectionString);

            rep.Remove(sales);
        }
Example #10
0
        public void Put(SALES sales)
        {
            SALESRepository rep = new SALESRepository(connectionString);

            rep.Update(sales);
        }
Example #11
0
        public void Post(SALES sales)
        {
            SALESRepository rep = new SALESRepository(connectionString);

            rep.Add(sales);
        }