Ejemplo n.º 1
0
        public frmShipping(string UserName, string PassWord, string DefaultAddress, string PhoneNumber, string FullName)
        {
            this.UserName       = UserName;
            this.DefaultAddress = DefaultAddress;
            this.PassWord       = PassWord;
            InitializeComponent();
            this.lblAddress.Text     = DefaultAddress;
            this.lblFullName.Text    = FullName;
            this.lblPhoneNumber.Text = PhoneNumber;
            this.lblShowPrice.Text   = OrderItemsController.ShowTotalPrice(UserName, PassWord).Tables[0].Rows[0][0].ToString();
            DataTable dtAllBillDetails = OrderItemsController.ShowCart(UserName).Tables[0];
            int       ylbl             = 10;

            foreach (DataRow dr in dtAllBillDetails.Rows)
            {
                Guna.UI.WinForms.GunaLabel lbl = new Guna.UI.WinForms.GunaLabel();
                lbl.Location = new Point(8, ylbl);
                lbl.Font     = new Font("Tahoma", 9, FontStyle.Bold);
                lbl.Text     = dr["ItemName"].ToString() + " x " + dr["Quantity"].ToString() + " : \t" + dr["PaidPrice"].ToString();
                lbl.AutoSize = true;
                pnAllBillDetails.Controls.Add(lbl);

                ylbl += 24;
            }
        }
Ejemplo n.º 2
0
        public frmShoppingCart(string UserName, string PassWord)
        {
            this.UserName = UserName;
            this.PassWord = PassWord;
            InitializeComponent();
            DataTable dtCart = OrderItemsController.ShowCart(UserName).Tables[0];

            foreach (DataRow dr in dtCart.Rows)
            {
                string ImageTemp = dr["Image"].ToString();
                Image  image;
                if (ImageTemp != "")
                {
                    string appPath  = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10)) + @"\images\imagesProduct\";
                    string FileName = appPath + ImageTemp;
                    image = Image.FromFile(FileName);
                }
                else
                {
                    ImageTemp = "10.jpg";
                    string appPath  = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10)) + @"\images\imagesUser\";
                    string FileName = appPath + ImageTemp;
                    image = Image.FromFile(FileName);
                }
                image = new Bitmap(image, new Size(70, 70));
                string ItemName    = dr["ItemName"].ToString();
                string Description = dr["Description"].ToString();
                string PaidPrice   = dr["PaidPrice"].ToString();
                string Orgin       = dr["Orgin"].ToString();
                string Quantity    = dr["Quantity"].ToString();
                dtGVShoppingCart.Rows.Add(image, ItemName, Description, PaidPrice, Orgin, Quantity);
            }
        }
Ejemplo n.º 3
0
        private void btnDeleteCart_Click(object sender, EventArgs e)
        {
            DialogResult dialog = MessageBox.Show("Bạn muốn xóa " + ItemNameTemp + " khỏi giỏ hàng", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (dialog == DialogResult.OK)
            {
                bool check = OrderItemsController.DeleteItem_Cart(UserName, PassWord, ItemNameTemp, ref err);
                if (check == true)
                {
                    MessageBox.Show("Bạn đã xóa " + ItemNameTemp + " khỏi giỏ hàng thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DataTable dtCart = OrderItemsController.ShowCart(UserName).Tables[0];
                    dtGVShoppingCart.Rows.Clear();
                    foreach (DataRow dr in dtCart.Rows)
                    {
                        string ImageTemp = dr["Image"].ToString();
                        Image  image;
                        if (ImageTemp != "")
                        {
                            string appPath  = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10)) + @"\images\imagesProduct\";
                            string FileName = appPath + ImageTemp;
                            image = Image.FromFile(FileName);
                        }
                        else
                        {
                            ImageTemp = "10.jpg";
                            string appPath  = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 10)) + @"\images\imagesUser\";
                            string FileName = appPath + ImageTemp;
                            image = Image.FromFile(FileName);
                        }
                        image = new Bitmap(image, new Size(70, 70));
                        string ItemName    = dr["ItemName"].ToString();
                        string Description = dr["Description"].ToString();
                        string PaidPrice   = dr["PaidPrice"].ToString();
                        string Orgin       = dr["Orgin"].ToString();
                        string Quantity    = dr["Quantity"].ToString();
                        dtGVShoppingCart.Rows.Add(image, ItemName, Description, PaidPrice, Orgin, Quantity);
                    }
                }
            }
        }