public int suggestion_DAL_insert(suggestionBO sbo) { try { s_querry = "insert into suggestion (suggestion_id,subject,userEmail,suggestion_msg,userName,date_time) values(@suggestion_id,@subject,@userEmail,@suggestion_msg,@userName,@date_time)"; if (con.State == ConnectionState.Closed) { con.Open(); } cmd = new SqlCommand(s_querry, con); cmd.Parameters.AddWithValue("@suggestion_id", sbo.suggestion_id); cmd.Parameters.AddWithValue("@userName", sbo.user_name); cmd.Parameters.AddWithValue("@suggestion_msg", sbo.suggestion_msg); cmd.Parameters.AddWithValue("@date_time", sbo.date_time); cmd.Parameters.AddWithValue("@userEmail", sbo.userEmail); cmd.Parameters.AddWithValue("@subject", sbo.subject); return(cmd.ExecuteNonQuery()); } catch (Exception) { throw; } finally { cmd.Dispose(); con.Close(); con.Dispose(); } }
//SENDING MAIL to admin protected void suggestion_btn_click(object sender, EventArgs e) { Next_ID nid = new Next_ID(); suggestionBO s_bo = new suggestionBO(); suggestionBAL s_bal = new suggestionBAL(); try { s_bo.suggestion_id = nid.incrementer("suggestion_id", "suggestion"); s_bo.user_name = getusername.UserNameFetch(Convert.ToInt32(Session["user_id"])); s_bo.userEmail = getusername.UserEmailFetch(Convert.ToInt32(Session["user_id"])); s_bo.subject = DDLEmailSubject.SelectedValue.ToString(); s_bo.suggestion_msg = writeEmail.Value; writeEmail.Value = ""; //Server.HtmlEncode(hid_Email_body.Value.ToString()); s_bo.date_time = Convert.ToDateTime(DateTime.Now.ToString()); if (s_bal.suggestion_DAL_insert(s_bo) > 0) { Response.Write("<script type='text/javascript'> window.onload=function(){document.getElementById('parent').style.display='block';}; </script>"); //Response.Redirect("~/UserProfile.aspx"); } } catch (Exception ex) { ErrorReportBAL error = new ErrorReportBAL(); error.SendErrorReport("UserProfileSuggestion.aspx", ex.ToString()); Response.Write("<script>alert('Some Error Occured \n Sorry for inconvenience');</script>"); } }
protected void send_feedBack(object sender, EventArgs e) { Next_ID nid = new Next_ID(); suggestionBAL sBal = new suggestionBAL(); suggestionBO sBO = new suggestionBO(); try { sBO.user_name = sugName.Value.Trim() + suglName.Value.Trim(); sBO.suggestion_id = nid.incrementer("suggestion_id", "suggestion"); sBO.suggestion_msg = comments.Value; sBO.date_time = Convert.ToDateTime(DateTime.Now.ToString()); sBO.userEmail = txtemail.Value; sBO.subject = ""; if (sBal.suggestion_DAL_insert(sBO) > 0) { Response.Write("<script>alert('Thansk for your valuable feedback ');</script>"); sugName.Value = ""; comments.Value = ""; txtemail.Value = ""; } } catch (Exception ex) { ErrorReportBAL error = new ErrorReportBAL(); error.SendErrorReport("ContachUs.aspx", ex.ToString()); Response.Write("<script>alert('An error occured \n Sorry for inconvenience ');</script>"); } }
//admin inbox function public void AdminMsgDelete(suggestionBO suggestionInfo) { try { if (newcon.State == ConnectionState.Closed) { newcon.Open(); } String query = "Delete from suggestion where suggestion_id = @bid"; command = new SqlCommand(query, newcon); command.Parameters.AddWithValue("@bid", suggestionInfo.suggestion_id); command.ExecuteNonQuery(); } catch { throw; } finally { if (newcon.State == ConnectionState.Open) { newcon.Close(); } } }
protected void send_feedBack(object sender, EventArgs e) { Next_ID nid = new Next_ID(); suggestionBAL sBal = new suggestionBAL(); suggestionBO sBO = new suggestionBO(); try { sBO.user_name = sugName.Value; sBO.suggestion_id = nid.incrementer("suggestion_id", "suggestion"); sBO.suggestion_msg = comments.Value; sBO.date_time = Convert.ToDateTime(DateTime.Now.ToString()); sBO.userEmail = txtemail.Value; if (sBal.suggestion_DAL_insert(sBO) > 0) { Response.Write("<script>alert('Thansk for your valuable feedback ');</script>"); sugName.Value = ""; comments.Value = ""; txtemail.Value = ""; } } catch (Exception) { Response.Write("<script>alert('Sorry for inconvenience ');</script>"); } }
public int suggestion_DAL_insert(suggestionBO sug_bo) { try { return(sug_dal.suggestion_DAL_insert(sug_bo)); } catch (Exception) { throw; } }
public void AdminMsgDelete(suggestionBO sugesstionInfo) { try { adminfunction.AdminMsgDelete(sugesstionInfo); } catch { throw; } }
public int suggestion_DAL_insert(suggestionBO sug_bo) { try { return sug_dal.suggestion_DAL_insert(sug_bo); } catch (Exception) { throw; } }
public suggestionBO AdminMsgViewer(int msg_id) { suggestionBO suggetionviewer = new suggestionBO(); try { if (newcon.State == ConnectionState.Closed) { newcon.Open(); } String query = "Select * from Suggestion where Suggestion_ID = @sid"; command = new SqlCommand(query, newcon); command.Parameters.AddWithValue("@sid", msg_id); reader = command.ExecuteReader(); if (reader.HasRows) { reader.Read(); { suggetionviewer.suggestion_id = Convert.ToInt32(reader[0]); suggetionviewer.suggestion_msg = reader[2].ToString(); suggetionviewer.date_time = Convert.ToDateTime(reader[3]); suggetionviewer.subject = reader[4].ToString(); suggetionviewer.user_name = reader[5].ToString(); } } else { suggetionviewer = null; } command.Dispose(); reader.Dispose(); msgChecked(msg_id); return(suggetionviewer); } catch { throw; } finally { if (newcon.State == ConnectionState.Open) { newcon.Close(); } } }
public int suggestion_DAL_del(suggestionBO sug_bo) { try { con.Open(); s_querry = "delete from suggestion where suggestion_id=@suggestion_id"; cmd = new SqlCommand(s_querry, con); cmd.Parameters.AddWithValue("@suggestion_id", sug_bo.suggestion_id); return(cmd.ExecuteNonQuery()); } catch { throw; } finally { cmd.Dispose(); con.Close(); con.Dispose(); } }
public int suggestion_DAL_del(suggestionBO sug_bo) { try { con.Open(); s_querry = "delete from suggestion where suggestion_id=@suggestion_id"; cmd = new SqlCommand(s_querry, con); cmd.Parameters.AddWithValue("@suggestion_id", sug_bo.suggestion_id); return cmd.ExecuteNonQuery(); } catch { throw; } finally { cmd.Dispose(); con.Close(); con.Dispose(); } }
protected void lbtnDelete_Click(object sender, CommandEventArgs e) { try { suggestionBO suggetionobj = new suggestionBO(); suggetionobj.suggestion_id = Convert.ToInt32(e.CommandArgument.ToString()); adminInboxFunctions.AdminMsgDelete(suggetionobj); Response.Redirect("~/admin/AdminInbox.aspx"); } catch (Exception ex) { Response.Write("error occured : " + ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin_id"] == null) { Response.Redirect("AdminLogin.aspx"); } else { if (!(Page.IsPostBack)) { if (Request.QueryString["id"] == null) { Response.Redirect("~/Admin/AdminInbox.aspx"); } else { try { msg = msgviewer.AdminMsgViewer(Convert.ToInt32(Request.QueryString["id"])); if (msg == null) { Response.Write("Sorry, But the Message is not present"); } else { div_blog_title.InnerText = "Subject " + msg.subject.ToString(); spn_timeOfPost.InnerText = Server.HtmlDecode((msg.date_time).ToLongDateString()); div_blog_body.InnerHtml = msg.suggestion_msg.ToString(); spn_posterName.InnerHtml = msg.user_name.ToString(); } } catch (Exception ex) { Response.Write("Error Ocured : " + ex.ToString()); } } } } }
public int suggestion_DAL_insert(suggestionBO sbo) { try { s_querry = "insert into suggestion values(@suggestion_id,@userName,@suggestion_msg,@date_time,@userEmail)"; if (con.State == ConnectionState.Closed) { con.Open(); } cmd = new SqlCommand(s_querry, con); cmd.Parameters.AddWithValue("@suggestion_id",sbo.suggestion_id); cmd.Parameters.AddWithValue("@userName", sbo.user_name); cmd.Parameters.AddWithValue("@suggestion_msg",sbo.suggestion_msg); cmd.Parameters.AddWithValue("@date_time",sbo.date_time); cmd.Parameters.AddWithValue("@userEmail", sbo.userEmail); return cmd.ExecuteNonQuery(); } catch (Exception) { throw; } finally { cmd.Dispose(); con.Close(); con.Dispose(); } }