protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["username"] != null) { sUserName = Request.Cookies["username"].Value; sUserName = System.Web.HttpUtility.UrlDecode(sUserName); } try { string sLoginType = "1"; if (Request.Cookies["logintype"] != null) { sLoginType = Request.Cookies["logintype"].Value; } object sUserID = Session["userid"]; if (sUserID == null) { Response.Write(BllCommon.Transferlocation()); return; } string sGroups = "0"; if (!IsPostBack) { //获取车组 if (sLoginType == "1") { DataSet ds = BllVehicle.GetVehGroupFromLogin(Convert.ToInt32(sUserID)); List <CVehGroup> lstVehGroup = new List <CVehGroup>(); Hashtable htGroupPID = new Hashtable(); Hashtable htGroupID = new Hashtable(); if (ds != null && ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { if (sUserID != "1") { sGroups = sGroups + "," + dr["VehGroupID"].ToString(); } string id = "G" + dr["VehGroupID"]; string PID = "G" + dr["fVehGroupID"]; if (!htGroupPID.ContainsKey(PID)) { htGroupPID.Add(PID, id); } if (!htGroupID.ContainsKey(id)) { htGroupID.Add(id, PID); } } foreach (DataRow dr in ds.Tables[0].Rows) { CVehGroup vehGroup = new CVehGroup(); vehGroup.id = "G" + dr["VehGroupID"]; vehGroup.name = dr["VehGroupName"].ToString(); vehGroup.PID = "G" + dr["fVehGroupID"]; vehGroup.HasChild = 0; vehGroup.Root = 0; if (htGroupPID.ContainsKey(vehGroup.id)) { vehGroup.HasChild = 1; } if (!htGroupID.ContainsKey(vehGroup.PID)) { vehGroup.Root = 1; } lstVehGroup.Add(vehGroup); } } string json5 = JsonHelper.SerializeObject(lstVehGroup); //ViewState["VehGroup"] = json5; sVehGroup = json5; } else { List <CVehGroup> lstVehGroup = new List <CVehGroup>(); CVehGroup vehGroup = new CVehGroup(); vehGroup.id = "G0"; vehGroup.name = "我的车辆"; vehGroup.PID = "G-1"; vehGroup.HasChild = 0; vehGroup.Root = 1; lstVehGroup.Add(vehGroup); string json5 = JsonHelper.SerializeObject(lstVehGroup); //ViewState["VehGroup"] = json5; sVehGroup = json5; } //if (Request.Cookies["VehGroup"] == null) //{ // AddCookie("VehGroup", json5); //} //else //{ // ModifyCookie("VehGroup", json5); //} if (sLoginType == "1") { if (sUserID.ToString() == "1") { } else { DataSet dsPermission = BllSql.RunSqlSelect("select FuncID from UserPermission where UserID = " + sUserID.ToString()); if (dsPermission != null && dsPermission.Tables.Count > 0 && dsPermission.Tables[0].Rows.Count > 0) { sPermission = dsPermission.Tables[0].Rows[0][0].ToString(); } } } else { sPermission = "5006"; } List <COil> lstOil = new List <COil>(); if (sLoginType == "1") { DataSet dsOil = null; if (sUserID.ToString() == "1") { dsOil = BllSql.RunSqlSelect("SELECT Vehyh_Table.r_id, Vehyh_Table.VehID, Vehyh_Table.Veh_Cph, Vehyh_Table.YH_Scale, Vehyh_Table.YH_Number, Vehyh_Table.oilminu, Vehyh_Table.oilpercent FROM Vehyh_Table INNER JOIN VehicleDetail ON Vehyh_Table.VehID = VehicleDetail.VehID"); } else { dsOil = BllSql.RunSqlSelect("SELECT Vehyh_Table.r_id, Vehyh_Table.VehID, Vehyh_Table.Veh_Cph, Vehyh_Table.YH_Scale, Vehyh_Table.YH_Number, Vehyh_Table.oilminu, Vehyh_Table.oilpercent FROM Vehyh_Table INNER JOIN VehicleDetail ON Vehyh_Table.VehID = VehicleDetail.VehID where VehicleDetail.VehGroupID in(" + sGroups + ")"); } if (dsOil != null && dsOil.Tables.Count > 0 && dsOil.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsOil.Tables[0].Rows) { string sVeh = "V" + dr["VehID"].ToString(); COil cOil = new COil(); foreach (COil item in lstOil) { if (item.VehID == sVeh) { cOil = item; break; } } cOil.Cph = dr["Veh_Cph"].ToString(); cOil.id = Convert.ToInt32(dr["r_id"]); COilDetail cDetail = new COilDetail(); cDetail.OilValue = Convert.ToDouble(dr["YH_Number"]); cDetail.Scale = Convert.ToDouble(dr["YH_Scale"]); cOil.lstDetail.Add(cDetail); cOil.StealOil = Convert.ToInt32(dr["oilpercent"]); cOil.VehID = "V" + dr["VehID"].ToString(); lstOil.Add(cOil); } } } else { DataSet dsOil = BllSql.RunSqlSelect("SELECT Vehyh_Table.r_id, Vehyh_Table.VehID, Vehyh_Table.Veh_Cph, Vehyh_Table.YH_Scale, Vehyh_Table.YH_Number, Vehyh_Table.oilminu, Vehyh_Table.oilpercent FROM Vehyh_Table INNER JOIN VehicleDetail ON Vehyh_Table.VehID = VehicleDetail.VehID where Vehyh_Table.VehID =" + sUserID); if (dsOil != null && dsOil.Tables.Count > 0 && dsOil.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsOil.Tables[0].Rows) { string sVeh = "V" + dr["VehID"].ToString(); COil cOil = new COil(); foreach (COil item in lstOil) { if (item.VehID == sVeh) { cOil = item; break; } } cOil.Cph = dr["Veh_Cph"].ToString(); cOil.id = Convert.ToInt32(dr["r_id"]); COilDetail cDetail = new COilDetail(); cDetail.OilValue = Convert.ToDouble(dr["YH_Number"]); cDetail.Scale = Convert.ToDouble(dr["YH_Scale"]); cOil.lstDetail.Add(cDetail); cOil.StealOil = Convert.ToInt32(dr["oilpercent"]); cOil.VehID = "V" + dr["VehID"].ToString(); lstOil.Add(cOil); } } } string jsonOil = JsonHelper.SerializeObject(lstOil); sOil = jsonOil; } } catch (Exception Exception) { } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["username"] != null) { sUserName = Request.Cookies["username"].Value; sUserName = System.Web.HttpUtility.UrlDecode(sUserName); } try { string sLoginType = "1"; if (Request.Cookies["logintype"] != null) { sLoginType = Request.Cookies["logintype"].Value; } object sUserID = Session["userid"]; if (sUserID == null) { Response.Write(BllCommon.Transferlocation()); return; } string sGroups = "0"; if (!IsPostBack) { //获取车组 if (sLoginType == "1") { DataSet ds = BllVehicle.GetVehGroupFromLogin(Convert.ToInt32(sUserID)); List <CVehGroup> lstVehGroup = new List <CVehGroup>(); Hashtable htGroupPID = new Hashtable(); Hashtable htGroupID = new Hashtable(); if (ds != null && ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { string id = "G" + dr["VehGroupID"]; string PID = "G" + dr["fVehGroupID"]; if (!htGroupPID.ContainsKey(PID)) { htGroupPID.Add(PID, id); } if (!htGroupID.ContainsKey(id)) { htGroupID.Add(id, PID); } } foreach (DataRow dr in ds.Tables[0].Rows) { CVehGroup vehGroup = new CVehGroup(); vehGroup.id = "G" + dr["VehGroupID"]; vehGroup.name = dr["VehGroupName"].ToString(); vehGroup.PID = "G" + dr["fVehGroupID"]; vehGroup.HasChild = 0; vehGroup.Root = 0; if (htGroupPID.ContainsKey(vehGroup.id)) { vehGroup.HasChild = 1; } if (!htGroupID.ContainsKey(vehGroup.PID)) { vehGroup.Root = 1; } lstVehGroup.Add(vehGroup); } } string json5 = JsonHelper.SerializeObject(lstVehGroup); //ViewState["VehGroup"] = json5; sVehGroup = json5; } else { List <CVehGroup> lstVehGroup = new List <CVehGroup>(); CVehGroup vehGroup = new CVehGroup(); vehGroup.id = "G0"; vehGroup.name = "我的车辆"; vehGroup.PID = "G-1"; vehGroup.HasChild = 0; vehGroup.Root = 1; lstVehGroup.Add(vehGroup); string json5 = JsonHelper.SerializeObject(lstVehGroup); //ViewState["VehGroup"] = json5; sVehGroup = json5; } //if (Request.Cookies["VehGroup"] == null) //{ // AddCookie("VehGroup", json5); //} //else //{ // ModifyCookie("VehGroup", json5); //} if (sLoginType == "1") { if (sUserID.ToString() == "1") { } else { DataSet dsPermission = BllSql.RunSqlSelect("select FuncID from UserPermission where UserID = " + sUserID.ToString()); if (dsPermission != null && dsPermission.Tables.Count > 0 && dsPermission.Tables[0].Rows.Count > 0) { sPermission = dsPermission.Tables[0].Rows[0][0].ToString(); } } } else { sPermission = "5006"; } } } catch (Exception Exception) { } }
protected void Page_Load(object sender, EventArgs e) { //http://localhost:12358/TF_WebH5/login.aspx?rUser=d3lz&rPwd=d3lz if (Request.Cookies["m_username"] != null) { sUserName = Request.Cookies["m_username"].Value; sUserName = System.Web.HttpUtility.UrlDecode(sUserName); } try { string sLoginType = "1"; if (Request.Cookies["m_logintype"] != null) { sLoginType = Request.Cookies["m_logintype"].Value; } object sUserID = Session["m_userid"]; if (sUserID == null) { Response.Write(BllCommon.Transferlocation()); return; } if (!IsPostBack) { //获取车组 if (sLoginType == "1") { DataSet ds = BllVehicle.GetVehGroupFromLogin(Convert.ToInt32(sUserID)); List <CVehGroup> lstVehGroup = new List <CVehGroup>(); Hashtable htGroupPID = new Hashtable(); Hashtable htGroupID = new Hashtable(); if (ds != null && ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { string id = "G" + dr["VehGroupID"]; string PID = "G" + dr["fVehGroupID"]; if (!htGroupPID.ContainsKey(PID)) { htGroupPID.Add(PID, id); } if (!htGroupID.ContainsKey(id)) { htGroupID.Add(id, PID); } } foreach (DataRow dr in ds.Tables[0].Rows) { CVehGroup vehGroup = new CVehGroup(); vehGroup.id = "G" + dr["VehGroupID"]; vehGroup.name = dr["VehGroupName"].ToString(); vehGroup.PID = "G" + dr["fVehGroupID"]; vehGroup.HasChild = 0; vehGroup.Root = 0; if (htGroupPID.ContainsKey(vehGroup.id)) { vehGroup.HasChild = 1; } if (!htGroupID.ContainsKey(vehGroup.PID)) { vehGroup.Root = 1; } lstVehGroup.Add(vehGroup); } } string json5 = JsonHelper.SerializeObject(lstVehGroup); sVehGroup = json5; //获取用户信息 int iGroupID = -1; DataSet dsUserGroup = BllVehicle.GetUserGroupFromLogin(Convert.ToInt32(sUserID)); if (dsUserGroup == null || dsUserGroup.Tables.Count == 0 || dsUserGroup.Tables[0].Rows.Count == 0) { CUserGroup cModel = new CUserGroup(); cModel.HasChild = 0; cModel.id = "U_User"; cModel.name = "用户管理"; cModel.PID = ""; cModel.Root = 1; List <CUserGroup> lstUserGroup = new List <CUserGroup>(); lstUserGroup.Add(cModel); string jsonUserGroup = JsonHelper.SerializeObject(lstUserGroup); sUserGroup = jsonUserGroup; } else { List <CUserGroup> lstUserGroup = new List <CUserGroup>(); CUserGroup cModel = new CUserGroup(); cModel.HasChild = 0; cModel.id = "M_User"; cModel.name = "用户管理"; cModel.PID = ""; cModel.Root = 1; lstUserGroup.Add(cModel); foreach (DataRow dr in dsUserGroup.Tables[0].Rows) { cModel = new CUserGroup(); cModel.HasChild = 0; iGroupID = Convert.ToInt32(dr["UserGroupID"]); cModel.id = "U" + dr["UserGroupID"].ToString(); cModel.name = dr["UserGroupName"].ToString(); cModel.PID = "M_User"; cModel.Root = 1; lstUserGroup.Add(cModel); } string jsonUserGroup = JsonHelper.SerializeObject(lstUserGroup); sUserGroup = jsonUserGroup; } //获取用户 DataSet dsUser = BllVehicle.GetUserFromLogin(Convert.ToInt32(sUserID), iGroupID); if (dsUser == null || dsUser.Tables.Count == 0 || dsUser.Tables[0].Rows.Count == 0) { List <CUser> lstUser = new List <CUser>(); string jsonUser = JsonHelper.SerializeObject(lstUser); sUser = jsonUser; } else { List <CUser> lstUser = new List <CUser>(); foreach (DataRow dr in dsUser.Tables[0].Rows) { if (sUserID.Equals(dr["UserID"].ToString())) { sUserType = dr["UserTypeID"].ToString(); break; } } foreach (DataRow dr in dsUser.Tables[0].Rows) { if (sUserType == "1" || sUserID.Equals(dr["UserID"].ToString())) { CUser cModel = new CUser(); cModel.HasChild = 0; cModel.id = "R" + dr["UserID"].ToString(); cModel.name = dr["UserName"].ToString(); cModel.PID = "U" + dr["UserGroupID"].ToString(); lstUser.Add(cModel); } } string jsonUser = JsonHelper.SerializeObject(lstUser); sUser = jsonUser; } } else { List <CVehGroup> lstVehGroup = new List <CVehGroup>(); CVehGroup vehGroup = new CVehGroup(); vehGroup.id = "G0"; vehGroup.name = "我的车辆"; vehGroup.PID = "G-1"; vehGroup.HasChild = 0; vehGroup.Root = 1; lstVehGroup.Add(vehGroup); string json5 = JsonHelper.SerializeObject(lstVehGroup); sVehGroup = json5; } } } catch (Exception Exception) { } }