public void BindData() { string act = Request["act"]; string sql = "SELECT * FROM tbl_User WHERE 1=1 "; if (SessionUtil.GetValue("RoleID") != "WebAdmin,") { sql += " AND User_ID=" + SessionUtil.GetValue("UserID"); } if (pbID != 0) { sql += " AND User_ID in (Select User_ID from tbl_User where User_Role=" + pbID + ")"; } if (act == "search") { string key = Request["key"]; sql += " AND User_Name LIKE N'%" + key + "%' OR Username LIKE N'%" + key + "%'"; } sql += " ORDER BY User_Date DESC"; //Response.Write(SessionUtil.GetValue("RoleID")+sql); DataSet dsData = UpdateData.UpdateBySql(sql); Session["dsData"] = dsData; gvData.DataSource = dsData; string[] arrKey01 = { "User_ID" }; gvData.DataKeyNames = arrKey01; gvData.DataBind(); }
protected string LoadRequestTravel() { if (SessionUtil.GetValue("UserID") == "") { return(""); } StringBuilder str = new StringBuilder(); int memID = int.Parse(SessionUtil.GetValue("UserID")); string sql = "SELECT Diemdi, Diemden FROM tbl_User m join User_NhaXe un on m.User_ID=un.UserID join Nhaxe nx on nx.ID=un.NhaxeId join Xe xe on xe.Nhaxe=nx.ID join ChuyenXe cx on cx.MaXe=xe.MaXe WHERE m.User_ID=" + memID; DataTable dt = UpdateData.UpdateBySql(sql).Tables[0]; DataRowCollection rows = dt.Rows; foreach (DataRow item in rows) { string diemdi = item["Diemdi"].ToString(); string diemden = item["Diemden"].ToString(); var rq = new RequestRepository().SearchFor(o => o.From.Contains(diemdi) || diemdi.Contains(o.From) && diemden.Contains(o.To) || o.To.Contains(diemden)).ToList(); var i = 1; foreach (var item2 in rq) { str.Append("<tr>"); str.Append("<td>" + i + "</td>"); str.Append("<td>" + diemdi + "</td>"); str.Append("<td>" + diemden + "</td>"); str.Append("<td>" + item2.Sdt + "</td>"); str.Append("<td>" + item2.StartDate.Value.ToString("dd/MM/yyyy") + "</td>"); str.Append("<td>" + item2.StartTime.Value.ToString("hh:mm") + "</td>"); str.Append("<td>" + item2.More + "</td>"); str.Append("</tr>"); i++; } } return(str.ToString()); }
public static string getAllOrderBySql() { //string sql = "select * from tbl_Order o, ChuyenXe cx, Xe x, NhaXe nx where o.MaChuyenXe = cx.MaChuyenXe and cx.MaXe = x.MaXe and x.Nhaxe = nx.ID"; //DataTable dt = UpdateData.UpdateBySql(sql).Tables[0]; DataTable dt = UpdateData.ExecStore("SP_GetOrderByNhaxe", SessionUtil.GetValue("UserID")).Tables[0]; return(JsonConvert.SerializeObject(dt)); }
protected DataTable NhaXe() { if (SessionUtil.GetValue("UserID") != "") { return(UpdateData.ExecStore("SP_CCB_NHAXE", SessionUtil.GetValue("UserID")).Tables[0]); } else { return(new DataTable()); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserID"] == null) { Response.Write("<b style='color: red'>Bạn chưa đăng nhập</b>"); return; } if (!IsPostBack) { string machuyenxe = Request.QueryString["id"]; if (!string.IsNullOrEmpty(machuyenxe)) { ddlNhaxe.Visible = false; lbNhaxe.Visible = false; lbTitle.Text = "Cập nhật thông tin chuyến xe"; DataTable dtXe = UpdateData.ExecStore("SP_CCB_XE", SessionUtil.GetValue("UserID")).Tables[0]; DataTable dtNhaXe = UpdateData.ExecStore("SP_CCB_NHAXE", SessionUtil.GetValue("UserID")).Tables[0]; DataTable dtTinh = UpdateData.ExecStore("SP_CCB_Tinh", "").Tables[0]; Value.BindToDropdown(ddlXe, dtXe); Value.BindToDropdown(ddlNhaxe, dtNhaXe); Value.BindToDropdown(ddlDenTinh, dtTinh); Value.BindToDropdown(ddlDiTinh, dtTinh); ChuyenXe cx = new ChuyenXeRepository().Find(int.Parse(machuyenxe)); txtGiaThuong.Text = cx.GiaThuong.ToString(); txtGiaVip.Text = cx.GiaVIP.ToString(); txtGiodi.Text = cx.Giokhoihanh.Value.ToString("hh:mm:ss"); txtKhuyenMai.Text = cx.KhuyenMai.ToString(); txtLotrinh.Text = cx.LoTrinh; txtNgaydi.Text = cx.Ngaydi.Value.ToString("yyyy-MM-dd"); txtThoigiandiG.Text = cx.Thoigiandukien.Value.ToString("hh"); txtThoigiandiP.Text = cx.Thoigiandukien.Value.ToString("mm"); txtVethuong.Text = cx.TongSoVeThuong.ToString(); txtVeVip.Text = cx.TongSoVeVIP.ToString(); for (int i = 0; i < ddlDiTinh.Items.Count; i++) { if (cx.DiTinh.ToString() == ddlDiTinh.Items[i].Value) { ddlDiTinh.Items[i].Selected = true; DataTable dtDiHuyen = UpdateData.ExecStore("SP_CCB_Huyen_FROM_Tinh", cx.DiTinh.ToString()).Tables[0]; Value.BindToDropdown(ddlDiHuyen, dtDiHuyen); if (ddlDiHuyen.Items.Count > 0) { for (int j = 0; j < ddlDiHuyen.Items.Count; j++) { if (cx.DiHuyen.ToString() == ddlDiHuyen.Items[j].Value) { ddlDiHuyen.Items[j].Selected = true; } } } } } for (int i = 0; i < ddlXe.Items.Count; i++) { if (cx.MaXe.ToString() == ddlXe.Items[i].Value) { ddlXe.Items[i].Selected = true; } } for (int i = 0; i < status.Items.Count; i++) { if (cx.TrangThai.ToString() == status.Items[i].Value) { status.Items[i].Selected = true; } } for (int i = 0; i < ddlDenTinh.Items.Count; i++) { if (cx.DenTinh.ToString() == ddlDenTinh.Items[i].Value) { ddlDenTinh.Items[i].Selected = true; DataTable dtDenHuyen = UpdateData.ExecStore("SP_CCB_Huyen_FROM_Tinh", cx.DenTinh.ToString()).Tables[0]; Value.BindToDropdown(ddlDenHuyen, dtDenHuyen); for (int j = 0; j < ddlDenHuyen.Items.Count; j++) { if (cx.DenHuyen.ToString() == ddlDenHuyen.Items[j].Value) { ddlDenHuyen.Items[j].Selected = true; } } } } } else { lbTitle.Text = "Thêm mới chuyến xe"; DataTable dtXe = UpdateData.ExecStore("SP_CCB_XE", SessionUtil.GetValue("UserID")).Tables[0]; DataTable dtTinh = UpdateData.ExecStore("SP_CCB_Tinh", "").Tables[0]; DataTable dtNhaXe = UpdateData.ExecStore("SP_CCB_NHAXE", SessionUtil.GetValue("UserID")).Tables[0]; Value.BindToDropdown(ddlXe, dtXe); Value.BindToDropdown(ddlDenTinh, dtTinh); Value.BindToDropdown(ddlNhaxe, dtNhaXe); Value.BindToDropdown(ddlDiTinh, dtTinh); DataTable dtDiHuyen = UpdateData.ExecStore("SP_CCB_Huyen_FROM_Tinh", ddlDiTinh.SelectedValue).Tables[0]; Value.BindToDropdown(ddlDiHuyen, dtDiHuyen); DataTable dtDenHuyen = UpdateData.ExecStore("SP_CCB_Huyen_FROM_Tinh", ddlDenTinh.SelectedValue).Tables[0]; Value.BindToDropdown(ddlDenHuyen, dtDenHuyen); } } }
protected void btnCheckIn_Click(object sender, EventArgs e) { string mave = txtMaVe.Text; if (string.IsNullOrEmpty(mave)) { Value.ShowMessage(ltrError, string.Format(ErrorMessage.Required, "Mã vé"), "danger"); return; } else { if (Session["UserID"] != null) { string sql = "SP_CHECKINTICKET"; DataRowCollection rows = UpdateData.ExecStore(sql, SessionUtil.GetValue("UserID") + ",'" + mave + "'").Tables[0].Rows; if (rows.Count > 0) { bool isTimeout = rows[0]["isTimeOut"].ToString() == "1"?true:false; if (isTimeout) { Value.ShowMessage(ltrError, string.Format(ErrorMessage.TimeOut, "Mã vé"), "danger"); displayDetail = "displaynone"; } else { bool isDone = rows[0]["isDone"].ToString() == "1" ? true : false; if (isDone) { Value.ShowMessage(ltrError, string.Format(ErrorMessage.TimeOut, "Mã vé"), "danger"); displayDetail = "displaynone"; } else { Hashtable tb = new Hashtable(); tb.Add("isDone", "1"); bool update = UpdateData.Update("tbl_OrderDetail", tb, "Mave='" + mave + "'"); if (update) { Value.ShowMessage(ltrError, string.Format(ErrorMessage.Success, "Kiểm tra vé"), AlertType.SUCCESS); displayDetail = ""; this.mave = mave; this.loaive = rows[0]["Type"].ToString() == "TH" ? "Thường" : "VIP"; nguoimua = rows[0]["Order_Ten"].ToString() == null ? rows[0]["Member_Name"].ToString() : rows[0]["Order_Ten"].ToString(); sdt = rows[0]["Order_Tel"].ToString() == null ? rows[0]["Member_Phone"].ToString() : rows[0]["Order_Tel"].ToString(); email = rows[0]["Order_Email"].ToString() == null ? rows[0]["Member_Email"].ToString() : rows[0]["Order_Email"].ToString(); email = rows[0]["Order_Address"].ToString() == null ? rows[0]["Member_Address"].ToString() : rows[0]["Order_Address"].ToString(); ngaymua = DateTime.Parse(rows[0]["Order_CreatedDate"].ToString()).ToString("dd/MM/yyyy"); giave = double.Parse(rows[0]["UnitPrice"].ToString()).ToString("N0"); diemdi = rows[0]["Diemdi"].ToString(); diemden = rows[0]["Diemden"].ToString(); giodi = DateTime.Parse(rows[0]["Giokhoihanh"].ToString()).ToString("hh:mm"); ngaydi = DateTime.Parse(rows[0]["Ngaydi"].ToString()).ToString("dd/MM/yyyy"); method = rows[0]["Name"].ToString(); } else { Value.ShowMessage(ltrError, ErrorMessage.UnknowError, AlertType.ERROR); displayDetail = ""; } } } } else { Value.ShowMessage(ltrError, string.Format(ErrorMessage.NotFound, "Mã vé"), "danger"); displayDetail = "displaynone"; } } else { Value.ShowMessage(ltrError, ErrorMessage.Unauthorized, "danger"); displayDetail = "displaynone"; } } }
public static string SELECTALLCHUYENXE() { var obj = SMAC.UpdateData.ExecStore("SP_ViewChuyenXe", SessionUtil.GetValue("UserID")).Tables[0]; return(JsonConvert.SerializeObject(obj)); }
public static string GetAllXe() { return(JsonConvert.SerializeObject(UpdateData.ExecStore("SP_GetAllXe", SessionUtil.GetValue("UserID")).Tables[0])); }