Example #1
0
        private void UpdateCartSession()
        {
            if (Session["cartid"] == null)
            {
                if (!string.IsNullOrEmpty(baseviewmodel.cartid))
                {
                    cart = db.carts.Where(x => x.id.ToString() == baseviewmodel.cartid).SingleOrDefault();
                    if (cart != null)
                    {
                        Session["cartid"] = baseviewmodel.cartid;
                    }
                }
            }

            if (Session["cartid"] != null)
            {
                if (cart == null)
                {
                    cart = db.carts.Where(x => x.id.ToString() == baseviewmodel.cartid).SingleOrDefault();
                }
            }

            if (cart != null)
            {
                sessionid   = cart.userid;
                subdomainid = cart.subdomainid;

                baseviewmodel.store_name = cart.MASTERsubdomain.organisation.name;
                baseviewmodel.year       = DateTime.UtcNow.Year;
                if (cart.userid.HasValue)
                {
                    baseviewmodel.user_name = cart.user.firstName;
                }
            }
        }
Example #2
0
    public void FillRepeater()
    {
        using (cart obj = new cart())
        {
            obj._userid    = Convert.ToInt64(Session["UserID"].ToString());
            obj._sessionid = Session["Current"].ToString();
            obj._orderid   = Convert.ToInt64("0");

            DataSet ds = new DataSet();
            ds = obj.cart_details();

            if (ds.Tables[0].Rows.Count > 0)
            {
                rptcart.DataSource = ds;
                rptcart.DataBind();
            }
            else
            {
                lblerror.Text      = "No Item In Cart";
                lblerror.Visible   = true;
                rptcart.Visible    = false;
                totaldiv.Visible   = false;
                btnconfirm.Visible = false;
            }
            ds             = obj.cart_total();
            lbltotals.Text = ds.Tables[0].Rows[0]["total"].ToString();
        }
    }
Example #3
0
        public ActionResult AddToCart(string id)
        {
            int accountid = (Session["User"] as account).id;
            int pid       = Convert.ToInt32(id);

            var query = from cart in cos.carts
                        where cart.id_user == accountid && cart.id_products == pid
                        select cart;

            if (query.SingleOrDefault() != null)
            {
                cart existCart = query.FirstOrDefault();
                existCart.quantity++;
            }
            else
            {
                var newcart = new cart {
                    id_user = accountid, id_products = pid, quantity = 1, createdAt = DateTime.Now
                };
                cos.carts.Add(newcart);
            }

            cos.SaveChanges();


            return(View("Cart"));
        }
Example #4
0
 public baseCartController()
 {
     cart          = null;
     db            = new tradelrDataContext();
     repository    = new TradelrRepository(db);
     baseviewmodel = new BaseViewModel();
 }
        public async Task <IActionResult> Putcart([FromRoute] int id, [FromBody] cart cart)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cart.cartID)
            {
                return(BadRequest());
            }

            _context.Entry(cart).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!cartExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #6
0
        public List <cart> GetAllItems()
        {
            List <cart> allItems = new List <cart>();

            string cs = @"URI=file:../cart.db";

            using var con = new SQLiteConnection(cs);
            con.Open();

            string stm = "SELECT * FROM cart";

            using var cmd = new SQLiteCommand(stm, con);

            using SQLiteDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                cart temp = new cart()
                {
                    cartid = rdr.GetInt32(0), itemName = rdr.GetString(1), price = rdr.GetDouble(2), quantity = rdr.GetInt32(3)
                };
                allItems.Add(temp);
            }

            return(allItems);
        }
Example #7
0
        public ActionResult update()
        {
            String temp;
            cart   cart = (cart)Session["cart"];

            for (int i = 0; i < cart.lstcart.Count(); i++)
            {
                temp = Request.Form[cart.lstcart[i].Id_Product.ToString()];
                if (temp == null && cart.lstcart[i].Amount != null)
                {
                    continue;
                }
                else if (temp == null || Int32.Parse(temp) == 0)
                {
                    cart.lstcart.RemoveAt(i);
                }
                else
                {
                    cart.lstcart[i].Amount = Int32.Parse(temp);
                    //cart.lstcart[i].Total = (Double)cart.lst[i].amount * cart.lst[i].price;
                }
            }
            Session["Cart"] = cart;
            return(View());
        }
