private void GetData() { try { DataTable dt = null; if (!String.IsNullOrEmpty(Request.QueryString["servicetype"])) { string serviceType = Request.QueryString["servicetype"].ToString(); if (serviceType == "lophoc") { dt = objConnect.GetTableWithCommandText("select * from tblEventComment where CUSTOMEREVENT = " + Request.QueryString["Id"] + " AND STATUS <>3 AND SERVICETYPE='" + serviceType + "' order by ID desc"); } else { dt = objConnect.GetTableWithCommandText("select * from tblEventComment where CUSTOMER_ID = " + Request.QueryString["Id"] + " AND STATUS <>3 AND SERVICETYPE='" + serviceType + "' order by ID desc"); } } else { dt = objConnect.GetTableWithCommandText("select * from tblEventComment where CUSTOMER_ID = '" + Request.QueryString["Id"] + "' AND STATUS <>3 order by ID desc"); } rptData.DataSource = dt; rptData.DataBind(); } catch { } }
protected void btnSubmit_Click(object sender, EventArgs e) { DataTable dbUse = objConnect.GetTableWithCommandText("select ADMIN_ID from tblAdministrators WHERE USERNAME='******'"); if (dbUse.Rows.Count > 0) { string rollID = dbUse.Rows[0]["ADMIN_ID"].ToString(); bool ktHoiDap = objConnect.ExcutedCMD("update tblHoiDap set ANSWER=N'" + txtContent.Text + "', ADMIN_ANSWER='" + Session["username"].ToString() + "', STATUS=1 where ID=" + id); DataTable db = objConnect.GetTableWithCommandText("select * from tblEmailTemplate where EMAILID=2"); string content = db.Rows[0]["CONTENT"].ToString(); string title = db.Rows[0]["DESCRIPTION"].ToString(); string email = txtEmail.Text.Trim(); content = content.Replace("$1", name); content = content.Replace("$2", txtContent.Text); bool kt = objMail.SendMail(email, title, content); //bool kt = objMail.SendMail(email, title, content); if (kt == true) { objAsk.UpdateStatus(id); string str = "<script type='text/javascript'>"; str += "function OnRemove(){self.parent.tb_remove();}OnRemove();"; str += "</script>"; Response.Write(str); } } else { Response.Redirect("Login.aspx"); } }
public string getHTMlLink(object Name, object Email) { DataTable _cus = objConnect.GetTableWithCommandText("select CUSTOMER_ID from tblCustomers where EMAIL=N'" + Email + "'"); if (_cus.Rows.Count > 0) { return("<a href='DetailCustomer.aspx?CUSTOMER_ID=" + _cus.Rows[0]["CUSTOMER_ID"] + "'>" + Name + "</a>"); } else { return(Name.ToString()); } }
void loadData() { DataTable db = cnts.GetTableWithCommandText("Select * From tblTestimonial order by CREATED_DATE desc"); rptData.DataSource = db; rptData.DataBind(); }
void loadTags() { string _htmlClass = ""; DataTable dbTags = objTags.GetAllTags(); //Lấy list tag_id của thành viên. string listTags = ""; string[] sp_list = { }; if (!String.IsNullOrEmpty(Request.QueryString["ID"])) { DataTable dbListTags = cnts.GetTableWithCommandText("select * From tblNewsTags where News_ID=" + Request.QueryString["ID"]); if (dbListTags.Rows.Count > 0) { listTags = dbListTags.Rows[0]["TAG_ID"].ToString(); sp_list = listTags.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } } foreach (DataRow item in dbTags.Rows) { string _name = item["Name"].ToString(); string _id = item["ID"].ToString(); //Kiểm tra xem kH đã check tags nào chưa? string checkeds = ""; if (_id != "") { foreach (var arrID in sp_list) { if (Convert.ToInt32(_id) == Convert.ToInt32(arrID)) { checkeds = "checked='checked'"; break; } } _htmlClass += "<div class='inputtypeNewTags' style='padding: 10px;float:left; border-bottom: 1px solid #ddd;font-size:12px;'><input " + checkeds + " style='clear:left;margin-right:5px;' type='checkbox' value='" + _id + "'/> <strong>" + _name + "</strong></div>"; } } ltTags.Text = _htmlClass; }
void loadData() { DataTable db = cnts.GetTableWithCommandText("Select * from tblPicture order by ID desc"); CollectionPager1.DataSource = db.DefaultView; CollectionPager1.BindToControl = rptData; CollectionPager1.PageSize = 30; CollectionPager1.MaxPages = 10000; rptData.DataSource = CollectionPager1.DataSourcePaged; rptData.DataBind(); }
void loadData() { DataTable db = cnts.GetTableWithCommandText("select * from tblVideo"); CollectionPager1.DataSource = db.DefaultView; CollectionPager1.MaxPages = 10000000; CollectionPager1.PageSize = 30; CollectionPager1.BindToControl = rptData; rptData.DataSource = CollectionPager1.DataSource; rptData.DataBind(); }
void CheckRole() { string userName = Session["username"].ToString(); DataTable dbRole = cnts.GetTableWithCommandText("select * from tblAdministrators A join tblRole R ON A.ROLL = R.ROLEID where username='******'"); int roleID = 3; if (dbRole.Rows.Count > 0) { roleID = Convert.ToInt32(dbRole.Rows[0]["ROLEID"].ToString()); } Session["Role"] = roleID; }
public static int CheckRole(string username) { ConnectSQL cnts = new ConnectSQL(); int roleID = 3; DataTable dbRole = cnts.GetTableWithCommandText("select * from tblAdministrators A join tblRole R ON A.ROLL = R.ROLEID where username='******'"); if (dbRole.Rows.Count > 0) { roleID = Convert.ToInt32(dbRole.Rows[0]["ROLEID"].ToString()); } return(roleID); }
void bind() { DataTable dt = objConnect.GetTableWithCommandText("select * from tblRole where ROLEID = " + Request.QueryString["id"].ToString()); if (dt.Rows.Count > 0) { txtTitle.Text = dt.Rows[0]["ROLENAME"].ToString(); if (dt.Rows[0]["STATUS"].ToString() == "1") { chkStatus.Checked = true; } } }
private void GetData() { try { id = Int32.Parse(Request.QueryString["id"].ToString()).ToString(); DataTable dtAsk = objConnect.GetTableWithCommandText("select * From tblLienHe where ID=" + id); Repeater1.DataSource = dtAsk; Repeater1.DataBind(); } catch { } }
protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView dr = (DataRowView)e.Item.DataItem; Literal lblText = (Literal)e.Item.FindControl("litText"); DataTable dt3 = cnts.GetTableWithCommandText("select top 1 * from tblEventComment where CUSTOMER_ID = " + dr["ID"] + " order by ID desc"); string text = ""; if (dt3.Rows.Count > 0) { text = dt3.Rows[0]["CONTENT"].ToString(); } //lblText.Text = "<input placeholder='Nhập và kết thúc bằng enter' style='width:200px;' class='viewcomment' type='text' id='txt" + dr["ID"] + "' value='" + text + "' valID='" + dr["ID"] + "'/>"; lblText.Text = "<textarea id='txt" + dr["ID"] + "' class='viewcomment' valid='" + dr["ID"] + "' type='text' style='width:500px;height:50px;float:left;word-wrap:break-word;' placeholder='Mời bạn comment. Kết thúc bằng Enter.'>" + text + "</textarea>"; }
void checkTreeNode(string role) { DataTable dtRoleFunction = objConnect.GetTableWithCommandText("select * from tblRoleFunction where isActive = 1 and ROLEID = " + role); if (dtRoleFunction.Rows.Count > 0) { foreach (DataRow dr in dtRoleFunction.Rows) { string fid = dr["FUNCTIONID"].ToString(); for (int i = 0; i < trvFunction.Nodes.Count; i++) { TreeNodeSelected(trvFunction.Nodes[i], fid); } } } }
void bind() { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { DataTable dt = objConnect.GetTableWithCommandText("select * from tblFunctions where FunctionID = " + Request.QueryString["id"].ToString()); if (dt.Rows.Count > 0) { txtFunctionName.Text = dt.Rows[0]["FunctionName"].ToString(); txtIndex.Text = dt.Rows[0]["Indexes"].ToString(); txtUrl.Text = dt.Rows[0]["Url"].ToString(); ddlParent.SelectedValue = dt.Rows[0]["ParentID"].ToString(); if (dt.Rows[0]["isDisplay"].ToString() == "True") { chkDisplay.Checked = true; } } } }
public DataTable getSchool() { return(cnts.GetTableWithCommandText("SELECT TOP 8 * FROM tblSchool where Status=1 order by NEWID()")); }
public DataTable LoadRoot() { DataTable dt = objCon.GetTableWithCommandText("select * from tblFunctions where ParentID = 0 order by Indexes"); return(dt); }
public DataTable getPhoto() { return(cnts.GetTableWithCommandText("select * from tblPhotoView where PICTURE_ID=" + Request.QueryString["ID"].ToString() + " order by CREATED_DATE ASC")); }
protected void btnSend_Click(object sender, EventArgs e) { string fullname = txtFullName.Text.Trim(); string email = txtEmail.Text.Trim(); string phone = txtPhoneNumber.Text.Trim(); string address = txtDiaChi.Text; string content = txtNoiDung.Value.Trim(); int _customerID = 0; //kiểm tra xem email đã tồn tài trong hệ thống hay chưa DataTable dbCheckEmail = objCus.GetDataByEmail(email); if (dbCheckEmail.Rows.Count > 0) { _customerID = Convert.ToInt32(dbCheckEmail.Rows[0]["ID"].ToString()); } else { _customerID = objCus.Insert(fullname, email, phone, DateTime.Now, 0, address, "", DateTime.Now, 0); } if (_customerID > 0) { if (txtCapcha.Text.Trim().ToLower().Equals(Session["Capcha"].ToString().ToLower())) { int a = objLienHe.Insert(_customerID, content, DateTime.Now, 0); if (a > 0) { string rec = ""; DataTable dtRec = cnts.GetTableWithCommandText("select * from tblMailReceiver where STATUS = 1"); if (dtRec.Rows.Count > 0) { foreach (DataRow dr in dtRec.Rows) { rec += dr["EMAIL"].ToString() + ";"; } } else { rec = "[email protected];"; } DataTable db = cnts.GetTableWithCommandText("select * from tblEmailTemplate where EMAILID=1"); string contentSend = db.Rows[0]["CONTENT"].ToString(); contentSend = contentSend.Replace("$1", fullname); contentSend = contentSend.Replace("$2", email); contentSend = contentSend.Replace("$3", phone); contentSend = contentSend.Replace("$4", content); string[] _listEmail = rec.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < _listEmail.Length; i++) { objMail.SendMail(_listEmail[i], db.Rows[0]["DESCRIPTION"].ToString(), contentSend); } string str = "<script type='text/javascript'>"; str += "function OnRemove(){alert('Cảm ơn bạn đã đặt câu hỏi. Chúng tôi sẽ trả lời trong vòng 3 ngày làm việc!');self.parent.tb_remove();}OnRemove();"; str += "</script>"; Response.Write(str); } } else { labCaptcha.Text = "Nhập sai mã."; imgCapcha.ImageUrl = "../capcha.aspx"; } } else { string str = "<script type='text/javascript'>"; str += "function OnRemove(){self.parent.tb_remove();}OnRemove();"; str += "</script>"; Response.Write(str); } }