Ejemplo n.º 1
0
        /// <summary>
        /// 检查用户是否可以登录(检查用户名、密码、有效期、是否是管理员)
        /// </summary>
        /// <param name="strUserName"></param>
        /// <param name="strPwd"></param>
        /// <returns></returns>
        public static OperationReturn CheckUser(string strUserName, string strPwd)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = Defines.RET_SUCCESS;
            try
            {
                DatabaseInfo dbInfo               = App.currDBInfo;
                string       strDBConnString      = dbInfo.GetConnectionString();
                string       strSql               = string.Empty;
                string       strUserNameEncrypted = EncryptOperations.EncryptWithM002(strUserName);

                switch (App.currDBInfo.TypeID)
                {
                case 2:
                    strSql    = "SELECT *  FROM T_11_005_{0} where C002='{1}'";
                    strSql    = string.Format(strSql, App.strRent, strUserNameEncrypted);
                    optReturn = MssqlOperation.GetDataSet(strDBConnString, strSql);
                    break;

                case 3:
                    strSql    = "SELECT *  FROM T_11_005_{0} where C002='{1}'";
                    strSql    = string.Format(strSql, App.strRent, strUserNameEncrypted);
                    optReturn = OracleOperation.GetDataSet(strDBConnString, strSql);
                    break;
                }
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                DataSet ds = optReturn.Data as DataSet;
                if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
                {
                    optReturn.Result = false;
                    optReturn.Code   = ConstDefines.UserName_Or_Pwd_Not_Exists;
                    return(optReturn);
                }
                string strUserID   = ds.Tables[0].Rows[0]["C001"].ToString();
                string strPwdInDB  = ds.Tables[0].Rows[0]["C004"].ToString();
                string strPwdInput = EncryptOperations.EncryptUserPwd(strUserID, strPwd);
                if (!strPwdInDB.Equals(strPwdInput))
                {
                    optReturn.Result = false;
                    optReturn.Code   = ConstDefines.UserName_Or_Pwd_Not_Exists;
                    return(optReturn);
                }

                DateTime dtFrom = DateTime.Parse(EncryptOperations.DecryptWithM002(ds.Tables[0].Rows[0]["C017"].ToString()));
                string   strTo  = EncryptOperations.DecryptWithM002(ds.Tables[0].Rows[0]["C018"].ToString());
                if (!strTo.Equals(ConstDefines.strUNLIMITED))
                {
                    //如果有效期不是UNLIMITED 需要判断是否过期
                    DateTime dtTo = DateTime.Parse(strTo);
                    if (!(DateTime.Now > dtFrom && DateTime.Now < dtTo))
                    {
                        optReturn.Result = false;
                        optReturn.Code   = ConstDefines.User_Overdue;
                        return(optReturn);
                    }
                }
                //检查用户是否是管理员角色
                switch (dbInfo.TypeID)
                {
                case 2:
                    strSql    = "SELECT *  FROM T_11_201_{0} where C004 ={1} and C003 =1060000000000000001";
                    strSql    = string.Format(strSql, App.strRent, strUserID);
                    optReturn = MssqlOperation.GetDataSet(strDBConnString, strSql);
                    break;

                case 3:
                    strSql    = "SELECT *  FROM T_11_201_{0} where C004 ={1} and C003 =1060000000000000001";
                    strSql    = string.Format(strSql, App.strRent, strUserID);
                    optReturn = OracleOperation.GetDataSet(strDBConnString, strSql);
                    break;
                }
                if (!optReturn.Result)
                {
                    optReturn.Code = ConstDefines.Get_User_Role_Failed;
                    return(optReturn);
                }
                ds = optReturn.Data as DataSet;
                if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
                {
                    optReturn.Result = false;
                    optReturn.Code   = ConstDefines.User_Not_Admin;
                    return(optReturn);
                }
                optReturn.Data = strUserID;
                return(optReturn);
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = ConstDefines.Check_User_Exception;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }
Ejemplo n.º 2
0
        void BtnTest_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DatabaseInfo dbInfo = new DatabaseInfo();
                dbInfo.TypeID    = 2;
                dbInfo.Host      = "192.168.4.182";
                dbInfo.Port      = 1433;
                dbInfo.DBName    = "UMPDataDB0713";
                dbInfo.LoginName = "PFDEV";
                dbInfo.Password  = "******";
                //dbInfo.TypeID = 2;
                //dbInfo.Host = "10.26.1.52";
                //dbInfo.Port = 1433;
                //dbInfo.DBName = "UMPDataDB";
                //dbInfo.LoginName = "sa";
                //dbInfo.Password = "******";
                string               strConn = dbInfo.GetConnectionString();
                DataSet              objDataSet;
                string               strSql;
                SqlConnection        objConn;
                SqlDataAdapter       objAdapter;
                DbCommandBuilder     objCmdBuilder;
                DataRow              dr;
                bool                 isAdd;
                List <ExtensionInfo> listExtInfos = new List <ExtensionInfo>();
                ExtensionInfo        extInfo;
                strSql =
                    string.Format(
                        "select * from t_11_101_00000 where c001 > 2250000000000000000 and c001 < 2260000000000000000 and c002 = 1 order by c001,c002");
                objConn    = new SqlConnection(strConn);
                objAdapter = new SqlDataAdapter(strSql, objConn);
                objDataSet = new DataSet();
                try
                {
                    objAdapter.Fill(objDataSet);
                    for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                    {
                        dr = objDataSet.Tables[0].Rows[i];
                        int key = Convert.ToInt32(dr["C011"]);
                        extInfo           = new ExtensionInfo();
                        extInfo.ObjID     = 1040000000000000001 + key;
                        extInfo.ChanObjID = Convert.ToInt64(dr["C001"]);
                        listExtInfos.Add(extInfo);
                    }
                    for (int i = 0; i < listExtInfos.Count; i++)
                    {
                        extInfo = listExtInfos[i];
                        strSql  = string.Format("select * from t_11_101_00000 where c001 = {0} order by c001,c002", extInfo.ChanObjID);
                        objAdapter.SelectCommand = new SqlCommand(strSql, objConn);
                        objDataSet = new DataSet();
                        objAdapter.Fill(objDataSet);
                        for (int j = 0; j < objDataSet.Tables[0].Rows.Count; j++)
                        {
                            dr = objDataSet.Tables[0].Rows[j];

                            int row = Convert.ToInt32(dr["C002"]);
                            if (row == 1)
                            {
                                extInfo.ID          = Convert.ToInt32(dr["C012"]);
                                extInfo.ServerObjID = Convert.ToInt64(dr["C013"]);
                                extInfo.ChanID      = extInfo.ID;
                            }
                            if (row == 2)
                            {
                                extInfo.Extension = dr["C012"].ToString();
                                extInfo.ChanName  = extInfo.Extension;
                            }
                        }
                    }
                    strSql =
                        string.Format(
                            "select * from t_11_101_00000 where c001 > 1040000000000000000 and c001 < 1050000000000000000 and c002 = 1 order by c001,c002");
                    objAdapter.SelectCommand = new SqlCommand(strSql, objConn);
                    objDataSet    = new DataSet();
                    objCmdBuilder = new SqlCommandBuilder(objAdapter);
                    objCmdBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    objCmdBuilder.SetAllValues   = false;
                    objAdapter.Fill(objDataSet);
                    for (int i = 0; i < listExtInfos.Count; i++)
                    {
                        extInfo = listExtInfos[i];
                        isAdd   = false;
                        dr      =
                            objDataSet.Tables[0].Select(string.Format("C001 = {0} and C002 = {1}", extInfo.ObjID, 1))
                            .FirstOrDefault();
                        if (dr == null)
                        {
                            dr    = objDataSet.Tables[0].NewRow();
                            isAdd = true;
                        }
                        dr["C001"] = extInfo.ObjID;
                        dr["C002"] = 1;
                        dr["C011"] = 1010000000000000001;
                        dr["C017"] = extInfo.Extension;
                        dr["C018"] = extInfo.ChanName;
                        if (isAdd)
                        {
                            objDataSet.Tables[0].Rows.Add(dr);
                        }
                    }

                    objAdapter.Update(objDataSet);
                    objDataSet.AcceptChanges();

                    strSql =
                        string.Format(
                            "select * from t_11_101_00000 where c001 > 1040000000000000000 and c001 < 1050000000000000000 and c002 = 2 order by c001,c002");
                    objAdapter.SelectCommand = new SqlCommand(strSql, objConn);
                    objDataSet    = new DataSet();
                    objCmdBuilder = new SqlCommandBuilder(objAdapter);
                    objCmdBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    objCmdBuilder.SetAllValues   = false;
                    objAdapter.Fill(objDataSet);
                    for (int i = 0; i < listExtInfos.Count; i++)
                    {
                        extInfo = listExtInfos[i];
                        isAdd   = false;
                        dr      =
                            objDataSet.Tables[0].Select(string.Format("C001 = {0} and C002 = {1}", extInfo.ObjID, 2))
                            .FirstOrDefault();
                        if (dr == null)
                        {
                            dr    = objDataSet.Tables[0].NewRow();
                            isAdd = true;
                        }
                        dr["C001"] = extInfo.ObjID;
                        dr["C002"] = 2;
                        dr["C015"] = extInfo.ServerObjID;
                        dr["C016"] = extInfo.ChanID;
                        dr["C020"] = extInfo.ChanObjID;
                        if (isAdd)
                        {
                            objDataSet.Tables[0].Rows.Add(dr);
                        }
                    }

                    objAdapter.Update(objDataSet);
                    objDataSet.AcceptChanges();

                    strSql =
                        string.Format(
                            "select * from t_11_201_00000 where c003 = 1020000000000000001 and c004 > 1040000000000000000 and c004 < 1050000000000000000");
                    objAdapter.SelectCommand = new SqlCommand(strSql, objConn);
                    objDataSet    = new DataSet();
                    objCmdBuilder = new SqlCommandBuilder(objAdapter);
                    objCmdBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    objCmdBuilder.SetAllValues   = false;
                    objAdapter.Fill(objDataSet);
                    for (int i = 0; i < listExtInfos.Count; i++)
                    {
                        extInfo = listExtInfos[i];
                        isAdd   = false;
                        dr      =
                            objDataSet.Tables[0].Select(string.Format("C004 = {0}", extInfo.ObjID))
                            .FirstOrDefault();
                        if (dr == null)
                        {
                            dr    = objDataSet.Tables[0].NewRow();
                            isAdd = true;
                        }
                        dr["C001"] = 0;
                        dr["C002"] = 0;
                        dr["C003"] = 1020000000000000001;
                        dr["C004"] = extInfo.ObjID;
                        dr["C005"] = DateTime.Parse("2014/1/1");
                        dr["C006"] = DateTime.Parse("2199/12/31");
                        if (isAdd)
                        {
                            objDataSet.Tables[0].Rows.Add(dr);
                        }
                    }

                    objAdapter.Update(objDataSet);
                    objDataSet.AcceptChanges();


                    AppendMessage(string.Format("End.\t{0}", listExtInfos.Count));
                }
                catch (Exception ex)
                {
                    AppendMessage(ex.Message);
                }
                finally
                {
                    if (objConn.State == ConnectionState.Open)
                    {
                        objConn.Close();
                    }
                    objConn.Dispose();
                }
            }
            catch (Exception ex)
            {
                AppendMessage(string.Format("Fail.\t{0}", ex.Message));
            }
        }