Example #8
0
        public ActionResult pay(bill ttKhachHang)
        {
            ttKhachHang.create_date = DateTime.Now.Date;
            db = new ToysDBContext();
            db.bills.Add(ttKhachHang);


            cart cart = (cart)Session["cart"];

            foreach (CartItem item in cart.lstcart)
            {
                bill_detail detail = new bill_detail();
                detail.bill_id    = ttKhachHang.id;
                detail.product_id = item.Id_Product;
                detail.amount     = item.Amount;
                detail.price      = item.Amount * item.price;
                db.bill_detail.Add(detail);
            }

            int    stt     = db.SaveChanges();
            string message = "Có lỗi khi đặt hàng!";            if (stt > 0)

            {
                message = "Đặt hàng thành công";
            }
            Session["message"] = message;
            Session["Cart"]    = null;

            return(RedirectToAction("Index", "Home"));
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            moveSidePanel(U_sb_btn);
            cart btt = new cart();

            Addcontrolstopanel(btt);
        }
Example #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parm"></param>
        /// <param name="msgType">1 add 0 del</param>
        /// <returns></returns>
        public ApiMessage <bool> Add(cart parm)
        {
            var api  = new ApiMessage <bool>();
            var list = _db.Query <cart>(@"SELECT * FROM Cart WHERE UserID=@UserID AND ProductID=@ProductID", parm).ToList();

            if (list.Any())
            {
                var node = list.FirstOrDefault();
                if (parm.Amount == 0)
                {
                    node.Delete();
                }
                else
                {
                    node.Amount    = parm.Amount;
                    node.CreatDate = DateTime.Now;
                    node.Update();
                }
            }
            else
            {
                parm.CreatDate = DateTime.Now;
                parm.ID        = Guid.NewGuid().ToString();
                parm.Insert();
            }
            api.Msg = "添加成功";
            return(api);
        }
Example #11
0
    protected void btnclearall_Click(object sender, EventArgs e)
    {
        using (cart obj = new cart())
        {
            if (Session["UserID"] != null)
            {
                if (Session["UserID"] != "")
                {
                    obj._userid    = Convert.ToInt64(Session["UserID"].ToString());
                    obj._sessionid = Session["Current"].ToString();
                    obj._orderid   = Convert.ToInt64("0");

                    obj.cart_clear();
                    FillRepeater();
                    lblMsg.Text    = "Your Cart is Clear";
                    lblMsg.Visible = true;
                }
            }
            else
            {
                obj._userid    = Convert.ToInt64("0");
                obj._sessionid = Session["Current"].ToString();
                obj._orderid   = Convert.ToInt64("0");

                obj.cart_clear();
                FillRepeater();
                lblMsg.Text    = "Your Cart is Clear";
                lblMsg.Visible = true;
            }
        }
    }
Example #12
0
    public void Updateuserid()
    {
        if (Session["UserID"] != null)
        {
            if (Session["UserID"] != "")
            {
                using (cart obj = new cart())
                {
                    obj._userid    = Convert.ToInt64(Session["UserID"].ToString());
                    obj._sessionid = Session["Current"].ToString();
                    obj._orderid   = Convert.ToInt64("0");

                    obj.cart_updateuserid();


                    DataSet ds  = new DataSet();
                    DataSet dsr = new DataSet();
                    ds  = obj.cart_selectbyusoid();
                    dsr = obj.cart_selectbyuoid();
                    int i = dsr.Tables[0].Rows.Count;
                    int j = ds.Tables[0].Rows.Count;
                    if (i > j)
                    {
                        obj.cart_updatesessionid();
                    }
                }
            }
        }
    }
Example #13
0
        /// <summary>
        /// 添加购物车
        /// </summary>
        /// <returns></returns>
        public ActionResult Add()
        {
            //  string cgoodsid = Request.QueryString["goodsid"];
            string cgoodsname     = Request.QueryString["goodsname"];
            string cgoodsnewprice = Request.QueryString["goodsnewprice"];
            string cgooodscolor   = Request.QueryString["gooodscolor"];
            string cgoodssize     = Request.QueryString["goodssize"];
            string cgoodsnumber   = Request.QueryString["goodsnumber"];
            string cgoodsimage    = Request.QueryString["goodsimgae"];

            //将用户选中的商品加入购物车,根据用户是否等,用户登录  直接加入数据库,没有登录直接加入cookies
            cart cart = new cart
            {
                goodsname     = cgoodsname,
                goodsimage    = cgoodsimage,
                goodsnewprice = Convert.ToDecimal(cgoodsnewprice),
                goodssize     = cgoodssize,
                goodsnumber   = Convert.ToInt32(cgoodsnumber),
                goodscolor    = cgooodscolor
            };

            //定义一个集合存储cart对象
            IList <cart> clist = new List <cart>();

            clist.Add(cart);
            // HttpCookie cartlistcookie = new HttpCookie("cartlist", clist);


            return(View());
        }
Example #14
0
        public void macCart(cart obj)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = ConfigurationManager.ConnectionStrings["EcommerceCon"].ConnectionString;
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = con;
            cmd.CommandText = "macClientInfo";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@mac", SqlDbType.VarChar).Value = obj.mac;
            SqlDataAdapter da = new SqlDataAdapter();

            da.SelectCommand = cmd;
            DataSet ds = new DataSet();

            da.Fill(ds);
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                TempData["cartProds"] = dr["cartProds"].ToString();
                TempData["amtDue"]    = dr["amtDue"].ToString();
            }
            con.Close();
        }
Example #15
0
        public ActionResult Display(int[] def)
        {
            //TempData["qwe"] = form1["def"];
            miniprojectEntities entities = new miniprojectEntities();
            //booklist result = new booklist();
            //result.selectedbook = def;
            ////return RedirectToAction("Displayfinal");
            //IEnumerable<int> y = result.selectedbook;
            ////List<booklist> selbooks;
            cart     order = new cart();
            booklist temp  = new booklist();

            foreach (int item in def)
            {
                temp              = entities.booklists.FirstOrDefault(x => x.book_id == item);
                order.book_id     = temp.book_id;
                order.book_name   = temp.book_name;
                order.author_name = temp.author_name;
                order.price       = temp.price;
                order.genre_id    = temp.genre_id;
                // order.user_id=
                entities.carts.Add(order);
                entities.SaveChanges();
            }

            return(RedirectToAction("Displayfinal"));
        }
Example #16
0
 protected void btnaddcart_Click(object sender, EventArgs e)
 {
     using (cart obj = new cart())
     {
         if (ViewState["rbtnid"] != null)
         {
             obj._productid     = Convert.ToInt64(Request.QueryString["sid"].ToString());
             obj._ppid          = Convert.ToInt64(ViewState["rbtnid"].ToString());
             obj._prid          = Convert.ToInt64(ViewState["prid"].ToString());
             Session["Current"] = Session.SessionID.ToString();
             obj._sessionid     = Session["Current"].ToString();
             obj._orderid       = Convert.ToInt64("0");
             obj._credit        = Convert.ToInt64(lbltotal.Text.ToString());
             if (Session["UserID"] != null)
             {
                 if (Session["UserID"] != "")
                 {
                     obj._userid = Convert.ToInt64(Session["UserID"].ToString());
                 }
             }
             else
             {
                 obj._userid = Convert.ToInt64("0");
             }
             obj.cart_insert();
             Response.Redirect("Cart.aspx");
         }
         else
         {
             lblMsg.Visible = true;
             lblMsg.Text    = "Chose one product item";
         }
     }
 }
