protected void cmdSave_Click(object sender, EventArgs e)
    {
        Item myItem = new Item();
        myItem.Id = Request.Params["itemid"];
        myItem.VendorId = int.Parse(Request.Params["vendorid"]);
        myItem.Price = decimal.Parse(txtPrice.Text);

        ItemDA myIDA = new ItemDA();
        myIDA.Save(myItem);
    }
예제 #2
0
 public static int ItemInCartCount()
 {
     try
     {
         return(ItemDA.ItemInCartCount());
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
예제 #3
0
 public static int ItemUpdateInCart(ItemInfo Obj)
 {
     try
     {
         return(ItemDA.ItemUpdate(Obj));
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
예제 #4
0
        public static List <ItemInfo> ItemIdInCart()
        {
            var listObject = new List <ItemInfo>();

            try
            {
                listObject = CBO <ItemInfo> .FillCollectionFromDataSet(ItemDA.ItemIdInCart());
            }
            catch (Exception ex)
            {
            }
            return(listObject);
        }
예제 #5
0
        public static List <ItemInfo> ItemLoad(int i_itemStatus, decimal i_begin, decimal i_end)
        {
            var listObject = new List <ItemInfo>();

            try
            {
                listObject = CBO <ItemInfo> .FillCollectionFromDataSet(ItemDA.ItemLoad(i_itemStatus, i_begin, i_end));
            }
            catch (Exception ex)
            {
            }
            return(listObject);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Params["itemid"] != null && Request.Params["vendorid"] != null && !IsPostBack )
        {
        //they passed in a product ID and a vendorid I can continue
            Item myItem = new Item();
            myItem.Id = Request.Params["itemid"];
            myItem.VendorId = int.Parse(Request.Params["vendorid"]);

            ItemDA myIDA = new ItemDA();
            txtID.Text = myIDA.Get(myItem)[0].Id;
            txtPrice.Text = myIDA.Get(myItem)[0].Price.ToString();

            //myIDA.dispose();
            //myItem.dispose();
            myIDA = null;
            myItem = null;

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // method that gets items in controls and
        // checks weather the sales price label is invisible or not
        GetItems();

        try
        {
            if (Request.QueryString["ItemID"] != null)
            {

                // get item information based on itemID
                Item item = new Item();
                item.Id = Request.QueryString["ItemID"];
                ItemDA itemDA = new ItemDA();
                Collection<Item> getItem = itemDA.Get(item);

                RangeValidator range = (RangeValidator)FormView1.FindControl("rvQuantity");

                //  if quantity available is less than minquanitity make txtQuantity and btnAddToCart invisible
                // and display Item is on Back order message.
                if (getItem[0].QuantityAvailable < getItem[0].MinQuantity)
                {
                    range.MaximumValue = "0";

                    range.MinimumValue = "0";

                    quantity.ReadOnly = true;

                    Button addtocart = (Button)FormView1.FindControl("btnAddToCart");

                    addtocart.Visible = false;

                    error.Text = "Item is on backorder!";
                    error.Visible = true;

                    quantity.Visible = false;

                    Label lblquantity = (Label)FormView1.FindControl("lblQuantity");
                    lblquantity.Visible = false;

                }
                else
                {
                    range.MaximumValue = getItem[0].QuantityAvailable.ToString();

                    range.MinimumValue = getItem[0].MinQuantity.ToString();
                }

                //clear
                item = null;
                itemDA = null;
                getItem = null;
            }
        }
        catch (HttpException)
        {

        }
        catch (SqlException)
        {

        }
    }