Beispiel #1
0
        private OperationReturn GetInspectorList(SessionInfo session, List <string> listParams)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string  rentToken = session.RentInfo.Token;
                string  strSql;
                DataSet objDataSet;
                string  strUserID = listParams[0];
                switch (session.DBType)
                {
                case 2:
                    strSql    = string.Format("SELECT * FROM T_11_005_{0} WHERE C001 IN (SELECT C004 FROM T_31_041_{0}) AND C001 IN (SELECT C004 FROM T_11_201_{0} WHERE C003 = {1})", rentToken, strUserID);
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    strSql    = string.Format("SELECT * FROM T_11_005_{0} WHERE C001 IN (SELECT C004 FROM T_31_041_{0}) AND C001 IN (SELECT C004 FROM T_11_201_{0} WHERE C003 = {1})", rentToken, strUserID);
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType);
                    return(optReturn);
                }
                if (objDataSet == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null");
                    return(optReturn);
                }
                List <string> listReturn = new List <string>();
                for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                {
                    DataRow dr                   = objDataSet.Tables[0].Rows[i];
                    string  strInspectorID       = dr["C001"].ToString();
                    string  strInspectorName     = dr["C002"].ToString();
                    string  strInspectorFullName = dr["C003"].ToString();
                    strInspectorName     = DecryptString(strInspectorName);
                    strInspectorFullName = DecryptString(strInspectorFullName);
                    string strInfo = string.Format("{0}{1}{2}{1}{3}", strInspectorID, ConstValue.SPLITER_CHAR, strInspectorName, strInspectorFullName);
                    listReturn.Add(strInfo);
                }
                optReturn.Data = listReturn;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
                return(optReturn);
            }
            return(optReturn);
        }
Beispiel #2
0
        private OperationReturn GetOperationResultList(SessionInfo session)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                int     LangID = session.LangTypeInfo.LangID;
                string  strSql;
                DataSet objDataSet;
                switch (session.DBType)
                {
                case 2:
                    strSql    = string.Format("SELECT * FROM T_00_005 WHERE C002 LIKE 'OP%' AND C001={0}", LangID);
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    strSql    = string.Format("SELECT * FROM T_00_005 WHERE C002 LIKE 'OP%' AND C001={0}", LangID);
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType);
                    return(optReturn);
                }
                if (objDataSet == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null");
                    return(optReturn);
                }
                List <string> listReturn = new List <string>();
                for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = objDataSet.Tables[0].Rows[i];
                    string  strOperationResultsCodes    = dr["C002"].ToString();
                    string  strOperationResultsContents = dr["C005"].ToString();
                    string  strInfo = string.Format("{0}{1}{2}", strOperationResultsCodes, ConstValue.SPLITER_CHAR, strOperationResultsContents);
                    listReturn.Add(strInfo);
                }
                optReturn.Data = listReturn;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
                return(optReturn);
            }
            return(optReturn);
        }
Beispiel #3
0
        private OperationReturn GetVoiceIP_Name201(SessionInfo session)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string  rentToken = session.RentInfo.Token;
                string  strSql;
                DataSet objDataSet;
                switch (session.DBType)
                {
                case 2:
                    strSql    = string.Format("SELECT DISTINCT C019,C020 FROM T_21_001", rentToken);
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    strSql    = string.Format("SELECT DISTINCT C019,C020 FROM T_21_001", rentToken);
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType);
                    return(optReturn);
                }
                if (objDataSet == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null");
                    return(optReturn);
                }
                List <string> listReturn = new List <string>();
                for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                {
                    DataRow dr           = objDataSet.Tables[0].Rows[i];
                    string  strVoiceName = dr["C019"].ToString();
                    string  strVoiceIP   = dr["C020"].ToString();
                    string  strInfo      = string.Format("{0}{1}{2}", strVoiceName, ConstValue.SPLITER_CHAR, strVoiceIP);
                    listReturn.Add(strInfo);
                }
                optReturn.Data = listReturn;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
                return(optReturn);
            }
            return(optReturn);
        }
Beispiel #4
0
        private OperationReturn GetControlOrgInfoList(SessionInfo session, List <string> listParams)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                //ListParam
                //0      用户编号
                //1      上级机构编号(-1表示获取当前所属机构信息),就是没有父节点的节点,就是根节点
                if (listParams == null || listParams.Count < 2)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Request param is null or count invalid");
                    return(optReturn);
                }
                string  strUserID   = listParams[0];
                string  strParentID = listParams[1];
                string  rentToken   = session.RentInfo.Token;
                string  strSql;
                DataSet objDataSet;
                switch (session.DBType)
                {
                case 2:
                    if (strParentID == "-1")
                    {
                        strSql = string.Format("SELECT * FROM T_11_006_{0} WHERE C001 IN (SELECT C006 FROM T_11_005_{0} WHERE C001 = {1})", rentToken, strUserID);
                        //strSql = string.Format("SELECT * FROM T_11_006_{0} WHERE C001 IN (SELECT C006 FROM T_11_005_{0})", rentToken);
                    }
                    else
                    {
                        strSql = string.Format("SELECT * FROM T_11_006_{0} WHERE C001 IN (SELECT C004 FROM T_11_201_{0} WHERE C003 = {1}) AND C004 = {2}", rentToken, strUserID, strParentID);
                        //strSql = string.Format("SELECT * FROM T_11_006_{0} WHERE C004 = {1}", rentToken,  strParentID);
                    }
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    if (strParentID == "-1")
                    {
                        strSql = string.Format("SELECT * FROM T_11_006_{0} WHERE C001 IN (SELECT C006 FROM T_11_005_{0} WHERE C001 = {1})", rentToken, strUserID);
                        //strSql = string.Format("SELECT * FROM T_11_006_{0} WHERE C001 IN (SELECT C006 FROM T_11_005_{0})", rentToken);
                    }
                    else
                    {
                        strSql = string.Format("SELECT * FROM T_11_006_{0} WHERE C001 IN (SELECT C004 FROM T_11_201_{0} WHERE C003 = {1}) AND C004 = {2}", rentToken, strUserID, strParentID);
                        //strSql = string.Format("SELECT * FROM T_11_006_{0} WHERE C004 = {1}", rentToken,  strParentID);
                    }
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType);
                    return(optReturn);
                }
                if (objDataSet == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null");
                    return(optReturn);
                }
                List <string> listReturn = new List <string>();
                for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                {
                    DataRow dr          = objDataSet.Tables[0].Rows[i];
                    string  strName     = dr["C001"].ToString();
                    string  strFullName = dr["C002"].ToString();
                    strName     = DecryptString(strName);
                    strFullName = DecryptString(strFullName);
                    string strInfo = string.Format("{0}{1}{2}", strName, ConstValue.SPLITER_CHAR, strFullName);
                    listReturn.Add(strInfo);
                }
                optReturn.Data = listReturn;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
                return(optReturn);
            }
            return(optReturn);
        }