Example #17
0
    protected void addcart_Click(object sender, ImageClickEventArgs e)
    {
        Userinfo user = new Userinfo();

        if (this.countliteral.Text.Trim() != "缺货")
        {
            cart ocart = new cart();
            if (ocart.isexitproduct(int.Parse(this.Request.QueryString["pid"].ToString())) == false)
            {
                if (ocart.addtocart(int.Parse(this.Request.QueryString["pid"].ToString()), user.getUserID(), 1, false) == 1)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物成功')</script>", false);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物失败')</script>", false);
                }
            }
            else
            {
                if (ocart.updatecartbyid(int.Parse(this.Request.QueryString["pid"].ToString())) == 1)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物成功')</script>", false);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物失败')</script>", false);
                }
            }
        }
        else
        {
            this.addcart.Enabled = false;
        }
    }
        public JsonResult AddItem(productos producto, int cantidad)
        {
            EstatusLog estatus = new EstatusLog();
            cart       carrito = new cart();

            if (logic.ActiveUser() == null)
            {
                estatus.success  = false;
                estatus.errorMsg = "NotUser";
                return(Json(estatus));
            }
            carrito.userid   = logic.ActiveUser().id;
            carrito.prodid   = producto.id;
            carrito.cantidad = cantidad;
            carrito.fecha    = DateTime.Now;
            try {
                db.cart.Add(carrito);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                estatus.success  = false;
                estatus.errorMsg = ex.Message;
            }
            return(Json(estatus));
        }
Example #19
0
        public ActionResult Adtocart(tbl_product pi, string qty, int Id)
        {
            tbl_product p = db.tbl_product.Where(x => x.pro_id == Id).SingleOrDefault();

            cart c = new cart();

            c.productid   = p.pro_id;
            c.price       = (float)p.pro_price;
            c.qty         = Convert.ToInt32(qty);
            c.bill        = c.price * c.qty;
            c.productname = p.pro_name;
            if (TempData["cart"] == null)
            {
                li.Add(c);
                TempData["cart"] = li;
            }
            else
            {
                List <cart> li2 = TempData["cart"] as List <cart>;
                li2.Add(c);
                TempData["cart"] = li2;
            }

            TempData.Keep();



            return(RedirectToAction("Index"));
        }
Example #20
0
        public ActionResult AddToCart(String name)
        {
            menu r = null;
            cart c = new cart();

            foreach (var i in t.menus)
            {
                if (name == i.name)
                {
                    r = i;
                    break;
                }
            }
            if (r == null)
            {
                return(HttpNotFound());
            }
            else
            {
                c.name  = r.name;
                c.free  = r.free;
                c.price = r.price;
                t.carts.Add(c);
                t.SaveChanges();
                return(RedirectToAction("Cart"));
            }
        }
Example #21
0
        public int Index(cart obj)
        {
            int qty;

            try
            {
                SqlConnection con = new SqlConnection();
                con.ConnectionString = ConfigurationManager.ConnectionStrings["EcommerceCon"].ConnectionString;
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandText = "pSMWcartQty";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@mac", SqlDbType.VarChar).Value = obj.mac;
                cmd.Parameters.Add("@id", SqlDbType.VarChar).Value  = obj.productId;
                qty = Convert.ToInt16(cmd.ExecuteScalar());
                con.Close();
                return(qty);
            }
            catch (Exception e)
            {
                return(0);
            }
        }
Example #22
0
 public void Index(cart a)
 {
     try
     {
         SqlConnection con = new SqlConnection();
         con.ConnectionString = ConfigurationManager.ConnectionStrings["EcommerceCon"].ConnectionString;
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         SqlCommand cmd = new SqlCommand();
         cmd.Connection  = con;
         cmd.CommandText = "cartAdd";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@mac", SqlDbType.VarChar).Value        = a.mac;
         cmd.Parameters.Add("@product_id", SqlDbType.VarChar).Value = a.productId;
         cmd.Parameters.Add("@cartProds", SqlDbType.Int).Value      = Convert.ToInt32(a.cartProds);
         cmd.Parameters.Add("@amtDue", SqlDbType.Int).Value         = Convert.ToInt32(a.amtDue);
         cmd.Parameters.Add("@username", SqlDbType.VarChar).Value   = a.username;
         cmd.ExecuteNonQuery();
         con.Close();
     }
     catch (Exception e)
     {
     }
 }
