protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; hlThoat.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "ADMIN", "mid/" + ModuleId); bool isAdmin = (UserInfo.IsInRole("admin") || UserInfo.IsInRole("LCD_Admin") || UserInfo.IsInRole("GiaoDichVien")); if (!isAdmin) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId)); try { string sql = "EXEC ChungNT.Feedback_ID @ID"; SqlParameter[] para = new SqlParameter[1]; para[0] = new SqlParameter("@ID", Request["ID"]); zClass ob = new zClass(); DataSet ds = ob.bindDataset(sql, para); lbHeadline.Text = string.Format("{0} : {1}", ds.Tables[0].Rows[0]["CreatedByName"].ToString(), ds.Tables[0].Rows[0]["Subject"].ToString()); lbID.Text = ds.Tables[0].Rows[0]["FeedbackID"].ToString(); lbHoTen.Text = ds.Tables[0].Rows[0]["CreatedByName"].ToString(); lbDiaChi.Text = ds.Tables[0].Rows[0]["DiaChi"].ToString(); lbDienThoai.Text = ds.Tables[0].Rows[0]["DienThoai"].ToString(); lbEmail.Text = ds.Tables[0].Rows[0]["CreatedByEmail"].ToString(); lbTieuDe.Text = ds.Tables[0].Rows[0]["Subject"].ToString(); lbNoiDung.Text = ds.Tables[0].Rows[0]["Message"].ToString(); lbThoiGian.Text = ds.Tables[0].Rows[0]["DateCreated"].ToString(); lbReplyID.Text = ds.Tables[0].Rows[0]["R_ID"].ToString(); tbHoTen.Text = ds.Tables[0].Rows[0]["R_Name"].ToString(); tbTieuDe.Text = ds.Tables[0].Rows[0]["R_Subject"].ToString(); tbNoiDung.Text = ds.Tables[0].Rows[0]["R_Message"].ToString(); } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; } }
protected void btGuiDi_Click(object sender, EventArgs e) { try { string sql = "EXEC ChungNT.Feedback_Update 0, @PortalID, @CategoryID, @CreatedByName, @CreatedByEmail, @Subject, @Message, 0, @DiaChi, @DienThoai"; SqlParameter[] para = new SqlParameter[8]; para[0] = new SqlParameter("@PortalID", ddDienLuc.SelectedValue); para[1] = new SqlParameter("@CategoryID", ModuleId); para[2] = new SqlParameter("@CreatedByName", tbHoTen.Text); para[3] = new SqlParameter("@CreatedByEmail", tbEmail.Text); para[4] = new SqlParameter("@Subject", tbTieuDe.Text); para[5] = new SqlParameter("@Message", tbNoiDung.Text); para[6] = new SqlParameter("@DiaChi", tbDiaChi.Text); para[7] = new SqlParameter("@DienThoai", tbDienThoai.Text); zClass ob = new zClass(); DataSet ds = ob.bindDataset(sql, para); if (ds.Tables[0].Rows[0][0].ToString() == "1") { btGuiDi.Enabled = false; lbError.Text = "Trả lời thành công. Câu hỏi đã được hiển thị."; } else lbError.Text = "Không thể trả lời."; } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; hlThoat.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId); try { string sql = "EXEC ChungNT.Feedback_DonVi @moduleID, 0"; SqlParameter[] para = new SqlParameter[1]; para[0] = new SqlParameter("@moduleID", ModuleId); zClass ob = new zClass(); DataSet ds = ob.bindDataset(sql, para); ddDienLuc.DataSource = ds.Tables[0]; ddDienLuc.DataBind(); lbTieuDe.Text = ds.Tables[1].Rows[0][0].ToString(); } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; hlThoat.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId); bool isAdmin = (UserInfo.IsInRole("admin") || UserInfo.IsInRole("LCD_Admin") || UserInfo.IsInRole("GiaoDichVien")); if (!isAdmin) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId)); try { string sql = "EXEC ChungNT.Feedback_DonVi @moduleID, 1"; SqlParameter[] para = new SqlParameter[1]; para[0] = new SqlParameter("@moduleID", ModuleId); zClass ob = new zClass(); DataSet ds = ob.bindDataset(sql, para); dlDonVi.DataSource = ds.Tables[0]; dlDonVi.DataBind(); dlChucNang.DataSource = ds.Tables[1]; dlChucNang.DataBind(); load_data(); } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; } }
protected void btTraLoi_Click(object sender, EventArgs e) { try { string sql = "EXEC ChungNT.Feedback_Update @ID, 0, @CategoryID, @CreatedByName, '', @Subject, @Message, @ApprovedBy, '', ''"; SqlParameter[] para = new SqlParameter[6]; para[0] = new SqlParameter("@ID", lbReplyID.Text); para[1] = new SqlParameter("@CategoryID", ModuleId); para[2] = new SqlParameter("@CreatedByName", tbHoTen.Text); para[3] = new SqlParameter("@Subject", tbTieuDe.Text); para[4] = new SqlParameter("@Message", tbNoiDung.Text); para[5] = new SqlParameter("@ApprovedBy", lbID.Text); zClass ob = new zClass(); DataSet ds = ob.bindDataset(sql, para); if (ds.Tables[0].Rows[0][0].ToString() == "1") { btTraLoi.Enabled = false; lbError.Text = "Trả lời thành công. Câu hỏi đã được hiển thị."; } else lbError.Text = "Không thể trả lời."; } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; } }
private void load_data() { try { SqlParameter[] para = new SqlParameter[1]; SqlParameter temp = new SqlParameter("@ID", lbID.Text); para[0] = temp; zClass ob = new zClass(); string sql = "EXEC ChungNT.Feedback_ID @ID"; DataSet ds = ob.bindDataset(sql, para); //DataSet ds = ob.zSelect("EXEC ChungNT.Feedback_ID " + lbID.Text); lbID.Text = ds.Tables[0].Rows[0][0].ToString(); tbHoTen.Text = ds.Tables[0].Rows[0][1].ToString(); tbEmail.Text = ds.Tables[0].Rows[0][2].ToString(); tbTieuDe.Text = ds.Tables[0].Rows[0][4].ToString(); tbNoiDung.Text = ds.Tables[0].Rows[0][5].ToString(); lbR_ID.Text = ds.Tables[0].Rows[0][6].ToString(); tbR_HoTen.Text = ds.Tables[0].Rows[0][7].ToString(); tbR_TieuDe.Text = ds.Tables[0].Rows[0][8].ToString(); tbR_NoiDung.Text = ds.Tables[0].Rows[0][9].ToString(); tbDiaChi.Text = ds.Tables[0].Rows[0][11].ToString(); tbDienThoai.Text = ds.Tables[0].Rows[0][12].ToString(); try { ddDienLuc.SelectedValue = ds.Tables[0].Rows[0][10].ToString(); } catch { } } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; lbID.Text = "0"; lbR_ID.Text = "0"; } }
protected void btGuiDi_Click(object sender, EventArgs e) { try { SqlParameter[] para = new SqlParameter[9]; SqlParameter temp = new SqlParameter("@ID", lbID.Text); para[0] = temp; temp = new SqlParameter("@PortalID", ddDienLuc.SelectedValue); para[1] = temp; temp = new SqlParameter("@CategoryID", ModuleId); para[2] = temp; temp = new SqlParameter("@CreatedByName", tbHoTen.Text); para[3] = temp; temp = new SqlParameter("@CreatedByEmail", tbEmail.Text); para[4] = temp; temp = new SqlParameter("@Subject", tbTieuDe.Text); para[5] = temp; temp = new SqlParameter("@Message", tbNoiDung.Text); para[6] = temp; temp = new SqlParameter("@DiaChi", tbDiaChi.Text); para[7] = temp; temp = new SqlParameter("@DienThoai", tbDienThoai.Text); para[8] = temp; zClass ob = new zClass(); string sql = "EXEC ChungNT.Feedback_Update @ID, @PortalID, @CategoryID, @CreatedByName, @CreatedByEmail, @Subject, @Message, 0, @DiaChi, @DienThoai"; DataSet ds = ob.bindDataset(sql, para); //string hoTen = ob.reWrite(tbHoTen.Text); //string email = ob.reWrite(tbEmail.Text); //string tieuDe = ob.reWrite(tbTieuDe.Text); //string noiDung = ob.reWrite(tbNoiDung.Text); //string diaChi = ob.reWrite(tbDiaChi.Text); //string dienThoai = ob.reWrite(tbDienThoai.Text); //string cmd = string.Format("EXEC ChungNT.Feedback_Update {0}, {5}, '{6}', N'{1}', '{2}', N'{3}', N'{4}', 0, N'{7}', '{8}'", // lbID.Text, hoTen, email, tieuDe, noiDung, ddDienLuc.SelectedValue, ModuleId, diaChi, dienThoai); //DataSet ds = ob.zSelect(cmd); if (ds.Tables[0].Rows[0][0].ToString() == "1") lbError.Text = "Nội dung của bạn đã được gửi đi. Chúng tôi sẽ trả lời trong thời gian sớm nhất."; else lbError.Text = "Nội dung chưa được gửi đi."; } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; } }