Ejemplo n.º 3
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptFromClient(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (webRequest.Code)
                {
                case (int)S2101Codes.GetAllowConditions:
                    optReturn = GetAllowConditions(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    List <string> listCons = optReturn.Data as List <string>;
                    webReturn.ListData = listCons;
                    break;

                case (int)S2101Codes.GetRoleOperationList:
                    optReturn = GetRoleOperationList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    List <string> listOpts = optReturn.Data as List <string>;
                    webReturn.ListData = listOpts;
                    break;

                case (int)S2101Codes.SubmitStrategies:
                    optReturn = SubmitStrategies(session, webRequest.ListData, webRequest.Data);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S2101Codes.GetFilterWithCreator:
                    optReturn = GetFilterWithCreator(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    List <string> listFwc = optReturn.Data as List <string>;
                    webReturn.ListData = listFwc;
                    break;

                case (int)S2101Codes.DeleteStrategy:
                    optReturn = DeleteStrategy(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;

                default:
                    webReturn.Result  = false;
                    webReturn.Code    = Defines.RET_PARAM_INVALID;
                    webReturn.Message = string.Format("WebCodes invalid.\t{0}", webRequest.Code);
                    return(webReturn);
                }
                webReturn.Result  = true;
                webReturn.Code    = 0;
                webReturn.Message = optReturn.Message;
                return(webReturn);
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
        }
Ejemplo n.º 4
0
        protected override void InitSessionInfo()
        {
            base.InitSessionInfo();

            if (Session == null)
            {
                return;
            }

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = ConstValue.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            userInfo.Password = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = ConstValue.USER_ADMIN;

            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol     = "http";
            serverInfo.Address      = "192.168.6.69";
            serverInfo.Port         = 8081;
            serverInfo.SupportHttps = false;
            Session.AppServerInfo   = serverInfo;

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID              = 2;
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1433;
            dbInfo.DBName              = "UMPDataDB_SEF_1";
            dbInfo.LoginName           = "sa";
            dbInfo.Password            = "******";
            dbInfo.RealPassword        = "******";
            Session.DatabaseInfo       = dbInfo;
            Session.DBType             = dbInfo.TypeID;
            Session.DBConnectionString = dbInfo.GetConnectionString();

//             AppServerInfo serverInfo = new AppServerInfo();
//             serverInfo.Protocol = "http";
//             serverInfo.Address = "192.168.9.223";
//             serverInfo.Port = 8081;
//             serverInfo.SupportHttps = false;
//             Session.AppServerInfo = serverInfo;

//             DatabaseInfo dbInfo = new DatabaseInfo();
//             dbInfo.TypeID = 2;
//             dbInfo.Host = "192.168.9.223";
//             dbInfo.Port = 1433;
//             dbInfo.DBName = "UMPDataDB0711";
//             dbInfo.LoginName = "sa";
//             dbInfo.Password = "******";
//             Session.DatabaseInfo = dbInfo;
//             Session.DBType = dbInfo.TypeID;
//             Session.DBConnectionString = dbInfo.GetConnectionString();

//             DatabaseInfo dbInfo = new DatabaseInfo();
//             dbInfo.TypeID = 3;
//             dbInfo.TypeName = "ORCL";
//             dbInfo.Host = "192.168.4.182";
//             dbInfo.Port = 1521;
//             dbInfo.DBName = "PFOrcl";
//             dbInfo.LoginName = "PFDEV831";
//             dbInfo.Password = "******";
//             Session.DatabaseInfo = dbInfo;
//             Session.DBType = dbInfo.TypeID;
//             Session.DBConnectionString = dbInfo.GetConnectionString();
        }
Ejemplo n.º 5
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                List <string>   listReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptFromClient(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (webRequest.Code)
                {
                case (int)S1101Codes.GetOrganizationList:
                    optReturn = GetControledOrgList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    listReturn         = optReturn.Data as List <string>;
                    webReturn.ListData = listReturn;
                    break;

                case (int)S1101Codes.AddNewOrgInfo:
                    optReturn = AddNewOrgInfo(session, webRequest.Data);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.DeleteOrgInfo:
                    optReturn = DeleteOrgInfo(session, webRequest.Data);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.ModifyOrgInfo:
                    optReturn = ModifyOrgInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.GetUserList:
                    optReturn = GetControledUserList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    listReturn         = optReturn.Data as List <string>;
                    webReturn.ListData = listReturn;
                    break;

                case (int)S1101Codes.GetUserExtInfo:
                    optReturn = GetUserExtInfo(session, webRequest.Data);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.AddNewUser:
                    optReturn = AddNewUser(session, webRequest.Data);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.ModifyUserInfo:
                    optReturn = ModifyUserInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.DeleteUserInfo:
                    optReturn = DeleteUserInfo(session, webRequest.Data);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.ModifyUserExtInfo:
                    optReturn = ModifyUserExtInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.MoveUser:
                    optReturn = MoveUser(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.MoveAgent:
                    optReturn = MoveAgent(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.GetUserRoleList:
                    optReturn = GetUserRoleList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    listReturn         = optReturn.Data as List <string>;
                    webReturn.ListData = listReturn;
                    break;

                case (int)S1101Codes.SetUserRoles:
                    optReturn = SetUserRoles(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    listReturn         = optReturn.Data as List <string>;
                    webReturn.ListData = listReturn;
                    break;

                case (int)S1101Codes.GetResourceProperty:
                    optReturn = GetResourceProperty(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1101Codes.GetControlObjectList:
                    optReturn = GetControlObjectList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    listReturn         = optReturn.Data as List <string>;
                    webReturn.ListData = listReturn;
                    break;

                case (int)S1101Codes.SetUserControlObject:
                    optReturn = SetUserControlObject(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    listReturn         = optReturn.Data as List <string>;
                    webReturn.ListData = listReturn;
                    break;

                case (int)S1101Codes.GetObjectBasicInfoList:
                    optReturn = GetObjectBasicInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1101Codes.GetOrgTypeList:
                    optReturn = GetOrgTypeList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1101Codes.GetParameter:
                    optReturn = GetParameters(session);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.StringValue;
                    break;

                case (int)S1101Codes.GetControlAgentInfoList:
                    optReturn = GetControlAgentInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1101Codes.GetControlExtensionInfoList:
                    optReturn = GetControlExtensionInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1101Codes.GetControlRealExtensionInfoList:
                    optReturn = GetControlRealExtensionInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1101Codes.GetResourceObjList:
                    optReturn = GetResourceObjList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1101Codes.GetAgentOrExt:
                    optReturn = GetAgentOrExt(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1101Codes.LoadNewUser:
                    optReturn = LoadNewUser(session, webRequest.Data);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.MotifyAgentNameByAccount:
                    optReturn = MotifyAgentNameByAccount(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.ModifyUserPasswordM003:
                    optReturn = ModifyUserPasswordM003(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1101Codes.GetDomainInfo:
                    optReturn = GetDomainInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                default:
                    webReturn.Result  = false;
                    webReturn.Code    = Defines.RET_PARAM_INVALID;
                    webReturn.Message = string.Format("WebCodes invalid.\t{0}", webRequest.Code);
                    return(webReturn);
                }
                webReturn.Result  = true;
                webReturn.Code    = 0;
                webReturn.Message = optReturn.Message;
                return(webReturn);
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
        }
Ejemplo n.º 6
0
        private void InsertScreenRecord(RecordInfoExt recordInfo)
        {
            try
            {
                if (Session == null)
                {
                    return;
                }
                DatabaseInfo dbInfo = Session.DatabaseInfo;
                if (dbInfo == null)
                {
                    return;
                }

                #region 创建记录信息字符串

                string strInsertString = string.Empty;
                strInsertString += string.Format("c023{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "AS");
                strInsertString += string.Format("c024{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "CHN");
                strInsertString += string.Format("c022{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, 0);
                strInsertString += string.Format("c003{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "00000");
                strInsertString += string.Format("c077{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.RecordReference);
                strInsertString += string.Format("c020{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.ServerIP);
                strInsertString += string.Format("c037{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.ServerID);
                strInsertString += string.Format("c038{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.ChannelID);
                strInsertString += string.Format("c039{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "N/A");
                strInsertString += string.Format("c014{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.MediaType);
                strInsertString += string.Format("c015{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, string.Empty);
                strInsertString += string.Format("c004{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.StartRecordTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"));
                strInsertString += string.Format("c005{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.StartRecordTime.ToString("yyyy-MM-dd HH:mm:ss"));
                strInsertString += string.Format("c006{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.StartRecordTime.ToString("yyyyMMddHHmmss"));
                strInsertString += string.Format("c007{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.StartRecordTime.AddYears(-1600).Ticks);
                strInsertString += string.Format("c008{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.StopRecordTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"));
                strInsertString += string.Format("c009{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.StopRecordTime.ToString("yyyy-MM-dd HH:mm:ss"));
                strInsertString += string.Format("c010{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.StopRecordTime.ToString("yyyyMMddHHmmss"));
                strInsertString += string.Format("c011{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.StopRecordTime.AddYears(-1600).Ticks);
                strInsertString += string.Format("c012{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, (int)(recordInfo.StopRecordTime - recordInfo.StartRecordTime).TotalSeconds);
                strInsertString += string.Format("c042{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.Extension);
                strInsertString += string.Format("c021{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.Extension);
                strInsertString += string.Format("c025{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.EncryptFlag);
                strInsertString += string.Format("c031{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c033{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "N");
                strInsertString += string.Format("c040{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, string.Empty);
                strInsertString += string.Format("c041{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, string.Empty);
                strInsertString += string.Format("c045{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c057{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, string.Empty);
                strInsertString += string.Format("c059{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c060{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c061{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c064{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c065{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c063{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c056{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");
                strInsertString += string.Format("c035{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "N");
                strInsertString += string.Format("c109{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, recordInfo.SessionID);
                strInsertString += string.Format("c066{0}{1}{0}{0}", ConstValue.SPLITER_CHAR, "0");

                #endregion


                #region 将记录信息插入数据库

                OperationReturn optReturn;
                string          strConn = dbInfo.GetConnectionString();
                int             errNum  = 0;
                string          errMsg  = string.Empty;
                switch (dbInfo.TypeID)
                {
                case 2:
                    DbParameter[] mssqlParameters =
                    {
                        MssqlOperation.GetDbParameter("@ainparam01",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam02",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam03",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam04",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam05",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam06",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam07",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam08",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam09",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@ainparam10",      MssqlDataType.Varchar, 1024),
                        MssqlOperation.GetDbParameter("@aouterrornumber", MssqlDataType.Bigint,     0),
                        MssqlOperation.GetDbParameter("@aouterrorstring", MssqlDataType.Varchar, 200)
                    };
                    mssqlParameters[0].Value      = strInsertString;
                    mssqlParameters[1].Value      = string.Empty;
                    mssqlParameters[2].Value      = string.Empty;
                    mssqlParameters[3].Value      = string.Empty;
                    mssqlParameters[4].Value      = string.Empty;
                    mssqlParameters[5].Value      = string.Empty;
                    mssqlParameters[6].Value      = string.Empty;
                    mssqlParameters[7].Value      = string.Empty;
                    mssqlParameters[8].Value      = string.Empty;
                    mssqlParameters[9].Value      = string.Empty;
                    mssqlParameters[10].Value     = errNum;
                    mssqlParameters[11].Value     = errMsg;
                    mssqlParameters[10].Direction = ParameterDirection.Output;
                    mssqlParameters[11].Direction = ParameterDirection.Output;
                    optReturn = MssqlOperation.ExecuteStoredProcedure(strConn, "P_21_001",
                                                                      mssqlParameters);
                    if (!optReturn.Result)
                    {
                        OnDebug(LogMode.Error,
                                string.Format("InsertScreenRecord fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    if (mssqlParameters[10].Value.ToString() != "0")
                    {
                        OnDebug(LogMode.Error,
                                string.Format("InsertScreenRecord fail.\t{0}\t{1}", mssqlParameters[10].Value, mssqlParameters[11].Value));
                        return;
                    }
                    break;

                case 3:
                    DbParameter[] orclParameters =
                    {
                        OracleOperation.GetDbParameter("ainparam01",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam02",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam03",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam04",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam05",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam06",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam07",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam08",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam09",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("ainparam10",  OracleDataType.Varchar2, 1024),
                        OracleOperation.GetDbParameter("errornumber", OracleDataType.Int32,       0),
                        OracleOperation.GetDbParameter("errorstring", OracleDataType.Varchar2, 200)
                    };
                    orclParameters[0].Value      = strInsertString;
                    orclParameters[1].Value      = string.Empty;
                    orclParameters[2].Value      = string.Empty;
                    orclParameters[3].Value      = string.Empty;
                    orclParameters[4].Value      = string.Empty;
                    orclParameters[5].Value      = string.Empty;
                    orclParameters[6].Value      = string.Empty;
                    orclParameters[7].Value      = string.Empty;
                    orclParameters[8].Value      = string.Empty;
                    orclParameters[9].Value      = string.Empty;
                    orclParameters[10].Value     = errNum;
                    orclParameters[11].Value     = errMsg;
                    orclParameters[10].Direction = ParameterDirection.Output;
                    orclParameters[11].Direction = ParameterDirection.Output;
                    optReturn = OracleOperation.ExecuteStoredProcedure(strConn, "P_21_001",
                                                                       orclParameters);
                    if (!optReturn.Result)
                    {
                        OnDebug(LogMode.Error,
                                string.Format("InsertScreenRecord fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    if (orclParameters[10].Value.ToString() != "0")
                    {
                        OnDebug(LogMode.Error,
                                string.Format("InsertScreenRecord fail.\t{0}\t{1}", orclParameters[10].Value, orclParameters[11].Value));
                        return;
                    }
                    break;

                default:
                    OnDebug(LogMode.Error,
                            string.Format("InsertScreenRecord fail.\tDatabaseType invalid"));
                    return;
                }

                #endregion

                OnDebug(LogMode.Info, string.Format("InsertScreenRecord\t{0}", recordInfo.RecordReference));
            }
            catch (Exception ex)
            {
                OnDebug(LogMode.Error, string.Format("InsertScreenRecord fail.\t{0}", ex.Message));
            }
        }
Ejemplo n.º 7
0
        private void Login()
        {
            try
            {
                if (DatabaseInfo == null)
                {
                    ShowException(string.Format("Fail.\t DatabaseInfo is null"));
                    return;
                }

                string strAccount  = TxtAccount.Text.Trim();
                string strPassword = TxtPassword.Password.Trim();

                if (string.IsNullOrEmpty(strAccount) ||
                    string.IsNullOrEmpty(strPassword))
                {
                    ShowException(string.Format("Account or password empty!"));
                    return;
                }

                SetBusy(true, App.GetLanguageInfo("N008", string.Format("Checking login information, please wait for a moment...")));
                bool             isFail   = true;
                string           strError = string.Empty;
                OperationReturn  optReturn;
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (s, de) =>
                {
                    try
                    {
                        string strAccountEncrypt = App.EncryptStringM002(strAccount);
                        int    dbType            = DatabaseInfo.TypeID;
                        string strSql;
                        string strConn      = DatabaseInfo.GetConnectionString();
                        string strRentToken = string.Format("00000");
                        switch (dbType)
                        {
                        case 2:
                            strSql = string.Format("SELECT * FROM T_11_005_{0} WHERE C002 = '{1}'",
                                                   strRentToken,
                                                   strAccountEncrypt);
                            optReturn = MssqlOperation.GetDataSet(strConn, strSql);
                            break;

                        case 3:
                            strSql = string.Format("SELECT * FROM T_11_005_{0} WHERE C002 = '{1}'",
                                                   strRentToken,
                                                   strAccountEncrypt);
                            optReturn = OracleOperation.GetDataSet(strConn, strSql);
                            break;

                        default:
                            strError = string.Format("Database type not support.\t{0}", dbType);
                            return;
                        }
                        if (!optReturn.Result)
                        {
                            strError = string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message);
                            return;
                        }
                        DataSet objDataSet = optReturn.Data as DataSet;
                        if (objDataSet == null ||
                            objDataSet.Tables.Count <= 0)
                        {
                            strError = string.Format("DataSet is null");
                            return;
                        }
                        if (objDataSet.Tables[0].Rows.Count <= 0)
                        {
                            strError = string.Format("Account not exist.\t{0}", strAccount);
                            return;
                        }
                        DataRow dr       = objDataSet.Tables[0].Rows[0];
                        long    userID   = Convert.ToInt64(dr["C001"]);
                        string  strPass  = dr["C004"].ToString();
                        string  strTemp  = string.Format("{0}{1}", userID, strPassword);
                        byte[]  byteTemp = ServerHashEncryption.EncryptBytes(Encoding.Unicode.GetBytes(strTemp),
                                                                             EncryptionMode.SHA512V00Hex);
                        var aes = ServerAESEncryption.EncryptBytes(byteTemp, EncryptionMode.AES256V02Hex);
                        strTemp = ServerEncryptionUtils.Byte2Hex(aes);
                        if (!strTemp.Equals(strPass))
                        {
                            strError = string.Format("Password error.");
                            return;
                        }
                        IsLogined = true;
                        UserInfo userInfo = new UserInfo();
                        userInfo.UserID   = userID;
                        userInfo.Account  = strAccount;
                        userInfo.Password = strPassword;
                        UserInfo          = userInfo;
                        isFail            = false;
                    }
                    catch (Exception ex)
                    {
                        strError = string.Format("Fail.\t{0}", ex.Message);
                    }
                };
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();
                    SetBusy(false, string.Empty);

                    if (isFail)
                    {
                        ShowException(strError);
                        return;
                    }
                    DialogResult = true;
                    Close();
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Ejemplo n.º 8
0
        private void AddBugInfos()
        {
            try
            {
                if (mCurrentVersion == null)
                {
                    return;
                }
                UpdateModule info          = new UpdateModule();
                int          serialNoIndex = GetBugSerialNoIndex();
                serialNoIndex++;
                info.SerialNo = string.Format("{0}{1}", mCurrentVersion.StrValue, serialNoIndex.ToString("0000"));
                var bugType = ComboBugTypes.SelectedItem as ComboItem;
                if (bugType == null)
                {
                    ShowException(string.Format("Bug Type invalid!"));
                    return;
                }
                info.Type = bugType.IntValue;
                var module = ComboModules.SelectedItem as ComboItem;
                if (module == null)
                {
                    ShowException(string.Format("Module invalid!"));
                    return;
                }
                info.ModuleID   = module.IntValue;
                info.ModuleName = module.Name;
                DateTime dtValue;
                if (!DateTime.TryParse(TxtUpdateDate.Text + " 00:00:00", out dtValue))
                {
                    ShowException(string.Format("UpdateDate invalid!"));
                    return;
                }
                info.OptDate = dtValue.ToString("yyyyMMdd");
                int intValue;
                if (!int.TryParse(TxtLevel.Text, out intValue) ||
                    intValue < 0 ||
                    intValue > 10)
                {
                    ShowException(string.Format("Level invalid!"));
                    return;
                }
                info.Level   = intValue;
                info.Content = TxtContent.Text;
                int langIDIndex = GetBugLangIDIndex(info.ModuleID);
                langIDIndex++;
                info.LangID       = string.Format("MC{0}{1}", info.ModuleID.ToString("0000"), langIDIndex.ToString("0000"));
                info.ModuleLangID = string.Format("M{0}", info.ModuleID.ToString("0000"));

                if (mDatabaseInfo == null)
                {
                    return;
                }
                bool bIsSucess = false;

                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (s, de) =>
                {
                    try
                    {
                        string           strConn = mDatabaseInfo.GetConnectionString();
                        int              dbType  = mDatabaseInfo.TypeID;
                        string           strSql;
                        IDbConnection    objConn;
                        IDbDataAdapter   objAdapter;
                        DbCommandBuilder objCmdBuilder;
                        switch (dbType)
                        {
                        case 2:
                            strSql        = string.Format("SELECT * FROM T_UPDATE_LIST WHERE 1 = 2");
                            objConn       = MssqlOperation.GetConnection(strConn);
                            objAdapter    = MssqlOperation.GetDataAdapter(objConn, strSql);
                            objCmdBuilder = MssqlOperation.GetCommandBuilder(objAdapter);
                            break;

                        case 3:
                            strSql        = string.Format("SELECT * FROM T_UPDATE_LIST WHERE 1 = 2");
                            objConn       = OracleOperation.GetConnection(strConn);
                            objAdapter    = OracleOperation.GetDataAdapter(objConn, strSql);
                            objCmdBuilder = OracleOperation.GetCommandBuilder(objAdapter);
                            break;

                        default:
                            ShowException(string.Format("DatabaseType invalid!"));
                            bIsSucess = false;
                            return;
                        }
                        if (objConn == null || objAdapter == null || objCmdBuilder == null)
                        {
                            ShowException(string.Format("DBObject is null"));
                            bIsSucess = false;
                            return;
                        }
                        objCmdBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                        objCmdBuilder.SetAllValues   = false;
                        try
                        {
                            DataSet objDataSet = new DataSet();
                            objAdapter.Fill(objDataSet);

                            DataRow dr = objDataSet.Tables[0].NewRow();
                            dr["C001"] = info.SerialNo;
                            dr["C002"] = info.Type;
                            dr["C003"] = info.ModuleID;
                            dr["C004"] = info.ModuleName;
                            dr["C005"] = info.OptDate;
                            dr["C006"] = info.Level;
                            dr["C007"] = info.Content;
                            dr["C008"] = info.LangID;
                            dr["C009"] = info.ModuleLangID;
                            dr["C010"] = mCurrentVersion.Display;

                            objDataSet.Tables[0].Rows.Add(dr);

                            objAdapter.Update(objDataSet);
                            objDataSet.AcceptChanges();

                            bIsSucess = true;
                        }
                        catch (Exception ex)
                        {
                            ShowException(string.Format("Fail.\t{0}", ex.Message));
                            bIsSucess = false;
                        }
                        finally
                        {
                            if (objConn.State == ConnectionState.Open)
                            {
                                objConn.Close();
                            }
                            objConn.Dispose();
                        }
                    }
                    catch (Exception ex)
                    {
                        ShowException(ex.Message);
                    }
                };
                worker.RunWorkerCompleted += (s, re) =>
                {
                    worker.Dispose();

                    if (bIsSucess)
                    {
                        AppendMessage(string.Format("Add end.\t{0}", info.SerialNo));

                        ReloaddBugInfos();
                    }
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Ejemplo n.º 9
0
        private void SaveSettings()
        {
            try
            {
                DatabaseInfo dbInfo     = new DatabaseInfo();
                var          dbTypeItem = ComboDBType.SelectedItem as ComboItem;
                if (dbTypeItem == null)
                {
                    ShowException(string.Format("DBType invalid!"));
                    return;
                }
                dbInfo.TypeID = dbTypeItem.IntValue;
                if (string.IsNullOrEmpty(TxtDBHost.Text))
                {
                    ShowException(string.Format("DBHost invalid!"));
                    return;
                }
                dbInfo.Host = TxtDBHost.Text;
                int intValue;
                if (string.IsNullOrEmpty(TxtDBPort.Text) ||
                    !int.TryParse(TxtDBPort.Text, out intValue))
                {
                    ShowException(string.Format("DBPort invalid!"));
                    return;
                }
                dbInfo.Port = intValue;
                if (string.IsNullOrEmpty(TxtDBName.Text))
                {
                    ShowException(string.Format("DBName invalid!"));
                    return;
                }
                dbInfo.DBName = TxtDBName.Text;
                if (string.IsNullOrEmpty(TxtDBUser.Text))
                {
                    ShowException(string.Format("DBUser Invalid!"));
                    return;
                }
                dbInfo.LoginName = TxtDBUser.Text;
                if (string.IsNullOrEmpty(TxtDBPassword.Password))
                {
                    ShowException(string.Format("Password invalid!"));
                    return;
                }
                dbInfo.Password     = TxtDBPassword.Password;
                dbInfo.RealPassword = dbInfo.Password;


                mDatabaseInfo       = dbInfo;
                mDBConnectionString = dbInfo.GetConnectionString();
                if (mUpdateConfig == null)
                {
                    return;
                }
                mUpdateConfig.DatabaseInfo   = mDatabaseInfo;
                mUpdateConfig.CurrentVersion = mCurrentVersion.StrValue;

                string          strPath   = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, UpdateConfig.FILE_NAME);
                OperationReturn optReturn = XMLHelper.SerializeFile(mUpdateConfig, strPath);
                if (!optReturn.Result)
                {
                    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                    return;
                }

                AppendMessage(string.Format("End.\t{0}", strPath));
                ReloaddBugInfos();
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Ejemplo n.º 10
0
        private OperationReturn ExtDBCommand(List <string> listParams)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                //ListParams
                //参考S000A1Codes中的定义
                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 strSql    = listParams[1];
                WriteOperationLog(
                    string.Format("GetDBInfo:\tUserID:{0};Sql:{1}",
                                  strUserID,
                                  strSql));
                strSql    = DecryptFromClient(strSql);
                optReturn = ReadDatabaseInfo();
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                DatabaseInfo dbInfo = optReturn.Data as DatabaseInfo;
                if (dbInfo == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DatabaseInfo is null");
                    return(optReturn);
                }
                string strConn = dbInfo.GetConnectionString();
                switch (dbInfo.TypeID)
                {
                case 2:
                    optReturn = MssqlOperation.ExecuteSql(strConn, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    break;

                case 3:
                    optReturn = OracleOperation.ExecuteSql(strConn, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("DBType invalid.\t{0}", dbInfo.TypeID);
                    return(optReturn);
                }
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
                return(optReturn);
            }
            return(optReturn);
        }
Ejemplo n.º 11
0
        protected override void InitSessionInfo()
        {
            base.InitSessionInfo();
            if (Session == null)
            {
                return;
            }
            Session.AppName  = "UMPS1600";
            Session.ModuleID = 1600;
            //Session.UserID = 1021401010000000151;
            //Session.UserInfo.UserID = 1021401010000000151;
            //Session.UserInfo.Account = "charley";
            //Session.UserInfo.UserName = "******";

            //Session.UserID = 1021401010000000152;
            //Session.UserInfo.UserID = 1021401010000000152;
            //Session.UserInfo.Account = "PFUser1";
            //Session.UserInfo.UserName = "******";

            Session.UserID            = 1020000000000000001;
            Session.UserInfo.UserID   = 1020000000000000001;
            Session.UserInfo.Account  = "administrator";
            Session.UserInfo.UserName = "******";

            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol     = "http";
            serverInfo.Address      = "192.168.6.7";
            serverInfo.Port         = 8081;
            serverInfo.SupportHttps = false;
            Session.AppServerInfo   = serverInfo;

            Session.LangTypeID          = 1028;
            Session.LangTypeInfo.LangID = 1028;

            //AppServerInfo serverInfo = new AppServerInfo();
            //serverInfo.Protocol = "https";
            //serverInfo.Address = "192.168.6.86";
            //serverInfo.Port = 8082;
            //serverInfo.SupportHttps = true;
            //Session.AppServerInfo = serverInfo;

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID              = 3;
            dbInfo.TypeName            = "ORCL";
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1521;
            dbInfo.DBName              = "PFOrcl";
            dbInfo.LoginName           = "PFDEV831";
            dbInfo.Password            = "******";
            Session.DatabaseInfo       = dbInfo;
            Session.DBType             = dbInfo.TypeID;
            Session.DBConnectionString = dbInfo.GetConnectionString();

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.TypeName = "MSSQL";
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB1027";
            //dbInfo.LoginName = "PFDEV";
            //dbInfo.Password = "******";
            //Session.DatabaseInfo = dbInfo;
            //Session.DBType = dbInfo.TypeID;
            //Session.DBConnectionString = dbInfo.GetConnectionString();
        }
Ejemplo n.º 12
0
        private OperationReturn ReadDatabaseInfo()
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "UMP.Server\\Args01.UMP.xml");
                if (!File.Exists(path))
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_FILE_NOT_EXIST;
                    optReturn.Message = string.Format("UMP.Server\\Args01.UMP.xml file not exist.\t{0}", path);
                    return(optReturn);
                }
                DatabaseInfo dbInfo = new DatabaseInfo();
                XmlDocument  doc    = new XmlDocument();
                doc.Load(path);
                XmlNode node = doc.SelectSingleNode("DatabaseParameters");
                if (node == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_CONFIG_INVALID;
                    optReturn.Message = string.Format("DatabaseParameters node not exist");
                    return(optReturn);
                }
                string      strValue;
                int         intValue;
                XmlNodeList listNodes = node.ChildNodes;
                for (int i = 0; i < listNodes.Count; i++)
                {
                    XmlNode temp = listNodes[i];
                    if (temp.Attributes != null)
                    {
                        var isEnableAttr = temp.Attributes["P03"];
                        if (isEnableAttr != null)
                        {
                            strValue = isEnableAttr.Value;
                            strValue = DecryptFromClient(strValue);
                            if (strValue != "1")
                            {
                                continue;
                            }
                        }
                        var attr = temp.Attributes["P02"];
                        if (attr != null)
                        {
                            strValue = attr.Value;
                            strValue = DecryptFromClient(strValue);
                            if (int.TryParse(strValue, out intValue))
                            {
                                dbInfo.TypeID = intValue;
                            }
                        }
                        attr = temp.Attributes["P04"];
                        if (attr != null)
                        {
                            strValue    = attr.Value;
                            strValue    = DecryptFromClient(strValue);
                            dbInfo.Host = strValue;
                        }
                        attr = temp.Attributes["P05"];
                        if (attr != null)
                        {
                            strValue = attr.Value;
                            strValue = DecryptFromClient(strValue);
                            if (int.TryParse(strValue, out intValue))
                            {
                                dbInfo.Port = intValue;
                            }
                        }
                        attr = temp.Attributes["P06"];
                        if (attr != null)
                        {
                            strValue      = attr.Value;
                            strValue      = DecryptFromClient(strValue);
                            dbInfo.DBName = strValue;
                        }
                        attr = temp.Attributes["P07"];
                        if (attr != null)
                        {
                            strValue         = attr.Value;
                            strValue         = DecryptFromClient(strValue);
                            dbInfo.LoginName = strValue;
                        }
                        attr = temp.Attributes["P08"];
                        if (attr != null)
                        {
                            strValue        = attr.Value;
                            dbInfo.Password = strValue;
                        }
                    }
                }
                dbInfo.RealPassword = DecryptFromClient(dbInfo.Password);
                optReturn.Data      = dbInfo;
                optReturn.Message   = dbInfo.GetConnectionString();
            }
            catch (Exception ex)
            {
                optReturn.Result    = false;
                optReturn.Code      = Defines.RET_FAIL;
                optReturn.Message   = ex.Message;
                optReturn.Exception = ex;
            }
            return(optReturn);
        }
Ejemplo n.º 13
0
        private void InitSessionInfo()
        {
            mSession = SessionInfo.CreateSessionInfo("Demo", 0, (int)AppType.UMPClient);
            RentInfo rentInfo = new RentInfo();

            rentInfo.ID       = ConstValue.RENT_DEFAULT;
            rentInfo.Token    = ConstValue.RENT_DEFAULT_TOKEN;
            rentInfo.Domain   = "voicecyber.com";
            rentInfo.Name     = "voicecyber";
            mSession.RentInfo = rentInfo;
            mSession.RentID   = ConstValue.RENT_DEFAULT;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = ConstValue.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            userInfo.Password = "******";
            mSession.UserInfo = userInfo;
            mSession.UserID   = ConstValue.USER_ADMIN;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID       = ConstValue.ROLE_SYSTEMADMIN;
            roleInfo.Name     = "System Admin";
            mSession.RoleInfo = roleInfo;
            mSession.RoleID   = ConstValue.ROLE_SYSTEMADMIN;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name     = "Style01";
            themeInfo.Color    = "Green";
            mSession.ThemeInfo = themeInfo;
            mSession.ThemeName = "Style01";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            mSession.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            mSession.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            mSession.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            mSession.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID   = 1033;
            langType.LangName = "en-us";
            langType.Display  = "English";
            mSession.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            mSession.SupportLangTypes.Add(langType);
            mSession.LangTypeInfo = langType;
            mSession.LangTypeID   = langType.LangID;

            langType          = new LangTypeInfo();
            langType.LangID   = 1028;
            langType.LangName = "zh-cn";
            langType.Display  = "繁体中文";
            mSession.SupportLangTypes.Add(langType);

            AppServerInfo appServerInfo = new AppServerInfo();

            appServerInfo.Protocol      = "http";
            appServerInfo.Address       = "192.168.6.63";
            appServerInfo.Port          = 8081;
            appServerInfo.SupportHttps  = false;
            appServerInfo.SupportNetTcp = false;
            mSession.AppServerInfo      = appServerInfo;

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB0304";
            //dbInfo.LoginName = "PFDEV";
            //dbInfo.Password = "******";
            //mSession.DatabaseInfo = dbInfo;
            //mSession.DBType = dbInfo.TypeID;
            //mSession.DBConnectionString = dbInfo.GetConnectionString();

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID               = 3;
            dbInfo.Host                 = "192.168.4.182";
            dbInfo.Port                 = 1521;
            dbInfo.DBName               = "PFOrcl";
            dbInfo.LoginName            = "pfdev832";
            dbInfo.Password             = "******";
            dbInfo.RealPassword         = "******";
            mSession.DatabaseInfo       = dbInfo;
            mSession.DBType             = dbInfo.TypeID;
            mSession.DBConnectionString = dbInfo.GetConnectionString();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 把更新后的版本写进数据库
        /// </summary>
        /// <returns></returns>
        public static OperationReturn WriteVersionToDB()
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = Defines.RET_SUCCESS;
            try
            {
                optReturn = Common.GetMachineID();
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                string       strMachineID  = optReturn.Data as string;
                DatabaseInfo dbInfo        = App.currDBInfo;
                string       strConnString = dbInfo.GetConnectionString();
                string       strSql        = string.Empty;
                switch (App.currDBInfo.TypeID)
                {
                case 2:
                    strSql    = "SELECT *  FROM T_00_000 where C000 = '{0}' and C001 = '{1}'";
                    strSql    = string.Format(strSql, App.strRent, strMachineID);
                    optReturn = MssqlOperation.GetDataSet(strConnString, strSql);
                    break;

                case 3:
                    strSql    = "SELECT *  FROM T_00_000 where C000 = '{0}' and C001 = '{1}'";
                    strSql    = string.Format(strSql, App.strRent, strMachineID);
                    optReturn = OracleOperation.GetDataSet(strConnString, strSql);
                    break;
                }
                if (!optReturn.Result)
                {
                    App.WriteLog("Get version failed. message : " + optReturn.Message);
                    return(optReturn);
                }
                DataSet ds = optReturn.Data as DataSet;
                if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
                {
                    //记录不存在 新增
                    switch (dbInfo.TypeID)
                    {
                    case 2:
                        strSql    = "insert into T_00_000(C000,C001,C002,C003,C004,C005,C006,C009) values ('{0}','{1}','{2}','SP','1','{3}','{4}','Service Pack Version')";
                        strSql    = string.Format(strSql, App.strRent, strMachineID, App.updateInfo.Version, DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss"), DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss"));
                        optReturn = MssqlOperation.ExecuteSql(strConnString, strSql);
                        break;

                    case 3:
                        strSql    = "insert into T_00_000(C000,C001,C002,C003,C004,C005,C006,C009) values ('{0}','{1}','{2}','SP','1',TO_DATE('{3}','YYYY-MM-DD HH24:MI:SS'),TO_DATE('{4}','YYYY-MM-DD HH24:MI:SS'),'Service Pack Version')";
                        strSql    = string.Format(strSql, App.strRent, strMachineID, App.updateInfo.Version, DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss"), DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss"));
                        optReturn = OracleOperation.ExecuteSql(strConnString, strSql);
                        break;
                    }
                    if (!optReturn.Result)
                    {
                        App.WriteLog("Insert sp version failed. message : " + optReturn.Message);
                        return(optReturn);
                    }
                    else
                    {
                        App.WriteLog("Update version to " + App.updateInfo.Version);
                    }
                }
                else
                {
                    switch (dbInfo.TypeID)
                    {
                    case 2:
                        strSql    = "update t_00_000 set C002 = '{0}' where C000 = '{1}'";
                        strSql    = string.Format(strSql, App.updateInfo.Version, App.strRent);
                        optReturn = MssqlOperation.ExecuteSql(strConnString, strSql);
                        break;

                    case 3:
                        strSql    = "update t_00_000 set C002 = '{0}' where C000 = '{1}'";
                        strSql    = string.Format(strSql, App.updateInfo.Version, App.strRent);
                        optReturn = OracleOperation.ExecuteSql(strConnString, strSql);
                        break;
                    }
                    if (!optReturn.Result)
                    {
                        App.WriteLog("Insert sp version failed. message : " + optReturn.Message);
                        return(optReturn);
                    }
                    else
                    {
                        App.WriteLog("Update version to " + App.updateInfo.Version);
                    }
                }
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = ConstDefines.Write_Version_To_DB_Exception;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 主机接替备机时 更新资源表
        /// </summary>
        /// <param name="dbInfo">数据库连接信息</param>
        /// <param name="strRelpaceModuleNumber">要接替的主机key</param>
        /// <param name="strResourceKey">备机key</param>
        /// <returns></returns>
        public static OperationReturn UpdateReplaceModuleNumberInDB(DatabaseInfo dbInfo, string strRelpaceModuleNumber, string strResourceKey)
        {
            OperationReturn optReturn = new OperationReturn();

            try
            {
                string strConnectString = dbInfo.GetConnectionString();
                //先找到备机对应的资源ID
                string strSql = string.Empty;
                switch (dbInfo.TypeID)
                {
                case 2:
                    strSql    = "select * from t_11_101_{0} where C001 >2210000000000000000 and C001 <2220000000000000000 and C002 =1 and C014 in( {1},{2})";
                    strSql    = string.Format(strSql, "00000", strResourceKey, strRelpaceModuleNumber);
                    optReturn = MssqlOperation.GetDataSet(strConnectString, strSql);
                    break;

                case 3:
                    strSql    = "select * from t_11_101_{0} where C001 >2210000000000000000 and C001 <2220000000000000000 and C002 =1 and C014 in( {1},{2})";
                    strSql    = string.Format(strSql, "00000", strResourceKey, strRelpaceModuleNumber);
                    optReturn = OracleOperation.GetDataSet(strConnectString, strSql);
                    break;
                }

                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                DataSet ds = optReturn.Data as DataSet;
                if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
                {
                    optReturn.Result = false;
                    return(optReturn);
                }
                //定义两个变量 来保存主备机器的资源ID
                string strMainResID   = string.Empty;
                string strBackupResID = string.Empty;
                string strKey         = string.Empty;
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    strKey = row["C012"].ToString();
                    if (strKey == strResourceKey)
                    {
                        strBackupResID = row["C001"].ToString();
                        continue;
                    }
                    else if (strKey == strRelpaceModuleNumber)
                    {
                        strMainResID = row["C001"].ToString();
                    }
                }

                //判断备机资源的standbyrole是不是3
                switch (dbInfo.TypeID)
                {
                case 2:
                    strSql    = "select * from t_11_101_{0} where C001 ={1} and C002 = 2";
                    strSql    = string.Format(strSql, "00000", strBackupResID);
                    optReturn = MssqlOperation.GetDataSet(strConnectString, strSql);
                    break;

                case 3:
                    strSql    = "select * from t_11_101_{0} where C001 ={1} and C002 = 2";
                    strSql    = string.Format(strSql, "00000", strBackupResID);
                    optReturn = OracleOperation.GetDataSet(strConnectString, strSql);
                    break;
                }
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                ds = optReturn.Data as DataSet;
                if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
                {
                    optReturn.Result = false;
                    return(optReturn);
                }
                string strStandbyrole = ds.Tables[0].Rows[0]["C012"].ToString();
                if (strStandbyrole != "3")
                {
                    optReturn.Result = false;
                    return(optReturn);
                }
                //更新备机的RelpaceModuleNumber
                switch (dbInfo.TypeID)
                {
                case 2:
                    strSql    = "update t_11_101_{0} set C011 = '{1}' where C001 = {2} and C002 = 3";
                    strSql    = string.Format(strSql, "00000", strRelpaceModuleNumber, strBackupResID);
                    optReturn = MssqlOperation.ExecuteSql(strConnectString, strSql);
                    break;

                case 3:
                    strSql    = "UPDATE t_11_101_{0} SET C011 = '{1}' where C001 = {2} and C002 = 3";
                    strSql    = string.Format(strSql, "00000", strRelpaceModuleNumber, strBackupResID);
                    optReturn = OracleOperation.ExecuteSql(strConnectString, strSql);
                    break;
                }
                if (!optReturn.Result)
                {
                    return(optReturn);
                }

                //更新主机的RelpaceModuleNumber
                switch (dbInfo.TypeID)
                {
                case 2:
                    strSql    = "update t_11_101_{0} set C011 = '{1}' where C001 = {2} and C002 = 3";
                    strSql    = string.Format(strSql, "00000", strResourceKey, strMainResID);
                    optReturn = MssqlOperation.ExecuteSql(strConnectString, strSql);
                    break;

                case 3:
                    strSql    = "UPDATE t_11_101_{0} SET C011 = '{1}' where C001 = {2} and C002 = 3";
                    strSql    = string.Format(strSql, "00000", strResourceKey, strMainResID);
                    optReturn = OracleOperation.ExecuteSql(strConnectString, strSql);
                    break;
                }
                if (!optReturn.Result)
                {
                    return(optReturn);
                }

                optReturn.Result = true;
                optReturn.Code   = Defines.RET_SUCCESS;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
            }

            return(optReturn);
        }
Ejemplo n.º 16
0
        void BtnTest_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                #region 生成配置文件

                //UpdateConfig config = new UpdateConfig();
                //config.CurrentVersion = "803001P02000";
                //ModuleInfo module = new ModuleInfo();
                //module.ModuleID = 3102;
                //module.MasterID = 31;
                //module.ModuleName = "Query";
                //module.Display = "查询";
                //config.ListModuleInfos.Add(module);

                //string strPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, UpdateConfig.FILE_NAME);
                //OperationReturn optReturn = XMLHelper.SerializeFile(config, strPath);
                //if (!optReturn.Result)
                //{
                //    ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                //    return;
                //}

                //AppendMessage(string.Format("End.\t{0}", strPath));

                #endregion


                #region 导出语言包

                DatabaseInfo dbInfo = new DatabaseInfo();
                dbInfo.TypeID       = 3;
                dbInfo.Host         = "192.168.4.182";
                dbInfo.Port         = 1521;
                dbInfo.DBName       = "PFOrcl";
                dbInfo.LoginName    = "PFDEV832";
                dbInfo.Password     = "******";
                dbInfo.RealPassword = dbInfo.Password;

                List <int> listLangIDs = new List <int>();
                listLangIDs.Add(1033);
                listLangIDs.Add(1028);
                listLangIDs.Add(1041);
                listLangIDs.Add(2052);

                for (int i = 0; i < listLangIDs.Count; i++)
                {
                    int             langTypeID  = listLangIDs[i];
                    string          strLangName = langTypeID.ToString();
                    string          strConn     = dbInfo.GetConnectionString();
                    string          strSql;
                    OperationReturn optReturn;
                    switch (dbInfo.TypeID)
                    {
                    case 2:
                        strSql    = string.Format("SELECT * FROM T_00_005 WHERE C001 = {0} ORDER BY C001,C002", langTypeID);
                        optReturn = MssqlOperation.GetDataSet(strConn, strSql);
                        break;

                    case 3:
                        strSql    = string.Format("SELECT * FROM T_00_005 WHERE C001 = {0} ORDER BY C001,C002", langTypeID);
                        optReturn = OracleOperation.GetDataSet(strConn, strSql);
                        break;

                    default:
                        AppendMessage(string.Format("Fail.\t DBType invalid"));
                        continue;
                    }
                    if (!optReturn.Result)
                    {
                        AppendMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    DataSet objDataSet = optReturn.Data as DataSet;
                    if (objDataSet == null ||
                        objDataSet.Tables.Count <= 0)
                    {
                        AppendMessage(string.Format("DataSet is null or DataTable not exist."));
                        continue;
                    }
                    LangLister lister = new LangLister();
                    lister.LangID   = langTypeID;
                    lister.LangName = strLangName;
                    lister.Path     = string.Format("{0}.XML", langTypeID);
                    int count = objDataSet.Tables[0].Rows.Count;
                    for (int j = 0; j < count; j++)
                    {
                        DataRow dr = objDataSet.Tables[0].Rows[j];

                        LanguageInfo langInfo = new LanguageInfo();
                        langInfo.LangID    = langTypeID;
                        langInfo.Name      = dr["C002"].ToString();
                        langInfo.Module    = Convert.ToInt32(dr["C009"]);
                        langInfo.SubModule = Convert.ToInt32(dr["C010"]);
                        langInfo.Page      = dr["C011"].ToString();
                        langInfo.ObjName   = dr["C012"].ToString();
                        string display = string.Empty;
                        display         += dr["C005"].ToString();
                        display         += dr["C006"].ToString();
                        display         += dr["C007"].ToString();
                        display         += dr["C008"].ToString();
                        langInfo.Display = display;

                        lister.ListLangInfos.Add(langInfo);
                    }

                    string strPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, lister.Path);
                    optReturn = XMLHelper.SerializeFile(lister, strPath);
                    if (!optReturn.Result)
                    {
                        AppendMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                        continue;
                    }
                    AppendMessage(string.Format("End.\t{0}\t{1}", strPath, count));
                }
                AppendMessage(string.Format("End."));

                #endregion
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Ejemplo n.º 17
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            webReturn.Result = true;
            webReturn.Code   = 0;
            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptString04(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (webRequest.Code)
                {
                case (int)S1600RequestCode.ChangeUserStatus:
                    optReturn = ChangeUserStatus(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result = false;
                        webReturn.Code   = optReturn.Code;
                        return(webReturn);
                    }
                    break;

                case (int)S1600RequestCode.GetCookieStatus:
                    optReturn         = GetCookieStatusByID(session, webRequest.ListData);
                    webReturn.Message = optReturn.Message;
                    if (!optReturn.Result)
                    {
                        webReturn.Result = false;
                        webReturn.Code   = optReturn.Code;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;
                }
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
            return(webReturn);
        }
Ejemplo n.º 18
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            webReturn.Result = true;
            webReturn.Code   = 0;
            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptString(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                optReturn = XMLHelper.DeserializeObject <ServerRequestInfo>(webRequest.Data);
                if (!optReturn.Result)
                {
                    webReturn.Result  = false;
                    webReturn.Code    = optReturn.Code;
                    webReturn.Message = optReturn.Message;
                    return(webReturn);
                }
                ServerRequestInfo request = optReturn.Data as ServerRequestInfo;
                if (request == null)
                {
                    webReturn.Result  = false;
                    webReturn.Code    = Defines.RET_OBJECT_NULL;
                    webReturn.Message = string.Format("RequestInfo is null");
                    return(webReturn);
                }
                switch (request.Command)
                {
                case (int)ServerRequestCommand.GetDiskDriverList:
                    optReturn = GetDiskDriverList(request);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)ServerRequestCommand.GetChildDirectoryList:
                    optReturn = GetChildDirectoryList(request);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)ServerRequestCommand.GetChildFileList:
                    optReturn = GetChildFileList(request);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)ServerRequestCommand.GetNetworkCardList:
                    optReturn = GetNetworkCardList(request);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)ServerRequestCommand.GetCTIServiceName:
                    optReturn = GetCTIServiceName(request);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)ServerRequestCommand.GetServerName:

                    break;

                case (int)ServerRequestCommand.SetResourceChanged:
                    optReturn = SetResourceChanged(request);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;

                default:
                    webReturn.Result  = false;
                    webReturn.Code    = Defines.RET_PARAM_INVALID;
                    webReturn.Message = string.Format("Request code invalid.\t{0}", webRequest.Code);
                    return(webReturn);
                }
                webReturn.Message = optReturn.Message;
                return(webReturn);
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
        }
Ejemplo n.º 19
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            webReturn.Result = true;
            webReturn.Code   = 0;
            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptFromClient(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (webRequest.Code)
                {
                case (int)S5100RequestCode.AddBookmarkLevel:
                    optReturn = AddBookmarkLevel(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data as string;
                    break;

                case (int)S5100RequestCode.GetAllBookmarkLevels:
                    optReturn = GetAllBookmarkLevels(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S5100RequestCode.GetAllKeyWorlds:
                    optReturn = GetAllKeyWorlds(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S5100RequestCode.AddKeyWorld:
                    optReturn         = AddKeyWorld(session, webRequest.ListData);
                    webReturn.Message = optReturn.Message;
                    if (!optReturn.Result)
                    {
                        if (optReturn.Code > (int)S5100WcfErrorCode.GenerateKeyWorldXmlException)
                        {
                            webReturn.Data = optReturn.Data as string;
                        }
                        webReturn.Result = false;
                        webReturn.Code   = optReturn.Code;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data as string;
                    break;

                case (int)S5100RequestCode.ModifyKeyWorld:
                    optReturn = ModifyKeyWorld(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        if (optReturn.Code > (int)S5100WcfErrorCode.GenerateKeyWorldXmlException)
                        {
                            webReturn.Data = optReturn.Data as string;
                        }
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;

                case (int)S5100RequestCode.DeleteKeyWorld:
                    optReturn = DeleteKeyWorld(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;

                case (int)S5100RequestCode.ModifyBookmarkLevel:
                    optReturn = ModifyBookmarkLevel(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;

                case (int)S5100RequestCode.SetBookmarkLevelStatus:
                    optReturn = SetLevelStatus(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;

                case (int)S5100RequestCode.DeleteBookmarkLevel:
                    optReturn = DeleteBookmarkLevel(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
            return(webReturn);
        }
Ejemplo n.º 20
0
        public static void Init()
        {
            string path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"UMP.Client");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            Session                = new SessionInfo();
            Session.SessionID      = Guid.NewGuid().ToString();
            Session.AppName        = AppName;
            Session.LastActiveTime = DateTime.Now;
            Session.UserID         = S3104Consts.USER_ADMIN;


            //PartitionTableInfo partInfo = new PartitionTableInfo();
            //partInfo.TableName = ConstValue.TABLE_NAME_RECORD;
            //partInfo.PartType = TablePartType.DatetimeRange;
            //partInfo.Other1 = ConstValue.TABLE_FIELD_NAME_RECORD_STARTRECORDTIME;
            //Session.ListPartitionTables.Add(partInfo);
            //partInfo = new PartitionTableInfo();
            //partInfo.TableName = ConstValue.TABLE_NAME_OPTLOG;
            //partInfo.PartType = TablePartType.DatetimeRange;
            //partInfo.Other1 = ConstValue.TABLE_FIELD_NAME_OPTLOG_OPERATETIME;
            //Session.ListPartitionTables.Add(partInfo);


            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = S3104Consts.RENT_DEFAULT;
            rentInfo.Token   = S3104Consts.RENT_DEFAULT_TOKEN;
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = S3104Consts.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            Session.UserInfo  = userInfo;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = S3104Consts.ROLE_SYSTEMADMIN;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;

            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol     = "https";
            serverInfo.Address      = "192.168.6.27";
            serverInfo.Port         = 8082;
            serverInfo.SupportHttps = true;
            Session.AppServerInfo   = serverInfo;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name    = "Default";
            themeInfo.Color   = "Brown";
            Session.ThemeInfo = themeInfo;
            Session.ThemeName = "Default";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID      = 1033;
            langType.LangName    = "en-US";
            langType.Display     = "English(U.S.)";
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = 1033;
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-CN";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 1028;
            langType.LangName = "tc-CN";
            langType.Display  = "繁體中文";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 1041;
            langType.LangName = "jp-JP";
            langType.Display  = "日本语";
            Session.SupportLangTypes.Add(langType);

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID              = 3;
            dbInfo.TypeName            = "ORCL";
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1521;
            dbInfo.DBName              = "PFOrcl";
            dbInfo.LoginName           = "PFDEV_TEST";
            dbInfo.Password            = "******";
            Session.DBType             = dbInfo.TypeID;
            Session.DBConnectionString = dbInfo.GetConnectionString();
            Session.DatabaseInfo       = dbInfo;

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.TypeName = "MSSQL";
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB0826";
            //dbInfo.LoginName = "PFDEV";
            //dbInfo.Password = "******";
            //Session.DBConnectionString = dbInfo.GetConnectionString();
            //Session.DatabaseInfo = dbInfo;


            Session.InstallPath = @"C:\UMPRelease";
            WriteLog("AppInit", string.Format("SessionInfo inited."));
        }
Ejemplo n.º 21
0
        protected override void InitSessionInfo()
        {
            base.InitSessionInfo();

            if (Session == null)
            {
                return;
            }

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = ConstValue.ROLE_SYSTEMADMIN;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;
            //Session.RoleID = ConstValue.RESOURCE_USER;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = ConstValue.USER_ADMIN;
            userInfo.Account  = "a";
            userInfo.UserName = "******";
            userInfo.Password = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = ConstValue.USER_ADMIN;

            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol     = "http";
            serverInfo.Address      = "192.168.6.114";
            serverInfo.Port         = 8081;
            serverInfo.SupportHttps = false;
            Session.AppServerInfo   = serverInfo;

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID              = 3;
            dbInfo.TypeName            = "ORCL";
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1521;
            dbInfo.DBName              = "PFOrcl";
            dbInfo.LoginName           = "PFDEV832";
            dbInfo.Password            = "******";
            dbInfo.RealPassword        = "******";
            Session.DatabaseInfo       = dbInfo;
            Session.DBType             = dbInfo.TypeID;
            Session.DBConnectionString = dbInfo.GetConnectionString();

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB1031";
            //dbInfo.LoginName = "PFDEV";
            //dbInfo.Password = "******";
            //dbInfo.RealPassword = "******";
            //Session.DatabaseInfo = dbInfo;
            //Session.DBType = dbInfo.TypeID;
            //Session.DBConnectionString = dbInfo.GetConnectionString();

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.TypeName = "MSSQL";
            //dbInfo.Host = "192.168.9.236";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB20160427";
            //dbInfo.LoginName = "sa";
            //dbInfo.Password = "******";
            //Session.DatabaseInfo = dbInfo;
            //Session.DBType = dbInfo.TypeID;
            //Session.DBConnectionString = dbInfo.GetConnectionString();


            //分表之类的参数
            //Session.ListPartitionTables.Clear();
            //PartitionTableInfo partInfo = new PartitionTableInfo();
            //partInfo.TableName = ConstValue.TABLE_NAME_RECORD;
            //partInfo.PartType = TablePartType.DatetimeRange;
            //partInfo.Other1 = ConstValue.TABLE_FIELD_NAME_RECORD_STARTRECORDTIME;
            //Session.ListPartitionTables.Add(partInfo);

            StartArgs = "1105";
        }
Ejemplo n.º 22
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            webReturn.Result = true;
            webReturn.Code   = 0;
            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptFromClient(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (webRequest.Code)
                {
                case (int)S2501Codes.GetAlarmMessageList:
                    optReturn = GetAlarmMessageList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S2501Codes.GetAlarmInfoList:
                    optReturn = GetAlarmInfomationList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S2501Codes.GetAlarmReceiverList:
                    optReturn = GetAlarmReveiverList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S2501Codes.SaveAlarmInfoList:
                    optReturn = SaveAlarmInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S2501Codes.RemoveAlarmInfoList:
                    optReturn = RemoveAlarmInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S2501Codes.SaveAlarmReceiverList:
                    optReturn = SaveAlarmReceiverList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                default:
                    webReturn.Result  = false;
                    webReturn.Code    = Defines.RET_PARAM_INVALID;
                    webReturn.Message = string.Format("Request code invalid.\t{0}", webRequest.Code);
                    return(webReturn);
                }
                webReturn.Message = optReturn.Message;
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
            return(webReturn);
        }
Ejemplo n.º 23
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            webReturn.Result = true;
            webReturn.Code   = 0;
            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptFromClient(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (webRequest.Code)
                {
                case (int)S1110Codes.GetResourcePropertyInfoList:
                    optReturn = GetResourcePropertyInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.GetResourcePropertyValueList:
                    optReturn = GetResourcePropertyValueList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.GetResourceTypeParamList:
                    optReturn = GetResourceTypeParamList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.GetResourceGroupParamList:
                    optReturn = GetResourceGroupParamList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.GetBasicInfoDataList:
                    optReturn = GetBasicInfoDataList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.GetSftpUserList:
                    optReturn = GetSftpUserList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.GetBasicResourceInfoList:
                    optReturn = GetBasicResourceInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.GetResouceObjectList:
                    optReturn = GetResourceObjectList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.SaveResourcePropertyData:
                    optReturn = SaveResourcePropertyData(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.SaveResourceChildObjectData:
                    optReturn = SaveResourceChildObjectData(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S1110Codes.RemoveResourceObjectData:
                    optReturn = RemoveResourceObjectData(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S1110Codes.GenerateResourceXml:
                    optReturn = GenerateResourceXml(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                default:
                    webReturn.Result  = false;
                    webReturn.Code    = Defines.RET_PARAM_INVALID;
                    webReturn.Message = string.Format("Request code invalid.\t{0}", webRequest.Code);
                    return(webReturn);
                }
                webReturn.Message = optReturn.Message;
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
            return(webReturn);
        }
Ejemplo n.º 24
0
        protected override void InitSessionInfo()
        {
            base.InitSessionInfo();

            if (Session == null)
            {
                return;
            }
            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol     = "http";
            serverInfo.Address      = "192.168.6.114";
            serverInfo.Port         = 8081;
            serverInfo.SupportHttps = false;
            Session.AppServerInfo   = serverInfo;

            //AppServerInfo serverInfo = new AppServerInfo();
            //serverInfo.Protocol = "http";
            //serverInfo.Address = "192.168.8.96";
            //serverInfo.Port = 8081;
            //serverInfo.SupportHttps = false;
            //Session.AppServerInfo = serverInfo;

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 3;
            //dbInfo.TypeName = "ORCL";
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1521;
            //dbInfo.DBName = "PFOrcl";
            //dbInfo.LoginName = "PFDEV";
            //dbInfo.Password = "******";
            //Session.DatabaseInfo = dbInfo;
            //Session.DBType = dbInfo.TypeID;
            //Session.DBConnectionString = dbInfo.GetConnectionString();

            DatabaseInfo dbInfo = new DatabaseInfo();

            //dbInfo.TypeID = 3;
            //dbInfo.TypeName = "ORCL";
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1521;
            //dbInfo.DBName = "PFOrcl";
            //dbInfo.LoginName = "PFDEV832";
            //dbInfo.Password = "******";
            //dbInfo.RealPassword = "******";
            //Session.DatabaseInfo = dbInfo;
            //Session.DBType = dbInfo.TypeID;
            //Session.DBConnectionString = dbInfo.GetConnectionString();
            //StartArgs = "1111";
            dbInfo.TypeID              = 2;
            dbInfo.TypeName            = "MSSQL";
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1433;
            dbInfo.DBName              = "UMPDataDB1031";
            dbInfo.LoginName           = "PFDEV";
            dbInfo.Password            = "******";
            dbInfo.RealPassword        = "******";
            Session.DatabaseInfo       = dbInfo;
            Session.DBType             = dbInfo.TypeID;
            StartArgs                  = "1111";
            Session.DBConnectionString = dbInfo.GetConnectionString();
        }
Ejemplo n.º 25
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            webReturn.Result = true;
            webReturn.Code   = 0;
            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptFromClient(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (webRequest.Code)
                {
                case (int)S2400RequestCode.GetEmailInfo:
                    optReturn = GetEmailInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data as string;
                    break;

                case (int)S2400RequestCode.UpdateEmailInfo:
                    optReturn = UpdateEmailInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
            }
            return(webReturn);
        }
Ejemplo n.º 26
0
        public WebReturn DoOperation(WebRequest webRequest)
        {
            WebReturn webReturn = new WebReturn();

            webReturn.Result = true;
            webReturn.Code   = 0;
            if (webRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = webRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn;
                DatabaseInfo    dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptString04(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (webRequest.Code)
                {
                case (int)S3102Codes.GetAllCustomConditionItem:
                    optReturn = GetAllCustomCondition(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetUserQueryCondition:
                    optReturn = GetUserQueryCondition(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetUserCustomConditionItem:
                    optReturn = GetUserCustomConditionItem(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetConditionSubItem:
                    optReturn = GetConditionSubItem(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetQueryConditionDetail:
                    optReturn = GetQueryConditionDetail(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.CreateQueryConditionString:
                    optReturn = CreateQueryConditionString(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetRecordData:
                    optReturn = GetRecordData(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveConditions:
                    optReturn = SaveConditions(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.SaveConditionSubItems:
                    optReturn = SaveConditionSubItems(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.GetControlOrgInfoList:
                    optReturn = GetControlOrgInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetControlAgentInfoList:
                    optReturn = GetControlAgentInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetControlExtensionInfoList:
                    optReturn = GetControlExtensionInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetControlRealExtensionInfoList:
                    optReturn = GetControlRealExtensionInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetRecordMemoList:
                    optReturn = GetRecordMemoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveRecordMemoInfo:
                    optReturn = SaveRecordMemoInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.GetUserScoreSheetList:
                    optReturn = GetUserScoreSheetList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetScoreSheetInfo:
                    optReturn = GetScoreSheetInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.GetScoreResultList:
                    optReturn = GetScoreResultList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetScoreCommentResultList:
                    optReturn = GetScoreCommentResultList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveScoreSheetResult:
                    optReturn = SaveScoreSheetResult(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.SaveScoreItemResult:
                    optReturn = SaveScoreItemResultInfo(session, webRequest.ListData);
                    //FileLog.WriteInfo("SaveScoreItemResult", "1");
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveScoreDataResult:
                    optReturn = SaveScoreDataResult(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveScoreCommentResultInfos:
                    optReturn = SaveScoreCommentResultInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetUserSettingList:
                    optReturn = GetUserSettingList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveUserSettingInfos:
                    optReturn = SaveUserSettingInfos(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveViewColumnInfos:
                    optReturn = SaveViewColumnInfos(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveUserConditionItemInfos:
                    optReturn = SaveUserConditionItemInfos(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SavePlayInfo:
                    optReturn = SavePlayInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetPlayInfoList:
                    optReturn = GetPlayInfoList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.InsertConditionSubItems:
                    optReturn = InsertConditionSubItems(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.InsertManageObjectQueryInfos:
                    optReturn = InsertManageObjectQueryInfos(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.GetRecordBookmarkList:
                    optReturn = GetRecordBookmarkList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetSftpServerList:
                    optReturn = GetSftpServerList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetDownloadParamList:
                    optReturn = GetDownloadParamList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetRelativeRecordList:
                    optReturn = GetRelativeRecordList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveRecordBookmarkInfo:
                    optReturn = SaveRecordBookmarkInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetBookmarkRankList:
                    optReturn = GetBookmarkRankList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveBookmarkRankInfo:
                    optReturn = SaveBookmarkRankInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveMemoInfoToT_21_001:
                    optReturn = SaveMemoInfoToT_21_001(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.SaveBookMarkTitleToT_21_001:
                    optReturn = SaveBookMarkTitleToT_21_001(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetInspectorList:
                    optReturn = GetInspectorList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetAllScoreSheetList:
                    optReturn = GetAllScoreSheetList(session);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetRecordScoreDetail:
                    optReturn = GetRecordScoreDetail(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.IsComplainedRecord:
                    optReturn = IsComplainedRecord(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data as string;
                    break;

                case (int)S3102Codes.IsTaskedRecord:
                    optReturn = IsTaskedRecord(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data as string;
                    break;

                case (int)S3102Codes.GetSkillGroupInfo:
                    optReturn = GetSkillGroupInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetOrgSkillGroupInf:
                    optReturn = GetOrgSkillGroupInf(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetOrgList:
                    optReturn = GetOrgList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetAgentList:
                    optReturn = GetAgentList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetExtensionList:
                    optReturn = GetExtensionList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.ExecuteStrSql:
                    optReturn = ExecuteStrSql(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetLibraryFolder:
                    optReturn = GetLibraryFolder(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetLibraryFolderContent:
                    optReturn = GetLibraryFolderContent(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.GetConversationInfo:
                    optReturn = GetConversationInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.InsertLearningToLibrary:
                    optReturn = InsertLearningToLibrary(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data as string;
                    break;

                case (int)S3102Codes.GetAutoScore:
                    optReturn = GetAutoScore(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.UpLoadFiles:
                    optReturn = UMPUpOperation(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    //webReturn.ListData = optReturn.Data as List<string>;
                    break;

                case (int)S3102Codes.DeleteUsersRecordBookMark:
                    optReturn = DeleteUsersRecordBookMark(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data as string;
                    break;

                case (int)S3102Codes.GetKeyWordsInfo:
                    optReturn = GetKeyWordsInfo(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                case (int)S3102Codes.UMPDeleteOperation:
                    optReturn = UMPDeleteOperation(webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    break;

                case (int)S3102Codes.GetBookMarkRecordPath:
                    optReturn = GetBookMarkRecordPath();
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.SaveQueryResult:
                    optReturn = SaveQueryResult(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data == null ? string.Empty : optReturn.Data.ToString();
                    break;

                case (int)S3102Codes.GetKeywordResultList:
                    optReturn = GetKeywordResultList(session, webRequest.ListData);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.ListData = optReturn.Data as List <string>;
                    break;

                default:
                    webReturn.Result  = false;
                    webReturn.Code    = Defines.RET_PARAM_INVALID;
                    webReturn.Message = string.Format("Request code invalid.\t{0}", webRequest.Code);
                    return(webReturn);
                }
                webReturn.Message = optReturn.Message;
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
            return(webReturn);
        }
Ejemplo n.º 27
0
        public WebReturn UploadOperation(UploadRequest uploadRequest)
        {
            WebReturn webReturn = new WebReturn();

            webReturn.Result = true;
            webReturn.Code   = 0;
            if (uploadRequest == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("WebRequest is null");
                return(webReturn);
            }
            SessionInfo session = uploadRequest.Session;

            if (session == null)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_PARAM_INVALID;
                webReturn.Message = string.Format("SessionInfo is null");
                return(webReturn);
            }
            webReturn.Session = session;
            try
            {
                OperationReturn optReturn = new OperationReturn();
                DatabaseInfo    dbInfo    = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = DecryptString04(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }
                switch (uploadRequest.Code)
                {
                case (int)RequestCode.WSUploadFile:
                    optReturn = UploadFile(session, uploadRequest);
                    if (!optReturn.Result)
                    {
                        webReturn.Result  = false;
                        webReturn.Code    = optReturn.Code;
                        webReturn.Message = optReturn.Message;
                        return(webReturn);
                    }
                    webReturn.Data = optReturn.Data.ToString();
                    break;

                default:
                    webReturn.Result  = false;
                    webReturn.Code    = Defines.RET_PARAM_INVALID;
                    webReturn.Message = string.Format("Request code invalid.\t{0}", uploadRequest.Code);
                    return(webReturn);
                }
                webReturn.Message = optReturn.Message;
            }
            catch (Exception ex)
            {
                webReturn.Result  = false;
                webReturn.Code    = Defines.RET_FAIL;
                webReturn.Message = ex.Message;
                return(webReturn);
            }
            return(webReturn);
        }
Ejemplo n.º 28
0
        public static OperationReturn GetAllMachines(DatabaseInfo dbInfo)
        {
            Dictionary <int, MachineInfo> lstMachines = new Dictionary <int, MachineInfo>();
            string          strConnectString          = dbInfo.GetConnectionString();
            OperationReturn optReturn = new OperationReturn();
            string          strSql    = string.Empty;

            switch (dbInfo.TypeID)
            {
            case 2:
                strSql = "select a.C001,a.C012,b.c011,a.c002 as A002 ,b.c002 as B002,a.C017,c.C012 as D012 from t_11_101_{0} a " +
                         "left join t_11_101_{0} b on a.c001 = b.c001 " +
                         "left join t_11_101_{0} c on a.c001 = c.c001 " +
                         "where a.C001 >2210000000000000000 and a.C001 <2220000000000000000 and a.C002 =1 " +
                         "and  b.C001 >2210000000000000000 and b.C001 <2220000000000000000 and b.C002 =3 " +
                         " and c.C001 >2210000000000000000 and c.C001 <2220000000000000000 and c.C002 =2 ";
                strSql    = string.Format(strSql, "00000", "00000");
                optReturn = MssqlOperation.GetDataSet(strConnectString, strSql);
                break;

            case 3:
                strSql = "select a.C001,a.C012,b.c011,a.c002 as A002 ,b.c002 as B002,a.C017,c.C012 as D012 from t_11_101_{0} a " +
                         "left join t_11_101_{0} b on a.c001 = b.c001 " +
                         "left join t_11_101_{0} c on a.c001 = c.c001 " +
                         "where a.C001 >2210000000000000000 and a.C001 <2220000000000000000 and a.C002 =1 " +
                         "and  b.C001 >2210000000000000000 and b.C001 <2220000000000000000 and b.C002 =3 " +
                         " and c.C001 >2210000000000000000 and c.C001 <2220000000000000000 and c.C002 =2 ";
                strSql    = string.Format(strSql, "00000", "00000");
                optReturn = OracleOperation.GetDataSet(strConnectString, strSql);
                break;
            }
            if (!optReturn.Result)
            {
                optReturn.Message = "GetAllMachines error ,sql = " + strSql;
                return(optReturn);
            }
            DataSet ds = optReturn.Data as DataSet;

            if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
            {
                optReturn.Data = lstMachines;
                return(optReturn);
            }
            MachineInfo machine = null;

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                try
                {
                    machine     = new MachineInfo();
                    machine.Key = int.Parse(row["C012"].ToString());
                    machine.ReplaceModuleNumber = row["C011"].ToString();
                    machine.ResID       = long.Parse(row["C001"].ToString());
                    machine.Host        = Common.DecodeEncryptValue(row["C017"].ToString());
                    machine.StandByRole = row["D012"].ToString();
                    lstMachines.Add(machine.Key, machine);
                }
                catch (Exception ex)
                {
                }
                //lstMachines.Add(int.Parse(row["C012"].ToString()), row["C011"].ToString());
            }
            optReturn.Data = lstMachines;
            return(optReturn);
        }
Ejemplo n.º 29
0
        private void Init()
        {
            Session                = new SessionInfo();
            Session.SessionID      = Guid.NewGuid().ToString();
            Session.AppName        = AppName;
            Session.LastActiveTime = DateTime.Now;

            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = 1000000000000000001;
            rentInfo.Token   = "00000";
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;
            Session.RentID   = 1000000000000000001;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = 1020000000000000001;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = 1020000000000000001;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = 1060000000000000001;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;
            Session.RoleID   = 1060000000000000001;

            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol   = "http";
            serverInfo.Address    = "192.168.6.75";
            serverInfo.Port       = 8081;
            Session.AppServerInfo = serverInfo;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name    = "Default";
            themeInfo.Color   = "Brown";
            Session.ThemeInfo = themeInfo;
            Session.ThemeName = "Default";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID      = 1033;
            langType.LangName    = "en-us";
            langType.Display     = "English";
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = 1033;
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID              = 3;
            dbInfo.TypeName            = "ORCL";
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1521;
            dbInfo.DBName              = "PFOrcl";
            dbInfo.LoginName           = "PFDEV";
            dbInfo.Password            = "******";
            Session.DatabaseInfo       = dbInfo;
            Session.DBType             = dbInfo.TypeID;
            Session.DBConnectionString = dbInfo.GetConnectionString();

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.TypeName = "MSSQL";
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB";
            //dbInfo.LoginName = "sa";
            //dbInfo.Password = "******";
            //Session.DBType = dbInfo.TypeID;
            //Session.DBConnectionString = dbInfo.GetConnectionString();
            //Session.DatabaseInfo = dbInfo;

            Session.InstallPath = @"C:\UMPRelease";
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 获得最后一次安装的版本 顺便把T_00_000备份到App.dsT000
        /// </summary>
        /// <returns></returns>
        public static OperationReturn GetLastVersion()
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = Defines.RET_SUCCESS;
            try
            {
                //获得machineID
                optReturn = Common.GetMachineID();
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                string       strMachineID  = optReturn.Data as string;
                DatabaseInfo dbInfo        = App.currDBInfo;
                string       strConnString = dbInfo.GetConnectionString();
                string       strSql        = string.Empty;
                switch (dbInfo.TypeID)
                {
                case 2:
                    strSql    = "SELECT *  FROM T_00_000";
                    optReturn = MssqlOperation.GetDataSet(strConnString, strSql);
                    break;

                case 3:
                    strSql    = "SELECT *  FROM T_00_000";
                    optReturn = OracleOperation.GetDataSet(strConnString, strSql);
                    break;
                }
                if (!optReturn.Result)
                {
                    optReturn.Code = ConstDefines.Get_T000_Failed;
                    return(optReturn);
                }
                DataSet ds = optReturn.Data as DataSet;
                App.dsT000 = ds;
                //从ds中查找C000=‘00000’ && C001 = ‘SP_LastVersion’的数据
                if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
                {
                    optReturn.Result = false;
                    optReturn.Code   = ConstDefines.T000_Is_Null;
                    return(optReturn);
                }
                string strFilter = "C000 = '{0}' and C001 = '{1}'";
                strFilter = string.Format(strFilter, App.strRent, strMachineID);
                List <DataRow> lstRows = ds.Tables[0].Select(strFilter).ToList();
                if (lstRows.Count <= 0)
                {
                    //如果没有上次升级版本的记录 就当是8.03.001版 可以升级
                    optReturn.Data = "8.03.001";
                    return(optReturn);
                }
                string strLastVersion = lstRows[0]["C002"].ToString();
                optReturn.Data = strLastVersion;
                return(optReturn);
            }
            catch (Exception ex)
            {
                optReturn.Code    = ConstDefines.Get_Version_Exception;
                optReturn.Result  = false;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }