Ejemplo n.º 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.lblErrorMessage.Text.Length != 0)
            {
                this.lblErrorMessage.Text = "";
            }

            BoothInfoDTO dto = populate();

            Facade       facade       = Facade.GetInstance();
            IBoothInfoBL oBoothInfoBL = facade.createBoothInfoBL();
            oBoothInfoBL.addNewBoothRecord(dto);

            this.lblErrorMessage.Text = "Data Save Successfully.";

            this.ddlBranchName.SelectedValue = "";
            this.txtHideFieldPK.Value        = "";
            this.txtCashLimit.Text           = "";
            this.chkBoothStatus.Checked      = true;
            this.btnSave.Text = "Save";
            this.GridView1.DataBind();
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }
    }
Ejemplo n.º 2
0
    protected void btnBoothReg_Click(object sender, EventArgs e)
    {
        int permanentDay = 0;
        int demoDay      = 0;
        int ExpiresDate  = 0;

        if ((chkPermanent.Checked == false) && (chkDemo.Checked == false))
        {
            this.lblErrorMessage.Text = "You must be select Registration Type!";
            return;
        }
        if ((chkPermanent.Checked == true) && (chkDemo.Checked == true))
        {
            this.lblErrorMessage.Text = "You must be select one registration Type!";
            return;
        }
        if ((chkPermanent.Checked == true) && (chkDemo.Checked == false))
        {
            permanentDay = 356;
        }
        if ((chkPermanent.Checked == false) && (chkDemo.Checked == true))
        {
            if (this.txtBoothExpiresDate.Text == "")
            {
                return;
            }
            demoDay = int.Parse(this.txtBoothExpiresDate.Text);
        }
        if (this.lblErrorMessage.Text.Length != 0)
        {
            this.lblErrorMessage.Text = "";
        }


        BoothInfoDTO dto = populate();

        Facade       facade       = Facade.GetInstance();
        IBoothInfoBL oBoothInfoBL = facade.createBoothInfoBL();

        oBoothInfoBL.addNewBoothRecord(dto);


        // Get values in text field
        string boothNo = this.ddlBoothNo.SelectedValue;

        if (permanentDay != 0)
        {
            ExpiresDate = permanentDay;
        }
        else
        {
            ExpiresDate = demoDay;
        }



        DateTime dt = DateTime.Now;
        TimeSpan ts = new TimeSpan(0, ExpiresDate, 0, 0);

        //Create a custome coookies
        HttpCookie myCookie = new HttpCookie("DPOS");

        //Keep data in cookies
        //myCookie["BoothNo"] = "ONE";
        myCookie["BoothNo"] = boothNo;
        myCookie.Expires    = dt.Add(ts);
        Response.Cookies.Add(myCookie);


        this.lblErrorMessage.Text     = "Booth Registration Successfully.";
        this.ddlBoothNo.SelectedValue = "";
        //this.pnlDay.Visible = false;
        this.txtHideFieldPK.Value = "";
        this.chkPermanent.Checked = false;
        this.chkDemo.Checked      = false;
    }