Exemplo n.º 1
0
    protected void lnkBtnSave_Click(object sender, EventArgs e)
    {
        string promoteName = PromoteName.Text;
        string discount    = Discount.Text;

        if ((!promote.PromoteName.Equals(promoteName)) && (BLLPromote.checkPromoteExistName(promoteName) != 0))
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Promote Name existed. Please try again');", true);
        }
        else
        {
            Promote newPromote = new Promote();
            newPromote.PromoteID   = promote.PromoteID;
            newPromote.PromoteName = promoteName;
            newPromote.Discount    = Int32.Parse(discount);
            if (cbStatus.Checked)
            {
                newPromote.Status = true;
            }
            else
            {
                newPromote.Status = false;
            }
            BLLPromote.UpdatePromote(newPromote);
            Response.Redirect("PromoteList.aspx");
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int promoteId = Convert.ToInt32(Request.QueryString["PromoteID"].ToString());

        promote = BLLPromote.getPromoteByID(promoteId)[0];
        if (!Page.IsPostBack)
        {
            FillData();
        }
    }
Exemplo n.º 3
0
    protected void bntNext(object sender, EventArgs e)
    {
        if (MultiView1.ActiveViewIndex == 1)
        {
            MultiView1.ActiveViewIndex++;
        }
        else if (MultiView1.ActiveViewIndex == 2)
        {
            MultiView1.ActiveViewIndex++;
        }
        if (MultiView1.ActiveViewIndex == 3)
        {
            Promote   promote   = new Promote();
            string    age       = (MultiView1.Views[2].FindControl("tbBirthday") as TextBox).Text;
            int       age2      = tinhtuoi(age);
            int       idPromote = 0;
            ArrayList arrSeart  = (ArrayList)ViewState["CountSeat"];
            //kiem tra tuoi
            if (age2 <= 5)
            {
                idPromote = 1;
            }
            else if (5 < age2 & age2 <= 12)
            {
                idPromote = 2;
            }
            else if (12 < age2 & age2 <= 50)
            {
                idPromote = 3;
            }
            else if (50 < age2)
            {
                idPromote = 4;
            }
            ViewState["promoteID"] = idPromote;
            promote             = BLLPromote.getPromoteByID(idPromote);
            lbDiscount.Text     = promote.PromoteName.ToString();
            lbCustomer2.Text    = tbName.Text;
            lbPromotePrent.Text = promote.Discount.ToString();

            lbNumberSeat.Text = arrSeart.Count.ToString();
            int countTicket = int.Parse(lbNumberSeat.Text);

            string litPrice     = (MultiView1.Views[1].FindControl("lbPrice2") as Label).Text;
            float  price        = float.Parse(litPrice.ToString());
            int    discount     = int.Parse(lbPromotePrent.Text.ToString());
            float  discoutPrent = (price * discount * countTicket) / 100;
            ViewState["totalFare"] = price * countTicket;
            float total = price * countTicket - discoutPrent;
            //litPromote.Text = discoutPrent.ToString();
            lbTotalPrice.Text = total.ToString();
        }
    }
Exemplo n.º 4
0
    protected void LoadData()
    {
        DataTable dt = BLLPromote.getAllPromote();

        dv         = new DataView(dt);
        dv.Sort    = "PromoteID ASC";
        total.Text = dv.Count.ToString();
        gvPromoteList.DataSource = dv;
        gvPromoteList.DataBind();
        if (gvPromoteList.HeaderRow != null)
        {
            gvPromoteList.HeaderRow.TableSection = TableRowSection.TableHeader;
        }
    }
Exemplo n.º 5
0
    protected void lnkBtnSave_Click(object sender, EventArgs e)
    {
        string promoteName = PromoteName.Text;
        string discount    = Discount.Text;

        if (BLLPromote.checkPromoteExistName(promoteName) != 0)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Promote Name existed. Please try again');", true);
        }
        else
        {
            Promote promote = new Promote();
            promote.PromoteName = promoteName;
            promote.Discount    = Int32.Parse(discount);
            promote.Status      = true;
            BLLPromote.InsertPromote(promote);
            Response.Redirect("PromoteList.aspx");
        }
    }
Exemplo n.º 6
0
    protected void lnkDelete_Click(object sender, EventArgs e)
    {
        int test = 0;

        foreach (GridViewRow row in gvPromoteList.Rows)
        {
            CheckBox cb = (CheckBox)row.FindControl("chkSel");
            if (cb.Checked)
            {
                ++test;
                int id = int.Parse(row.Cells[1].Text);
                int k  = BLLPromote.DeletePromote(id);
            }
        }
        if (test == 0)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Please select a Promote from the list to delete');", true);
        }
        else
        {
            Response.Redirect("PromoteList.aspx");
        }
    }