Example #23
0
        public void UpdateCart(string value, double price)
        {
            // string cs = @"URI=file:../cart.db"; // make this a static class!!
            // using var con = new SQLiteConnection(cs);
            // con.Open();

            ConnectionString myConnection = new ConnectionString();
            string           cs           = myConnection.cs;

            using var con = new MySqlConnection(cs);
            con.Open();

            Console.WriteLine("I made it to the price and it is " + price);


            // cmd.CommandText = @"INSERT INTO cart(itemName, quantity, price) VALUES(@itemName, @quantity, @price)";
            string stm = @"INSERT INTO cart(itemName, quantity, price) VALUES(@itemName, @quantity, @price)";

            using var cmd = new MySqlCommand(stm, con);

            cmd.Parameters.AddWithValue("@itemName", value);
            cmd.Parameters.AddWithValue("@quantity", 1);
            cmd.Parameters.AddWithValue("@price", price);
            cmd.Prepare();
            cmd.ExecuteNonQuery();
            cart addparm = new cart()
            {
                itemName = value, quantity = 0, price = price
            };

            addChickenParm.Add(addparm);
        }
Example #24
0
        public void Post([FromBody] cart value)
        {
            Console.WriteLine(value);
            iPostCart insertObject = new saveData();

            insertObject.UpdateCart(value.itemName, value.price);
        }
Example #25
0
        public ActionResult AddToCart(int?id)
        {
            if (Session["email"] != null)
            {
                if (db.products.Find(id) != null)
                {
                    var  prod = db.products.Where(u => u.id == id).ToList();
                    cart cart = new cart();
                    cart.product = prod.Select(u => u.id).FirstOrDefault();
                    cart.user    = int.Parse(Session["id"].ToString());
                    cart.Qte     = 1;

                    db.carts.Add(cart);
                    db.SaveChanges();
                    return(Redirect("/products/Details/" + id));
                }
                else
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
                }
            }
            else
            {
                return(Redirect("/users/Login"));
            }
        }
Example #26
0
        public static void Add(cart value)
        {
            Console.WriteLine("made it to add");
            int id = maxIDfinder.find();

            Console.WriteLine(id);
            string cs = @"URI=file:../carttotals.db";

            using var con = new SQLiteConnection(cs);
            con.Open();

            var newQ = value.quantity + 1;
            var newP = 0.0;

            if (value.quantity == 0)
            {
                newP = value.price * newQ;
            }
            else
            {
                newP = (value.price / value.quantity) * newQ;
            }
            Console.WriteLine(value.price + " " + newQ);

            string stm = @$ "UPDATE carttotals set qhouse = {newQ}, phouse = {newP} WHERE orderID = @id";

            using var cmd = new SQLiteCommand(stm, con);
            cmd.Parameters.AddWithValue("@id", id);
            cmd.Prepare();
            cmd.ExecuteNonQuery();
            con.Close();
        }
Example #27
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrWhiteSpace(Request.QueryString["id"]))
        {
            string clientId = Context.User.Identity.GetUserId();

            if (clientId != null)
            {
                int id     = Convert.ToInt32(Request.QueryString["id"]);
                int amount = Convert.ToInt32(ddlAmount.SelectedValue);

                cart cart = new cart
                {
                    Amount        = amount,
                    ClientID      = clientId,
                    DatePurchased = DateTime.Now,
                    IsInCart      = true,
                    ProductID     = id
                };

                CartModel model = new CartModel();
                lblResult.Text = model.InsertCart(cart);
            }
            else
            {
                lblResult.Text = "Please Log in to order items";
            }
        }
    }
