protected void grdOrders_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); DataTable dt = new DataTable(); dt = OrdersService.Orders_GetById(strCA); switch (e.CommandName) { case "Edit": Id = strCA; DataTable dtOrderDetail = OrderDetailService.OrderDetail_GetByTop("", "OrderId=" + Id, ""); grdProducts.DataSource = dtOrderDetail; grdProducts.DataBind(); lblName.Text = dt.Rows[0]["Name"].ToString(); lblTel.Text = dt.Rows[0]["Tel"].ToString(); lblEmail.Text = dt.Rows[0]["Email"].ToString(); lblAddress.Text = dt.Rows[0]["Address"].ToString(); lblDetail.Text = dt.Rows[0]["Detail"].ToString(); PageHelper.LoadDropDownListStatusCart(drlStatus); txtDate.Text = DateTimeClass.ConvertDateTime(DateTime.Now, "MM/dd/yyyy HH:mm:ss"); pnView.Visible = false; pnUpdate.Visible = true; break; } }
protected void Update_Click(object sender, EventArgs e) { if (Page.IsValid) { Data.User obj = new Data.User(); obj.Id = Id; obj.Name = txtName.Text; obj.UserName = txtUsername.Text; obj.Password = txtPassword.Text; obj.Email = txtEmail.Text; obj.Phone = txtPhone.Text; obj.Date = DateTimeClass.ConvertDateTime(DateTime.Now.ToString(), "MM/dd/yy hh:mm:ss"); obj.Admin = chkAdmin.Checked ? "1" : "0"; obj.Active = "0"; if (Insert == true) { UserService.User_Insert(obj); } else { UserService.User_Update(obj); } BindGrid(); pnView.Visible = true; pnUpdate.Visible = false; Insert = false; } }
protected void grdNews_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); DataTable dt = new DataTable(); dt = NewsService.News_GetById(strCA); switch (e.CommandName) { case "Edit": Insert = false; Id = strCA; txtName.Text = dt.Rows[0]["Name"].ToString(); txtImage.Text = dt.Rows[0]["Image"].ToString(); imgImage.ImageUrl = dt.Rows[0]["Image"].ToString().Length > 0 ? dt.Rows[0]["Image"].ToString() : ""; //txtFile.Text = dt.Rows[0]["File"].ToString(); txtContent.Text = dt.Rows[0]["Content"].ToString(); fckDetail.Value = dt.Rows[0]["Detail"].ToString(); txtDate.Text = DateTimeClass.ConvertDateTime(dt.Rows[0]["Date"].ToString()); txtOrd.Text = dt.Rows[0]["Ord"].ToString(); chkActive.Checked = dt.Rows[0]["Active"].ToString() == "1" || dt.Rows[0]["Active"].ToString() == "True"; LoadGroupNewsDropDownList(); ddlGroupNews.Text = dt.Rows[0]["GroupNewsId"].ToString(); PageHelper.LoadDropNewsPriority(ddlPriority); ddlPriority.SelectedValue = dt.Rows[0]["Priority"].ToString(); chkIndex.Checked = dt.Rows[0]["Index"].ToString() == "1"; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; sql.ExecuteNonQuery("Update [News] set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(where); break; case "Delete": sql.ExecuteNonQuery("Delete CommentNews where NewsID='" + strCA + "'"); NewsService.News_Delete(strCA); BindGrid(where); break; case "Priority": string strPri = ""; strPri = dt.Rows[0]["Priority"].ToString() == "1" ? "0" : "1"; sql.ExecuteNonQuery("Update [News] set [Priority]=" + strPri + " Where Id='" + strCA + "'"); BindGrid(where); break; case "Index": string strIndex = ""; strIndex = dt.Rows[0]["Index"].ToString() == "1" ? "0" : "1"; sql.ExecuteNonQuery("Update [News] set [Index]=" + strIndex + " Where Id='" + strCA + "'"); BindGrid(where); break; } }
protected void AddButton_Click(object sender, EventArgs e) { ltrPass.Text = "Mật Khẩu"; ControlClass.ResetControlValues(this); txtDate.Text = DateTimeClass.ConvertDateTime(DateTime.Now, "MM/dd/yyyy"); pnUpdate.Visible = true; chkActive.Checked = true; pnView.Visible = false; }
protected void AddButton_Click(object sender, EventArgs e) { pnUpdate.Visible = true; ControlClass.ResetControlValues(this); LoadGroupNewsDropDownList(); PageHelper.LoadDropDownListLanguage(ddlLanguage); txtDate.Text = DateTimeClass.ConvertDateTime(DateTime.Now, "dd/MM/yyyy hh:mm:ss tt"); pnView.Visible = false; Insert = true; }
private void ChangeUser() { pnView.Visible = false; pnUpdate.Visible = true; txtPass.Visible = false; ddlAdmin.Enabled = false; txtId.Text = Request.Cookies["IdUser"].Value; List <Data.User> listE = UserBUS.User_GetById(txtId.Text); txtImage.Text = listE[0].Image; txtDate.Text = DateTimeClass.ConvertDateTime(listE[0].DateCreate, "MM/dd/yyyy"); txtName.Text = listE[0].Name; txtUsername.Text = listE[0].Username; ddlAdmin.SelectedValue = listE[0].Admin; chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True"; }
private void LoadInf() { string id = Request.QueryString["idS"].ToString(); var dt1 = new DataTable(); dt1 = BookingService.Booking_Sum(id); //int daco = Int32.Parse(dt1.Rows[0]["tickets"].ToString()); var dt = new DataTable(); dt = ShowTimesService.ShowTimes_GetById(id); lblNameCinema.Text = dt.Rows[0]["NameCi"].ToString(); Imagethumb.ImageUrl = dt.Rows[0]["PictureBig"].ToString(); lblAddress.Text = dt.Rows[0]["Address"].ToString(); lblFilm.Text = dt.Rows[0]["NameF"].ToString(); lblSeats.Text = dt.Rows[0]["Seats"].ToString() + " (total)"; //int tong = Int32.Parse(dt.Rows[0]["Seats"].ToString()); lblDuration.Text = dt.Rows[0]["Duration"].ToString() + " minutes"; lblShowtime.Text = DateTimeClass.ConvertDateTime(dt.Rows[0]["ShowTime"].ToString(), "dd/MM/yyyy"); lblTime.Text = DateTimeClass.ConvertTime(dt.Rows[0]["Time"].ToString()); lblPrice.Text = StringClass.FormatNumber(dt.Rows[0]["Price"].ToString()); double price = Convert.ToDouble(dt.Rows[0]["Price"].ToString()); double number = Convert.ToDouble(txtNumber.Text); string str = (price * number).ToString(); lblTotal.Text = StringClass.FormatNumber(str); //string str2 = (tong - daco).ToString(); //lblNumbertickets.Text = str2 + " (empty)"; lblNumbertickets.Text = dt1.Rows[0]["tickets"].ToString(); if (dt1.Rows[0]["tickets"].ToString() == dt.Rows[0]["Seats"].ToString()) { lblMessage.Text = "Not tickets"; txtNumber.ReadOnly = true; lblOrder.Enabled = false; } //if (dt1.Rows[0]["tickets"].ToString() == "") //{ // lblNumbertickets.Text = "0"; //} else { lblMessage.Text = ""; txtNumber.ReadOnly = false; lblOrder.Enabled = true; } }
protected void grdAdmin_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { string strCa = e.CommandArgument.ToString(); if (e.CommandName == "Edit") { DataTable dt = AdminService.Admin_GetById(strCa); txtId.Value = dt.Rows[0]["AdmId"].ToString(); txtUsername.Text = dt.Rows[0]["Username"].ToString(); txtFullName.Text = dt.Rows[0]["FullName"].ToString(); txtBod.Text = DateTimeClass.ConvertDateTime(dt.Rows[0]["Bod"].ToString(), "MM/dd/yyyy"); txtAddress.Text = dt.Rows[0]["Address"].ToString(); txtPhone.Text = dt.Rows[0]["Phone"].ToString(); txtEmail.Text = dt.Rows[0]["Email"].ToString(); pnUpdate.Visible = true; pnView.Visible = false; } }
protected void grdUser_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": txtPass.Text = ""; txtPass.Visible = false; List <Data.User> ListE = UserBUS.User_GetById(strCA); txtId.Text = strCA; txtImage.Text = ListE[0].Image.Length > 0 ? ListE[0].Image: ""; txtDate.Text = DateTimeClass.ConvertDateTime(ListE[0].DateCreate, "MM/dd/yyyy"); txtName.Text = ListE[0].Name; txtUsername.Text = ListE[0].Username; ddlAdmin.SelectedValue = ListE[0].Admin; chkActive.Checked = ListE[0].Active == "1" || ListE[0].Active == "True"; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; SqlDataProvider sql = new SqlDataProvider(); sql.ExecuteNonQuery("Update Users set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(); break; case "Delete": UserBUS.User_Delete(strCA); BindGrid(); break; case "Pass": Response.Redirect("/Admins/UpdatePass.aspx?Id=" + strCA + ""); BindGrid(); break; case "Role": break; } }
protected void grdNews_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); DataTable dt = new DataTable(); dt = NewsService.News_GetById(strCA); switch (e.CommandName) { case "Edit": Insert = false; Id = strCA; txtName.Text = dt.Rows[0]["Name"].ToString(); txtFile.Text = dt.Rows[0]["File"].ToString(); txtSoHieu.Text = dt.Rows[0]["Content"].ToString(); fckDetail.Value = dt.Rows[0]["Detail"].ToString(); txtDate.Text = DateTimeClass.ConvertDateTime(dt.Rows[0]["Date"].ToString()); txtPublic.Text = DateTimeClass.ConvertDateTime(dt.Rows[0]["LinkDemo"].ToString()); txtOrd.Text = dt.Rows[0]["Ord"].ToString(); chkActive.Checked = dt.Rows[0]["Active"].ToString() == "1" || dt.Rows[0]["Active"].ToString() == "True"; LoadGroupNewsDropDownList(); PageHelper.LoadDropDownListLanguage(ddlLanguage); ddlLanguage.SelectedValue = dt.Rows[0]["Language"].ToString(); ddlGroupNews.Text = dt.Rows[0]["GroupNewsId"].ToString(); pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; sql.ExecuteNonQuery("Update [News] set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(where); break; case "Delete": sql.ExecuteNonQuery("Delete CommentNews where NewsID='" + strCA + "'"); NewsService.News_Delete(strCA); BindGrid(where); break; } }
protected void btnSend_Click(object sender, EventArgs e) { Data.Contact obj = new Data.Contact(); obj.Name = txtHoTen.Text; obj.Company = txtAddress.Text; obj.Email = txtEmail.Text; obj.Phone = txtPhone.Text; obj.Website = string.Empty; obj.Title = txtTitle.Text; obj.Detail = txtDetail.Text; obj.Date = DateTimeClass.ConvertDateTime(DateTime.Now.ToLongDateString(), "MM/dd/yyyy HH:mm:ss"); obj.Language = "vi"; ContactService.Contact_Insert(obj); #region [SendMail] try { string strchuoi = "Họ tên: " + txtHoTen.Text.Trim() + "\n<br />"; strchuoi += "E-mail: " + txtEmail.Text.Trim() + "\n<br />"; strchuoi += "Điện thoại: " + txtPhone.Text.Trim() + "\n<br />"; strchuoi += "Địa chỉ: " + txtAddress.Text.Trim() + "\n<br />"; strchuoi += "Nội dung: " + txtDetail.Text.Trim() + "\n"; MailSender.SendMail("", "", txtTitle.Text.Trim(), strchuoi); WebMsgBox.Show("Bạn đã gửi thành công!"); } catch (Exception ex) { WebMsgBox.Show("Bạn đã gửi thất bại! Vui lòng thử lại lần nữa!"); } finally { txtTitle.Text = string.Empty; txtAddress.Text = string.Empty; txtHoTen.Text = string.Empty; txtEmail.Text = string.Empty; txtDetail.Text = string.Empty; txtPhone.Text = string.Empty; } #endregion }
protected void Update_Click(object sender, EventArgs e) { if (Page.IsValid) { Data.News obj = new Data.News(); obj.Id = Id; obj.Name = txtName.Text; obj.Image = txtImage.Text; obj.File = ""; obj.Content = txtContent.Text; obj.Detail = fckDetail.Value; obj.Date = DateTimeClass.ConvertDateTime(txtDate.Text, "MM/dd/yyyy HH:mm:ss"); obj.Index = "0"; obj.Ord = txtOrd.Text != "" ? txtOrd.Text : "1"; obj.Active = chkActive.Checked ? "1" : "0"; obj.Position = ddlPosition.SelectedValue; obj.GroupNewsId = ddlGroupNews.SelectedValue; obj.GroupTagNews = StringClass.NameToTag(ddlGroupNews.SelectedItem.Text); obj.Description = ""; obj.Keyword = ""; obj.Views = "0"; obj.LinkDemo = ""; obj.Language = ddlLanguage.SelectedValue; if (Insert == true) { NewsService.News_Insert(obj); } else { NewsService.News_Update(obj); } BindGrid(where); pnView.Visible = true; pnUpdate.Visible = false; Insert = false; } }
void load_DDH() { string tennguoidung = Session["nguoidung"].ToString(); string thongtinkh = "select * from Nguoi_Dung where Ten_Nguoi_Dung='" + tennguoidung + "'"; DataTable dt = XLDL.docbang(thongtinkh); int manguoidung = int.Parse(dt.Rows[0][0].ToString()); SqlConnection conn = new SqlConnection(DataProvider.ConnectionString); SqlCommand cmd = new SqlCommand("select * from Thue_Xe where userid = @Ma_KH and end_date <='" + DateTimeClass.ConvertDateTime(DateTime.Now, "MM/dd/yyyy HH:mm:ss tt") + "'", conn); cmd.Parameters.AddWithValue("@Ma_KH", manguoidung); SqlDataAdapter adapter; adapter = new SqlDataAdapter(cmd); // PHANLOAI = adapter.("PHAN_LOAI"); DataTable dt_TX_hethan = new DataTable(); adapter.Fill(dt_TX_hethan); adapter.Dispose(); gdvTX.DataSource = dt_TX_hethan; gdvTX.DataBind(); //load DDH chưa giao SqlCommand cmd1 = new SqlCommand("select * from Thue_Xe where userid = @Ma_KH1 and end_date >'" + DateTimeClass.ConvertDateTime(DateTime.Now, "MM/dd/yyyy HH:mm:ss tt") + "'", conn); cmd1.Parameters.AddWithValue("@Ma_KH1", manguoidung); SqlDataAdapter adapter2; adapter2 = new SqlDataAdapter(cmd1); // PHANLOAI = adapter.("PHAN_LOAI"); DataTable dt_TX_hientai = new DataTable(); adapter2.Fill(dt_TX_hientai); adapter2.Dispose(); gdvTX2.DataSource = dt_TX_hientai; gdvTX2.DataBind(); }
protected void btnDelivery_Click(object sender, EventArgs e) { try { if (Page.IsValid) { if (string.IsNullOrEmpty(fname.Value.Trim())) { lblName.Visible = true; fname.Focus(); return; } else { lblName.Visible = false; } if (string.IsNullOrEmpty(email.Value.Trim())) { lblEmail.Visible = true; email.Focus(); return; } else { lblEmail.Visible = false; } if (string.IsNullOrEmpty(adr.Value.Trim())) { lblTel.Visible = true; adr.Focus(); return; } else { lblTel.Visible = false; } if (string.IsNullOrEmpty(city.Value.Trim())) { lblAddress.Visible = true; city.Focus(); return; } else { lblAddress.Visible = false; } Hashtable htData = new Hashtable(); for (int i = 0; i < rptCart.Items.Count; i++) { RepeaterItem item = rptCart.Items[i]; TextBox txtquantity = (TextBox)item.FindControl("txtquantity"); DropDownList ddlSize = (DropDownList)item.FindControl("ddlSize"); HiddenField hfId = (HiddenField)item.FindControl("hfId"); htData.Add(hfId.Value.Trim(), txtquantity.Text.Trim() + "," + ddlSize.SelectedValue); } Orders order = new Orders(); order.Id = Id; order.Name = StringClass.SqlInjection(fname.Value.Trim()); order.Email = StringClass.SqlInjection(email.Value.Trim()); order.Tel = StringClass.SqlInjection(adr.Value.Trim()); order.Address = StringClass.SqlInjection(city.Value.Trim()); order.OrderId = orderId; order.OrderDate = DateTimeClass.ConvertDateTime(DateTime.Now, "dd/MM/yyyy HH:mm:ss"); if (rdoChuyenkhoan.Checked) { order.PaymentMethod = "0"; } else { order.PaymentMethod = "1"; } order.Price = totalPrice; order.Status = "1"; order.Detail = StringClass.SqlInjection(content.Value.Trim()); order.DeliveryDate = ""; OrdersService.PurchaseProduct(order, htData); lblMsg.Text = "Cảm ơn bạn đã mua sản phẩm của chúng tôi. Chúng tôi sẽ giao hàng trong thời gian sớm nhất."; shoppingcart.Visible = false; rptCart.Visible = false; } } catch (Exception ex) { MailSender.SendMail("", "", "Error System", ex.Message + "\n" + ex.StackTrace); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["nguoidung"] == null) { mtvThongTin.ActiveViewIndex = 1; //lblErr.Text = "Lỗi: Không tìm thấy thông tin người dùng."; } else//đã đăng nhập { mtvThongTin.ActiveViewIndex = 0; string tennguoidung = Session["nguoidung"].ToString(); string thongtinkh = "select * from Nguoi_Dung where Ten_Nguoi_Dung='" + tennguoidung + "'"; DataTable dt = XLDL.docbang(thongtinkh); int manguoidung = int.Parse(dt.Rows[0]["Ma_Nguoi_Dung"].ToString()); lblHoTen.Text = dt.Rows[0]["Ho_Ten"].ToString(); lblGioiTinh.Text = dt.Rows[0]["Gioi_Tinh"].ToString(); lblDiaChi.Text = dt.Rows[0]["Dia_Chi"].ToString(); lblCMND.Text = dt.Rows[0]["CMND"].ToString(); lblEmail.Text = dt.Rows[0]["Email"].ToString(); lblSDT.Text = dt.Rows[0]["SDT"].ToString(); int maxe = int.Parse(Request.QueryString["Ma_Xe"]); DateTime startdate = DateTime.Parse(Request.QueryString["startD"]); // Cần chuyển định dạng ngày tháng của biến startdate thành MM/dd/yyyy HH:mm:ss tt string ttphieuthue = " select * from Thue_Xe inner join Xe on Thue_Xe.carid = Xe.Ma_Xe where carid=" + maxe + " and start_date='" + DateTimeClass.ConvertDateTime(startdate, "MM/dd/yyyy HH:mm:ss tt") + "'"; DataTable dt2 = XLDL.docbang(ttphieuthue); try { // hien thi ten dia diem nhan xe thay vi hien ma dia diem string pick = dt2.Rows[0]["pick_location"].ToString(); string ttdiadiemnhanxe = " select * from Van_Phong where id=" + pick; DataTable dtpick = XLDL.docbang(ttdiadiemnhanxe); lblDiaDiemNhanXe.Text = dtpick.Rows[0]["Ten_VP"].ToString(); // hien thi dia diem tra xe string drop = dt2.Rows[0]["drop_location"].ToString(); string ttdiadiemtraxe = " select * from Van_Phong where id=" + drop; DataTable dtdrop = XLDL.docbang(ttdiadiemtraxe); lblDiaDiemTraXe.Text = dtdrop.Rows[0]["Ten_VP"].ToString(); lblMaPhieuThue.Text = dt2.Rows[0]["id"].ToString(); lblStartDate.Text = DateTimeClass.ConvertDateTime(dt2.Rows[0]["start_date"].ToString(), "dd/MM/yyyy HH:mm:ss"); lblEndDate.Text = DateTimeClass.ConvertDateTime(dt2.Rows[0]["end_date"].ToString(), "dd/MM/yyyy HH:mm:ss"); lblMaXe.Text = dt2.Rows[0]["carid"].ToString(); lblTenXe.Text = dt2.Rows[0]["Ten_xe"].ToString(); lblDonGia.Text = "$" + dt2.Rows[0]["Gia"].ToString() + "/ngày"; //Tính toán tổng thời gian thuê TimeSpan tgThue = new TimeSpan(); tgThue = DateTime.Parse(dt2.Rows[0]["end_date"].ToString()) - DateTime.Parse(dt2.Rows[0]["start_date"].ToString()); lblGioThue.Text = Math.Round(tgThue.TotalDays, 2).ToString() + " ngày " + "(" + tgThue.TotalHours.ToString() + " giờ)"; // Tính thành tiền: float thanhtien = float.Parse(dt2.Rows[0]["Gia"].ToString()) * float.Parse(Math.Round(tgThue.TotalDays, 2).ToString()); lblThanhTien.Text = "$" + Math.Round(thanhtien).ToString(); string str = "update Thue_Xe set thanh_tien='" + Math.Round(thanhtien).ToString() + "' where carid=" + maxe + " and start_date='" + DateTimeClass.ConvertDateTime(startdate, "MM/dd/yyyy HH:mm:ss tt") + "'"; XLDL.thuchienlenh(str); } catch { lblerr.Text = "Lỗi định dạng ngày tháng!"; lblerr.Visible = true; } } }
protected void grdCustomer_ItemCommand(object source, DataGridCommandEventArgs e) { try { string strCa = e.CommandArgument.ToString(); string strWhere = " 1=1 "; if (e.CommandName == "Edit") { _insert = false; txtUsername.ReadOnly = true; DataTable dt = CustomerService.Customer_GetById(strCa); txtId.Value = dt.Rows[0]["CusId"].ToString(); txtUsername.Text = dt.Rows[0]["Username"].ToString(); txtCreditCard.Text = dt.Rows[0]["CreditCard"].ToString(); txtFullName.Text = dt.Rows[0]["FullName"].ToString(); txtBod.Text = DateTimeClass.ConvertDateTime(dt.Rows[0]["Bod"].ToString(), "MM/dd/yyyy"); txtAddress.Text = dt.Rows[0]["Address"].ToString(); txtPhone.Text = dt.Rows[0]["Phone"].ToString(); txtAvata.Text = dt.Rows[0]["Avata"].ToString(); imgImage.ImageUrl = dt.Rows[0]["Avata"].ToString(); txtEmail.Text = dt.Rows[0]["Email"].ToString(); chkActive.Checked = dt.Rows[0]["Status"].ToString() == "1" || dt.Rows[0]["Status"].ToString() == "True"; pnUpdate.Visible = true; pnView.Visible = false; } if (e.CommandName == "Delete") { CustomerService.Customer_Delete(strCa); BindGrid(); } if (e.CommandName == "Status") { string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; CustomerService.Customer_Update_Status(strCa, strA); BindGrid(); } if (e.CommandName == "ascUsername") { if (Common.StringClass.Check(txtFilterName.Text)) { strWhere += " and FullName like N'%" + txtFilterName.Text + "%' "; } if (Common.StringClass.Check(ddlFilterActive.SelectedValue)) { strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' "; } grdCustomer.DataSource = CustomerService.Customer_GetByTop("", strWhere, "Username"); grdCustomer.DataBind(); if (grdCustomer.PageCount <= 1) { grdCustomer.PagerStyle.Visible = false; } } if (e.CommandName == "descUsername") { if (Common.StringClass.Check(txtFilterName.Text)) { strWhere += " and FullName like N'%" + txtFilterName.Text + "%' "; } if (Common.StringClass.Check(ddlFilterActive.SelectedValue)) { strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' "; } grdCustomer.DataSource = CustomerService.Customer_GetByTop("", strWhere, "Username desc"); grdCustomer.DataBind(); if (grdCustomer.PageCount <= 1) { grdCustomer.PagerStyle.Visible = false; } } if (e.CommandName == "ascFullName") { if (Common.StringClass.Check(txtFilterName.Text)) { strWhere += " and FullName like N'%" + txtFilterName.Text + "%' "; } if (Common.StringClass.Check(ddlFilterActive.SelectedValue)) { strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' "; } grdCustomer.DataSource = CustomerService.Customer_GetByTop("", strWhere, "FullName"); grdCustomer.DataBind(); if (grdCustomer.PageCount <= 1) { grdCustomer.PagerStyle.Visible = false; } } if (e.CommandName == "descFullName") { if (Common.StringClass.Check(txtFilterName.Text)) { strWhere += " and FullName like N'%" + txtFilterName.Text + "%' "; } if (Common.StringClass.Check(ddlFilterActive.SelectedValue)) { strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' "; } grdCustomer.DataSource = CustomerService.Customer_GetByTop("", strWhere, "FullName desc"); grdCustomer.DataBind(); if (grdCustomer.PageCount <= 1) { grdCustomer.PagerStyle.Visible = false; } } } catch (Exception ex) { WebMsgBox.Show(ex.Message); } }