コード例 #1
0
    public static DataSet GetUserGroupFromLogin(int iUserID)
    {
        string strSQL       = "";
        string strGroupList = "";

        try
        {
            if (iUserID == 1)
            {
                strSQL = "SELECT UserGroupID,UserGroupName "
                         + " FROM UserGroupMain where UserGroupName != '车辆登录专用' and DelFlag = 0";
            }
            else
            {
                strSQL = "SELECT UserGroupMain.UserGroupID,UserGroupMain.UserGroupName "
                         + " FROM UserGroupMain inner JOIN "
                         + "      UserGroupDetail ON "
                         + "            UserGroupMain.UserGroupID = UserGroupDetail.UserGroupID "
                         + "WHERE UserGroupDetail.UserID = " + iUserID.ToString() + " and UserGroupName != '车辆登录专用' and DelFlag = 0 ";
            }

            DataSet ds = BllSql.RunSqlSelect(strSQL);
            return(ds);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
コード例 #2
0
 protected void btnLoginCS_Click(object sender, EventArgs e)
 {
     if (Request.Cookies["m_userid"] != null)
     {
         string sUserName = Request.Cookies["m_username"].Value;
         string sPwd      = Request.Cookies["m_pwd"].Value;
         if (string.IsNullOrEmpty(sUserName) || string.IsNullOrEmpty(sPwd))
         {
             Response.Redirect("Login.aspx?err=4012", true);
             return;
         }
         if (!SqlFilter.Filter.ProcessFilter(ref sUserName) || !SqlFilter.Filter.ProcessFilter(ref sPwd))
         {
             Response.Redirect("Login.aspx?err=4002", true);
             return;
         }
         int iType = BllSql.RunSqlScalar("select UserTypeID from usermain where username = '******' and Password='******'");
         if (iType == 3)
         {
             Response.Redirect("Login.aspx?err=4015", true);
             return;
         }
         Session["m_userid"] = Request.Cookies["m_userid"].Value;
         Response.Redirect("MngIndex.aspx", true);
     }
 }
コード例 #3
0
    public static DataSet GetUserFromLogin(int iUserID, int iGroupID)
    {
        string strSQL       = "";
        string strGroupList = "";

        try
        {
            if (iUserID == 1)
            {
                strSQL = "SELECT UserMain.UserID,UserMain.UserName,UserGroupDetail.UserGroupID,UserMain.UserTypeID "
                         + " FROM UserMain inner join UserGroupDetail on UserGroupDetail.UserID = UserMain.UserID where DelPurview = 0";
            }
            else
            {
                strSQL = "SELECT UserMain.UserID,UserMain.UserName,UserGroupDetail.UserGroupID,UserMain.UserTypeID "
                         + " FROM UserMain inner join UserGroupDetail on UserGroupDetail.UserID = UserMain.UserID where UserMain.UserID > 1 and DelPurview = 0 and UserGroupDetail.UserGroupID = " + iGroupID.ToString();
            }

            DataSet ds = BllSql.RunSqlSelect(strSQL);
            return(ds);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
コード例 #4
0
    public static int GetVehicleUsage(int iUserID, string sDbName, ref string strGroupList)
    {
        string strSQL = "";

        try
        {
            if (iUserID == 1)
            {
                strSQL = "SELECT count(1) from " + sDbName + ".dbo.VehOnline  ";
            }
            else
            {
                //取所有列表ID
                //If sVersion = "SZHZ" Then
                //    strGroupList = GetAllVehGroupByGroup_UserID(adoConn, iUserID, sUserName)
                if (strGroupList == "-1")
                {
                    strGroupList = GetAllVehGroupByUserID(iUserID);
                    if (strGroupList.Trim().Length == 0)
                    {
                        strGroupList = "0";
                    }
                }
                strSQL = "SELECT count(1) from VehicleDetail INNER JOIN " + sDbName + ".dbo.VehOnline as a ON VehicleDetail.VehID = a.VehID where VehicleDetail.VehGroupID in (" + strGroupList + ") ";
            }

            int iCount = BllSql.RunSqlScalar(strSQL);
            return(iCount);
        }
        catch (Exception ex)
        {
            return(0);
        }
    }
コード例 #5
0
    public static DataSet GetVehicleProvice(int iUserID)
    {
        string strSQL       = "";
        string strGroupList = "";

        try
        {
            string sTime = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd HH:mm:ss");
            if (iUserID == 1)
            {
                strSQL = "SELECT VehID,Province,City from VehProvince where [Date] >= '" + sTime + "' ";
            }
            else
            {
                //取所有列表ID
                strGroupList = GetAllVehGroupByUserID(iUserID);

                if (strGroupList.Trim().Length == 0)
                {
                    strGroupList = "0";
                }

                strSQL = "SELECT VehProvince.VehID,Province,City from VehProvince INNER JOIN VehicleDetail ON VehProvince.VehId = VehicleDetail.VehID where  [Date] >= '" + sTime + "' and VehicleDetail.VehGroupID in (" + strGroupList + ") ";
            }

            DataSet ds = BllSql.RunSqlSelect(strSQL);
            return(ds);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
コード例 #6
0
ファイル: BllCommon.cs プロジェクト: pentiumCM/GPS
    public static bool IsUserLogin(string sUserName, string sPwd, out int iUserID, out string sErr)
    {
        iUserID = -1;
        sErr    = "";
        System.Collections.Generic.List <Models.CSqlParameters> lstPar = new System.Collections.Generic.List <Models.CSqlParameters>();
        Models.CSqlParameters par = new Models.CSqlParameters();
        par.iLen       = sUserName.Length * 2;
        par.pDirection = System.Data.ParameterDirection.Input;
        par.sName      = "UserName";
        par.sqlDbType  = System.Data.SqlDbType.NVarChar;
        par.sValue     = sUserName;
        lstPar.Add(par);

        par            = new Models.CSqlParameters();
        par.iLen       = sPwd.Length * 2;
        par.pDirection = System.Data.ParameterDirection.Input;
        par.sName      = "Password";
        par.sqlDbType  = System.Data.SqlDbType.NVarChar;
        par.sValue     = sPwd;
        lstPar.Add(par);
        string sSql = "select ExpirationTime,UserID from usermain where username = @UserName and password = @Password and DelPurview = 0 ";

        System.Data.DataSet ds = BllSql.RunSqlSelectParameters(false, sSql, lstPar, out sErr);
        if (sErr.Length > 0)
        {
            return(false);
        }
        else
        {
            if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                sErr = "4004";
                return(false);
            }
            else
            {
                try
                {
                    DateTime dtTime = DateTime.Parse(ds.Tables[0].Rows[0]["ExpirationTime"].ToString());
                    if (dtTime.Subtract(DateTime.Now).TotalMinutes > 0)
                    {
                        iUserID = Convert.ToInt32(ds.Tables[0].Rows[0]["UserID"]);
                        return(true);
                    }
                    else
                    {
                        sErr = "4005";
                        return(false);
                    }
                    return(false);
                }
                catch { }
                sErr = "4006";
                return(false);
            }
        }
    }
コード例 #7
0
ファイル: BllCommon.cs プロジェクト: pentiumCM/GPS
    //递归遍历一个车组下的所有子车组
    public static bool RecursiveVehParentGroup(int iGroupID, ref string strGroupID)
    {
        string strSQL;
        int    n;

        System.Collections.Generic.List <Models.CVehGroup> db = new System.Collections.Generic.List <Models.CVehGroup>();
        try
        {
            //一次性查出所有的车组关系
            strSQL = "SELECT VehGroupID,fVehGroupID FROM VehGroupDetail ";
            DataSet ds = BllSql.RunSqlSelect(strSQL);
            n = ds.Tables[0].Rows.Count;
            //如果有数据
            if (n >= 1)
            {
                //复制下来
                string id;
                string pid;

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    id  = ds.Tables[0].Rows[i]["VehGroupID"].ToString();
                    pid = ds.Tables[0].Rows[i]["fVehGroupID"].ToString();
                    Models.CVehGroup model = new Models.CVehGroup();
                    model.PID = pid;
                    model.id  = id;
                    db.Add(model);
                }
                string sGroupIDTemp = iGroupID.ToString();
                for (int i = 0; i < db.Count; i++)
                {
                    //找到它的子节点
                    if (db[i].id == sGroupIDTemp)
                    {
                        if (db[i].PID == "-1")
                        {
                            break;
                        }
                        strGroupID += db[i].PID + ",";
                        getParentVehGroup(db, db[i].PID, ref strGroupID);
                    }
                }
                if (strGroupID.Length >= 1)
                {
                    if (strGroupID.Substring(strGroupID.Length - 1, 1) == ",")
                    {
                        strGroupID = strGroupID.Substring(0, strGroupID.Length - 1);
                    }
                }
            }
            return(true);
        }
        catch (Exception ex)
        {
            return(false);
        }
    }
コード例 #8
0
    public static DataSet GetVehGroupFromLogin(int iUserID)
    {
        string strSQL       = "";
        string strGroupList = "";

        try
        {
            if (iUserID == 1)
            {
                strSQL = "SELECT VehGroupMain.VehGroupID, VehGroupMain.VehGroupName, "
                         + "VehGroupDetail.fVehGroupID "
                         + " FROM VehGroupMain left JOIN "
                         + "      VehGroupDetail ON "
                         + "            VehGroupMain.VehGroupID = VehGroupDetail.VehGroupID ";
            }
            else
            {
                //取所有列表ID
                //If sVersion = "SZHZ" Then
                //    strGroupList = GetAllVehGroupByGroup_UserID(adoConn, iUserID, sUserName)
                strGroupList = GetAllVehGroupByUserID(iUserID);

                if (strGroupList.Trim().Length == 0)
                {
                    strGroupList = "0";
                }

                strSQL = "SELECT VehGroupMain.VehGroupID, VehGroupMain.VehGroupName, "
                         + "VehGroupDetail.fVehGroupID "
                         + " FROM VehGroupMain left JOIN "
                         + "      VehGroupDetail ON "
                         + "            VehGroupMain.VehGroupID = VehGroupDetail.VehGroupID "
                         + "WHERE (VehGroupMain.VehGroupID IN (" + strGroupList + ")) ";
            }

            if (iUserID == 1)
            {
                strSQL = strSQL + " where (VehGroupMain.delflag Is null Or VehGroupMain.delflag = 0)";
            }
            else
            {
                strSQL = strSQL + " and (VehGroupMain.delflag Is null Or VehGroupMain.delflag = 0)";
            }
            DataSet ds = BllSql.RunSqlSelect(strSQL);
            return(ds);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
コード例 #9
0
    public static DataSet GetAllVehicleByTeamID(int iTeamID)
    {
        string strSQL = "";

        try
        {
            strSQL = "SELECT Id,Deviceid, IpAddress, Cph, OwnNo,TaxiNo,ProductCode,Decph,OwnerName,Contact1,AlarmLinkTel,Contact2,LinkTel2,Contact3,ContactPhone3,YyZh,ByZd,FrameNo,EngineNo,VehicleType,Color,PurchaseDate,ServerEndTime,EnrolDate,ServerMoney,Seller,LogOutCause,InstallPerson,InstallAddress,RecordPerson,BusinessPerson,PowerType,Marks,RepairTime,InsuranceTime,DistrictCode,WebPass,InsertTime  from Vehicle inner join VehicleDetail on VehicleDetail.VehID = Vehicle.Id where VehGroupID = " + iTeamID.ToString();

            DataSet ds = BllSql.RunSqlSelect(strSQL);
            return(ds);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
コード例 #10
0
ファイル: BllCommon.cs プロジェクト: pentiumCM/GPS
    public static bool IsVehLogin(string sUserName, string sPwd, out int iUserID, out string sErr)
    {
        iUserID = -1;
        sErr    = "";
        System.Collections.Generic.List <Models.CSqlParameters> lstPar = new System.Collections.Generic.List <Models.CSqlParameters>();
        Models.CSqlParameters par = new Models.CSqlParameters();
        par.iLen       = sUserName.Length * 2;
        par.pDirection = System.Data.ParameterDirection.Input;
        par.sName      = "UserName";
        par.sqlDbType  = System.Data.SqlDbType.NVarChar;
        par.sValue     = sUserName;
        lstPar.Add(par);

        par            = new Models.CSqlParameters();
        par.iLen       = sPwd.Length * 2;
        par.pDirection = System.Data.ParameterDirection.Input;
        par.sName      = "Password";
        par.sqlDbType  = System.Data.SqlDbType.NVarChar;
        par.sValue     = sPwd;
        lstPar.Add(par);
        string sSql = "select Id from Vehicle where Cph = @UserName and WebPass = @Password and DelFlag = 0 ";

        System.Data.DataSet ds = BllSql.RunSqlSelectParameters(false, sSql, lstPar, out sErr);
        if (sErr.Length > 0)
        {
            return(false);
        }
        else
        {
            if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                sErr = "4004";
                return(false);
            }
            else
            {
                try
                {
                    iUserID = Convert.ToInt32(ds.Tables[0].Rows[0]["Id"]);
                    return(true);
                }
                catch { }
                sErr = "4006";
                return(false);
            }
        }
    }
コード例 #11
0
    public static DataSet GetVehicleFromLogin(int iUserID)
    {
        string strSQL       = "";
        string strGroupList = "";

        try
        {
            if (iUserID == 1)
            {
                strSQL = "SELECT Id,Deviceid, IpAddress, Cph,OwnNo, TaxiNo,VehGroupID,ProductCode,OwnerName,Contact3,Seller  from Vehicle INNER JOIN VehicleDetail ON Vehicle.Id = VehicleDetail.VehID ";
            }
            else
            {
                //取所有列表ID
                //If sVersion = "SZHZ" Then
                //    strGroupList = GetAllVehGroupByGroup_UserID(adoConn, iUserID, sUserName)
                strGroupList = GetAllVehGroupByUserID(iUserID);

                if (strGroupList.Trim().Length == 0)
                {
                    strGroupList = "0";
                }

                strSQL = "SELECT Id,Deviceid, IpAddress, Cph, OwnNo,TaxiNo,VehGroupID,ProductCode,OwnerName,Contact3,Seller from Vehicle INNER JOIN VehicleDetail ON Vehicle.Id = VehicleDetail.VehID where VehicleDetail.VehGroupID in (" + strGroupList + ") ";
            }

            if (iUserID == 1)
            {
                strSQL = strSQL + " where (Vehicle.delflag is null) or (Vehicle.delflag=0)";
            }
            else
            {
                strSQL = strSQL + "  and ((Vehicle.delflag is null) or (Vehicle.delflag=0))";
            }
            DataSet ds = BllSql.RunSqlSelect(strSQL);
            return(ds);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
コード例 #12
0
    public static DataSet GetAnnual(int iUserID, DateTime dt)
    {
        string strSQL       = "";
        string strGroupList = "";

        try
        {
            if (iUserID == 1)
            {
                strSQL = "SELECT Id,RepairTime  from Vehicle INNER JOIN VehicleDetail ON Vehicle.Id = VehicleDetail.VehID ";
            }
            else
            {
                //取所有列表ID
                strGroupList = GetAllVehGroupByUserID(iUserID);

                if (strGroupList.Trim().Length == 0)
                {
                    strGroupList = "0";
                }

                strSQL = "SELECT Id,RepairTime from Vehicle INNER JOIN VehicleDetail ON Vehicle.Id = VehicleDetail.VehID where VehicleDetail.VehGroupID in (" + strGroupList + ") ";
            }

            if (iUserID == 1)
            {
                strSQL = strSQL + " where RepairTime <= '" + dt.ToString("yyyy-MM-dd HH:mm:ss") + "' and (Vehicle.delflag is null) or (Vehicle.delflag=0) order by RepairTime";
            }
            else
            {
                strSQL = strSQL + " and RepairTime <= '" + dt.ToString("yyyy-MM-dd HH:mm:ss") + "' and ((Vehicle.delflag is null) or (Vehicle.delflag=0)) order by RepairTime";
            }
            DataSet ds = BllSql.RunSqlSelect(strSQL);
            return(ds);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
コード例 #13
0
 public static string GetChildUserID(int iUserID)
 {
     try
     {
         string  strSQL = "select UserID from UserGroupDetail where usergroupid=" + iUserID.ToString();
         string  result = iUserID.ToString();
         DataSet ds     = BllSql.RunSqlSelect(strSQL);
         if (ds == null || ds.Tables.Count == 0)
         {
             return(result);
         }
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             result += "," + ds.Tables[0].Rows[i]["UserID"].ToString();
         }
         return(result);
     }
     catch (Exception ex)
     {
         return(iUserID.ToString());
     }
 }
コード例 #14
0
    //<summary>
    //按用户ID取
    //</summary>
    //<param name="iUserID"></param>
    //<returns></returns>
    //<remarks></remarks>
    public static string GetAllVehGroupByUserID(int iUserID)
    {
        string        strSQL         = "";
        string        strGroupIDList = "";
        StringBuilder sb             = new StringBuilder();

        try
        {
            //查出用户名下的所有根车组
            if (iUserID == 1)
            {
                strSQL = "SELECT DISTINCT(VehGroupID) FROM VehGroupmain ";
            }
            else
            {
                strSQL = "exec GetAllVehGroupByUserID " + iUserID.ToString();
            }
            DataSet ds = BllSql.RunSqlSelect(strSQL);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    sb.Append(ds.Tables[0].Rows[i][0].ToString() + ",");
                }
                strGroupIDList = sb.ToString();
                strGroupIDList = strGroupIDList.Substring(0, strGroupIDList.Length - 1);
            }
            else
            {
                return("");
            }
            return(strGroupIDList);
        }
        catch (Exception ex)
        {
            return("");
        }
    }
コード例 #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["username"] != null)
     {
         sUserName = Request.Cookies["username"].Value;
     }
     try
     {
         object sUserID = Session["userid"];
         if (sUserID == null)
         {
             Response.Write(BllCommon.TransferMobilelocation());
             return;
         }
         if (!IsPostBack)
         {
             //获取车组
             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;
             //if (Request.Cookies["VehGroup"] == null)
             //{
             //    AddCookie("VehGroup", json5);
             //}
             //else
             //{
             //    ModifyCookie("VehGroup", json5);
             //}
             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();
                 }
             }
         }
     }
     catch (Exception Exception)
     {
     }
 }
コード例 #16
0
ファイル: BllCommon.cs プロジェクト: pentiumCM/GPS
    public static void AddOpNoteFromVehMgr(string sType, int iVehID, string sOpDetail, string sMark, string sUserName, string sIpDetail, int iUserID, object[] arrOther)
    {
        try
        {
            string sOpTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            int    iOpType = 0;
            string sDBName = "Bee" + DateTime.Now.ToString("yyyyMMdd") + "..OptNotes";
            string strSQL  = "";
            if (sType == "EditUser")
            {
                int iEditUserID = iUserID;
                int blnIsEdit   = Convert.ToInt32(arrOther[0]);
                if (blnIsEdit == 1)
                {
                    sOpDetail = "用户【" + sUserName + "】编辑用户【" + arrOther[1].ToString() + "】信息";
                    sMark     = "编辑用户信息";
                }
                else
                {
                    sOpDetail = "用户【" + sUserName + "】添加用户【" + arrOther[1] + "】信息";
                    sMark     = "添加用户信息";
                }
            }
            else if (sType == "DelUser")
            {
                sOpDetail = "用户【" + sUserName + "】删除用户【" + arrOther[0].ToString() + "】信息";
                sMark     = "删除用户信息";
            }
            else if (sType == "EditUserGroup")
            {
                int    bInIsEdit            = Convert.ToInt32(arrOther[0]);
                string sEditUserGroupString = arrOther[1].ToString();
                if (bInIsEdit == 1)
                {
                    sOpDetail = "用户【" + sUserName + "】添加用户组【" + sEditUserGroupString + "】信息";
                    sMark     = "添加用户组信息";
                }
                else
                {
                    sOpDetail = "用户【" + sUserName + "】编辑用户组" + arrOther[1].ToString() + "为【" + arrOther[2].ToString() + "】信息";
                    //sOpDetail = "用户【" + sUserName + "】" + sEditUserGroupString
                    sMark = "编辑用户组信息";
                }
            }
            else if (sType == "DelUserGroup")
            {
                sOpDetail = "用户【" + sUserName + "】删除用户组【" + arrOther[0].ToString() + " ID:" + arrOther[1].ToString() + "】信息";

                sMark = "删除用户组信息";
            }
            else if (sType == "EditVeh")
            {
                int    bInIsEdit   = Convert.ToInt32(arrOther[0]);
                string sOldEditVeh = arrOther[1].ToString();
                if (bInIsEdit == 0)
                {
                    iVehID    = Convert.ToInt32(arrOther[2]);
                    sOpDetail = "用户【" + sUserName + "】编辑车辆" + sOldEditVeh + "为【" + arrOther[3].ToString() + "】信息";

                    sMark = "编辑车辆信息";
                }
                else
                {
                    sOpDetail = "用户【" + sUserName + "】添加车辆【" + arrOther[3].ToString() + "】信息";
                    sMark     = "添加车辆信息";
                }
            }
            else if (sType == "EditVehGroup")
            {
                int bInIsEdit = Convert.ToInt32(arrOther[0]);
                if (bInIsEdit == 0)
                {
                    string sOldGroupName = arrOther[1].ToString();
                    sOpDetail = "用户【" + sUserName + "】编辑车组" + sOldGroupName + "为【" + arrOther[2].ToString() + "】";
                    sMark     = "编辑车组信息";
                }
                else
                {
                    string sOldGroupName = arrOther[1].ToString();
                    sOpDetail = "用户【" + sUserName + "】添加车组【" + arrOther[2].ToString() + "】信息";
                    sMark     = "添加车组信息";
                }
            }
            else if (sType == "DeleteVehGroup")
            {
                sOpDetail = "用户【" + sUserName + "】删除车组【" + arrOther[0].ToString() + " ID:" + arrOther[1].ToString() + "】信息";
                sMark     = "删除车组信息";
            }
            else if (sType == "DelVeh")
            {
                iVehID    = Convert.ToInt32(arrOther[0]);
                sOpDetail = "用户【" + sUserName + "】删除车辆【" + arrOther[1].ToString() + "】信息";
                sMark     = "删除车辆信息";
            }
            else if (sType == "RecycleVehicle")
            {
                int iOpRecycleVehicleType = Convert.ToInt32(arrOther[0]);
                if (iOpRecycleVehicleType == 1)
                {
                    sOpDetail = "用户【" + sUserName + "】恢复车辆【" + arrOther[1].ToString() + "】信息";
                    sMark     = "恢复车辆信息";
                }
                else if (iOpRecycleVehicleType == 2)
                {
                    sOpDetail = "用户【" + sUserName + "】彻底删除车辆【" + arrOther[1].ToString() + "】信息";
                    sMark     = "彻底删除车辆信息";
                }
            }
            else if (sType == "RecycleVehGroup")
            {
                int iOpRecycleVehGroupType = Convert.ToInt32(arrOther[0]);
                if (iOpRecycleVehGroupType == 1)
                {
                    sOpDetail = "用户【" + sUserName + "】恢复车组【" + arrOther[1].ToString() + "】信息";
                    sMark     = "恢复车组信息";
                }
                else if (iOpRecycleVehGroupType == 2)
                {
                    sOpDetail = "用户【" + sUserName + "】彻底删除车组【" + arrOther[1].ToString() + "】信息";
                    sMark     = "彻底删除车组信息";
                }
            }
            else if (sType == "RecycleUser")
            {
                int iOpRecycleUserType = Convert.ToInt32(arrOther[0]);
                if (iOpRecycleUserType == 1)
                {
                    sOpDetail = "用户【" + sUserName + "】恢复用户【" + arrOther[1].ToString() + "】信息";
                    sMark     = "恢复用户信息";
                }
                else if (iOpRecycleUserType == 2)
                {
                    sOpDetail = "用户【" + sUserName + "】彻底删除用户【" + arrOther[1].ToString() + "】信息";
                    sMark     = "彻底删除用户信息";
                }
            }
            else if (sType == "RecycleUserGroup")
            {
                int iOpRecycleUserGroupType = Convert.ToInt32(arrOther[0]);
                if (iOpRecycleUserGroupType == 1)
                {
                    sOpDetail = "用户【" + sUserName + "】恢复用户组【" + arrOther[1].ToString() + "】信息";
                    sMark     = "恢复用户组信息";
                }
                else if (iOpRecycleUserGroupType == 2)
                {
                    sOpDetail = "用户【" + sUserName + "】彻底删除用户组【" + arrOther[1].ToString() + "】信息";
                    sMark     = "彻底删除用户组信息";
                }
            }

            strSQL = " insert into " + sDBName + "(UserID,UserLoginDetail,OpTime,VehID,OpType,OpDetail,Mark) "
                     + " values(" + iUserID.ToString() + ",'" + sIpDetail + "',getdate()," + iVehID.ToString() + "," + iOpType.ToString() + ",'" + sOpDetail + "','" + sMark + "') ";
            string sErr = "";
            BllSql.RunSqlExecute(strSQL, out sErr);
        }
        catch (Exception ex)
        {
        }
    }
コード例 #17
0
 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.TransferMobilelocation());
             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)
     {
     }
 }