Exemple #1
0
    protected void AddPetInfo(int id)
    {
        int isExit = 0;

        for (int j = 0; j < Profile.Cart.name.Count; j++)
        {
            if (id == (int)Profile.Cart.id[j])
            {
                int s = (int)Profile.Cart.qty[j];
                s++;
                Profile.Cart.qty[j] = s;
                Profile.Save();
                isExit = 1;
            }
        }
        if (isExit == 0)
        {
            PetDataContext db  = new PetDataContext();
            var            pet = (from m in db.MyPetInfo
                                  where m.ID == id
                                  select m).First();
            Profile.Cart.id.Add(pet.ID);
            Profile.Cart.name.Add(pet.name);
            Profile.Cart.kind.Add(pet.kind);
            Profile.Cart.price.Add(pet.price);
            Profile.Cart.qty.Add(1);
            Profile.Save();
        }
    }
Exemple #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        PetDataContext db    = new PetDataContext();
        Order          order = new Order();

        order.UserName  = "******";
        order.OrderDate = DateTime.Now;
        order.Addr1     = txtGoodsAddress.Text.Trim();
        order.Phone     = txtPhone.Text.Trim();
        order.Status    = "未审核";
        db.Order.InsertOnSubmit(order);
        db.SubmitChanges();
        int id = order.OrderId;

        for (int i = 0; i < Profile.Cart.name.Count; i++)
        {
            OrderItem orderItem = new OrderItem();
            orderItem.OrderId    = id;
            orderItem.ProName    = (String)Profile.Cart.name[i];
            orderItem.ListPrice  = (int)Profile.Cart.price[i];
            orderItem.Qty        = (int)Profile.Cart.qty[i];
            orderItem.TotalPrice = (int)Profile.Cart.qty[i] * (int)Profile.Cart.price[i];
            db.OrderItem.InsertOnSubmit(orderItem);
            db.SubmitChanges();
        }
        Profile.Cart.id.Clear();
        Profile.Cart.name.Clear();
        Profile.Cart.price.Clear();
        Profile.Cart.qty.Clear();
        Profile.Cart.totalPrice = "";
        lblMsg.Text             = "已经成功结算,谢谢光临";
    }
Exemple #3
0
    protected void btnComputerAgain_Click(object sender, EventArgs e)
    {
        lblError.Text = "";
        PetDataContext db = new PetDataContext();

        for (int i = 0; i < gvCart.Rows.Count; i++)
        {
            TextBox txtqty = new TextBox();
            txtqty = (TextBox)gvCart.Rows[i].FindControl("txtQty");
            if (txtqty != null)
            {
                var product = (from p in db.MyPetInfo where p.ID == int.Parse(gvCart.Rows[i].Cells[1].Text) select p).First();
                if (int.Parse(txtqty.Text) > product.qty)
                {
                    lblError.Text += "error:库存不足,商品名为:" + gvCart.Rows[i].Cells[2].Text + "的库存量为:" + product.qty.ToString() + "<br />";
                }
                else
                {
                    ChangeQty(int.Parse(gvCart.Rows[i].Cells[1].Text), int.Parse(txtqty.Text));
                }
            }
        }
        Bind();
    }
 public ConversationRepository(PetDataContext context, UnitOfWork unitOfWork) : base(context, unitOfWork)
 {
 }
Exemple #5
0
 public MessageRepository(PetDataContext context, UnitOfWork unitOfWork) : base(context, unitOfWork)
 {
 }
 public UserDetailsRepository(PetDataContext dbContext, UnitOfWork unitOfWork) :
     base(dbContext, unitOfWork)
 {
 }
 public FeedController(PetDataContext context)
 {
     _context = context;
 }
 public PetRepository(PetDataContext dbContext, UnitOfWork unitOfWork) :
     base(dbContext, unitOfWork)
 {
 }