コード例 #1
0
		/// <summary>
		/// 修改用户信息
		/// </summary>
		public Message GM_UpdateUserInfo()
		{
			int result = -1;
			int deptID = 0;
			int userID = 0;
			int userByID = 0;
			string realName = null;
			int status = 0;
            int onlineActive = 0;
			int sysAdmin = 0;
			DateTime limitTime;
			try
			{
				TLV_Structure tlv = new TLV_Structure(TagName.User_ID,4,msg.m_packet.m_Body.getTLVByTag(TagName.User_ID).m_bValueBuffer);
				userID =(int)tlv.toInteger();
				tlv = new TLV_Structure(TagName.UserByID,4,msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer);
				userByID  =(int)tlv.toInteger();
				tlv = new TLV_Structure(TagName.DepartID,4,msg.m_packet.m_Body.getTLVByTag(TagName.DepartID).m_bValueBuffer);
				deptID =(int)tlv.toInteger();
				realName = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.RealName).m_bValueBuffer);
				tlv = new TLV_Structure(TagName.Limit,3,msg.m_packet.m_Body.getTLVByTag(TagName.Limit).m_bValueBuffer);
				limitTime =tlv.toDate();
				tlv = new TLV_Structure(TagName.User_Status,4,msg.m_packet.m_Body.getTLVByTag(TagName.User_Status).m_bValueBuffer);
				status =(int)tlv.toInteger();
                tlv = new TLV_Structure(TagName.OnlineActive, 4, msg.m_packet.m_Body.getTLVByTag(TagName.OnlineActive).m_bValueBuffer);
                onlineActive = (int)tlv.toInteger();
				tlv = new TLV_Structure(TagName.SysAdmin, 4, msg.m_packet.m_Body.getTLVByTag(TagName.SysAdmin).m_bValueBuffer);
				sysAdmin = (int)tlv.toInteger();
                result = GMUserInfo.UpdateRow(userByID, deptID, userID, realName, limitTime, status, onlineActive,sysAdmin);
				if(result==1)
				{
					logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_AccountInfo,LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_AccountInfo + LanguageAPI.API_Success + "!");
					logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID,LanguageAPI.API_UserInfoAPI_UserID,LanguageAPI.API_UserInfoAPI_LimitDay);
					logAPI.writeData(Convert.ToString(userByID),Convert.ToString(userID),Convert.ToString(limitTime));
					Console.WriteLine(logAPI.Buffer.ToString());
					return Message.Common_USER_UPDATE_RESP("SUCESS");
				}
				else
				{
					logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_AccountInfo,LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_AccountInfo + LanguageAPI.API_Failure + "!");
					logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID,LanguageAPI.API_UserInfoAPI_UserID,LanguageAPI.API_UserInfoAPI_LimitDay);
					logAPI.writeData(Convert.ToString(userByID),Convert.ToString(userID),Convert.ToString(limitTime));
					Console.WriteLine(logAPI.Buffer.ToString());
					return Message.Common_USER_UPDATE_RESP("FAILURE");
				}
			}
			catch(SqlException ex)
			{
				Console.WriteLine(ex.Message);
				return Message.Common_USER_UPDATE_RESP(ex.Message);
			}

		}
コード例 #2
0
		/// <summary>
		/// 修改密码信息
		/// </summary>
		public Message GM_ModifPassWd()
		{
			GMLogAPI logAPI = new GMLogAPI();
			int result = -1;
			int userID = 0;
			int userByID = 0;
			string passWd = null;
			try
			{
				TLV_Structure strut1 = new TLV_Structure(TagName.User_ID,4,msg.m_packet.m_Body.getTLVByTag(TagName.User_ID).m_bValueBuffer);
				userID =(int)strut1.toInteger();
				TLV_Structure strut2 = new TLV_Structure(TagName.UserByID,4,msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer);
				userByID  =(int)strut2.toInteger();
				passWd =Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.PassWord).m_bValueBuffer);
				result = GMUserInfo.UpdateRow(userByID,userID,passWd);
				if(result==1)
				{
					logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_Password,LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_Password + LanguageAPI.API_Success + "!");
					logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID,LanguageAPI.API_UserInfoAPI_UserID,LanguageAPI.API_UserInfoAPI_NewPassword);
					logAPI.writeData(Convert.ToString(userByID),Convert.ToString(userID),passWd);
					Console.WriteLine(logAPI.Buffer.ToString());
					return Message.COMMON_MES_RESP("SUCESS",Msg_Category.USER_ADMIN,ServiceKey.USER_PASSWD_MODIF_RESP);

				}
				else
				{
					logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_Password,LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_Password + LanguageAPI.API_Failure + "!");
					logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID,LanguageAPI.API_UserInfoAPI_UserID,LanguageAPI.API_UserInfoAPI_NewPassword);
					logAPI.writeData(Convert.ToString(userByID),Convert.ToString(userID),passWd);
					Console.WriteLine(logAPI.Buffer.ToString());
					return Message.COMMON_MES_RESP("FAILURE",Msg_Category.USER_ADMIN,ServiceKey.USER_PASSWD_MODIF_RESP);
				}
			}
			catch(SqlException ex)
			{
				Console.WriteLine(ex.Message);
				return Message.COMMON_MES_RESP(ex.Message,Msg_Category.USER_ADMIN,ServiceKey.USER_PASSWD_MODIF_RESP);
			}

		}