Example #28
0
        public void addCartItem(int id, cart value)
        {
            // string cs = @"URI=file:../cart.db";
            // using var con = new SQLiteConnection(cs);
            // con.Open();

            ConnectionString myConnection = new ConnectionString();
            string           cs           = myConnection.cs;

            using var con = new MySqlConnection(cs);
            con.Open();

            var newQ = value.quantity + 1;
            var newP = (value.price / value.quantity) * newQ;

            Console.WriteLine(value.price + " " + newQ);

            string stm = @$ "UPDATE cart set quantity = {newQ}, price = {newP} WHERE cartid = @id";

            using var cmd = new MySqlCommand(stm, con);

            cmd.Parameters.AddWithValue("@id", id);
            cmd.Prepare();
            cmd.ExecuteNonQuery();
            con.Close();
            addChickenParm.Add(value);
        }
Example #29
0
        /*
         * 将专辑作为参数加入到购物车中,在 Cart 表中跟踪每个专辑的数量,在这个方法中,我们将会检查是在表中增加一个新行,还是仅仅在用户已经选择的专辑上增加数量。
         */
        public void AddToCart(album album)
        {
            Maticsoft.BLL.cart item = new Maticsoft.BLL.cart();
            List <Maticsoft.DAL.SqlWhereClass> lssqlwhere = new List <Maticsoft.DAL.SqlWhereClass>();

            Maticsoft.DAL.SqlWhereClass sqlwhere = new Maticsoft.DAL.SqlWhereClass("CartId", "CartId", Maticsoft.DAL.NetOperate.EQ, "'" + ShoppingCartid + "'");
            lssqlwhere.Add(sqlwhere);
            sqlwhere = new Maticsoft.DAL.SqlWhereClass("AlbumId", "AlbumId", Maticsoft.DAL.NetOperate.EQ, album.AlbumId.ToString());
            lssqlwhere.Add(sqlwhere);
            var CartItem = item.GetModel(lssqlwhere);

            if (CartItem == null)
            {
                CartItem = new cart
                {
                    AlbumId     = album.AlbumId,
                    CartId      = ShoppingCartid,
                    Count       = 1,
                    DateCreated = DateTime.Now
                };
                item.Add(CartItem);
            }
            else
            {
                CartItem.Count++;
                item.Update(CartItem);
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            int i    = int.Parse(Request.QueryString["id"]);
            int qnty = int.Parse(TextBox1.Text);

            if (int.Parse(TextBox1.Text) != 0)
            {
                int cost = int.Parse(TextBox1.Text) * (int.Parse(Label6.Text));
                shoppingDataContext sdc2 = new shoppingDataContext();
                cart cart = new cart()
                {
                    quantity   = int.Parse(TextBox1.Text),
                    total_cost = cost,
                    cust_id    = int.Parse(Session["cust"].ToString()),
                    prod_id    = int.Parse(Request.QueryString["id"])
                };
                sdc2.carts.InsertOnSubmit(cart);
                sdc2.SubmitChanges();
                Label12.Text = "Successfully Added..";
            }
            else
            {
                Label12.Text = "Plz select quntity";
            }
        }
 partial void Insertcart(cart instance);
 partial void Updatecart(cart instance);
    public void UpdateCate(cart ca)
    {
        try
        {
            LQDataContext ctxx = new LQDataContext();
            var q = ctxx.carts.Where(d => d.id_cart == ca.id_cart).SingleOrDefault();
            q.time_cart = ca.time_cart;
            ctxx.SubmitChanges();
        }
        catch (Exception ex)
        {

        }
    }
	private void attach_carts(cart entity)
	{
		this.SendPropertyChanging();
		entity.cust = this;
	}
 partial void Deletecart(cart instance);
 public void add_cart()
 {
     if (c != null)
     {
         cartss = new cart();
         cartss.id_cus = c.id_cus;
         cartss.time_cart = DateTime.Now;
         rp.AddCart(cartss);
     }
 }
	private void detach_carts(cart entity)
	{
		this.SendPropertyChanging();
		entity.cust = null;
	}
 public bool AddCart(cart ca)
 {
     LQDataContext ctxs = new LQDataContext();
     ctxs.carts.InsertOnSubmit(ca);
     ctxs.SubmitChanges();
     return true;
 }