//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; } } }
public int InsertFeedback(FeedbackElement oFeed) { string query = "INSERT INTO TBL_FEEDBACK(Feed_DATETIME,NAME, MY_HAPPINESS_Emoji, MY_HAPPINESS_IMG, MY_HAPPINESS_REMARK, MY_PLAY_Emoji, MY_PLAY_IMG, MY_PLAY_REMARK" + ", TEAM_HAPPINESS_Emoji, TEAM_HAPPINESS_IMG, TEAM_HAPPINESS_REMARK, GAME_HAPPINESS_Emoji, GAME_HAPPINESS_IMG, GAME_HAPPINESS_REMARK" + ", MYHAPPINESSPIC,MYPLAYPIC,GAMEHAPPINESSPIC,TEAMHAPPINESSPIC)" + " VALUES(Sysdatetime(),'" + oFeed.NAME + "', '" + oFeed.MY_HAPPINESS_EMOTION + "', '" + oFeed.MY_HAPPINESS_IMGNAME + "', '" + oFeed.MY_HAPPINESS_REMARK + "', '" + oFeed.MY_PLAY_EMOTION + "', '" + oFeed.MY_PLAY_IMGNAME + "', '" + oFeed.MY_PLAY_REMARK + "' " + ", '" + oFeed.TEAM_HAPPINESS_EMOTION + "', '" + oFeed.TEAM_HAPPINESS_IMGNAME + "', '" + oFeed.TEAM_HAPPINESS_REMARK + "', '" + oFeed.GAME_HAPPINESS_EMOTION + "', '" + oFeed.GAME_HAPPINESS_IMGNAME + "', '" + oFeed.GAME_HAPPINESS_REMARK + "'" + ", cast('" + oFeed.MyHappyIMG + "' as varbinary(max)), cast('" + oFeed.MyPlayIMG + "' as varbinary(max)) ,cast('" + oFeed.GameIMG + "' as varbinary(max)), cast('" + oFeed.TeamIMG + "' as varbinary(max)))"; int res = SqlHelper.ExecuteNonQuery(connetionString, CommandType.Text, query); return(res); }