예제 #1
0
    protected void lbtSusscess_Click(object sender, EventArgs e)
    {
        Basket objBasket = new Basket();
        objBasket.Data.BasketName = "Đơn hàng ngày " + DateTime.Now.ToString("hh:mm:ss tt mm/dd/yyyy ");
        objBasket.Data.CustomerName = txtFullName.Text;
        if (fileYC.Value != "")
        {
            objBasket.Data.BasketContent = Support.UploadFile(fileYC, "fileyc");
        }
        else
        {
            objBasket.Data.BasketContent = "";
        }

        objBasket.Data.CustomerAddress = txtAddress.Text;
        objBasket.Data.CustomerTel = txtPhone.Text;
        objBasket.Data.CustomerEmail = txtEmail.Text;
        objBasket.Data.Status = 0;
        objBasket.Data.DateCreated = ConvertData.ConvertToString(ConvertData.ConvertDatetimeToInt(DateTime.Today));

        int nResult = objBasket.Insert();

        //insert item to table basket details

        string nID = Request.QueryString["id"];

        int nCount = nID.Split('-').Length - 1;
        ArrayList alProducts = new ArrayList(nID.Split('-'));

        BasketDetail objBasketDetail = new BasketDetail();

        string strInsert;
        if (nResult > 0)
        {
            for (int i = 0; i < nCount; i++)
            {
                objBasketDetail.Data.ProductID2 = ConvertData.ConvertToInt(alProducts[i]);
                objBasketDetail.Data.BasketID = nResult;
                objBasketDetail.Data.Quantity = 1;
                objBasketDetail.Insert();
            }

            if (Request.Cookies["simpleCart"] != null)
            {
                HttpCookie myCookie = new HttpCookie("simpleCart");
                myCookie.Expires = DateTime.Now.AddDays(-1d);
                Response.Cookies.Add(myCookie);
            }

            Response.Redirect("Default.aspx?mess=2");

        }
        else
        {
            strInsert = "Đơn đặt hàng bị lỗi ! bạn vui lòng pm Y!M hỗ trợ để chúng tôi giúp bạn. Thân ái";
            MessageBoxss.Show(strInsert);
        }
    }
예제 #2
0
    public static string InsertOrder(string id, string name, string price, string fullname, string phone, string email, string address, string yeucau)
    {
        Basket objBasket = new Basket();
        objBasket.Data.BasketName = "Đơn hàng ngày " + DateTime.Now.ToString("hh:mm:ss tt mm/dd/yyyy ");
        objBasket.Data.CustomerName = fullname;
        objBasket.Data.BasketContent = yeucau;
        objBasket.Data.CustomerAddress =address;
        objBasket.Data.CustomerTel = phone;
        objBasket.Data.CustomerEmail = email;
        objBasket.Data.Status = 0;
        objBasket.Data.DateCreated = ConvertData.ConvertToString(ConvertData.ConvertDatetimeToInt(DateTime.Today));

        int nResult = objBasket.Insert();

        //insert item to table basket details

        string[] arrID = Regex.Split(id, "-");
        string[] arrName = Regex.Split(name, "-");
        string[] arrPrice = Regex.Split(price, "-");

        BasketDetail objBasketDetail = new BasketDetail();

        string strInsert;
        if (nResult > 0)
        {
            for (int i = 0; i < arrID.Length-1;i++ )
            {

                objBasketDetail.Data.ProductID2 = ConvertData.ConvertToInt(arrID[i]);
                objBasketDetail.Data.BasketID = nResult;
                objBasketDetail.Data.Quantity = 1;
                objBasketDetail.Insert();

            }

            strInsert = "Cám ơn bạn đã đặt mua sản phẩm. Chúng tôi sẽ liên lạc lại với quý khách trong thời gian sớm nhất . Thân ái !";
        }
        else
        {
            strInsert = "Đơn đặt hàng bị lỗi ! bạn vui lòng pm Y!M hỗ trợ để chúng tôi giúp bạn. Thân ái";
        }

        return strInsert;
    }
예제 #3
0
    private void GetData(int ItemID)
    {
        // Get data to view on UI Controls

        Basket objBasket = new Basket();
        objBasket.LoadById(ItemID);

        int nCreatDate = ConvertData.ConvertToInt(objBasket.Data.DateCreated);
        lblCustomer.Text = objBasket.Data.CustomerName;
        lblAddess.Text = objBasket.Data.CustomerAddress;
        lblTelephone.Text = objBasket.Data.CustomerTel;
        lblCreateDate.Text = ConvertData.ConvertIntToDatetimeString(nCreatDate);
        lnkFile.Text = objBasket.Data.BasketContent;
        lnkFile.NavigateUrl = "~/FileUpload/NguoiDung/" + objBasket.Data.BasketContent;

        int Result = objBasket.UpdateStatus(ItemID, EnumeType.ACTIVE);

        DataTable dtb = new DataTable();
        BasketDetail obj = new BasketDetail();
        dtb = obj.Search_BasketDetail_by_BasketID(ItemID);
        RptExport.DataSource = dtb;
        RptExport.DataBind();
    }