Пример #1
0
        public void data()
        {
            DataInteraction odata = new DataInteraction();

            DataTable dt = odata.GetEmotionList();


            ddlMyHappinessImg.DataSource     = dt;
            ddlMyHappinessImg.DataTextField  = "Emotion";
            ddlMyHappinessImg.DataValueField = "ImgName";
            ddlMyHappinessImg.DataBind();

            ddlMyPlayImg.DataSource     = dt;
            ddlMyPlayImg.DataTextField  = "Emotion";
            ddlMyPlayImg.DataValueField = "ImgName";
            ddlMyPlayImg.DataBind();

            ddlTeamHappyImg.DataSource     = dt;
            ddlTeamHappyImg.DataTextField  = "Emotion";
            ddlTeamHappyImg.DataValueField = "ImgName";
            ddlTeamHappyImg.DataBind();

            ddlGameHappyImg.DataSource     = dt;
            ddlGameHappyImg.DataTextField  = "Emotion";
            ddlGameHappyImg.DataValueField = "ImgName";
            ddlGameHappyImg.DataBind();
        }
        //public DataTable GetDataForChart()
        //{
        //    DataTable _objdt = new DataTable();

        //    _objdt.Columns.Add("flag", typeof(string));
        //    _objdt.Columns.Add("name", typeof(string));

        //    _objdt.Columns.Add("LabelValue");
        //    var _objrow = _objdt.NewRow();
        //    _objrow["name"] = "India";
        //    _objrow["flag"] = "images/flag-of-India.png";

        //    _objdt.Rows.Add(_objrow);
        //    _objrow = _objdt.NewRow();
        //    _objrow["name"] = "Kuwait";
        //    _objrow["flag"] = "images/flag-of-Kuwait.png";
        //    _objdt.Rows.Add(_objrow);

        //    _objrow = _objdt.NewRow();
        //    _objrow["name"] = "Egypt";
        //    _objrow["flag"] = "images/flag-of-Egypt.png";
        //    _objdt.Rows.Add(_objrow);

        //    _objrow = _objdt.NewRow();
        //    _objrow["name"] = "Bangladesh";
        //    _objrow["flag"] = "images/flag-of-Bangladesh.png";
        //    _objdt.Rows.Add(_objrow);

        //    _objrow = _objdt.NewRow();
        //    _objrow["name"] = "Afghanistan";
        //    _objrow["flag"] = "images/flag-of-Afghanistan.png";
        //    _objdt.Rows.Add(_objrow);
        //    return _objdt;
        //}

        protected void btnSave_Click(object sender, EventArgs e)
        {
            FeedbackElement oFeed = new FeedbackElement();
            string          erMsg = validateFields();

            if (!string.IsNullOrEmpty(erMsg.Trim()))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", "alert('" + erMsg.Trim() + "');", true);


                // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Notify", "alert('Notification : '"+erMsg.Trim()+"');", true);
                // LblError.Text = erMsg.Trim();
                //divError.InnerText = erMsg.Trim();
                return;
            }
            else
            {
                oFeed.NAME = txtName.Text;

                oFeed.MY_HAPPINESS_EMOTION = ddlMyHappinessImg.SelectedItem.Text;
                oFeed.MY_HAPPINESS_IMGNAME = ddlMyHappinessImg.SelectedItem.Value;
                oFeed.MY_HAPPINESS_REMARK  = txtMyHappiness.Text;

                oFeed.MY_PLAY_EMOTION = ddlMyPlayImg.SelectedItem.Text;
                oFeed.MY_PLAY_IMGNAME = ddlMyPlayImg.SelectedItem.Value;
                oFeed.MY_PLAY_REMARK  = txtMyPlay.Text;

                oFeed.GAME_HAPPINESS_EMOTION = ddlGameHappyImg.SelectedItem.Text;
                oFeed.GAME_HAPPINESS_IMGNAME = ddlGameHappyImg.SelectedItem.Value;
                oFeed.GAME_HAPPINESS_REMARK  = txtGameHappiness.Text;


                oFeed.TEAM_HAPPINESS_EMOTION = ddlTeamHappyImg.SelectedItem.Text;
                oFeed.TEAM_HAPPINESS_IMGNAME = ddlTeamHappyImg.SelectedItem.Value;
                oFeed.TEAM_HAPPINESS_REMARK  = txtTeamHappiness.Text;
                DataInteraction odal   = new DataInteraction();
                int             result = odal.InsertFeedback(oFeed);
                if (result == 1)
                {
                    //  LblError.Text = "Thanks for yor feedback";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", "alert('Thanks for yor feedback');", true);

                    //  divError.InnerText = "Thanks for yor feedback";
                    btnSave.Enabled = false;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", "alert('Oops! Something went wrong.');", true);
                    //     LblError.Text = "  Oops! Something went wrong.";
                    //  divError.InnerText = "  Oops! Something went wrong.";
                    btnSave.Enabled = true;
                }
            }
        }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataInteraction oDal = new DataInteraction();
         DataTable       dt   = oDal.GetFeedbackDetail();
         ViewState["dt"] = dt;
         if (dt.Rows.Count > 0)
         {
             BindGrid(GvDetail);
         }
         else
         {
             GvDetail.EmptyDataText = "No Records Found";
         }
     }
 }