コード例 #1
0
    protected void rpt_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        LinkButton lnkTime = (LinkButton)e.Item.FindControl("lnkTime");

        if (e.CommandName == "Select")
        {
            if (txt_date.Text != "")
            {
                st = "Select * from Appointment where date='" + txt_date.Text + "' and Time='" + lnkTime.Text + "' and DoctId=" + docid + " ";
                dr = db.readall(st);
                if (dr.Read())
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Already Appointment Taken ');", true);
                }
                else
                {
                    dr.Dispose();
                    st = "Insert into Appointment(PatientId,DoctId,date,Time) values (" + Session["Patient"] + "," + docid + " ,'" + txt_date.Text + "','" + lnkTime.Text + "')";

                    int x = db.ExeQuery(st);
                    if (x > 0)
                    {
                        //Response.Redirect("MyAppointmentStatus.aspx");
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Appointeted');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Try Again');", true);
                    }
                }
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// Page Load Event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            st         = "select top(1) image_url from tbl_themes where is_active = 1";
            background = db.read_val(st);

            if (Request.Cookies["tableNumber"] != null)
            {
                st = "select order_id,amount from tbl_orders where tableNumber=" + Request.Cookies["tableNumber"].Value + " and isClosed=0";

                SqlDataReader dr = db.readall(st);
                if (dr.Read())
                {
                    hf_orderid.Value     = dr[0].ToString();
                    lnk_cart.Text        = dr[1].ToString();
                    pnl_neworder.Visible = false;
                    pnl_page.Visible     = true;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel3, UpdatePanel3.GetType(), "", "$('#processing-modal').modal('show');", true);
                    pnl_neworder.Visible = true;
                    pnl_page.Visible     = false;
                }
                pnl_table.Visible = false;
                dr.Close();
            }
            else
            {
                pnl_page.Visible     = false;
                pnl_table.Visible    = true;
                btn_neworder.Visible = false;
            }
            st = "select category_id,category_name from tbl_category where is_active=1";
            db.fill_rptr_ret_sqlda(st, rpt_category);

            st = "SELECT [Combo_id],[title],[description],[price],[combo_picture] FROM [dbo].[tbl_combos]";
            db.fill_rptr_ret_sqlda(st, rpt_combos);

            st = @"SELECT tbl_player.song_id,tbl_songs.song_name,tbl_songs.song_url,case is_playing when 1 then 'playing' else '' end as is_playing,
                case when is_requested =1 or is_playing = 1 then 'display:none' else '' end as is_requested
                from tbl_player inner join tbl_songs on tbl_player.song_id = tbl_songs.song_id where is_played = 0 and is_played=0 order by order_number,requested_time";
            db.fill_rptr_ret_sqlda(st, rpt_playlist);
        }
    }